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/02/12 22:16:14 UTC
svn commit: r1445378 - in /cxf/branches/2.7.x-fixes:
rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/
rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/
systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/
systes...
Author: dkulp
Date: Tue Feb 12 21:16:13 2013
New Revision: 1445378
URL: http://svn.apache.org/r1445378
Log:
Merged revisions 1445284 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1445284 | dkulp | 2013-02-12 12:30:20 -0500 (Tue, 12 Feb 2013) | 2 lines
If the DescriptionInfo doesn't have a baseURI, create one to avoid policy fragments poluting from one wsdl to another.
........
Modified:
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java
Modified: cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java?rev=1445378&r1=1445377&r2=1445378&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java Tue Feb 12 21:16:13 2013
@@ -51,6 +51,7 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.service.model.BindingMessageInfo;
import org.apache.cxf.service.model.BindingOperationInfo;
@@ -126,6 +127,10 @@ public class ServiceModelPolicyUpdater {
if (ei.getService().getDescription() == null) {
DescriptionInfo description = new DescriptionInfo();
description.setName(ei.getService().getName());
+ if (!StringUtils.isEmpty(ei.getAddress())) {
+ description.setBaseURI(ei.getAddress() + "?wsdl");
+ }
+
ei.getService().setDescription(description);
}
ei.getService().getDescription().addExtensor(uee);
Modified: cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?rev=1445378&r1=1445377&r2=1445378&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Tue Feb 12 21:16:13 2013
@@ -187,7 +187,11 @@ public class Wsdl11AttachmentPolicyProvi
Policy policy = builder.getPolicy(e.getElement());
String fragement = "#" + uri;
registry.register(fragement, policy);
- registry.register(di.getBaseURI() + fragement, policy);
+ if (di.getBaseURI() == null) {
+ registry.register(Integer.toString(di.hashCode()) + fragement, policy);
+ } else {
+ registry.register(di.getBaseURI() + fragement, policy);
+ }
} catch (Exception policyEx) {
//ignore the policy can not be built
LOG.warning("Failed to build the policy '" + uri + "':" + policyEx.getMessage());
@@ -257,7 +261,11 @@ public class Wsdl11AttachmentPolicyProvi
Policy resolveReference(PolicyReference ref, DescriptionInfo di) {
Policy p = null;
if (isExternal(ref)) {
- p = resolveExternal(ref, di.getBaseURI());
+ String uri = di.getBaseURI();
+ if (uri == null) {
+ uri = Integer.toString(di.hashCode());
+ }
+ p = resolveExternal(ref, uri);
} else {
p = resolveLocal(ref, di);
}
@@ -267,7 +275,12 @@ public class Wsdl11AttachmentPolicyProvi
Policy resolveLocal(PolicyReference ref, DescriptionInfo di) {
String uri = ref.getURI().substring(1);
- String absoluteURI = di.getBaseURI() + ref.getURI();
+ String absoluteURI = di.getBaseURI();
+ if (absoluteURI == null) {
+ absoluteURI = Integer.toString(di.hashCode()) + ref.getURI();
+ } else {
+ absoluteURI = absoluteURI + ref.getURI();
+ }
Policy resolved = registry.lookup(absoluteURI);
if (null != resolved) {
return resolved;
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java?rev=1445378&r1=1445377&r2=1445378&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java Tue Feb 12 21:16:13 2013
@@ -55,9 +55,9 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class JavaFirstPolicyServiceTest extends AbstractBusClientServerTestBase {
- static final String PORT = allocatePort(JavaFirstPolicyServer.class);
- static final String PORT2 = allocatePort(JavaFirstPolicyServer.class, 2);
- static final String PORT3 = allocatePort(JavaFirstPolicyServer.class, 3);
+ static final String PORT = JavaFirstPolicyServer.PORT;
+ static final String PORT2 = JavaFirstPolicyServer.PORT2;
+ static final String PORT3 = JavaFirstPolicyServer.PORT3;
private static final String WSDL_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/";
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java?rev=1445378&r1=1445377&r2=1445378&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java Tue Feb 12 21:16:13 2013
@@ -29,6 +29,9 @@ import org.apache.cxf.testutil.common.Ab
import org.junit.Assert;
public class JavaFirstPolicyServer extends AbstractBusTestServerBase {
+ public static final String PORT = allocatePort(JavaFirstPolicyServer.class);
+ public static final String PORT2 = allocatePort(JavaFirstPolicyServer.class, 2);
+ public static final String PORT3 = allocatePort(JavaFirstPolicyServer.class, 3);
public JavaFirstPolicyServer() {
@@ -47,4 +50,8 @@ public class JavaFirstPolicyServer exten
e.printStackTrace();
}
}
+
+ public static void main(String args[]) {
+ new JavaFirstPolicyServer().start();
+ }
}