Repository: juddi Updated Branches: refs/heads/master 3fb9382b3 -> d2ccea33d
JUDDI-939 fixing test case Project: http://git-wip-us.apache.org/repos/asf/juddi/repo Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/d2ccea33 Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/d2ccea33 Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/d2ccea33 Branch: refs/heads/master Commit: d2ccea33dac4ebca14bf6a17bc0b1df145315a61 Parents: 3fb9382 Author: Alex <[email protected]> Authored: Thu Oct 29 07:39:15 2015 -0400 Committer: Alex <[email protected]> Committed: Thu Oct 29 07:39:15 2015 -0400 ---------------------------------------------------------------------- .../juddi/v3/client/mapping/ServiceLocator.java | 8 +++ .../apache/juddi/v3/client/UDDIClientTest.java | 2 +- .../v3/client/mapping/ServiceLocatorTest.java | 51 +++++++++++++++++++- 3 files changed, 58 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/juddi/blob/d2ccea33/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java ---------------------------------------------------------------------- diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java index 2ee15a8..7f79c98 100644 --- a/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java +++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ServiceLocator.java @@ -257,11 +257,19 @@ public class ServiceLocator { //Loop over all bindingTemplates found and get the endpoints. for (BindingTemplate bindingTemplate : bindingTemplates.getBindingTemplate()) { AccessPoint accessPoint = bindingTemplate.getAccessPoint(); + if (accessPoint!=null){ if (AccessPointType.END_POINT.toString().equals(accessPoint.getUseType())) { String url = accessPoint.getValue(); log.debug("epr= " + url); eprs.add(url); + } else if(AccessPointType.WSDL_DEPLOYMENT.toString().equals(accessPoint.getUseType())) { + //do something here + //try to open that wsdl, then grab the endpoints + } else if(AccessPointType.BINDING_TEMPLATE.toString().equals(accessPoint.getUseType())) { + //do something here + //grab that binding template and use that address } + } } if (eprs.size()>0) { topology = new Topology(eprs); http://git-wip-us.apache.org/repos/asf/juddi/blob/d2ccea33/juddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java ---------------------------------------------------------------------- diff --git a/juddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java b/juddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java index fd9a140..c57fb22 100644 --- a/juddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java +++ b/juddi-client/src/test/java/org/apache/juddi/v3/client/UDDIClientTest.java @@ -38,7 +38,7 @@ public class UDDIClientTest { UDDIClient client = new UDDIClient(); client.start(); client.getClientConfig().getUDDINode("default"); - assertEquals(2, client.getClientConfig().getUDDIClerks().size()); + assertEquals(3, client.getClientConfig().getUDDIClerks().size()); Thread.sleep(500); client.stop(); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/juddi/blob/d2ccea33/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ServiceLocatorTest.java ---------------------------------------------------------------------- diff --git a/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ServiceLocatorTest.java b/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ServiceLocatorTest.java index c99b0e2..0ff4d1a 100644 --- a/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ServiceLocatorTest.java +++ b/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ServiceLocatorTest.java @@ -14,9 +14,13 @@ */ package org.apache.juddi.v3.client.mapping; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Properties; +import java.util.UUID; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.juddi.v3.client.config.UDDIClient; import org.junit.Assert; import org.junit.Ignore; @@ -47,7 +51,50 @@ public class ServiceLocatorTest { } } - - + + @Test + public void testJUDDI_939() throws Exception { + UDDIClient uddiClient = new UDDIClient(); + ServiceLocator serviceLocator = uddiClient.getServiceLocator("default"); + Assert.assertNotNull(serviceLocator); + serviceLocator.setPolicy(PolicyRoundRobin.class.getName()); + //serviceLocator.withCache(new URL("http", "0.0.0.0", 0, "")); + } + + @Test(expected = ConfigurationException.class) + public void testJUDDI_939_1() throws Exception { + UDDIClient uddiClient = new UDDIClient(); + ServiceLocator serviceLocator = uddiClient.getServiceLocator(UUID.randomUUID().toString()); + Assert.fail(); + } + + + /** + * this test requires a running juddi node on port 8080 and is therefore disabled from this context + * @throws Exception + */ + @Ignore + @Test + public void testJUDDI_939_2() throws Exception { + String uddiServiceId = "uddi:juddi.apache.org:services-inquiry"; + try { + UDDIClient uddiClient = new UDDIClient(); + ServiceLocator serviceLocator = uddiClient.getServiceLocator("default8080"); + serviceLocator.setPolicy(PolicyRoundRobin.class.getName()); + //serviceLocator.withCache(new URL("http://localhost:8080/juddiv3/services/")); + String endpoint = serviceLocator.lookupEndpoint(uddiServiceId); + Assert.assertNotNull(endpoint); + + String endpoint2 = serviceLocator.lookupEndpoint(uddiServiceId); + Assert.assertNotNull(endpoint2); + Assert.assertNotEquals(endpoint2, endpoint); + + } catch (Exception e) { + throw new Exception("Could not resolve endpoint '" + uddiServiceId + "'.", e); + } + + } + + } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
