Repository: juddi-scout Updated Branches: refs/heads/master 2381cd31d -> 8836df0d6
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java b/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java index 0a173a2..44a56c1 100644 --- a/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java +++ b/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java @@ -24,9 +24,11 @@ import java.util.Iterator; import javax.xml.registry.BulkResponse; import javax.xml.registry.BusinessLifeCycleManager; +import javax.xml.registry.FindQualifier; import javax.xml.registry.JAXRException; import javax.xml.registry.JAXRResponse; import javax.xml.registry.RegistryService; +import javax.xml.registry.infomodel.ClassificationScheme; import javax.xml.registry.infomodel.Concept; import javax.xml.registry.infomodel.ExternalLink; import javax.xml.registry.infomodel.InternationalString; @@ -40,7 +42,10 @@ import junit.framework.JUnit4TestAdapter; import org.apache.ws.scout.BaseTestCase; import org.apache.ws.scout.Finder; +import org.apache.ws.scout.Remover; import org.junit.After; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import org.junit.Before; import org.junit.Test; @@ -67,14 +72,42 @@ public class JAXR050ServiceBindingTest extends BaseTestCase String tempOrgName = "Apache JAXR Service Org -- APACHE SCOUT TEST"; @Before - public void setUp() - { - super.setUp(); + public void setUp() { + super.setUp(); + login(); + try { + RegistryService rs = connection.getRegistryService(); + bqm = rs.getBusinessQueryManager(); + blm = rs.getBusinessLifeCycleManager(); + ClassificationScheme cScheme = blm.createClassificationScheme("org.jboss.soa.esb.:testcategory", "JBossESB Classification Scheme"); + ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>(); + cSchemes.add(cScheme); + BulkResponse br = blm.saveClassificationSchemes(cSchemes); + assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus()); + } catch (Exception je) { + je.printStackTrace(); + fail(je.getMessage()); + } } + @After - public void tearDown() - { + public void tearDown() { super.tearDown(); + login(); + try { + RegistryService rs = connection.getRegistryService(); + bqm = rs.getBusinessQueryManager(); + blm = rs.getBusinessLifeCycleManager(); + Collection<String> findQualifiers = new ArrayList<String>(); + findQualifiers.add(FindQualifier.AND_ALL_KEYS); + //findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); + ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory"); + Remover remover = new Remover(blm); + remover.removeClassificationScheme(cScheme); + } catch (Exception je) { + je.printStackTrace(); + fail(je.getMessage()); + } } /** @@ -109,13 +142,13 @@ public class JAXR050ServiceBindingTest extends BaseTestCase SpecificationLink specLink = blm.createSpecificationLink(); - Concept concept = null; + /*Concept concept = null; if ("3.0".equals(uddiversion)) { concept = (Concept)bqm.getRegistryObject("uddi:uddi.org:findqualifier:orlikekeys", BusinessLifeCycleManager.CONCEPT); } else { concept = (Concept)bqm.getRegistryObject("uuid:AD61DE98-4DB8-31B2-A299-A2373DC97212",BusinessLifeCycleManager.CONCEPT); } - specLink.setSpecificationObject(concept); + specLink.setSpecificationObject(concept);*/ //find serviceBinding Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(tmpSvcKey, specLink); http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java b/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java index b78199b..1366ca8 100644 --- a/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java +++ b/src/test/java/org/apache/ws/scout/registry/qa/JAXR060RegistryTest.java @@ -18,7 +18,7 @@ * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ + */ package org.apache.ws.scout.registry.qa; import static org.junit.Assert.assertEquals; @@ -53,18 +53,17 @@ import org.junit.Test; /** * Testing the registry. - * + * * @author kstam * */ -public class JAXR060RegistryTest extends BaseTestCase -{ +public class JAXR060RegistryTest extends BaseTestCase { + @Before public void setUp() { super.setUp(); login(); - try - { + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); blm = rs.getBusinessLifeCycleManager(); @@ -73,7 +72,8 @@ public class JAXR060RegistryTest extends BaseTestCase cSchemes.add(cScheme); BulkResponse br = blm.saveClassificationSchemes(cSchemes); assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus()); - } catch (JAXRException je) { + } catch (Exception je) { + je.printStackTrace(); fail(je.getMessage()); } } @@ -88,74 +88,72 @@ public class JAXR060RegistryTest extends BaseTestCase blm = rs.getBusinessLifeCycleManager(); Collection<String> findQualifiers = new ArrayList<String>(); findQualifiers.add(FindQualifier.AND_ALL_KEYS); - findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); + //findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory"); Remover remover = new Remover(blm); remover.removeClassificationScheme(cScheme); - } catch (JAXRException je) { + } catch (Exception je) { + je.printStackTrace(); fail(je.getMessage()); } } - - /** - * Tests the successful creation of the RED HAT/JBossESB Organization. - */ - @SuppressWarnings("unchecked") + + /** + * Tests the successful creation of the RED HAT/JBossESB Organization. + */ + @SuppressWarnings("unchecked") @Test - public void publishCheckAndDelete() - { + public void publishCheckAndDelete() { login(); - try - { + try { RegistryService rs = connection.getRegistryService(); blm = rs.getBusinessLifeCycleManager(); Creator creator = new Creator(blm); - + Collection<Organization> organizations = new ArrayList<Organization>(); Organization organization = creator.createOrganization("Red Hat/JBossESB"); organizations.add(organization); BulkResponse br = blm.saveOrganizations(organizations); - assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus()); - } catch (JAXRException je) { - je.printStackTrace(); - assertTrue(false); - } - //find organization - try - { + assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus()); + } catch (JAXRException je) { + je.printStackTrace(); + fail(je.getMessage()); + } + //find organization + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); Finder finder = new Finder(bqm, uddiversion); - Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB"); - Organization org = orgs.iterator().next(); - assertEquals("Red Hat/JBossESB", org.getName().getValue()); - } catch (JAXRException je) { - fail(je.getMessage()); - } - try { + Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB"); + Organization org = orgs.iterator().next(); + assertEquals("Red Hat/JBossESB", org.getName().getValue()); + } catch (JAXRException je) { + fail(je.getMessage()); + } + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); Finder finder = new Finder(bqm, uddiversion); Collection<Organization> orgs = finder.findOrganizationsByName("Not Existing Org"); - assertEquals(0, orgs.size()); - } catch (JAXRException je) { - fail(je.getMessage()); - } + assertEquals(0, orgs.size()); + } catch (JAXRException je) { + fail(je.getMessage()); + } //Publish a service - try { + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); Finder finder = new Finder(bqm, uddiversion); Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB"); Organization organization = orgs.iterator().next(); - + blm = rs.getBusinessLifeCycleManager(); //Adding the category as prefix for the name Service service = blm.createService(blm.createInternationalString("Registry Test ServiceName")); service.setDescription(blm.createInternationalString("Registry Test Service Description")); Collection<String> findQualifiers = new ArrayList<String>(); findQualifiers.add(FindQualifier.AND_ALL_KEYS); - findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); + //findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory"); Classification classification = blm.createClassification(cScheme, "category", "registry"); service.addClassification(classification); @@ -164,18 +162,18 @@ public class JAXR060RegistryTest extends BaseTestCase services.add(service); BulkResponse br = blm.saveServices(services); assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus()); - } catch (JAXRException je) { - fail(je.getMessage()); - } - //find Service - try - { + } catch (JAXRException je) { + je.printStackTrace(); + fail(je.getMessage()); + } + //find Service + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); blm = rs.getBusinessLifeCycleManager(); Finder finder = new Finder(bqm, uddiversion); //Find the service - Service service = finder.findService("registry","Registry Test ServiceName", blm); + Service service = finder.findService("registry", "Registry Test ServiceName", blm); assertEquals("Registry Test ServiceName", service.getName().getValue()); } catch (JAXRException je) { fail(je.getMessage()); @@ -187,89 +185,93 @@ public class JAXR060RegistryTest extends BaseTestCase blm = rs.getBusinessLifeCycleManager(); Finder finder = new Finder(bqm, uddiversion); //Find the service - Service service = finder.findService("registry","Registry Test ServiceName", blm); - + Service service = finder.findService("registry", "Registry Test ServiceName", blm); + ServiceBinding serviceBinding = blm.createServiceBinding(); serviceBinding.setDescription(blm.createInternationalString("eprDescription")); String xml = "<epr>epr uri</epr>"; serviceBinding.setAccessURI(xml); - + ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>(); serviceBindings.add(serviceBinding); service.addServiceBindings(serviceBindings); Collection<String> findQualifiers = new ArrayList<String>(); findQualifiers.add(FindQualifier.AND_ALL_KEYS); - findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); + //findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory"); Classification classification = blm.createClassification(cScheme, "category", "registry"); service.addClassification(classification); - - BulkResponse br = blm.saveServiceBindings(serviceBindings); + + BulkResponse br = blm.saveServiceBindings(serviceBindings); assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus()); - BulkResponse br2 = blm.saveServiceBindings(serviceBindings); //Save one more + BulkResponse br2 = blm.saveServiceBindings(serviceBindings); //Save one more assertEquals(BulkResponse.STATUS_SUCCESS, br2.getStatus()); - + + findQualifiers = new ArrayList<String>(); + findQualifiers.add(FindQualifier.AND_ALL_KEYS); + + cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory"); //Delete one binding - Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(service.getKey(),classification); - if ((serviceBindings2 != null) && (serviceBindings2.iterator() != null) - && (serviceBindings2.iterator().hasNext())) { - ServiceBinding serviceBinding2 = serviceBindings2.iterator().next(); - Remover remover = new Remover(blm); - remover.removeServiceBinding(serviceBinding2); + Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(service.getKey(), classification); + if ((serviceBindings2 != null) && (serviceBindings2.iterator() != null) + && (serviceBindings2.iterator().hasNext())) { + ServiceBinding serviceBinding2 = serviceBindings2.iterator().next(); + Remover remover = new Remover(blm); + remover.removeServiceBinding(serviceBinding2); } - } catch (JAXRException re) { - fail(re.getMessage()); - } + } catch (JAXRException re) { + re.printStackTrace(); + fail(re.getMessage()); + } //find all services for this organization - try - { + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); Finder finder = new Finder(bqm, uddiversion); - Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB"); + Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB"); Organization org = orgs.iterator().next(); - //Listing out the services and their Bindings - System.out.println("-------------------------------------------------"); + //Listing out the services and their Bindings + System.out.println("-------------------------------------------------"); System.out.println("Organization name: " + org.getName().getValue()); System.out.println("Description: " + org.getDescription().getValue()); System.out.println("Key id: " + org.getKey().getId()); - User primaryContact = org.getPrimaryContact(); + User primaryContact = org.getPrimaryContact(); System.out.println("Primary Contact: " + primaryContact.getPersonName().getFullName()); - Collection services = org.getServices(); - for (Iterator serviceIter = services.iterator();serviceIter.hasNext();) { - Service service = (Service) serviceIter.next(); + Collection services = org.getServices(); + for (Iterator serviceIter = services.iterator(); serviceIter.hasNext();) { + Service service = (Service) serviceIter.next(); System.out.println("- Service Name: " + service.getName().getValue()); System.out.println(" Service Key : " + service.getKey().getId()); - Collection serviceBindings = service.getServiceBindings(); - for (Iterator serviceBindingIter = serviceBindings.iterator();serviceBindingIter.hasNext();){ - ServiceBinding serviceBinding = (ServiceBinding) serviceBindingIter.next(); + Collection serviceBindings = service.getServiceBindings(); + for (Iterator serviceBindingIter = serviceBindings.iterator(); serviceBindingIter.hasNext();) { + ServiceBinding serviceBinding = (ServiceBinding) serviceBindingIter.next(); System.out.println(" ServiceBinding Description: " + serviceBinding.getDescription().getValue()); - String xml = serviceBinding.getAccessURI(); + String xml = serviceBinding.getAccessURI(); System.out.println(" ServiceBinding URI: " + xml); - assertEquals("<epr>epr uri</epr>",xml); - } - } + assertEquals("<epr>epr uri</epr>", xml); + } + } System.out.println("-------------------------------------------------"); - } catch (Exception je) { - fail(je.getMessage()); - } + } catch (Exception je) { + je.printStackTrace(); + fail(je.getMessage()); + } //delete the service - try - { + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); blm = rs.getBusinessLifeCycleManager(); Finder finder = new Finder(bqm, uddiversion); //Find the service - Service service = finder.findService("registry","Registry Test ServiceName", blm); + Service service = finder.findService("registry", "Registry Test ServiceName", blm); Remover remover = new Remover(blm); remover.removeService(service); } catch (JAXRException je) { + je.printStackTrace(); fail(je.getMessage()); } //delete the organization - try - { + try { RegistryService rs = connection.getRegistryService(); bqm = rs.getBusinessQueryManager(); blm = rs.getBusinessLifeCycleManager(); @@ -279,14 +281,13 @@ public class JAXR060RegistryTest extends BaseTestCase Remover remover = new Remover(blm); remover.removeOrganization(org); } catch (JAXRException je) { + je.printStackTrace(); fail(je.getMessage()); } } - - - public static junit.framework.Test suite() { - return new JUnit4TestAdapter(JAXR060RegistryTest.class); - } + public static junit.framework.Test suite() { + return new JUnit4TestAdapter(JAXR060RegistryTest.class); + } } http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/resources/META-INF/jaxr-uddi.xml ---------------------------------------------------------------------- diff --git a/src/test/resources/META-INF/jaxr-uddi.xml b/src/test/resources/META-INF/jaxr-uddi.xml index 79c4201..691f239 100644 --- a/src/test/resources/META-INF/jaxr-uddi.xml +++ b/src/test/resources/META-INF/jaxr-uddi.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <uddi> <reloadDelay>5000</reloadDelay> - <manager name="jaxr"> + <client name="jaxr"> <nodes> <node isHomeJUDDI="true"> <name>jaxr-client</name> @@ -12,5 +12,5 @@ <securityUrl>${javax.xml.registry.securityManagerURL}</securityUrl> </node> </nodes> - </manager> + </client> </uddi> \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
