Ejemplo n.º 1
0
 @Test(
     groups = {"wso2.greg.api"},
     description = "Testing newSchema API method with inline schema " + "content with name value",
     priority = 11)
 public void testNewSchemaInlineContentWithName() throws GovernanceException, IOException {
   String schemaFileLocation =
       ProductConstant.SYSTEM_TEST_RESOURCE_LOCATION
           + File.separator
           + "artifacts"
           + File.separator
           + "GREG"
           + File.separator
           + "schema"
           + File.separator
           + "calculator.xsd";
   try {
     schemaObj =
         schemaManager.newSchema(
             FileManager.readFile(schemaFileLocation).getBytes(),
             "SampleSchemaContentWithName.xsd");
     schemaManager.addSchema(schemaObj);
   } catch (GovernanceException e) {
     throw new GovernanceException(
         "Exception thrown while executing newSchema API method with "
             + "inline wsdl content and name"
             + e.getMessage());
   }
   schemaObj = schemaManager.getSchema(schemaObj.getId());
   assertTrue(
       schemaObj.getQName().getLocalPart().equalsIgnoreCase("SampleSchemaContentWithName.xsd"),
       "Error found in newSchema with inline schema content and name");
 }
Ejemplo n.º 2
0
 @Test(
     groups = {"wso2.greg.api"},
     description = "Testing newSchema API method with inline schema content",
     priority = 10)
 public void testNewSchemaInlineContent() throws GovernanceException, IOException {
   String schemaFileLocation =
       ProductConstant.SYSTEM_TEST_RESOURCE_LOCATION
           + File.separator
           + "artifacts"
           + File.separator
           + "GREG"
           + File.separator
           + "schema"
           + File.separator
           + "calculator.xsd";
   try {
     schemaObj = schemaManager.newSchema(FileManager.readFile(schemaFileLocation).getBytes());
     schemaManager.addSchema(schemaObj);
   } catch (GovernanceException e) {
     throw new GovernanceException(
         "Exception thrown while executing newSchema API method with "
             + "inline wsdl content"
             + e.getMessage());
   }
   schemaObj = schemaManager.getSchema(schemaObj.getId());
   assertTrue(
       schemaObj.getQName().getNamespaceURI().contains("http://charitha.org/"),
       "Error" + " found in newSchema with inline schema content");
 }
Ejemplo n.º 3
0
 @Test(
     groups = {"wso2.greg.api"},
     dependsOnMethods = {"testGetAllSchema"},
     description = "Testing " + "getSchema API method",
     priority = 4)
 public void testGetSchema() throws GovernanceException {
   try {
     schemaObj = schemaManager.getSchema(schemaArray[0].getId());
     assertTrue(
         schemaObj.getQName().getLocalPart().equalsIgnoreCase(schemaName),
         "SchemaManager:" + "getSchema API method not contain expected schema name");
   } catch (GovernanceException e) {
     throw new GovernanceException(
         "Error occurred while executing SchemaManager:getSchema method" + e);
   }
 }
 private void addSchema() throws IOException, RegistryException {
   SchemaManager schemaManager = new SchemaManager(governance);
   String schemaFilePath =
       ProductConstant.getResourceLocations(ProductConstant.GREG_SERVER_NAME)
           + File.separator
           + "schema"
           + File.separator;
   Schema schema =
       schemaManager.newSchema(
           FileManager.readFile(schemaFilePath + "Person.xsd").getBytes(), "Person.xsd");
   schemaManager.addSchema(schema);
   schema = schemaManager.getSchema(schema.getId());
   Resource resource = governance.get(schema.getPath());
   resource.addProperty("z", "30");
   governance.put(schema.getPath(), resource);
 }
Ejemplo n.º 5
0
 @Test(
     groups = {"wso2.greg.api"},
     dependsOnMethods = {"testGetSchema"},
     description = "Testing " + "updateSchema API method",
     priority = 5)
 public void testUpdateSchema() throws GovernanceException {
   String lcName = "ServiceLifeCycle";
   try {
     schemaObj.attachLifecycle(lcName);
     schemaManager.updateSchema(schemaObj);
     Schema localSchema = schemaManager.getSchema(schemaObj.getId());
     assertTrue(
         localSchema.getLifecycleName().equalsIgnoreCase(lcName),
         "Updated schema doesn't "
             + "have lifecycle Information.SchemaManager:updateSchema didn't work");
   } catch (GovernanceException e) {
     throw new GovernanceException(
         "Error occurred while executing SchemaManager:updateSchema method" + e);
   }
 }