activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r522936 - in /activemq/camel/trunk: ./ camel-core/src/main/java/org/apache/camel/impl/ camel-cxf/ camel-cxf/src/main/java/org/apache/camel/component/cxf/ camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/ camel-cxf/src/test/j...
Date Tue, 27 Mar 2007 14:46:51 GMT
Author: jstrachan
Date: Tue Mar 27 07:46:48 2007
New Revision: 522936

URL: http://svn.apache.org/viewvc?view=rev&rev=522936
Log:
added some (currently failing) test cases for the CXF transport

Added:
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties   (with props)
    activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/
    activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java   (with props)
    activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java   (with props)
    activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java   (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    activemq/camel/trunk/camel-cxf/pom.xml
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointResolver.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConstants.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
    activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportBase.java
    activemq/camel/trunk/pom.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Tue Mar 27 07:46:48 2007
@@ -18,8 +18,8 @@
 package org.apache.camel.impl;
 
 import org.apache.camel.*;
-import org.apache.camel.util.ServiceHelper;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.util.ServiceHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -177,17 +177,19 @@
      * Activates all the starting endpoints in that were added as routes.
      */
     public void activateEndpoints() throws Exception {
-        for (Route<Exchange> route : routes) {
-            Processor<Exchange> processor = route.getProcessor();
-            Consumer<Exchange> consumer = route.getEndpoint().createConsumer(processor);
-            if (consumer != null) {
-                consumer.start();
-                servicesToClose.add(consumer);
-            }
-            if (processor instanceof Service) {
-                Service service = (Service) processor;
-                service.start();
-                servicesToClose.add(service);
+        if (routes != null) {
+            for (Route<Exchange> route : routes) {
+                Processor<Exchange> processor = route.getProcessor();
+                Consumer<Exchange> consumer = route.getEndpoint().createConsumer(processor);
+                if (consumer != null) {
+                    consumer.start();
+                    servicesToClose.add(consumer);
+                }
+                if (processor instanceof Service) {
+                    Service service = (Service) processor;
+                    service.start();
+                    servicesToClose.add(service);
+                }
             }
         }
     }
@@ -197,7 +199,6 @@
      */
     public void deactivateEndpoints() throws Exception {
         ServiceHelper.stopServices(servicesToClose);
-
     }
 
     // Route Management Methods

Modified: activemq/camel/trunk/camel-cxf/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/pom.xml?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/pom.xml (original)
+++ activemq/camel/trunk/camel-cxf/pom.xml Tue Mar 27 07:46:48 2007
@@ -51,10 +51,84 @@
 
 
     <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-management</artifactId>
+      <version>2.0-incubator-RC-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-testutils</artifactId>
+      <version>2.0-incubator-RC-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-tools-common</artifactId>
+      <version>2.0-incubator-RC-SNAPSHOT</version>
+    </dependency>
+
+
+    <!--
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-activation_1.1_spec</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+            <dependency>
+                <groupId>com.sun.xml.messaging.saaj</groupId>
+                <artifactId>saaj-impl</artifactId>
+                <scope>runtime</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-jms_1.1_spec</artifactId>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.activemq</groupId>
+                <artifactId>activemq-core</artifactId>
+                <scope>test</scope>
+            </dependency>
+    -->
+
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymockclassextension</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <childDelegation>false</childDelegation>
+          <useFile>true</useFile>
+          <includes>
+            <include>**/*Test.*</include>
+          </includes>
+          <excludes>
+            <!-- TODO re-enable ASAP! -->
+            <exclude>**/Camel*Test.*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java Tue Mar 27 07:46:48 2007
@@ -27,7 +27,6 @@
  * @version $Revision$
  */
 public class CxfBinding {
-
     public Object extractBodyFromCxf(CxfExchange exchange, Message message) {
         //  TODO how do we choose a format?
         Set<Class<?>> contentFormats = message.getContentFormats();

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java Tue Mar 27 07:46:48 2007
@@ -17,24 +17,14 @@
  */
 package org.apache.camel.component.cxf;
 
-import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.CamelContext;
-import org.apache.cxf.Bus;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.endpoint.ServerRegistry;
-import org.apache.cxf.bus.CXFBusFactory;
+import org.apache.camel.impl.DefaultComponent;
 
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
 import java.io.IOException;
-import java.net.URISyntaxException;
 import java.net.URI;
-import java.net.SocketAddress;
-import java.net.InetSocketAddress;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Tue Mar 27 07:46:48 2007
@@ -18,12 +18,12 @@
 package org.apache.camel.component.cxf;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.Consumer;
+import org.apache.camel.impl.DefaultConsumer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.impl.DefaultConsumer;
 
 /**
  * The endpoint in the service engine
@@ -46,7 +46,8 @@
     }
 
     public Consumer<CxfExchange> createConsumer(Processor<CxfExchange> processor) throws Exception {
-        return startService(new DefaultConsumer<CxfExchange>(this, processor) {});
+        return startService(new DefaultConsumer<CxfExchange>(this, processor) {
+        });
     }
 
     public CxfExchange createExchange() {

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointResolver.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointResolver.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpointResolver.java Tue Mar 27 07:46:48 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.camel.component.cxf;
 
-import org.apache.camel.EndpointResolver;
-import org.apache.camel.Component;
 import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.EndpointResolver;
 import org.apache.camel.util.ObjectHelper;
 
 import java.io.IOException;
@@ -29,59 +29,58 @@
 /**
  * An implementation of {@link EndpointResolver} that creates
  * {@link CxfEndpoint} objects.
- *
+ * <p/>
  * The syntax for a MINA URI looks like:
- *
+ * <p/>
  * <pre><code>mina:</code></pre>
  *
  * @version $Revision:520964 $
  */
 public class CxfEndpointResolver implements EndpointResolver<CxfExchange> {
+    public static final String DEFAULT_COMPONENT_NAME = CxfEndpointResolver.class.getName();
 
-	public static final String DEFAULT_COMPONENT_NAME = CxfEndpointResolver.class.getName();
+    /**
+     * Finds the {@link CxfComponent} specified by the uri.  If the {@link CxfComponent}
+     * object do not exist, it will be created.
+     */
+    public Component resolveComponent(CamelContext container, String uri) {
+        String[] id = getEndpointId(uri);
+        return resolveCxfComponent(container, id[0]);
+    }
 
-	/**
-	 * Finds the {@link CxfComponent} specified by the uri.  If the {@link CxfComponent}
-	 * object do not exist, it will be created.
-	 */
-	public Component resolveComponent(CamelContext container, String uri) {
-		String[] id = getEndpointId(uri);
-		return resolveCxfComponent(container, id[0]);
-	}
-
-	/**
-	 * Finds the {@link CxfEndpoint} specified by the uri.  If the {@link CxfEndpoint} or it's associated
-	 * {@see QueueComponent} object do not exist, they will be created.
-	 */
-	public CxfEndpoint resolveEndpoint(CamelContext container, String uri) throws IOException, URISyntaxException {
-		String[] urlParts = getEndpointId(uri);
-    	CxfComponent component = resolveCxfComponent(container, urlParts[0]);
+    /**
+     * Finds the {@link CxfEndpoint} specified by the uri.  If the {@link CxfEndpoint} or it's associated
+     * {@see QueueComponent} object do not exist, they will be created.
+     */
+    public CxfEndpoint resolveEndpoint(CamelContext container, String uri) throws IOException, URISyntaxException {
+        String[] urlParts = getEndpointId(uri);
+        CxfComponent component = resolveCxfComponent(container, urlParts[0]);
         return component.createEndpoint(uri, urlParts);
     }
 
-	/**
-	 * @return an array that looks like: [componentName,endpointName]
-	 */
-	private String[] getEndpointId(String uri) {
-		String rc [] = {CxfEndpointResolver.DEFAULT_COMPONENT_NAME, null};
-		String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 3);
-    	if( splitURI[2] != null ) {
-    		rc[0] =  splitURI[1];
-    		rc[1] =  splitURI[2];
-    	} else {
-    		rc[1] =  splitURI[1];
-    	}
-		return rc;
-	}
-
-	@SuppressWarnings("unchecked")
-	private CxfComponent resolveCxfComponent(final CamelContext context, final String componentName) {
-    	Component rc = context.getOrCreateComponent(componentName, new Callable(){
-			public CxfComponent call() throws Exception {
-                return new CxfComponent(context);
-			}});
-    	return (CxfComponent) rc;
-	}
-
+    /**
+     * @return an array that looks like: [componentName,endpointName]
+     */
+    private String[] getEndpointId(String uri) {
+        String rc[] = {CxfEndpointResolver.DEFAULT_COMPONENT_NAME, null};
+        String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 3);
+        if (splitURI[2] != null) {
+            rc[0] = splitURI[1];
+            rc[1] = splitURI[2];
+        }
+        else {
+            rc[1] = splitURI[1];
+        }
+        return rc;
+    }
 
+    @SuppressWarnings("unchecked")
+    private CxfComponent resolveCxfComponent(final CamelContext context, final String componentName) {
+        Component rc = context.getOrCreateComponent(componentName, new Callable() {
+            public CxfComponent call() throws Exception {
+                return new CxfComponent(context);
+            }
+        });
+        return (CxfComponent) rc;
+    }
 }

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java Tue Mar 27 07:46:48 2007
@@ -17,12 +17,12 @@
  */
 package org.apache.camel.component.cxf;
 
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultExchange;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.Destination;
 
 /**
  * An {@link Exchange} for working with Apache CXF
@@ -47,6 +47,7 @@
         setOut(new CxfMessage(exchange.getOutMessage()));
         setFault(new CxfMessage(exchange.getInFaultMessage()));
     }
+
     @Override
     public CxfMessage getIn() {
         return (CxfMessage) super.getIn();
@@ -105,7 +106,6 @@
     public Conduit getConduit() {
         return getExchange().getConduit();
     }
-
 
     @Override
     protected CxfMessage createInMessage() {

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java Tue Mar 27 07:46:48 2007
@@ -93,7 +93,7 @@
     @Override
     protected void populateInitialHeaders(Map<String, Object> map) {
         if (cxfMessage != null) {
-            Set<Map.Entry<String,Object>> entries = cxfMessage.entrySet();
+            Set<Map.Entry<String, Object>> entries = cxfMessage.entrySet();
             for (Map.Entry<String, Object> entry : entries) {
                 String name = entry.getKey();
                 Object value = entry.getValue();

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java Tue Mar 27 07:46:48 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 import java.io.ByteArrayInputStream;
@@ -45,10 +46,11 @@
  * @version $Revision$
  */
 public class CamelConduit extends AbstractConduit implements Configurable {
-    protected static final String BASE_BEAN_NAME_SUFFIX = ".jms-conduit-base";
+    protected static final String BASE_BEAN_NAME_SUFFIX = ".camel-conduit-base";
     private static final Logger LOG = LogUtils.getL7dLogger(CamelConduit.class);
-    protected final CamelTransportBase base;
+    private final CamelTransportBase base;
     private String targetCamelEndpointUri;
+
 /*
     protected ClientConfig clientConfig;
     protected ClientBehaviorPolicyType runtimePolicy;
@@ -58,6 +60,10 @@
 
     public CamelConduit(CamelContext camelContext, Bus bus, EndpointInfo endpointInfo, EndpointReferenceType targetReference) {
         super(targetReference);
+        AttributedURIType address = targetReference.getAddress();
+        if (address != null) {
+            this.targetCamelEndpointUri = address.getValue();
+        }
 
         base = new CamelTransportBase(camelContext, bus, endpointInfo, false, BASE_BEAN_NAME_SUFFIX);
 
@@ -66,14 +72,14 @@
 
     // prepare the message for send out , not actually send out the message
     public void send(Message message) throws IOException {
-        getLogger().log(Level.FINE, "JMSConduit send message");
+        getLogger().log(Level.FINE, "CamelConduit send message");
 
         message.setContent(OutputStream.class,
-                new JMSOutputStream(message));
+                new CamelOutputStream(message));
     }
 
     public void close() {
-        getLogger().log(Level.FINE, "JMSConduit closed ");
+        getLogger().log(Level.FINE, "CamelConduit closed ");
 
         // ensure resources held by session factory are released
         //
@@ -85,7 +91,11 @@
     }
 
     public String getBeanName() {
-        return base.endpointInfo.getName().toString() + ".jms-conduit";
+        EndpointInfo info = base.endpointInfo;
+        if (info == null) {
+            return "default.camel-conduit";
+        }
+        return info.getName() + ".camel-conduit";
     }
 
     private void initConfig() {
@@ -107,11 +117,11 @@
         }
     }
 
-    private class JMSOutputStream extends AbstractCachedOutputStream {
+    private class CamelOutputStream extends AbstractCachedOutputStream {
         private Message outMessage;
         private boolean isOneWay;
 
-        public JMSOutputStream(Message m) {
+        public CamelOutputStream(Message m) {
             outMessage = m;
         }
 
@@ -159,7 +169,7 @@
 
                         if (id != null) {
                             if (correlationID != null) {
-                                String error = "User cannot set JMSCorrelationID when "
+                                String error = "User cannot set CamelCorrelationID when "
                                         + "making a request/reply invocation using "
                                         + "a static replyTo Queue.";
                             }
@@ -188,36 +198,36 @@
             Message inMessage = new MessageImpl();
             outMessage.getExchange().setInMessage(inMessage);
             //set the message header back to the incomeMessage
-            //inMessage.put(JMSConstants.CAMEL_CLIENT_RESPONSE_HEADERS,
-            //              outMessage.get(JMSConstants.CAMEL_CLIENT_RESPONSE_HEADERS));
+            //inMessage.put(CamelConstants.CAMEL_CLIENT_RESPONSE_HEADERS,
+            //              outMessage.get(CamelConstants.CAMEL_CLIENT_RESPONSE_HEADERS));
 
             /*
             Object result1;
 
             Object result = null;
 
-            javax.jms.Message jmsMessage1 = pooledSession.consumer().receive(timeout);
-            getLogger().log(Level.FINE, "client received reply: " , jmsMessage1);
+            javax.camel.Message camelMessage1 = pooledSession.consumer().receive(timeout);
+            getLogger().log(Level.FINE, "client received reply: " , camelMessage1);
 
-            if (jmsMessage1 != null) {
+            if (camelMessage1 != null) {
 
-                base.populateIncomingContext(jmsMessage1, outMessage, JMSConstants.CAMEL_CLIENT_RESPONSE_HEADERS);
-                String messageType = jmsMessage1 instanceof TextMessage
-                            ? JMSConstants.TEXT_MESSAGE_TYPE : JMSConstants.BINARY_MESSAGE_TYPE;
+                base.populateIncomingContext(camelMessage1, outMessage, CamelConstants.CAMEL_CLIENT_RESPONSE_HEADERS);
+                String messageType = camelMessage1 instanceof TextMessage
+                            ? CamelConstants.TEXT_MESSAGE_TYPE : CamelConstants.BINARY_MESSAGE_TYPE;
                 result = base.unmarshal((org.apache.camel.Exchange) outMessage);
                 result1 = result;
             } else {
-                String error = "JMSClientTransport.receive() timed out. No message available.";
+                String error = "CamelClientTransport.receive() timed out. No message available.";
                 getLogger().log(Level.SEVERE, error);
                 //TODO: Review what exception should we throw.
-                throw new JMSException(error);
+                throw new CamelException(error);
 
             }
             response = result1;
 
             //set the message header back to the incomeMessage
-            inMessage.put(JMSConstants.CAMEL_CLIENT_RESPONSE_HEADERS,
-                          outMessage.get(JMSConstants.CAMEL_CLIENT_RESPONSE_HEADERS));
+            inMessage.put(CamelConstants.CAMEL_CLIENT_RESPONSE_HEADERS,
+                          outMessage.get(CamelConstants.CAMEL_CLIENT_RESPONSE_HEADERS));
 
             */
 

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConstants.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConstants.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConstants.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConstants.java Tue Mar 27 07:46:48 2007
@@ -21,35 +21,28 @@
  * @version $Revision$
  */
 public class CamelConstants {
-
     public static final String TEXT_MESSAGE_TYPE = "text";
     public static final String BINARY_MESSAGE_TYPE = "binary";
-
     public static final String CAMEL_SERVER_REQUEST_HEADERS = "org.apache.cxf.camel.server.request.headers";
     public static final String CAMEL_SERVER_RESPONSE_HEADERS = "org.apache.cxf.camel.server.response.headers";
     public static final String CAMEL_REQUEST_MESSAGE = "org.apache.cxf.camel.request.message";
     public static final String CAMEL_RESPONSE_MESSAGE = "org.apache.cxf.camel.reponse.message";
     public static final String CAMEL_CLIENT_REQUEST_HEADERS = "org.apache.cxf.camel.client.request.headers";
     public static final String CAMEL_CLIENT_RESPONSE_HEADERS =
-        "org.apache.cxf.camel.client.response.headers";
-
+            "org.apache.cxf.camel.client.response.headers";
     public static final String CAMEL_CLIENT_RECEIVE_TIMEOUT = "org.apache.cxf.camel.client.timeout";
-
     public static final String CAMEL_SERVER_CONFIGURATION_URI =
-        "http://cxf.apache.org/configuration/transport/camel-server";
+            "http://cxf.apache.org/configuration/transport/camel-server";
     public static final String CAMEL_CLIENT_CONFIGURATION_URI =
-        "http://cxf.apache.org/configuration/transport/camel-client";
+            "http://cxf.apache.org/configuration/transport/camel-client";
     public static final String ENDPOINT_CONFIGURATION_URI =
-        "http://cxf.apache.org/jaxws/endpoint-config";
+            "http://cxf.apache.org/jaxws/endpoint-config";
     public static final String SERVICE_CONFIGURATION_URI =
-        "http://cxf.apache.org/jaxws/service-config";
+            "http://cxf.apache.org/jaxws/service-config";
     public static final String PORT_CONFIGURATION_URI =
-        "http://cxf.apache.org/jaxws/port-config";
-
+            "http://cxf.apache.org/jaxws/port-config";
     public static final String CAMEL_CLIENT_CONFIG_ID = "camel-client";
     public static final String CAMEL_SERVER_CONFIG_ID = "camel-server";
-
     public static final String CAMEL_REBASED_REPLY_TO = "org.apache.cxf.camel.server.replyto";
-
     public static final String CAMEL_CORRELATION_ID = "org.apache.cxf.camel.correlationId";
 }

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelDestination.java Tue Mar 27 07:46:48 2007
@@ -18,10 +18,10 @@
 package org.apache.camel.component.cxf.transport;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.Endpoint;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurable;
@@ -48,7 +48,7 @@
  * @version $Revision$
  */
 public class CamelDestination extends AbstractDestination implements Configurable {
-    protected static final String BASE_BEAN_NAME_SUFFIX = ".jms-destination-base";
+    protected static final String BASE_BEAN_NAME_SUFFIX = ".camel-destination-base";
     private static final Logger LOG = LogUtils.getL7dLogger(CamelDestination.class);
     CamelContext camelContext;
     String camelUri;
@@ -95,7 +95,7 @@
     }
 
     public void deactivate() {
-            base.close();
+        base.close();
     }
 
     public void shutdown() {
@@ -112,7 +112,7 @@
         MessageImpl inMessage = new MessageImpl();
         inMessage.setContent(InputStream.class, new ByteArrayInputStream(bytes));
         base.populateIncomingContext(exchange, inMessage, CamelConstants.CAMEL_SERVER_REQUEST_HEADERS);
-        //inMessage.put(JMSConstants.CAMEL_SERVER_RESPONSE_HEADERS, new JMSMessageHeadersType());
+        //inMessage.put(CamelConstants.CAMEL_SERVER_RESPONSE_HEADERS, new CamelMessageHeadersType());
         inMessage.put(CamelConstants.CAMEL_REQUEST_MESSAGE, exchange);
 
         inMessage.setDestination(this);
@@ -122,7 +122,7 @@
     }
 
     public String getBeanName() {
-        return endpointInfo.getName().toString() + ".jms-destination";
+        return endpointInfo.getName().toString() + ".camel-destination";
     }
 
     private void initConfig() {

Modified: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportBase.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportBase.java?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportBase.java (original)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportBase.java Tue Mar 27 07:46:48 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.component.cxf.transport;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
 import org.apache.camel.util.CamelClient;
 import org.apache.cxf.Bus;
 import org.apache.cxf.message.Message;
@@ -42,11 +42,10 @@
         this.client = new CamelClient<Exchange>(camelContext);
     }
 
-    public void populateIncomingContext(Exchange exchange, MessageImpl inMessage, String jmsServerRequestHeaders) {
+    public void populateIncomingContext(Exchange exchange, MessageImpl inMessage, String camelServerRequestHeaders) {
 
     }
 
-
     public String getReplyDestination() {
         return replyDestination;
     }
@@ -70,18 +69,17 @@
     /**
      * Populates a Camel exchange with a payload
      *
-     * @param payload the message payload, expected to be either of type
-     * String or byte[] depending on payload type
-     * @param replyTo the ReplyTo destination if any
+     * @param payload  the message payload, expected to be either of type
+     *                 String or byte[] depending on payload type
+     * @param replyTo  the ReplyTo destination if any
      * @param exchange the underlying exchange to marshal to
      */
-    protected void marshal(Object payload, String replyTo,   Exchange exchange) {
+    protected void marshal(Object payload, String replyTo, Exchange exchange) {
         org.apache.camel.Message message = exchange.getIn();
         message.setBody(payload);
         if (replyTo != null) {
             message.setHeader(CamelConstants.CAMEL_CORRELATION_ID, replyTo);
         }
-
     }
 
     /**
@@ -92,33 +90,33 @@
     }
 
     /*
-    protected JMSMessageHeadersType populateIncomingContext(javax.jms.Message message,
+    protected CamelMessageHeadersType populateIncomingContext(javax.camel.Message message,
                                                             org.apache.cxf.message.Message inMessage,
-                                                     String headerType)  throws JMSException {
-        JMSMessageHeadersType headers = null;
+                                                     String headerType)  throws CamelException {
+        CamelMessageHeadersType headers = null;
 
-        headers = (JMSMessageHeadersType)inMessage.get(headerType);
+        headers = (CamelMessageHeadersType)inMessage.get(headerType);
 
         if (headers == null) {
-            headers = new JMSMessageHeadersType();
+            headers = new CamelMessageHeadersType();
             inMessage.put(headerType, headers);
         }
 
-        headers.setJMSCorrelationID(message.getJMSCorrelationID());
-        headers.setJMSDeliveryMode(new Integer(message.getJMSDeliveryMode()));
-        headers.setJMSExpiration(new Long(message.getJMSExpiration()));
-        headers.setJMSMessageID(message.getJMSMessageID());
-        headers.setJMSPriority(new Integer(message.getJMSPriority()));
-        headers.setJMSRedelivered(Boolean.valueOf(message.getJMSRedelivered()));
-        headers.setJMSTimeStamp(new Long(message.getJMSTimestamp()));
-        headers.setJMSType(message.getJMSType());
+        headers.setCamelCorrelationID(message.getCamelCorrelationID());
+        headers.setCamelDeliveryMode(new Integer(message.getCamelDeliveryMode()));
+        headers.setCamelExpiration(new Long(message.getCamelExpiration()));
+        headers.setCamelMessageID(message.getCamelMessageID());
+        headers.setCamelPriority(new Integer(message.getCamelPriority()));
+        headers.setCamelRedelivered(Boolean.valueOf(message.getCamelRedelivered()));
+        headers.setCamelTimeStamp(new Long(message.getCamelTimestamp()));
+        headers.setCamelType(message.getCamelType());
 
-        List<JMSPropertyType> props = headers.getProperty();
+        List<CamelPropertyType> props = headers.getProperty();
         Enumeration enm = message.getPropertyNames();
         while (enm.hasMoreElements()) {
             String name = (String)enm.nextElement();
             String val = message.getStringProperty(name);
-            JMSPropertyType prop = new JMSPropertyType();
+            CamelPropertyType prop = new CamelPropertyType();
             prop.setName(name);
             prop.setValue(val);
             props.add(prop);
@@ -127,24 +125,24 @@
         return headers;
     }
 
-    protected int getJMSDeliveryMode(JMSMessageHeadersType headers) {
+    protected int getCamelDeliveryMode(CamelMessageHeadersType headers) {
         int deliveryMode = Message.DEFAULT_DELIVERY_MODE;
 
-        if (headers != null && headers.isSetJMSDeliveryMode()) {
-            deliveryMode = headers.getJMSDeliveryMode();
+        if (headers != null && headers.isSetCamelDeliveryMode()) {
+            deliveryMode = headers.getCamelDeliveryMode();
         }
         return deliveryMode;
     }
 
-    protected int getJMSPriority(JMSMessageHeadersType headers) {
+    protected int getCamelPriority(CamelMessageHeadersType headers) {
         int priority = Message.DEFAULT_PRIORITY;
-        if (headers != null && headers.isSetJMSPriority()) {
-            priority = headers.getJMSPriority();
+        if (headers != null && headers.isSetCamelPriority()) {
+            priority = headers.getCamelPriority();
         }
         return priority;
     }
 
-    protected long getTimeToLive(JMSMessageHeadersType headers) {
+    protected long getTimeToLive(CamelMessageHeadersType headers) {
         long ttl = -1;
         if (headers != null && headers.isSetTimeToLive()) {
             ttl = headers.getTimeToLive();
@@ -152,34 +150,34 @@
         return ttl;
     }
 
-    protected String getCorrelationId(JMSMessageHeadersType headers) {
+    protected String getCorrelationId(CamelMessageHeadersType headers) {
         String correlationId  = null;
         if (headers != null
-            && headers.isSetJMSCorrelationID()) {
-            correlationId = headers.getJMSCorrelationID();
+            && headers.isSetCamelCorrelationID()) {
+            correlationId = headers.getCamelCorrelationID();
         }
         return correlationId;
     }
 
 
-    protected String getAddrUriFromJMSAddrPolicy() {
-        AddressType jmsAddressPolicy = transport.getJMSAddress();
-        return "jms:" + jmsAddressPolicy.getJndiConnectionFactoryName()
+    protected String getAddrUriFromCamelAddrPolicy() {
+        AddressType camelAddressPolicy = transport.getCamelAddress();
+        return "camel:" + camelAddressPolicy.getJndiConnectionFactoryName()
                         + "#"
-                        + jmsAddressPolicy.getJndiDestinationName();
+                        + camelAddressPolicy.getJndiDestinationName();
     }
 
-    protected String getReplyTotAddrUriFromJMSAddrPolicy() {
-        AddressType jmsAddressPolicy = transport.getJMSAddress();
-        return "jms:"
-                        + jmsAddressPolicy.getJndiConnectionFactoryName()
+    protected String getReplyTotAddrUriFromCamelAddrPolicy() {
+        AddressType camelAddressPolicy = transport.getCamelAddress();
+        return "camel:"
+                        + camelAddressPolicy.getJndiConnectionFactoryName()
                         + "#"
-                        + jmsAddressPolicy.getJndiReplyDestinationName();
+                        + camelAddressPolicy.getJndiReplyDestinationName();
     }
 
     protected boolean isDestinationStyleQueue() {
-        return JMSConstants.CAMEL_QUEUE.equals(
-            transport.getJMSAddress().getDestinationStyle().value());
+        return CamelConstants.CAMEL_QUEUE.equals(
+            transport.getCamelAddress().getDestinationStyle().value());
     }
     */
 }

Added: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties?view=auto&rev=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties (added)
+++ activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties Tue Mar 27 07:46:48 2007
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+DISPATCH_FAILURE_MSG = Dispatch of incoming Camel request failed

Propchange: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java?view=auto&rev=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java (added)
+++ activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java Tue Mar 27 07:46:48 2007
@@ -0,0 +1,114 @@
+/**
+ * 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.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class CamelConduitTest extends CamelTestSupport {
+    public void DISABLED_testGetConfiguration() throws Exception {
+        // setup the new bus to get the configuration file
+        SpringBusFactory bf = new SpringBusFactory();
+        BusFactory.setDefaultBus(null);
+        bus = bf.createBus("/wsdl/camel_test_config.xml");
+        BusFactory.setDefaultBus(bus);
+        setupServiceInfo("http://cxf.apache.org/camel_conf_test",
+                "/wsdl/camel_test_no_addr.wsdl",
+                "HelloWorldQueueBinMsgService",
+                "HelloWorldQueueBinMsgPort");
+        CamelConduit conduit = setupCamelConduit(false, false);
+        /*
+        assertEquals("Can't get the right ClientReceiveTimeout",
+                     500L,
+                     conduit.getClientConfig().getClientReceiveTimeout());
+        assertEquals("Can't get the right SessionPoolConfig's LowWaterMark",
+                     10,
+                     conduit.getSessionPool().getLowWaterMark());
+        assertEquals("Can't get the right AddressPolicy's ConnectionPassword",
+                     "testPassword",
+                     conduit.getCamelAddress().getConnectionPassword());
+                     */
+        bus.shutdown(false);
+        BusFactory.setDefaultBus(null);
+    }
+
+    public void testPrepareSend() throws Exception {
+        setupServiceInfo("http://cxf.apache.org/hello_world_camel",
+                "/wsdl/camel_test.wsdl",
+                "HelloWorldService",
+                "HelloWorldPort");
+
+        CamelConduit conduit = setupCamelConduit(false, false);
+        Message message = new MessageImpl();
+        try {
+            conduit.send(message);
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        verifySentMessage(false, message);
+    }
+
+    public void verifySentMessage(boolean send, Message message) {
+        OutputStream os = message.getContent(OutputStream.class);
+        assertTrue("OutputStream should not be null", os != null);
+    }
+
+    public void testSendOut() throws Exception {
+        setupServiceInfo("http://cxf.apache.org/hello_world_camel",
+                "/wsdl/camel_test.wsdl",
+                "HelloWorldServiceLoop",
+                "HelloWorldPortLoop");
+
+        CamelConduit conduit = setupCamelConduit(true, false);
+        Message message = new MessageImpl();
+        // set the isOneWay to false
+        sendoutMessage(conduit, message, false);
+        verifyReceivedMessage(message);
+    }
+
+    public void verifyReceivedMessage(Message message) {
+        ByteArrayInputStream bis =
+                (ByteArrayInputStream) inMessage.getContent(InputStream.class);
+        byte bytes[] = new byte[bis.available()];
+        try {
+            bis.read(bytes);
+        }
+        catch (IOException ex) {
+            ex.printStackTrace();
+        }
+        String reponse = new String(bytes);
+        assertEquals("The reponse date should be equals", reponse, "HelloWorld");
+
+/*
+        CamelMessageHeadersType inHeader =
+            (CamelMessageHeadersType)inMessage.get(CamelConstants.Camel_CLIENT_RESPONSE_HEADERS);
+        
+        assertTrue("The inMessage Camel Header should not be null", inHeader != null);
+*/
+
+    }
+}

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelConduitTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java?view=auto&rev=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java (added)
+++ activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java Tue Mar 27 07:46:48 2007
@@ -0,0 +1,321 @@
+/**
+ * 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.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.MessageObserver;
+import org.easymock.classextension.EasyMock;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class CamelDestinationTest extends CamelTestSupport {
+    private Message destMessage;
+
+    private void waitForReceiveInMessage() {
+        int waitTime = 0;
+        while (inMessage == null && waitTime < 3000) {
+            try {
+                Thread.sleep(1000);
+            }
+            catch (InterruptedException e) {
+                // do nothing here
+            }
+            waitTime = waitTime + 1000;
+        }
+        assertTrue("Can't receive the Conduit Message in 3 seconds", inMessage != null);
+    }
+
+    private void waitForReceiveDestMessage() {
+        int waitTime = 0;
+        while (destMessage == null && waitTime < 3000) {
+            try {
+                Thread.sleep(1000);
+            }
+            catch (InterruptedException e) {
+                // do nothing here
+            }
+            waitTime = waitTime + 1000;
+        }
+        assertTrue("Can't receive the Destination message in 3 seconds", destMessage != null);
+    }
+
+    public CamelDestination setupCamelDestination(boolean send) throws IOException {
+        ConduitInitiator conduitInitiator = EasyMock.createMock(ConduitInitiator.class);
+        CamelDestination camelDestination = new CamelDestination(camelContext, bus, conduitInitiator, endpointInfo);
+        if (send) {
+            // setMessageObserver
+            observer = new MessageObserver() {
+                public void onMessage(Message m) {
+                    Exchange exchange = new ExchangeImpl();
+                    exchange.setInMessage(m);
+                    m.setExchange(exchange);
+                    destMessage = m;
+                }
+            };
+            camelDestination.setMessageObserver(observer);
+        }
+        return camelDestination;
+    }
+
+    public void testGetConfiguration() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        BusFactory.setDefaultBus(null);
+        bus = bf.createBus("/wsdl/camel_test_config.xml");
+        BusFactory.setDefaultBus(bus);
+        setupServiceInfo("http://cxf.apache.org/camel_conf_test",
+                "/wsdl/camel_test_no_addr.wsdl",
+                "HelloWorldQueueBinMsgService",
+                "HelloWorldQueueBinMsgPort");
+        CamelDestination destination = setupCamelDestination(false);
+
+        /*assertEquals("Can't get the right ServerConfig's MessageTimeToLive ",
+        500L,
+        destination.getServerConfig().getMessageTimeToLive());
+assertEquals("Can't get the right Server's MessageSelector",
+        "cxf_message_selector",
+        destination.getRuntimePolicy().getMessageSelector());
+assertEquals("Can't get the right SessionPoolConfig's LowWaterMark",
+        10,
+        destination.getSessionPool().getLowWaterMark());
+assertEquals("Can't get the right AddressPolicy's ConnectionPassword",
+        "testPassword",
+        destination.getCamelAddress().getConnectionPassword());*/
+        BusFactory.setDefaultBus(null);
+    }
+
+    public void testOneWayDestination() throws Exception {
+        destMessage = null;
+        inMessage = null;
+        setupServiceInfo("http://cxf.apache.org/hello_world_camel",
+                "/wsdl/camel_test.wsdl",
+                "HWStaticReplyQBinMsgService",
+                "HWStaticReplyQBinMsgPort");
+        CamelConduit conduit = setupCamelConduit(true, false);
+        Message outMessage = new MessageImpl();
+        setupMessageHeader(outMessage);
+        CamelDestination destination = null;
+        try {
+            destination = setupCamelDestination(true);
+            //destination.activate();
+        }
+        catch (IOException e) {
+            assertFalse("The CamelDestination activate should not through exception ", false);
+            e.printStackTrace();
+        }
+        sendoutMessage(conduit, outMessage, true);
+        // wait for the message to be get from the destination
+        waitForReceiveDestMessage();
+        // just verify the Destination inMessage
+        assertTrue("The destiantion should have got the message ", destMessage != null);
+        verifyReceivedMessage(destMessage);
+        verifyHeaders(destMessage, outMessage);
+        destination.shutdown();
+    }
+
+    private void setupMessageHeader(Message outMessage) {
+/*
+        CamelMessageHeadersType header = new CamelMessageHeadersType();
+        header.setCamelCorrelationID("Destination test");
+        header.setCamelDeliveryMode(3);
+        header.setCamelPriority(1);
+        header.setTimeToLive(1000);
+        outMessage.put(CamelConstants.Camel_CLIENT_REQUEST_HEADERS, header);
+*/
+    }
+
+    private void verifyReceivedMessage(Message inMessage) {
+        ByteArrayInputStream bis =
+                (ByteArrayInputStream) inMessage.getContent(InputStream.class);
+        byte bytes[] = new byte[bis.available()];
+        try {
+            bis.read(bytes);
+        }
+        catch (IOException ex) {
+            assertFalse("Read the Destination recieved Message error ", false);
+            ex.printStackTrace();
+        }
+        String reponse = new String(bytes);
+        assertEquals("The reponse date should be equals", reponse, "HelloWorld");
+    }
+
+    private void verifyRequestResponseHeaders(Message inMessage, Message outMessage) {
+/*
+        CamelMessageHeadersType outHeader =
+            (CamelMessageHeadersType)outMessage.get(CamelConstants.Camel_CLIENT_REQUEST_HEADERS);
+        
+        CamelMessageHeadersType inHeader =
+            (CamelMessageHeadersType)inMessage.get(CamelConstants.Camel_CLIENT_RESPONSE_HEADERS);
+
+        verifyJmsHeaderEquality(outHeader, inHeader);
+*/
+
+    }
+
+    private void verifyHeaders(Message inMessage, Message outMessage) {
+/*
+        CamelMessageHeadersType outHeader =
+            (CamelMessageHeadersType)outMessage.get(CamelConstants.Camel_CLIENT_REQUEST_HEADERS);
+        
+        CamelMessageHeadersType inHeader =
+            (CamelMessageHeadersType)inMessage.get(CamelConstants.Camel_SERVER_REQUEST_HEADERS);
+        verifyJmsHeaderEquality(outHeader, inHeader);
+*/
+
+    }
+
+    /*
+        private void verifyJmsHeaderEquality(CamelMessageHeadersType outHeader, CamelMessageHeadersType inHeader) {
+            assertEquals("The inMessage and outMessage Camel Header's CorrelationID should be equals",
+                         outHeader.getCamelCorrelationID(), inHeader.getCamelCorrelationID());
+            assertEquals("The inMessage and outMessage Camel Header's CamelPriority should be equals",
+                         outHeader.getCamelPriority(), inHeader.getCamelPriority());
+            assertEquals("The inMessage and outMessage Camel Header's CamelType should be equals",
+                         outHeader.getCamelType(), inHeader.getCamelType());
+
+        }
+
+    */
+    public void testRoundTripDestination() throws Exception {
+
+        inMessage = null;
+        setupServiceInfo("http://cxf.apache.org/hello_world_camel",
+                "/wsdl/camel_test.wsdl",
+                "HelloWorldService",
+                "HelloWorldPort");
+        //set up the conduit send to be true 
+        CamelConduit conduit = setupCamelConduit(true, false);
+        final Message outMessage = new MessageImpl();
+        setupMessageHeader(outMessage);
+        final CamelDestination destination = setupCamelDestination(true);
+
+        //set up MessageObserver for handlering the conduit message
+        MessageObserver observer = new MessageObserver() {
+            public void onMessage(Message m) {
+                Exchange exchange = new ExchangeImpl();
+                exchange.setInMessage(m);
+                m.setExchange(exchange);
+                verifyReceivedMessage(m);
+                verifyHeaders(m, outMessage);
+                //setup the message for 
+                Conduit backConduit;
+                try {
+                    backConduit = destination.getBackChannel(m, null, null);
+                    //wait for the message to be got from the conduit
+                    Message replyMessage = new MessageImpl();
+                    sendoutMessage(backConduit, replyMessage, true);
+                }
+                catch (Exception e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        };
+        destination.setMessageObserver(observer);
+        //set is oneway false for get response from destination
+        sendoutMessage(conduit, outMessage, false);
+        //wait for the message to be got from the destination, 
+        // create the thread to handler the Destination incomming message
+
+        waitForReceiveInMessage();
+        verifyReceivedMessage(inMessage);
+        // wait for a while for the camel session recycling
+        Thread.sleep(1000);
+        destination.shutdown();
+    }
+
+    public void testPropertyExclusion() throws Exception {
+
+        final String customPropertyName =
+                "THIS_PROPERTY_WILL_NOT_BE_AUTO_COPIED";
+
+        inMessage = null;
+        setupServiceInfo("http://cxf.apache.org/hello_world_camel",
+                "/wsdl/camel_test.wsdl",
+                "HelloWorldService",
+                "HelloWorldPort");
+        //set up the conduit send to be true 
+        CamelConduit conduit = setupCamelConduit(true, false);
+        final Message outMessage = new MessageImpl();
+        setupMessageHeader(outMessage);
+
+/*
+        CamelPropertyType excludeProp = new CamelPropertyType();
+        excludeProp.setName(customPropertyName);
+        excludeProp.setValue(customPropertyName);
+        
+        CamelMessageHeadersType headers = (CamelMessageHeadersType)
+            outMessage.get(CamelConstants.Camel_CLIENT_REQUEST_HEADERS);
+        headers.getProperty().add(excludeProp);
+*/
+
+        final CamelDestination destination = setupCamelDestination(true);
+
+        //set up MessageObserver for handlering the conduit message
+        MessageObserver observer = new MessageObserver() {
+            public void onMessage(Message m) {
+                Exchange exchange = new ExchangeImpl();
+                exchange.setInMessage(m);
+                m.setExchange(exchange);
+                verifyReceivedMessage(m);
+                verifyHeaders(m, outMessage);
+                //setup the message for 
+                Conduit backConduit;
+                try {
+                    backConduit = destination.getBackChannel(m, null, null);
+                    //wait for the message to be got from the conduit
+                    Message replyMessage = new MessageImpl();
+                    sendoutMessage(backConduit, replyMessage, true);
+                }
+                catch (Exception e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        };
+        destination.setMessageObserver(observer);
+        //set is oneway false for get response from destination
+        sendoutMessage(conduit, outMessage, false);
+        //wait for the message to be got from the destination, 
+        // create the thread to handler the Destination incomming message
+
+        waitForReceiveInMessage();
+        verifyReceivedMessage(inMessage);
+
+        verifyRequestResponseHeaders(inMessage, outMessage);
+
+/*
+        CamelMessageHeadersType inHeader =
+            (CamelMessageHeadersType)inMessage.get(CamelConstants.Camel_CLIENT_RESPONSE_HEADERS);
+        assertTrue("property has been excluded", inHeader.getProperty().isEmpty());
+*/
+
+        // wait for a while for the camel session recycling
+        Thread.sleep(1000);
+        destination.shutdown();
+    }
+}

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelDestinationTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java?view=auto&rev=522936
==============================================================================
--- activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java (added)
+++ activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java Tue Mar 27 07:46:48 2007
@@ -0,0 +1,117 @@
+/**
+ * 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 junit.framework.TestCase;
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.easymock.classextension.EasyMock;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+
+public abstract class CamelTestSupport extends TestCase {
+    protected CamelContext camelContext = new DefaultCamelContext();
+    protected Bus bus;
+    protected EndpointInfo endpointInfo;
+    protected EndpointReferenceType target;
+    protected MessageObserver observer;
+    protected Message inMessage;
+
+    public void setUp() throws Exception {
+        camelContext.activateEndpoints();
+        BusFactory bf = BusFactory.newInstance();
+        bus = bf.createBus();
+        BusFactory.setDefaultBus(bus);
+    }
+
+    public void tearDown() throws Exception {
+        bus.shutdown(true);
+        if (System.getProperty("cxf.config.file") != null) {
+            System.clearProperty("cxf.config.file");
+        }
+        camelContext.deactivateEndpoints();
+    }
+
+    protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
+        URL wsdlUrl = getClass().getResource(wsdl);
+
+        // TODO
+/*
+        assertNotNull(wsdlUrl);
+        WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName));
+
+        Service service = factory.create();        
+        endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, portName));
+*/
+
+    }
+
+    protected void sendoutMessage(Conduit conduit, Message message, Boolean isOneWay) throws IOException {
+
+        Exchange exchange = new ExchangeImpl();
+        exchange.setOneWay(isOneWay);
+        message.setExchange(exchange);
+        exchange.setInMessage(message);
+        try {
+            conduit.send(message);
+        }
+        catch (IOException ex) {
+            assertFalse("CamelConduit can't perpare to send out message", false);
+            ex.printStackTrace();
+        }
+        OutputStream os = message.getContent(OutputStream.class);
+        assertTrue("The OutputStream should not be null ", os != null);
+        os.write("HelloWorld".getBytes());
+        os.close();
+    }
+
+    protected CamelConduit setupCamelConduit(boolean send, boolean decoupled) {
+        if (decoupled) {
+            // setup the reference type
+        }
+        else {
+            target = EasyMock.createMock(EndpointReferenceType.class);
+        }
+
+        CamelConduit camelConduit = new CamelConduit(camelContext, bus, endpointInfo, target);
+
+        if (send) {
+            // setMessageObserver
+            observer = new MessageObserver() {
+                public void onMessage(Message m) {
+                    inMessage = m;
+                }
+            };
+            camelConduit.setMessageObserver(observer);
+        }
+
+        return camelConduit;
+    }
+}

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/CamelTestSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: activemq/camel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?view=diff&rev=522936&r1=522935&r2=522936
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Tue Mar 27 07:46:48 2007
@@ -365,6 +365,12 @@
         <scope>test</scope>
       </dependency>
 
+      <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymockclassextension</artifactId>
+        <version>2.2.1</version>
+        <scope>test</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 



Mime
View raw message