cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1051430 - in /cxf/trunk/rt/ws/policy: ./ src/main/java/org/apache/cxf/ws/policy/ src/test/java/org/apache/cxf/ws/policy/ src/test/resources/org/ src/test/resources/org/apache/ src/test/resources/org/apache/cxf/ src/test/resources/org/apach...
Date Tue, 21 Dec 2010 09:40:05 GMT
Author: ffang
Date: Tue Dec 21 09:40:05 2010
New Revision: 1051430

URL: http://svn.apache.org/viewvc?rev=1051430&view=rev
Log:
[CXF-3206]PolicyEngineImpl initializes bus interceptors twice

Added:
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineImplInitTest.java
    cxf/trunk/rt/ws/policy/src/test/resources/org/
    cxf/trunk/rt/ws/policy/src/test/resources/org/apache/
    cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/
    cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/
    cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/policy/
    cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/policy/PolicyEngineImplInitTest-context.xml
Modified:
    cxf/trunk/rt/ws/policy/pom.xml
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java

Modified: cxf/trunk/rt/ws/policy/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/pom.xml?rev=1051430&r1=1051429&r2=1051430&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/pom.xml (original)
+++ cxf/trunk/rt/ws/policy/pom.xml Tue Dec 21 09:40:05 2010
@@ -38,6 +38,11 @@
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
             <scope>provided</scope>
         </dependency>

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=1051430&r1=1051429&r2=1051430&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 Tue
Dec 21 09:40:05 2010
@@ -95,6 +95,10 @@ public class PolicyEngineImpl implements
 
     @Resource
     public final void setBus(Bus b) {
+        if (this.bus == b) {
+            //avoid bus init twice through injection
+            return;
+        }
         bus = b;
         addBusInterceptors();
         FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class);

Added: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineImplInitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineImplInitTest.java?rev=1051430&view=auto
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineImplInitTest.java
(added)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineImplInitTest.java
Tue Dec 21 09:40:05 2010
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import javax.annotation.Resource;
+
+
+import org.apache.cxf.Bus;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+
+import static org.junit.Assert.assertNotNull;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public class PolicyEngineImplInitTest {
+
+    @Resource
+    PolicyEngineImpl pe;
+
+    @Resource
+    Bus bus;
+
+    @Before
+    public void setUp() throws Exception {
+        assertNotNull(pe);
+    }
+
+    @Test
+    public void testPolicyInterceptors() throws Exception {
+        Assert.assertEquals("should only have one PolicyOutInterceptor", bus.getOutInterceptors().size(),
1);
+        Assert.assertEquals("should only have one PolicyInInterceptor", bus.getInInterceptors().size(),
1);
+    }
+}

Added: cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/policy/PolicyEngineImplInitTest-context.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/policy/PolicyEngineImplInitTest-context.xml?rev=1051430&view=auto
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/policy/PolicyEngineImplInitTest-context.xml
(added)
+++ cxf/trunk/rt/ws/policy/src/test/resources/org/apache/cxf/ws/policy/PolicyEngineImplInitTest-context.xml
Tue Dec 21 09:40:05 2010
@@ -0,0 +1,29 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hades="http://schemas.synyx.org/hades"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://schemas.synyx.org/hades http://schemas.synyx.org/hades/hades.xsd http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
+
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml"/>
+
+</beans>



Mime
View raw message