You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2009/02/10 09:42:01 UTC

svn commit: r742890 - in /servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel: JbiEndpointWithMepSpecifiedTest.java TwoServicemixCamelSusTest.java

Author: ffang
Date: Tue Feb 10 08:41:59 2009
New Revision: 742890

URL: http://svn.apache.org/viewvc?rev=742890&view=rev
Log:
[SM-1794]Added a simple unit test to verify the service-camel component will use different camel context for different su

Added:
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java   (with props)
Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java?rev=742890&r1=742889&r2=742890&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiEndpointWithMepSpecifiedTest.java Tue Feb 10 08:41:59 2009
@@ -77,6 +77,10 @@
     private class MyReceiverComponent extends ReceiverComponent {
         
         private int count;
+ 
+        public int getCount() {
+            return count;
+        }
         
         @Override
         public void onMessageExchange(MessageExchange exchange) throws MessagingException {

Added: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java?rev=742890&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java (added)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java Tue Feb 10 08:41:59 2009
@@ -0,0 +1,77 @@
+/*
+ * 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 org.apache.camel.CamelContext;
+
+public class TwoServicemixCamelSusTest extends
+        NonJbiCamelEndpointsIntegrationTest {
+    
+    private void deploySu(CamelJbiComponent component, String suName)
+        throws Exception {
+        String serviceUnitConfiguration = suName + "-src/camel-context.xml";
+        URL url = getClass().getResource(serviceUnitConfiguration);
+        File path = new File(new URI(url.toString()));
+        path = path.getParentFile();
+
+        // Deploy and start su
+        component.getServiceUnitManager()
+                .deploy(suName, path.getAbsolutePath());
+        component.getServiceUnitManager().init(suName, path.getAbsolutePath());
+        component.getServiceUnitManager().start(suName);
+    }
+
+    private void undeploySu(CamelJbiComponent component, String suName)
+        throws Exception {
+        String serviceUnitConfiguration = suName + "-src/camel-context.xml";
+        URL url = getClass().getResource(serviceUnitConfiguration);
+        File path = new File(new URI(url.toString()));
+        path = path.getParentFile();
+
+        // Stop and undeploy
+        component.getServiceUnitManager().stop(suName);
+        component.getServiceUnitManager().shutDown(suName);
+        component.getServiceUnitManager().undeploy(suName,
+                path.getAbsolutePath());
+    }
+
+    public void testComponentInstallation() throws Exception {
+
+        CamelJbiComponent component = new CamelJbiComponent();
+        container.activateComponent(component, "#ServiceMixComponent#");
+
+        // deploy two sus here
+        deploySu(component, "su3");
+        CamelContext su3CamelContext = component.getCamelContext();
+        assertNotNull("We should get a camel context here ", su3CamelContext);
+        deploySu(component, "su6");
+        CamelContext su6CamelContext = component.getCamelContext();
+        assertNotNull("We should get a camel context here ", su6CamelContext);
+        assertTrue("Here should be two different camel contexts",
+                !su3CamelContext.equals(su6CamelContext));
+
+        // deploy two sus here
+        undeploySu(component, "su3");
+        undeploySu(component, "su6");
+
+    }
+
+}

Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date