You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/12/09 09:20:22 UTC
svn commit: r888729 - in /camel/trunk: parent/ tests/camel-itest-karaf/
tests/camel-itest-osgi/
tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/
tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/
tests/camel-itest-o...
Author: ningjiang
Date: Wed Dec 9 08:20:20 2009
New Revision: 888729
URL: http://svn.apache.org/viewvc?rev=888729&view=rev
Log:
CAMEL-2270 upgraded the PaxExam version to 1.2.0
Modified:
camel/trunk/parent/pom.xml
camel/trunk/tests/camel-itest-karaf/pom.xml
camel/trunk/tests/camel-itest-osgi/pom.xml
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/ServletComponentTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/support/ServletActivator.java
Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Wed Dec 9 08:20:20 2009
@@ -85,8 +85,8 @@
<!-- spring 2.5.x is only compatible with junit 4.4 or lower - see SPR-5145 -->
<junit-version>4.4</junit-version>
<ognl-version>2.7.3_1</ognl-version>
- <pax-exam-version>1.0.0</pax-exam-version>
- <pax-tiny-bundle-version>1.0.0</pax-tiny-bundle-version>
+ <pax-exam-version>1.2.0</pax-exam-version>
+ <pax-tiny-bundle-version>1.2.0</pax-tiny-bundle-version>
<qpid-version>0.5.0</qpid-version>
<restlet-version>1.1.5</restlet-version>
<saxon-version>9.1.0.1</saxon-version>
Modified: camel/trunk/tests/camel-itest-karaf/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/pom.xml?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/pom.xml (original)
+++ camel/trunk/tests/camel-itest-karaf/pom.xml Wed Dec 9 08:20:20 2009
@@ -31,11 +31,6 @@
<name>Camel :: Karaf Integration Tests</name>
<description>Performs Karaf compliance integration tests</description>
- <properties>
- <pax-exam-version>1.0.0</pax-exam-version>
- <pax-tiny-bundle-version>1.0.0</pax-tiny-bundle-version>
- </properties>
-
<repositories>
<repository>
<id>biz.aQute</id>
Modified: camel/trunk/tests/camel-itest-osgi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/pom.xml?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/pom.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/pom.xml Wed Dec 9 08:20:20 2009
@@ -31,11 +31,6 @@
<name>Camel :: OSGi Integration Tests</name>
<description>Performs OSGi compliance integration tests</description>
- <properties>
- <pax-exam-version>1.0.0</pax-exam-version>
- <pax-tiny-bundle-version>1.0.0</pax-tiny-bundle-version>
- </properties>
-
<repositories>
<repository>
<id>biz.aQute</id>
@@ -142,35 +137,20 @@
</dependencies>
- <build>
- <plugins>
- <!-- generate dependencies versions -->
- <plugin>
- <groupId>org.apache.servicemix.tooling</groupId>
- <artifactId>depends-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-depends-file</id>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/*Test.*</include>
- </includes>
- <excludes>
- <exclude>**/XXXTest.*</exclude>
- </excludes>
- </configuration>
- </plugin>
-
- </plugins>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Test.*</include>
+ </includes>
+ <excludes>
+ <exclude>**/XXXTest.*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
<profiles>
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java Wed Dec 9 08:20:20 2009
@@ -18,7 +18,7 @@
import org.apache.camel.CamelContext;
import org.apache.camel.osgi.CamelContextFactory;
-import org.apache.camel.test.CamelTestSupport;
+import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.After;
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jaxb/JaxbFallbackConverterTest.java Wed Dec 9 08:20:20 2009
@@ -28,6 +28,7 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
@@ -74,9 +75,9 @@
// using the features to install the camel components
scanFeatures(mavenBundle().groupId("org.apache.camel.karaf").
artifactId("features").versionAsInProject().type("xml/features"),
- "camel-core", "camel-osgi", "camel-spring", "camel-test", "camel-jaxb"),
+ "camel-core", "camel-spring-osgi", "camel-test", "camel-jaxb"),
- felix());
+ equinox().version("3.5.1"));
return options;
}
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java Wed Dec 9 08:20:20 2009
@@ -135,7 +135,7 @@
// using the features to install the camel components
scanFeatures(mavenBundle().groupId("org.apache.camel.karaf").
artifactId("features").versionAsInProject().type("xml/features"),
- "camel-core", "camel-osgi", "camel-spring", "camel-test", "camel-jpa"),
+ "camel-core", "camel-spring-osgi", "camel-test", "camel-jpa"),
/* This the camel-jpa needed bundles
mavenBundle().groupId("org.apache.servicemix.specs").artifactId("org.apache.servicemix.specs.java-persistence-api-1.1.1").version("1.4-SNAPSHOT"),
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/ServletComponentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/ServletComponentTest.java?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/ServletComponentTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/ServletComponentTest.java Wed Dec 9 08:20:20 2009
@@ -28,17 +28,19 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.ops4j.pax.exam.options.SystemPropertyOption;
+import org.ops4j.pax.swissbox.tinybundles.core.metadata.BndBuilder;
import org.ops4j.pax.swissbox.tinybundles.dp.Constants;
+import org.osgi.service.http.HttpService;
import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
-import static org.ops4j.pax.exam.CoreOptions.bundle;
+
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.logProfile;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.asURL;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
@@ -55,27 +57,23 @@
@Configuration
public static Option[] configure() {
Option[] options = options(
-
+
// install the spring dm profile
profile("spring.dm").version("1.2.0"),
+ profile("compendium"),
+ profile("web"),
// set the system property for pax web
org.ops4j.pax.exam.CoreOptions.systemProperty("org.osgi.service.http.port").value("9080"),
- // install the profile for OSGi web
- mavenBundle().groupId("org.ops4j.pax.web").artifactId("pax-web-service").version("0.6.0"),
-
// this is how you set the default log level when using pax logging (logProfile)
org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
// using the features to install the camel components
scanFeatures(mavenBundle().groupId("org.apache.camel.karaf").
artifactId("features").versionAsInProject().type("xml/features"),
- "camel-core", "camel-osgi", "camel-spring", "camel-test", "camel-http", "camel-servlet"),
-
- // create a customer bundle start up the CamelHttpTransportServlet
- bundle(newBundle().addClass(ServletActivator.class)
- .prepare(withBnd().set(Constants.BUNDLE_SYMBOLICNAME, "CamelServletTinyBundle")
- .set(Constants.BUNDLE_ACTIVATOR, ServletActivator.class.getName())).build(asURL()).toString()),
+ "camel-core", "camel-spring-osgi", "camel-test", "camel-http", "camel-servlet"),
+
+
felix());
return options;
@@ -83,7 +81,8 @@
@Override
protected OsgiBundleXmlApplicationContext createApplicationContext() {
- return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/servlet/CamelServletContext.xml"});
+ return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/servlet/ServletService.xml",
+ "org/apache/camel/itest/osgi/servlet/CamelServletContext.xml"});
}
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/support/ServletActivator.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/support/ServletActivator.java?rev=888729&r1=888728&r2=888729&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/support/ServletActivator.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/servlet/support/ServletActivator.java Wed Dec 9 08:20:20 2009
@@ -22,27 +22,47 @@
import javax.servlet.Servlet;
import org.apache.camel.component.servlet.CamelHttpTransportServlet;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpContext;
import org.osgi.service.http.HttpService;
+import org.springframework.osgi.context.BundleContextAware;
-public final class ServletActivator implements BundleActivator {
+public final class ServletActivator implements BundleActivator, BundleContextAware {
+ private static final transient Log LOG = LogFactory.getLog(ServletActivator.class);
+ private static boolean registerService;
/**
* HttpService reference.
*/
private ServiceReference httpServiceRef;
-
+
/**
* Called when the OSGi framework starts our bundle
*/
- @SuppressWarnings("unchecked")
public void start(BundleContext bc) throws Exception {
- httpServiceRef = bc.getServiceReference(HttpService.class.getName());
+ registerServlet(bc);
+ }
+
+ /**
+ * Called when the OSGi framework stops our bundle
+ */
+ public void stop(BundleContext bc) throws Exception {
if (httpServiceRef != null) {
- final HttpService httpService = (HttpService)bc.getService(httpServiceRef);
+ bc.ungetService(httpServiceRef);
+ httpServiceRef = null;
+ }
+ }
+
+ protected void registerServlet(BundleContext bundleContext) throws Exception {
+ httpServiceRef = bundleContext.getServiceReference(HttpService.class.getName());
+
+ if (httpServiceRef != null && !registerService) {
+ LOG.info("Regist the servlet service");
+ final HttpService httpService = (HttpService)bundleContext.getService(httpServiceRef);
if (httpService != null) {
// create a default context to share between registrations
final HttpContext httpContext = httpService.createDefaultHttpContext();
@@ -55,18 +75,16 @@
initParams, // init params
httpContext // http context
);
-
+ registerService = true;
}
}
}
- /**
- * Called when the OSGi framework stops our bundle
- */
- public void stop(BundleContext bc) throws Exception {
- if (httpServiceRef != null) {
- bc.ungetService(httpServiceRef);
- httpServiceRef = null;
+ public void setBundleContext(BundleContext bc) {
+ try {
+ registerServlet(bc);
+ } catch (Exception e) {
+ LOG.error("Can't register the servlet, the reason is " + e);
}
}