You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/04/09 17:57:34 UTC
svn commit: r1466091 - in
/cxf/trunk/services/ws-discovery/ws-discovery-api/src:
main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
Author: dkulp
Date: Tue Apr 9 15:57:33 2013
New Revision: 1466091
URL: http://svn.apache.org/r1466091
Log:
Handle the WSD 1.0 scope match types
Modified:
cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
cxf/trunk/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
Modified: cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java?rev=1466091&r1=1466090&r2=1466091&view=diff
==============================================================================
--- cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java (original)
+++ cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java Tue Apr 9 15:57:33 2013
@@ -63,6 +63,7 @@ import org.apache.cxf.ws.addressing.Addr
import org.apache.cxf.ws.addressing.AttributedURIType;
import org.apache.cxf.ws.addressing.ContextUtils;
import org.apache.cxf.ws.addressing.impl.AddressingPropertiesImpl;
+import org.apache.cxf.ws.discovery.WSDVersion;
import org.apache.cxf.ws.discovery.WSDiscoveryClient;
import org.apache.cxf.ws.discovery.WSDiscoveryService;
import org.apache.cxf.ws.discovery.wsdl.ByeType;
@@ -320,12 +321,18 @@ public class WSDiscoveryServiceImpl impl
mb = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/rfc3986";
}
+ if (mb.startsWith(WSDVersion.NS_1_0)) {
+ mb = mb.substring(WSDVersion.NS_1_0.length());
+ } else if (mb.startsWith(WSDVersion.NS_1_1)) {
+ mb = mb.substring(WSDVersion.NS_1_1.length());
+ }
+
ListIterator<HelloType> cit = consider.listIterator();
while (cit.hasNext()) {
HelloType ht = cit.next();
boolean matches = false;
- if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/rfc3986".equals(mb)) {
+ if ("/rfc3986".equals(mb)) {
matches = true;
if (!pt.getScopes().getValue().isEmpty()) {
for (String ps : pt.getScopes().getValue()) {
@@ -340,7 +347,7 @@ public class WSDiscoveryServiceImpl impl
matches &= foundOne;
}
}
- } else if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/uuid".equals(mb)) {
+ } else if ("/uuid".equals(mb)) {
matches = true;
if (!pt.getScopes().getValue().isEmpty()) {
for (String ps : pt.getScopes().getValue()) {
@@ -355,12 +362,12 @@ public class WSDiscoveryServiceImpl impl
matches &= foundOne;
}
}
- } else if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ldap".equals(mb)) {
+ } else if ("/ldap".equals(mb)) {
//LDAP not supported
if (!pt.getScopes().getValue().isEmpty()) {
matches = false;
}
- } else if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/strcmp0".equals(mb)) {
+ } else if ("/strcmp0".equals(mb)) {
matches = true;
if (!pt.getScopes().getValue().isEmpty()) {
for (String s : pt.getScopes().getValue()) {
@@ -369,7 +376,7 @@ public class WSDiscoveryServiceImpl impl
}
}
}
- } else if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/none".equals(mb)
+ } else if ("/none".equals(mb)
&& (ht.getScopes() == null || ht.getScopes().getValue().isEmpty())) {
matches = true;
}
Modified: cxf/trunk/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java?rev=1466091&r1=1466090&r2=1466091&view=diff
==============================================================================
--- cxf/trunk/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java (original)
+++ cxf/trunk/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java Tue Apr 9 15:57:33 2013
@@ -31,6 +31,7 @@ import org.apache.cxf.ws.discovery.wsdl.
import org.apache.cxf.ws.discovery.wsdl.ProbeMatchType;
import org.apache.cxf.ws.discovery.wsdl.ProbeMatchesType;
import org.apache.cxf.ws.discovery.wsdl.ProbeType;
+import org.apache.cxf.ws.discovery.wsdl.ScopesType;
/**
@@ -56,11 +57,14 @@ public final class WSDiscoveryClientTest
bus = BusFactory.newInstance().createBus();
new LoggingFeature().initialize(bus);
WSDiscoveryClient c = new WSDiscoveryClient(bus);
- //c.setVersion10();
+ c.setVersion10();
System.out.println("1");
- ProbeMatchesType pmts = c.probe(new ProbeType());
+ ProbeType pt = new ProbeType();
+ ScopesType scopes = new ScopesType();
+ pt.setScopes(scopes);
+ ProbeMatchesType pmts = c.probe(pt);
System.out.println("2");
if (pmts != null) {
for (ProbeMatchType pmt : pmts.getProbeMatch()) {
@@ -69,7 +73,7 @@ public final class WSDiscoveryClientTest
System.out.println(pmt.getXAddrs());
}
}
- pmts = c.probe(new ProbeType());
+ pmts = c.probe(pt);
System.out.println("3");
if (pmts != null) {