After adding a WSDL, and then retrieving it for update, the resetting an attribute does not. Test code similar to the following can be used to reproduce the issue. We are using a RemoteRegistry implementation talking to WSO2 Gov Reg 4.1.0.

   @Test
   public void testCreateUpdateWSDL() throws Exception {

      WsdlManager wm = new WsdlManager(registry);
      Wsdl wsdl = wm.newWsdl(
loadFile("src/main/resources/META-INF/soa/services/wsdl/CreateServiceTest/CreateServiceTest.wsdl"),
               "Example.wsdl");
      wsdl.setAttribute(AssetConstants.TURMERIC_NAME, "Wsdl Name");
      assertNotNull(wsdl);
      wm.addWsdl(wsdl);
      String id = wsdl.getId();

GovernanceArtifact artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, id);
      assertNotNull("Unable to find wsdl", artifact);

      wsdl = wm.getWsdl(id);
      wsdl.setAttribute(AssetConstants.TURMERIC_NAME, "Wsdl New Name");
      wm.addWsdl(wsdl);

artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, id);
      assertNotNull("Unable to find wsdl after update", artifact);
assertEquals("oops..did not update wsdl", "Wsdl New Name", artifact.getAttribute(AssetConstants.TURMERIC_NAME));

   }

The expected value should be "Wsdl New Name". It seems to be retreiving the old name. A service test as follows works correctly:

   @Test
   public void testCreateUpdateService() throws Exception {

      ServiceManager sm = new ServiceManager(RSProviderUtil.getRegistry());
Service service = sm.newService(new QName("http://www.example.org";, "Example"));

service.setAttribute(AssetConstants.TURMERIC_NAME, "Example Service");
      sm.addService(service);
      String assetId = service.getId();

GovernanceArtifact artifact = GovernanceUtils.retrieveGovernanceArtifactById(registry, service.getId());
      assertNotNull(artifact);
assertEquals("Example Service", artifact.getAttribute(AssetConstants.TURMERIC_NAME));

      service = sm.getService(assetId);
      assertNotNull("Missing service.", service);
      service.setAttribute(AssetConstants.TURMERIC_NAME, "New Name");
      sm.addService(service);

      service = sm.getService(assetId);
      assertEquals("Service Name attribute did not update.", "New Name",
               service.getAttribute(AssetConstants.TURMERIC_NAME));
   }

Dave

_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to