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 2012/05/09 10:50:50 UTC
svn commit: r1336006 - in /camel/trunk/tests/camel-itest-karaf: ./
src/test/java/org/apache/camel/itest/karaf/
Author: ningjiang
Date: Wed May 9 08:50:49 2012
New Revision: 1336006
URL: http://svn.apache.org/viewvc?rev=1336006&view=rev
Log:
CAMEL-5258 upgrade camel-itest-karaf to use PAX-Exam 2.x
Modified:
camel/trunk/tests/camel-itest-karaf/pom.xml
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelHdfsTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJibxTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMailTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelTagsoupTest.java
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelXstreamTest.java
Modified: camel/trunk/tests/camel-itest-karaf/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/pom.xml?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/pom.xml (original)
+++ camel/trunk/tests/camel-itest-karaf/pom.xml Wed May 9 08:50:49 2012
@@ -33,15 +33,15 @@
<name>Camel :: Integration Tests :: Karaf</name>
<description>Performs Karaf compliance integration tests</description>
+ <properties>
+ <pax-exam-version>2.3.0</pax-exam-version>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit</artifactId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${pax-exam-version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -50,39 +50,32 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-default</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit-extender-impl</artifactId>
+ <groupId>org.ops4j.pax.swissbox</groupId>
+ <artifactId>pax-swissbox-tinybundles</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.swissbox</groupId>
- <artifactId>pax-swissbox-tinybundles</artifactId>
+ <groupId>org.openengsb.labs.paxexam.karaf</groupId>
+ <artifactId>paxexam-karaf-container</artifactId>
+ <version>0.5.3</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>org.apache.karaf.tooling.testing</artifactId>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>apache-karaf</artifactId>
<version>${karaf-version}</version>
+ <type>tar.gz</type>
+ <scope>test</scope>
<exclusions>
<exclusion>
- <groupId>org.apache.karaf</groupId>
- <artifactId>manual</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.karaf</groupId>
- <artifactId>org.apache.karaf.client</artifactId>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.dev</artifactId>
</exclusion>
<exclusion>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-api</artifactId>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
</exclusion>
</exclusions>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java Wed May 9 08:50:49 2012
@@ -16,15 +16,17 @@
*/
package org.apache.camel.itest.karaf;
-import java.net.URL;
+import java.io.File;
+
+import javax.inject.Inject;
+
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultRouteContext;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.osgi.CamelContextFactory;
-import org.apache.karaf.testing.Helper;
import org.junit.After;
import org.junit.Before;
-import org.ops4j.pax.exam.Inject;
+import org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.options.UrlReference;
import org.osgi.framework.BundleContext;
@@ -32,11 +34,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertNotNull;
+import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.replaceConfigurationFile;
+import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+import static org.ops4j.pax.exam.CoreOptions.scanFeatures;
+
public abstract class AbstractFeatureTest {
@@ -116,7 +119,7 @@ public abstract class AbstractFeatureTes
return factory.createContext();
}
- public static String extractName(Class clazz) {
+ public static String extractName(Class<?> clazz) {
String name = clazz.getName();
int id0 = name.indexOf("Camel") + "Camel".length();
int id1 = name.indexOf("Test");
@@ -131,19 +134,6 @@ public abstract class AbstractFeatureTes
return sb.toString();
}
- private static URL getResource(String location) {
- URL url = null;
- if (Thread.currentThread().getContextClassLoader() != null) {
- url = Thread.currentThread().getContextClassLoader().getResource(location);
- }
- if (url == null) {
- url = Helper.class.getResource(location);
- }
- if (url == null) {
- throw new RuntimeException("Unable to find resource " + location);
- }
- return url;
- }
public static UrlReference getCamelKarafFeatureUrl() {
String type = "xml/features";
@@ -161,26 +151,19 @@ public abstract class AbstractFeatureTes
}
public static Option[] configure(String feature) {
- Option[] options = combine(
- // Set the karaf environment with some customer configuration
- combine(
- Helper.getDefaultConfigOptions(
- Helper.getDefaultSystemOptions(),
- getResource("/org/apache/camel/itest/karaf/config.properties"),
- // this is how you set the default log level when using pax logging (logProfile)
- Helper.setLogLevel("WARN")),
- Helper.getDefaultProvisioningOptions()),
- // install the spring, http features first
- scanFeatures(getKarafFeatureUrl(), "spring", "http"),
-
- // install the cxf jaxb spec as the karaf doesn't provide it by default
- scanFeatures(getCamelKarafFeatureUrl(), "cxf-jaxb"),
-
- // using the features to install the camel components
- scanFeatures(getCamelKarafFeatureUrl(),
- "camel-core", "camel-spring", "camel-" + feature),
-
- workingDirectory("target/paxrunner/"));
+ Option[] options =
+ new Option[]{
+ karafDistributionConfiguration().frameworkUrl(
+ maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject())
+ //This version doesn't affect the verison of karaf we use
+ .karafVersion("2.2.7").name("Apache Karaf")
+ .unpackDirectory(new File("target/paxexam/unpack/")),
+
+ KarafDistributionOption.keepRuntimeFolder(),
+ // override the jre.properties
+ replaceConfigurationFile("etc/jre.properties", new File("src/test/resources/org/apache/camel/itest/karaf/jre.properties")),
+ // install the cxf jaxb spec as the karaf doesn't provide it by default
+ scanFeatures(getCamelKarafFeatureUrl(), "cxf-jaxb", "camel-core", "camel-spring", "camel-" + feature)};
return options;
}
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java Wed May 9 08:50:49 2012
@@ -16,8 +16,6 @@
*/
package org.apache.camel.itest.karaf;
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.model.dataformat.BindyDataFormat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java Wed May 9 08:50:49 2012
@@ -18,7 +18,6 @@ package org.apache.camel.itest.karaf;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.model.dataformat.BindyDataFormat;
-import org.apache.camel.spi.DataFormat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -31,7 +30,9 @@ public class CamelBindyTest extends Abst
public static final String COMPONENT = extractName(CamelBindyTest.class);
protected DataFormatDefinition createDataformatDefinition(String format) {
- return new BindyDataFormat();
+ BindyDataFormat dataformate = new BindyDataFormat();
+ dataformate.setPackages(new String[]{"Dummy"});
+ return dataformate;
}
@Test
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelHdfsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelHdfsTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelHdfsTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelHdfsTest.java Wed May 9 08:50:49 2012
@@ -16,7 +16,6 @@
*/
package org.apache.camel.itest.karaf;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJibxTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJibxTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJibxTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJibxTest.java Wed May 9 08:50:49 2012
@@ -18,7 +18,6 @@ package org.apache.camel.itest.karaf;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.model.dataformat.JibxDataFormat;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMailTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMailTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMailTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMailTest.java Wed May 9 08:50:49 2012
@@ -21,14 +21,6 @@ import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.options.FrameworkOption;
-
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-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.exam.container.def.PaxRunnerOptions.workingDirectory;
@RunWith(JUnit4TestRunner.class)
public class CamelMailTest extends AbstractFeatureTest {
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelTagsoupTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelTagsoupTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelTagsoupTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelTagsoupTest.java Wed May 9 08:50:49 2012
@@ -17,7 +17,6 @@
package org.apache.camel.itest.karaf;
import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.model.dataformat.JaxbDataFormat;
import org.apache.camel.model.dataformat.TidyMarkupDataFormat;
import org.junit.Test;
import org.junit.runner.RunWith;
Modified: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelXstreamTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelXstreamTest.java?rev=1336006&r1=1336005&r2=1336006&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelXstreamTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelXstreamTest.java Wed May 9 08:50:49 2012
@@ -18,7 +18,6 @@ package org.apache.camel.itest.karaf;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.model.dataformat.JsonDataFormat;
-import org.apache.camel.model.dataformat.XMLSecurityDataFormat;
import org.apache.camel.model.dataformat.XStreamDataFormat;
import org.junit.Test;
import org.junit.runner.RunWith;