cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r908549 - in /cxf/trunk/rt/core/src: main/java/org/apache/cxf/bus/spring/ main/resources/schemas/ test/java/org/apache/cxf/bus/spring/
Date Wed, 10 Feb 2010 15:46:52 GMT
Author: ningjiang
Date: Wed Feb 10 15:46:51 2010
New Revision: 908549

URL: http://svn.apache.org/viewvc?rev=908549&view=rev
Log:
CXF-2667 bus configure should provides bus attribute to set the bus

Added:
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml   (with props)
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
    cxf/trunk/rt/core/src/main/resources/schemas/core.xsd
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusDefinitionParserTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java?rev=908549&r1=908548&r2=908549&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java Wed
Feb 10 15:46:51 2010
@@ -49,11 +49,12 @@
         setBeanClass(BusConfig.class);
     }
     protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean)
{
-        String bus = element.getAttribute("bus");
+        String bus = element.getAttribute("bus");        
         if (StringUtils.isEmpty(bus)) {
             addBusWiringAttribute(bean, BusWiringType.CONSTRUCTOR);
         } else {
             bean.addConstructorArgReference(bus);
+            element.removeAttribute("bus");
         }
         super.doParse(element, ctx, bean);
     }

Modified: cxf/trunk/rt/core/src/main/resources/schemas/core.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/schemas/core.xsd?rev=908549&r1=908548&r2=908549&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/resources/schemas/core.xsd (original)
+++ cxf/trunk/rt/core/src/main/resources/schemas/core.xsd Wed Feb 10 15:46:51 2010
@@ -116,7 +116,8 @@
             </xsd:annotation>
         </xsd:element>
       </xsd:all>
-      <xsd:attributeGroup ref="cxf-beans:beanAttributes"/>          
+      <xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
+      <xsd:attribute name="bus" type="xsd:string" />        
     </xsd:complexType>
   </xsd:element>
 </xsd:schema>

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusDefinitionParserTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusDefinitionParserTest.java?rev=908549&r1=908548&r2=908549&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusDefinitionParserTest.java
(original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusDefinitionParserTest.java
Wed Feb 10 15:46:51 2010
@@ -34,6 +34,8 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
 public class BusDefinitionParserTest extends Assert {
     
     @Test
@@ -65,6 +67,26 @@
         assertTrue("bean injected into test feature has not been initialised", tf.testBean.initialised);
     }
     
+    @Test
+    public void testBusConfigure() {
+        ClassPathXmlApplicationContext context = null;
+        try {
+            context = new ClassPathXmlApplicationContext("org/apache/cxf/bus/spring/customerBus.xml");
+            Bus cxf1 = (Bus)context.getBean("cxf1");
+            
+            assertTrue(cxf1.getOutInterceptors().size() == 1);
+            assertTrue(cxf1.getInInterceptors().size() == 0);
+            
+            Bus cxf2 = (Bus)context.getBean("cxf2");
+            assertTrue(cxf2.getInInterceptors().size() == 1);
+            assertTrue(cxf2.getOutInterceptors().size() == 0);
+        } finally {
+            if (context != null) {
+                context.close();
+            }
+        }
+    }
+    
     static class TestBean {
 
         boolean initialised;

Added: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml?rev=908549&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml (added)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml Wed Feb 10 15:46:51
2010
@@ -0,0 +1,44 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
+
+  <bean id="cxf1" class="org.apache.cxf.bus.CXFBusImpl"/>
+   
+  <bean id="cxf2" class="org.apache.cxf.bus.CXFBusImpl"/>
+
+   <cxf:bus name="test1" bus="cxf1">
+        <cxf:outInterceptors>
+        <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+        </cxf:outInterceptors>
+    </cxf:bus>
+
+    <cxf:bus name="test2" bus="cxf2">
+        <cxf:inInterceptors>
+        <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+        </cxf:inInterceptors>
+    </cxf:bus>
+  
+
+</beans>

Propchange: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/customerBus.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message