Ejemplo n.º 1
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.º 2
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");
 }
 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.º 4
0
 @Test(
     groups = {"wso2.greg.api"},
     description = "Testing newSchema API method",
     priority = 1)
 public void testNewSchemaUrl() throws GovernanceException {
   try {
     cleanSchema();
     schemaObj =
         schemaManager.newSchema(
             "http://svn.wso2.org/repos/wso2/carbon"
                 + "/platform/trunk/platform-integration/system-test-framework/core/org.wso2."
                 + "automation.platform.core/src/main/resources/artifacts/GREG/schema/calculator.xsd");
   } catch (GovernanceException e) {
     throw new GovernanceException(
         "Error occurred while executing SchemaManager:newSchema with " + "URL method" + e);
   }
 }