public void verifySchema() throws GovernanceException {
   SchemaManager schemaManager = new SchemaManager(governance);
   Schema[] schemas = schemaManager.getAllSchemas();
   boolean resourceFound = false;
   for (Schema schema : schemas) {
     if (schema.getQName().getLocalPart().equals("SampleSchema.xsd")) {
       resourceFound = true;
     }
   }
   Assert.assertTrue(resourceFound);
 }
Ejemplo n.º 2
0
 @Test(
     groups = {"wso2.greg.api"},
     dependsOnMethods = {"testAddSchema"},
     description = "Testing " + "getAllSchemas API method",
     priority = 3)
 public void testGetAllSchema() throws GovernanceException {
   try {
     schemaArray = schemaManager.getAllSchemas();
     assertTrue(
         schemaArray.length > 0,
         "Error occurred while executing SchemaManager:" + "getAllSchemas method");
   } catch (GovernanceException e) {
     throw new GovernanceException(
         "Error occurred while executing SchemaManager:getAllSchemas method" + e);
   }
 }
Ejemplo n.º 3
0
 @Test(
     groups = {"wso2.greg.api"},
     description = "Testing getQName API method with schema object",
     priority = 7)
 public void testGetQName() throws Exception {
   boolean isSchemaFound = false;
   Schema[] schema = schemaManager.getAllSchemas();
   try {
     for (Schema s : schema) {
       if (s.getQName().getLocalPart().equalsIgnoreCase(schemaName)) {
         isSchemaFound = true;
       }
     }
     assertTrue(isSchemaFound, "getQName method prompt error while executing with schema object");
   } catch (Exception e) {
     throw new Exception("Error occurred while executing WsdlManager:getQName method" + e);
   }
 }
Ejemplo n.º 4
0
  @Test(
      groups = {"wso2.greg.api"},
      description = "Testing removeSchema API method",
      priority = 12)
  public void testRemoveSchema() throws GovernanceException {
    try {
      schemaManager.removeSchema(schemaObj.getId());
      schemaArray = schemaManager.getAllSchemas();
      for (Schema s : schemaArray) {
        assertFalse(
            s.getId().equalsIgnoreCase(schemaObj.getId()),
            "SchemaManager:removeSchema" + " API method having error");
      }

    } catch (GovernanceException e) {
      throw new GovernanceException(
          "Error occurred while executing SchemaManager:removeSchema method" + e);
    }
  }
Ejemplo n.º 5
0
 // https://wso2.org/jira/browse/REGISTRY-762
 @Test(
     groups = {"wso2.greg.api"},
     description = "Testing getUrl API method with schema object",
     priority = 8,
     enabled = false)
 public void testGetUrl() throws Exception {
   boolean isSchemaFound = false;
   Schema[] schema = schemaManager.getAllSchemas();
   try {
     for (Schema s : schema) {
       if ((s.getUrl() != null)) {
         isSchemaFound = true;
       }
     }
     assertTrue(isSchemaFound, "getUrl method prompt error while executing with schema object");
   } catch (Exception e) {
     throw new Exception("Error occurred while executing WsdlManager:getUrl method" + e);
   }
 }
Ejemplo n.º 6
0
 @Test(
     groups = {"wso2.greg.api"},
     description = "Testing getSchemaElement API method with schema object",
     priority = 9)
 public void testGetSchemaElement() throws Exception {
   boolean isSchemaFound = false;
   Schema[] schema = schemaManager.getAllSchemas();
   try {
     for (Schema s : schema) {
       if (s.getQName().getLocalPart().equalsIgnoreCase(schemaName)) {
         OMElement omElement = s.getSchemaElement();
         if (omElement.toString().contains("http://charitha.org/")) {
           isSchemaFound = true;
         }
       }
     }
     assertTrue(
         isSchemaFound, "getSchemaElement method prompt error while executing with schema object");
   } catch (Exception e) {
     throw new Exception("Error occurred while executing getSchemaElement method" + e);
   }
 }
Ejemplo n.º 7
0
 private void cleanSchema() throws GovernanceException {
   Schema[] schemas = schemaManager.getAllSchemas();
   for (Schema s : schemas) {
     schemaManager.removeSchema(s.getId());
   }
 }