Author: gertv Date: Tue Apr 21 13:10:46 2009 New Revision: 767141 URL: http://svn.apache.org/viewvc?rev=767141&view=rev Log: CAMEL-1536: Allow OSGi Camel integration tests to be run on Hudson/TeamCity
Modified: camel/trunk/tests/camel-itest-osgi/pom.xml camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTest.java Modified: camel/trunk/tests/camel-itest-osgi/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/pom.xml?rev=767141&r1=767140&r2=767141&view=diff ============================================================================== --- camel/trunk/tests/camel-itest-osgi/pom.xml (original) +++ camel/trunk/tests/camel-itest-osgi/pom.xml Tue Apr 21 13:10:46 2009 @@ -55,37 +55,47 @@ </repository> </repositories> + <pluginRepositories> + <pluginRepository> + <id>ops4j.releases</id> + <url>http://repository.ops4j.org/maven2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + <dependencies> <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam</artifactId> <version>${pax-exam-version}</version> - <!--<scope>test</scope>--> + <scope>test</scope> </dependency> <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-junit</artifactId> <version>${pax-exam-version}</version> - <!--<scope>test</scope>--> + <scope>test</scope> </dependency> <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-container-default</artifactId> <version>${pax-exam-version}</version> - <!--<scope>test</scope>--> + <scope>test</scope> </dependency> <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-junit-extender-impl</artifactId> <version>${pax-exam-version}</version> - <!--<scope>test</scope>--> + <scope>test</scope> </dependency> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> <version>4.0.1</version> - <!--<scope>test</scope>--> + <scope>test</scope> </dependency> @@ -129,4 +139,37 @@ </plugins> </build> -</project> \ No newline at end of file + <profiles> + <profile> + <id>ci-build-profile</id> + <activation> + <property> + <name>maven.repo.local</name> + </property> + </activation> + <build> + <plugins> + <!-- use Pax Exam Maven plugin to get around PAXEXAM-62/64 --> + <plugin> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>maven-paxexam-plugin</artifactId> + <executions> + <execution> + <id>generate-paxexam-config</id> + <goals> + <goal>generate-paxexam-config</goal> + </goals> + </execution> + </executions> + <configuration> + <settings> + <localRepository>${maven.repo.local}</localRepository> + </settings> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTest.java URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTest.java?rev=767141&r1=767140&r2=767141&view=diff ============================================================================== --- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTest.java (original) +++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTest.java Tue Apr 21 13:10:46 2009 @@ -18,6 +18,10 @@ package org.apache.camel.itest.osgi; +import static org.ops4j.pax.exam.CoreOptions.*; +import static org.ops4j.pax.exam.MavenUtils.*; +import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.*; + import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; @@ -25,17 +29,16 @@ import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; -import static org.ops4j.pax.exam.CoreOptions.*; import org.ops4j.pax.exam.Inject; -import static org.ops4j.pax.exam.MavenUtils.asInProject; import org.ops4j.pax.exam.Option; -import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.logProfile; +import org.ops4j.pax.exam.OptionUtils; import org.ops4j.pax.exam.junit.Configuration; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.ops4j.pax.exam.options.MavenUrlProvisionOption; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; + /** * @version $Revision: 1.1 $ */ @@ -78,20 +81,26 @@ @Configuration public static Option[] configure() { - return options( - // install log service using pax runners profile abstraction (there are more profiles, like DS) - logProfile(), - - // this is how you set the default log level when using pax logging (logProfile) - systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), - - // lets deploy the bundles we need - mavenBundleAsInProject("org.apache.camel", "camel-core"), - wrappedBundle(mavenBundleAsInProject("commons-logging", "commons-logging")), - - felix(), equinox()); + Option[] options = options( + // install log service using pax runners profile abstraction (there are more profiles, like DS) + logProfile(), + + // this is how you set the default log level when using pax logging (logProfile) + systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"), + + // lets deploy the bundles we need + mavenBundleAsInProject("org.apache.camel", "camel-core"), + + felix(), equinox()); + + // use config generated by the Maven plugin (until PAXEXAM-62/64 get resolved) + if (OSGiIntegrationTest.class.getClassLoader().getResource("META-INF/maven/paxexam-config.args") != null) { + options = OptionUtils.combine(options, mavenConfiguration()); + } + + return options; } - + /** * TODO we can remove this method when 0.4.1 of Pax Exam comes out! */