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/09 10:52:34 UTC

svn commit: r742359 - in /servicemix/components/engines/servicemix-camel/trunk/src/test: java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java resources/log4j.properties

Author: ffang
Date: Mon Feb  9 09:52:33 2009
New Revision: 742359

URL: http://svn.apache.org/viewvc?rev=742359&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/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java   (with props)
Modified:
    servicemix/components/engines/servicemix-camel/trunk/src/test/resources/log4j.properties

Added: servicemix/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java?rev=742359&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java (added)
+++ servicemix/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java Mon Feb  9 09:52:33 2009
@@ -0,0 +1,81 @@
+/*
+ * 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;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class TwoServicemixCamelSusTest extends
+		NonJbiCamelEndpointsIntegrationTest {
+	private static final transient Log LOG = LogFactory
+			.getLog(TwoServicemixCamelSusTest.class);
+
+	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/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/components/engines/servicemix-camel/trunk/src/test/java/org/apache/servicemix/camel/TwoServicemixCamelSusTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: servicemix/components/engines/servicemix-camel/trunk/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-camel/trunk/src/test/resources/log4j.properties?rev=742359&r1=742358&r2=742359&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-camel/trunk/src/test/resources/log4j.properties (original)
+++ servicemix/components/engines/servicemix-camel/trunk/src/test/resources/log4j.properties Mon Feb  9 09:52:33 2009
@@ -18,7 +18,7 @@
 #
 # The logging properties used during tests..
 #
-log4j.rootLogger=DEBUG, stdout
+log4j.rootLogger=DEBUG, out
 
 log4j.logger.org.apache.activemq=INFO
 log4j.logger.org.apache.activemq.spring=WARN