cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/2] git commit: [CXF-5665] Make sure the Policy annotations are only processed once
Date Wed, 02 Apr 2014 05:54:41 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/da66ca88
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/da66ca88
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/da66ca88

Branch: refs/heads/master
Commit: da66ca88de74811d9565566c232b002d39641a2d
Parents: 6a4a8fb
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 01:43:58 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/da66ca88/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 387c272..c24b41d 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
@@ -107,6 +107,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, null);
@@ -172,6 +176,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/da66ca88/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 94c6de4..d2256f1 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