cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1330522 - in /cxf/trunk/rt/ws/policy/src: main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml
Date Wed, 25 Apr 2012 19:59:50 GMT
Author: dkulp
Date: Wed Apr 25 19:59:50 2012
New Revision: 1330522

URL: http://svn.apache.org/viewvc?rev=1330522&view=rev
Log:
[CXF-4258] Disabling policy doesn't remove all the policy interceptors

Added:
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml 
 (with props)
Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=1330522&r1=1330521&r2=1330522&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Wed
Apr 25 19:59:50 2012
@@ -370,7 +370,7 @@ public class PolicyEngineImpl implements
         bus.getOutInterceptors().remove(PolicyOutInterceptor.INSTANCE);
         bus.getInFaultInterceptors().remove(ClientPolicyInFaultInterceptor.INSTANCE);
         bus.getOutFaultInterceptors().remove(ServerPolicyOutFaultInterceptor.INSTANCE);
-        bus.getInFaultInterceptors().add(PolicyVerificationInFaultInterceptor.INSTANCE);
+        bus.getInFaultInterceptors().remove(PolicyVerificationInFaultInterceptor.INSTANCE);
         addedBusInterceptors = false;
     }
 

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java?rev=1330522&r1=1330521&r2=1330522&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
Wed Apr 25 19:59:50 2012
@@ -20,6 +20,7 @@
 package org.apache.cxf.ws.policy;
 
 import java.util.Collection;
+import java.util.List;
 import java.util.Set;
 
 import javax.xml.namespace.QName;
@@ -29,6 +30,8 @@ import org.w3c.dom.Element;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider;
 import org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilder;
 import org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry;
@@ -51,7 +54,39 @@ public class PolicyExtensionsTest extend
         = new QName("http://www.w3.org/2005/08/addressing", "EndpointReference");
     
     private static final QName UNKNOWN = new QName("http://cxf.apache.org/test/policy", "unknown");
-    
+
+    @Test
+    public void testCXF4258() {
+        Bus bus = null;
+        try {
+            bus = new SpringBusFactory().createBus("/org/apache/cxf/ws/policy/disable-policy-bus.xml",
false);
+
+            AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
+            assertNotNull(abr);
+
+            PolicyEngine e = bus.getExtension(PolicyEngine.class);
+            assertNotNull(e);
+            
+            assertNoPolicyInterceptors(bus.getInInterceptors());
+            assertNoPolicyInterceptors(bus.getInFaultInterceptors());
+            assertNoPolicyInterceptors(bus.getOutFaultInterceptors());
+            assertNoPolicyInterceptors(bus.getOutInterceptors());
+            
+        } finally {
+            if (null != bus) {
+                bus.shutdown(true);
+                BusFactory.setDefaultBus(null);
+            }
+        }
+    }
+
+    private void assertNoPolicyInterceptors(List<Interceptor<? extends Message>>
ints) {
+        for (Interceptor<? extends Message> m : ints) {
+            assertFalse("Found " + m.getClass().getName(),
+                        m.getClass().getName().contains("org.apache.cxf.ws.policy"));
+        }
+    }
+
     @Test
     public void testExtensions() {
         Bus bus = null;

Added: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml?rev=1330522&view=auto
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml (added)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml Wed
Apr 25 19:59:50 2012
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+	<cxf:bus>
+		<cxf:features>
+			<p:policies enabled="false" />
+		</cxf:features>
+	</cxf:bus>
+</beans>

Propchange: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/disable-policy-bus.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message