cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [19/21] git commit: [CXF-5665] Make sure the Policy annotations are only processed once
Date Wed, 02 Apr 2014 06:26:15 GMT
[CXF-5665] Make sure the Policy annotations are only processed once


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/eb5ac691
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/eb5ac691
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/eb5ac691

Branch: refs/heads/2.7.x-fixes
Commit: eb5ac69120bc7799997740ff6817864039b55518
Parents: d504ce8
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Apr 2 01:43:58 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Apr 2 02:18:32 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java   |  8 ++++++++
 .../apache/cxf/ws/policy/PolicyAnnotationListener.java  | 12 ++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/eb5ac691/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
index c9a03e4..1a90a28 100644
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
+++ b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ws/PolicyAnnotationTest.java
@@ -110,6 +110,10 @@ public class PolicyAnnotationTest extends Assert {
                   "echoIntBindingOpOutputPolicy");
             check(xpu, wsdl, "/wsdl:definitions/wsdl:service/", "TestImplServiceServicePolicy");
             
+            assertEquals(1,
+                         xpu.getValueList("/wsdl:definitions/wsdl:binding/wsdl:operation/"
+                                              + "wsp:PolicyReference[@URI='#echoIntBindingOpPolicy']",
wsdl)
+                             .getLength());
             
             EndpointPolicy policy = bus.getExtension(PolicyEngine.class)
                 .getServerEndpointPolicy(s.getEndpoint().getEndpointInfo(), null);
@@ -177,6 +181,10 @@ public class PolicyAnnotationTest extends Assert {
                   "echoIntBindingOpOutputPolicy");
             check(xpu, wsdl, "/wsdl:definitions/wsdl:service/", "TestInterfaceServiceServicePolicy");
             
+            assertEquals(1,
+                         xpu.getValueList("/wsdl:definitions/wsdl:binding/wsdl:operation/"
+                                              + "wsp:PolicyReference[@URI='#echoIntBindingOpPolicy']",
wsdl)
+                             .getLength());
             
         } finally {
             bus.shutdown(true);

http://git-wip-us.apache.org/repos/asf/cxf/blob/eb5ac691/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
index 8a5c9e3..561bcc9 100644
--- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
+++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
@@ -176,7 +176,11 @@ public class PolicyAnnotationListener implements FactoryBeanListener
{
             if (!list.isEmpty()) {
                 List<Policy> stuff = CastUtils.cast((List<?>)inf.getProperty(EXTRA_POLICIES));
                 if (stuff != null) {
-                    stuff.addAll(list);
+                    for (Policy p2 : list) {
+                        if (!stuff.contains(p2)) {
+                            stuff.add(p2);
+                        }
+                    }
                 } else {
                     inf.setProperty(EXTRA_POLICIES, list);
                 }
@@ -340,7 +344,11 @@ public class PolicyAnnotationListener implements FactoryBeanListener
{
             if (!list.isEmpty()) {
                 List<Policy> stuff = CastUtils.cast((List<?>)ii.getProperty(EXTRA_POLICIES));
                 if (stuff != null) {
-                    stuff.addAll(list);
+                    for (Policy p2 : list) {
+                        if (!stuff.contains(p2)) {
+                            stuff.add(p2);
+                        }
+                    }
                 } else {
                     ii.setProperty(EXTRA_POLICIES, list);
                 }


Mime
View raw message