You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by wt...@apache.org on 2009/01/23 19:03:18 UTC
svn commit: r737122 - in /camel/trunk/components/camel-cxf/src/test:
java/org/apache/camel/component/cxf/spring/
resources/org/apache/camel/component/cxf/spring/
Author: wtam
Date: Fri Jan 23 10:03:18 2009
New Revision: 737122
URL: http://svn.apache.org/viewvc?rev=737122&view=rev
Log:
add a unit test for cxf bus injection
Added:
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java (with props)
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml (with props)
Modified:
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=737122&r1=737121&r2=737122&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Fri Jan 23 10:03:18 2009
@@ -31,7 +31,7 @@
public class CxfEndpointBeanTest extends TestCase {
- private ClassPathXmlApplicationContext ctx;
+ protected ClassPathXmlApplicationContext ctx;
protected void setUp() throws Exception {
ctx = new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeansRouter.xml"});
}
Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java?rev=737122&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java Fri Jan 23 10:03:18 2009
@@ -0,0 +1,47 @@
+/**
+ * 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.camel.component.cxf.spring;
+
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.cxf.CxfEndpoint;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Unit test for testing CXF bus injection.
+ *
+ * @version $Revision$
+ */
+public class CxfEndpointBeanWithBusTest extends CxfEndpointBeanTest {
+
+ @Override
+ protected void setUp() throws Exception {
+ ctx = new ClassPathXmlApplicationContext(
+ new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml"});
+ }
+
+ public void testBusInjectedBySpring() throws Exception {
+ CamelContext camelContext = (CamelContext) ctx.getBean("camel");
+ CxfEndpoint endpoint = (CxfEndpoint)camelContext.getEndpoint("cxf:bean:routerEndpoint");
+
+ // verify the interceptor that is added by the logging feature
+ assertTrue(endpoint.getBus().getInInterceptors().size() == 1);
+ assertEquals(LoggingInInterceptor.class, endpoint.getBus().getInInterceptors().get(0).getClass());
+ }
+
+}
Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml?rev=737122&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml (added)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml Fri Jan 23 10:03:18 2009
@@ -0,0 +1,66 @@
+<?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:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
+ xmlns:cxfcore="http://cxf.apache.org/core"
+ xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxfEndpoint/camel-cxf.xsd
+ http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ ">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+ <!-- configure the bus -->
+ <cxfcore:bus>
+ <cxfcore:features>
+ <cxfcore:logging/>
+ </cxfcore:features>
+ </cxfcore:bus>
+
+ <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:9000/router"
+ serviceClass="org.apache.camel.component.cxf.HelloService"/>
+
+
+ <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:9002/helloworld"
+ serviceClass="org.apache.camel.component.cxf.HelloService"/>
+
+ <!-- Setting the http conduit policy -->
+ <http-conf:conduit name="{http://cxf.component.camel.apache.org/}HelloServicePort.http-conduit">
+ <http-conf:client ReceiveTimeout="2000"
+ MaxRetransmits="1"
+ AllowChunking="false" />
+ </http-conf:conduit>
+
+ <bean id="myProcessor" class="org.apache.camel.component.cxf.spring.MyProcessor"/>
+
+ <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+ <route>
+ <from uri="cxf:bean:routerEndpoint" />
+ <process ref="myProcessor" />
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansRouterWithBus.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml