servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r564166 - in /incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test: java/org/apache/servicemix/camel/ resources/org/apache/servicemix/camel/ resources/org/apache/servicemix/camel/su1-src/ resources/org/apache/serv...
Date Thu, 09 Aug 2007 10:52:31 GMT
Author: jstrachan
Date: Thu Aug  9 03:52:30 2007
New Revision: 564166

URL: http://svn.apache.org/viewvc?view=rev&rev=564166
Log:
Refactored the code to the servicemix package structure and to pass those damn checkstyle/pmd
rules :)

Added:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingEndpointUriIntegrationTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingNameUriIntegrationTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingServiceUriIntegrationTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/camel-context.xml
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/camel-context.xml
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/camel-context.xml
  (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/camel-context.xml
  (with props)

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingEndpointUriIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingEndpointUriIntegrationTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingEndpointUriIntegrationTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingEndpointUriIntegrationTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.client.ServiceMixClient;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class JbiEndpointUsingEndpointUriIntegrationTest extends
+        NonJbiCamelEndpointsIntegrationTest {
+    /*
+     * @see TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        suName = "su2";
+        super.setUp();
+    }
+
+    @Override
+    protected void configureExchange(ServiceMixClient client,
+            MessageExchange exchange) {
+        QName serviceQName = new QName("http://foo.bar.org", "myService");
+        exchange.setService(serviceQName);
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingEndpointUriIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingNameUriIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingNameUriIntegrationTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingNameUriIntegrationTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingNameUriIntegrationTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.servicedesc.ServiceEndpoint;
+
+import org.apache.servicemix.client.ServiceMixClient;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class JbiEndpointUsingNameUriIntegrationTest extends
+        NonJbiCamelEndpointsIntegrationTest {
+    /*
+     * @see TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        suName = "su4";
+        super.setUp();
+    }
+
+    @Override
+    protected void configureExchange(ServiceMixClient client,
+            MessageExchange exchange) {
+        ServiceEndpoint endpoint = client.getContext().getEndpoint(
+                CamelJbiEndpoint.SERVICE_NAME, "cheese");
+        assertNotNull("Should have a Camel endpoint exposed in JBI!", endpoint);
+        exchange.setEndpoint(endpoint);
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingNameUriIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingServiceUriIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingServiceUriIntegrationTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingServiceUriIntegrationTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingServiceUriIntegrationTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.client.ServiceMixClient;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class JbiEndpointUsingServiceUriIntegrationTest extends
+        NonJbiCamelEndpointsIntegrationTest {
+    /*
+     * @see TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        suName = "su3";
+        super.setUp();
+    }
+
+    @Override
+    protected void configureExchange(ServiceMixClient client,
+            MessageExchange exchange) {
+        QName serviceQName = new QName("http://foo.bar.org", "myService");
+        exchange.setService(serviceQName);
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointUsingServiceUriIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,128 @@
+/*
+ * 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.servicemix.camel;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.TestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.ProducerCache;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+
+/**
+ * @version $Revision: 563665 $
+ */
+public abstract class JbiTestSupport extends TestSupport {
+    protected Exchange receivedExchange;
+
+    protected CamelContext camelContext = new DefaultCamelContext();
+
+    protected SpringJBIContainer jbiContainer = new SpringJBIContainer();
+
+    protected CountDownLatch latch = new CountDownLatch(1);
+
+    protected Endpoint<Exchange> endpoint;
+
+    protected String startEndpointUri = "jbi:endpoint:serviceNamespace:serviceA:endpointA";
+
+    protected ProducerCache<Exchange> client = new ProducerCache<Exchange>();
+
+    /**
+     * Sends an exchange to the endpoint
+     */
+    protected void sendExchange(final Object expectedBody) {
+        client.send(endpoint, new Processor() {
+            public void process(Exchange exchange) {
+                Message in = exchange.getIn();
+                in.setBody(expectedBody);
+                in.setHeader("cheese", 123);
+            }
+        });
+    }
+
+    protected Object assertReceivedValidExchange(Class type) throws Exception {
+        // lets wait on the message being received
+        boolean received = latch.await(5, TimeUnit.SECONDS);
+        assertTrue("Did not receive the message!", received);
+
+        assertNotNull(receivedExchange);
+        Message receivedMessage = receivedExchange.getIn();
+
+        assertEquals("cheese header", 123, receivedMessage.getHeader("cheese"));
+        Object body = receivedMessage.getBody();
+        log.debug("Received body: " + body);
+        return body;
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        jbiContainer.setEmbedded(true);
+
+        CamelJbiComponent component = new CamelJbiComponent();
+
+        List<ActivationSpec> activationSpecList = new ArrayList<ActivationSpec>();
+
+        // lets add the Camel endpoint
+        ActivationSpec activationSpec = new ActivationSpec();
+        activationSpec.setId("camel");
+        activationSpec.setService(new QName("camel", "camel"));
+        activationSpec.setEndpoint("camelEndpoint");
+        activationSpec.setComponent(component);
+        activationSpecList.add(activationSpec);
+
+        appendJbiActivationSpecs(activationSpecList);
+
+        ActivationSpec[] activationSpecs = activationSpecList
+                .toArray(new ActivationSpec[activationSpecList.size()]);
+        jbiContainer.setActivationSpecs(activationSpecs);
+        jbiContainer.afterPropertiesSet();
+
+        // lets configure some componnets
+        camelContext.addComponent("jbi", component);
+
+        // lets add some routes
+        camelContext.addRoutes(createRoutes());
+        endpoint = camelContext.getEndpoint(startEndpointUri);
+        assertNotNull("No endpoint found!", endpoint);
+
+        camelContext.start();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        client.stop();
+        camelContext.stop();
+        super.tearDown();
+    }
+
+    protected abstract void appendJbiActivationSpecs(
+            List<ActivationSpec> activationSpecList);
+
+    protected abstract RouteBuilder createRoutes();
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiTestSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,165 @@
+/*
+ * 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.servicemix.camel;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.servicedesc.ServiceEndpoint;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.jbi.container.JBIContainer;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class NonJbiCamelEndpointsIntegrationTest extends TestCase {
+    private static final transient Log LOG = LogFactory
+            .getLog(NonJbiCamelEndpointsIntegrationTest.class);
+
+    protected String suName = "su1";
+
+    protected JBIContainer container = new JBIContainer();
+
+    private File tempRootDir;
+
+    public void testComponentInstallation() throws Exception {
+        String serviceUnitConfiguration = suName + "-src/camel-context.xml";
+
+        CamelJbiComponent component = new CamelJbiComponent();
+        container.activateComponent(component, "#ServiceMixComponent#");
+        URL url = getClass().getResource(serviceUnitConfiguration);
+        File path = new File(new URI(url.toString()));
+        path = path.getParentFile();
+        ServiceMixClient client = new DefaultServiceMixClient(container);
+
+        try {
+            for (int i = 0; i < 2; i++) {
+                LOG.info("Loop counter: " + i);
+
+                // Deploy and start su
+                component.getServiceUnitManager().deploy(suName,
+                        path.getAbsolutePath());
+                component.getServiceUnitManager().init(suName,
+                        path.getAbsolutePath());
+                component.getServiceUnitManager().start(suName);
+
+                // Send message
+                MessageExchange exchange = createExchange(client);
+                configureExchange(client, exchange);
+                client.send(exchange);
+
+                // Stop and undeploy
+                component.getServiceUnitManager().stop(suName);
+                component.getServiceUnitManager().shutDown(suName);
+                component.getServiceUnitManager().undeploy(suName,
+                        path.getAbsolutePath());
+
+                // Send message
+                exchange = createExchange(client);
+                try {
+                    configureExchange(client, exchange);
+                    client.send(exchange);
+                    fail("Should have failed to send to a no longer deployed component");
+                } catch (Throwable e) {
+                    LOG.debug(
+                            "Caught expected exception as the component is undeployed: "
+                                    + e, e);
+                }
+            }
+        } catch (Exception e) {
+            LOG.error("Caught: " + e, e);
+            throw e;
+        }
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        container.setCreateMBeanServer(false);
+        container.setMonitorInstallationDirectory(false);
+        tempRootDir = File.createTempFile("servicemix", "rootDir");
+        tempRootDir.delete();
+        File tempTemp = new File(tempRootDir.getAbsolutePath() + "/temp");
+        if (!tempTemp.mkdirs()) {
+            fail("Unable to create temporary working root directory ["
+                    + tempTemp.getAbsolutePath() + "]");
+        }
+        LOG.info("Using temporary root directory ["
+                + tempRootDir.getAbsolutePath() + "]");
+
+        container.setRootDir(tempRootDir.getAbsolutePath());
+        container.setMonitorInstallationDirectory(false);
+        container.setUseMBeanServer(false);
+        container.setCreateMBeanServer(false);
+        container.setFlowName("st");
+        container.init();
+        container.start();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        container.stop();
+        container.shutDown();
+        deleteDir(tempRootDir);
+    }
+
+    protected InOut createExchange(ServiceMixClient client)
+        throws MessagingException {
+        
+        return client.createInOutExchange();
+    }
+
+    protected void configureExchange(ServiceMixClient client,
+            MessageExchange exchange) {
+        ServiceEndpoint endpoint = client.getContext().getEndpoint(
+                CamelJbiEndpoint.SERVICE_NAME, "seda:a");
+        assertNotNull("Should have a Camel endpoint exposed in JBI!", endpoint);
+        exchange.setEndpoint(endpoint);
+    }
+
+    public static boolean deleteDir(File dir) {
+        LOG.info("Deleting directory : " + dir.getAbsolutePath());
+        if (dir.isDirectory()) {
+            String[] children = dir.list();
+            for (int i = 0; i < children.length; i++) {
+                boolean success = deleteDir(new File(dir, children[i]));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+        // The directory is now empty so delete it
+        return dir.delete();
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.servicemix.camel;
+
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.seda.SedaEndpoint;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.jbi.resolver.URIResolver;
+import org.apache.servicemix.tck.SenderComponent;
+
+/**
+ * @version $Revision: 563665 $
+ */
+public class SendFromCamelToJbiAndBackToCamelTest extends JbiTestSupport {
+    protected SenderComponent senderComponent = new SenderComponent();
+
+    public void testCamelInvokingJbi() throws Exception {
+        senderComponent.sendMessages(1);
+
+        SedaEndpoint receiverEndpoint = (SedaEndpoint) camelContext
+                .getEndpoint("seda:receiver");
+
+        BlockingQueue<Exchange> queue = receiverEndpoint.getQueue();
+        Exchange exchange = queue.poll(5, TimeUnit.SECONDS);
+
+        assertNotNull(
+                "Camel Receiver queue should have received an exchange by now",
+                exchange);
+
+        log.debug("Receiver got exchange: " + exchange + " with body: "
+                + exchange.getIn().getBody());
+    }
+
+    @Override
+    protected RouteBuilder createRoutes() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                // no routes required
+            }
+        };
+    }
+
+    @Override
+    protected void appendJbiActivationSpecs(
+            List<ActivationSpec> activationSpecList) {
+        this.startEndpointUri = "seda:receiver";
+
+        ActivationSpec activationSpec = new ActivationSpec();
+        activationSpec.setId("jbiSender");
+        activationSpec.setService(new QName("serviceNamespace", "serviceA"));
+        activationSpec.setEndpoint("endpointA");
+
+        // lets setup the sender to talk directly to camel
+        senderComponent.setResolver(new URIResolver("camel:seda:receiver"));
+        activationSpec.setComponent(senderComponent);
+
+        activationSpecList.add(activationSpec);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        camelContext.stop();
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiAndBackToCamelTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.servicemix.camel;
+
+import java.util.List;
+
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.tck.MessageList;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+/**
+ * @version $Revision: 563665 $
+ */
+public class SendFromCamelToJbiTest extends JbiTestSupport {
+    private ReceiverComponent receiverComponent = new ReceiverComponent();
+
+    public void testCamelInvokingJbi() throws Exception {
+        sendExchange("<foo bar='123'/>");
+        MessageList list = receiverComponent.getMessageList();
+
+        list.assertMessagesReceived(1);
+        List messages = list.getMessages();
+        NormalizedMessage message = (NormalizedMessage) messages.get(0);
+        assertNotNull("null message!", message);
+        log.info("Received: " + message);
+
+        assertEquals("cheese header", 123, message.getProperty("cheese"));
+    }
+
+    @Override
+    protected RouteBuilder createRoutes() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                // no routes required
+            }
+        };
+    }
+
+    @Override
+    protected void appendJbiActivationSpecs(
+            List<ActivationSpec> activationSpecList) {
+        ActivationSpec activationSpec = new ActivationSpec();
+        activationSpec.setId("jbiReceiver");
+        activationSpec.setService(new QName("serviceNamespace", "serviceA"));
+        activationSpec.setEndpoint("endpointA");
+        activationSpec.setComponent(receiverComponent);
+
+        activationSpecList.add(activationSpec);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        camelContext.stop();
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.servicemix.camel;
+
+import java.util.List;
+
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.tck.MessageList;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+/**
+ * @version $Revision: 563665 $
+ */
+public class SendFromCamelToJbiThenRouteToAnotherJbiComponentTest extends
+        JbiTestSupport {
+    private ReceiverComponent receiverComponent = new ReceiverComponent();
+
+    public void testCamelInvokingJbi() throws Exception {
+        sendExchange("<foo bar='123'/>");
+        MessageList list = receiverComponent.getMessageList();
+
+        list.assertMessagesReceived(1);
+        List messages = list.getMessages();
+        NormalizedMessage message = (NormalizedMessage) messages.get(0);
+        assertNotNull("null message!", message);
+        log.info("Received: " + message);
+
+        assertEquals("cheese header", 123, message.getProperty("cheese"));
+    }
+
+    @Override
+    protected RouteBuilder createRoutes() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("jbi:endpoint:serviceNamespace:serviceA:endpointA").to(
+                        "jbi:endpoint:serviceNamespace:serviceB:endpointB");
+            }
+        };
+    }
+
+    @Override
+    protected void appendJbiActivationSpecs(
+            List<ActivationSpec> activationSpecList) {
+        ActivationSpec activationSpec = new ActivationSpec();
+        activationSpec.setId("jbiReceiver");
+        activationSpec.setService(new QName("serviceNamespace", "serviceB"));
+        activationSpec.setEndpoint("endpointB");
+        activationSpec.setComponent(receiverComponent);
+
+        activationSpecList.add(activationSpec);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        camelContext.stop();
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/camel-context.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/camel-context.xml?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/camel-context.xml
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/camel-context.xml
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+<!-- START SNIPPET: camel -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       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-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!--
+     from("seda:a").to("seda:b");
+  -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="seda:a"/>
+      <to uri="seda:b"/>
+    </route>
+  </camelContext>
+
+</beans>
+<!-- END SNIPPET: camel -->

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su1-src/camel-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/camel-context.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/camel-context.xml?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/camel-context.xml
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/camel-context.xml
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+<!-- START SNIPPET: camel -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       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-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!--
+     from("seda:a").to("seda:b");
+  -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="jbi:endpoint:http://foo.bar.org/myService/myEndpointName"/>
+      <to uri="seda:b"/>
+    </route>
+  </camelContext>
+
+</beans>
+<!-- END SNIPPET: camel -->

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su2-src/camel-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/camel-context.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/camel-context.xml?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/camel-context.xml
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/camel-context.xml
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+<!-- START SNIPPET: camel -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       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-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!--
+     from("seda:a").to("seda:b");
+  -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="jbi:service:http://foo.bar.org/myService"/>
+      <to uri="seda:b"/>
+    </route>
+  </camelContext>
+
+</beans>
+<!-- END SNIPPET: camel -->

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su3-src/camel-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/camel-context.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/camel-context.xml?view=auto&rev=564166
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/camel-context.xml
(added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/camel-context.xml
Thu Aug  9 03:52:30 2007
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+<!-- START SNIPPET: camel -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       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-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!--
+     from("seda:a").to("seda:b");
+  -->
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="jbi:name:cheese"/>
+      <to uri="seda:b"/>
+    </route>
+  </camelContext>
+
+</beans>
+<!-- END SNIPPET: camel -->

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/camel/su4-src/camel-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message