Author: ningjiang Date: Wed Jan 21 20:27:22 2009 New Revision: 736559 URL: http://svn.apache.org/viewvc?rev=736559&view=rev Log: CAMEL-1275 added the missed test file
Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java (with props) camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml (with props) Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java?rev=736559&view=auto ============================================================================== --- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java (added) +++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java Wed Jan 21 20:27:22 2009 @@ -0,0 +1,64 @@ +/** + * 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.transport; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.component.cxf.CxfConsumer; +import org.apache.camel.component.cxf.CxfEndpoint; +import org.apache.camel.component.cxf.CxfProducer; +import org.apache.camel.spring.SpringCamelContext; +import org.apache.camel.spring.SpringTestSupport; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class CamelEndpointSpringConfigureTest extends SpringTestSupport { + + public void testCreateDestinationFromSpring() throws Exception { + CxfEndpoint cxfEndpoint = (CxfEndpoint) context.getEndpoint("cxf:bean:serviceEndpoint"); + CxfProducer producer = (CxfProducer)cxfEndpoint.createProducer(); + assertNotNull("The producer should not be null", producer); + producer.start(); + CamelConduit conduit = (CamelConduit)producer.getClient().getConduit(); + assertTrue("we should get SpringCamelContext here", conduit.getCamelContext() instanceof SpringCamelContext); + assertEquals("The context id should be camel_conduit", "camel_conduit", conduit.getCamelContext().getName()); + + cxfEndpoint = (CxfEndpoint) context.getEndpoint("cxf:bean:routerEndpoint"); + CxfConsumer consumer = (CxfConsumer)cxfEndpoint.createConsumer(new Processor() { + public void process(Exchange exchange) throws Exception { + // do nothing here + } + }); + assertNotNull("The consumer should not be null", consumer); + consumer.start(); + CamelDestination destination = (CamelDestination)consumer.getServer().getDestination(); + assertTrue("we should get SpringCamelContext here", destination.getCamelContext() instanceof SpringCamelContext); + assertEquals("The context id should be camel_destination", "camel_destination", destination.getCamelContext().getName()); + + + } + + @Override + protected AbstractXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml"); + } + @Override + protected int getExpectedRouteCount() { + return 0; + } + +} Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigureTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml?rev=736559&view=auto ============================================================================== --- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml (added) +++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml Wed Jan 21 20:27:22 2009 @@ -0,0 +1,53 @@ +<?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:camel="http://cxf.apache.org/transports/camel" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://cxf.apache.org/transports/camel http://cxf.apache.org/transports/camel.xsd + http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxfEndpoint/camel-cxf.xsd + http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd + "> + <camel:destination name="{http://apache.org/hello_world_soap_http}SoapPort.camel-destination"> + <camelContext id="camel_destination" xmlns="http://activemq.apache.org/camel/schema/spring"> + </camelContext> + </camel:destination> + + <camel:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.camel-conduit"> + <camelContext id="camel_conduit" xmlns="http://activemq.apache.org/camel/schema/spring"> + </camelContext> + </camel:conduit> + + <cxf:cxfEndpoint id="routerEndpoint" address="camel://direct://Endpoint" + serviceClass="org.apache.hello_world_soap_http.Greeter" + endpointName="s:SoapPort" + serviceName="s:SOAPService" + xmlns:s="http://apache.org/hello_world_soap_http" + transportId="http://cxf.apache.org/transports/camel"> + </cxf:cxfEndpoint> + + <cxf:cxfEndpoint id="serviceEndpoint" address="camel://direct://service" + serviceClass="org.apache.hello_world_soap_http.Greeter" + endpointName="s:SoapPort" + serviceName="s:SOAPService" + xmlns:s="http://apache.org/hello_world_soap_http"> + </cxf:cxfEndpoint> + +</beans> \ No newline at end of file Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml