Skip to content

Commit

Permalink
SLING-3017 improve Karaf integration tests
Browse files Browse the repository at this point in the history
* use depends-maven-plugin and versionAsInProject()
* add Bundle-ManifestVersion header to fix problem with Karaf 4.0.0.M2
* rename featureRepository() to featureRepositories()

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1681614 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
oliverlietz committed May 25, 2015
1 parent 50a08d1 commit 35a0786
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
<!-- Apache Derby -->
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.11.1.1</version>
</dependency>
<!-- Apache Karaf -->
<dependency>
<groupId>org.apache.karaf.features</groupId>
Expand All @@ -79,6 +85,13 @@
<version>2.4.2</version>
<scope>test</scope>
</dependency>
<!-- bnd -->
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>2.4.1</version>
<scope>provided</scope>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -151,6 +164,18 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>generate-depends-file</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public abstract class KarafTestSupport {

public static final String KARAF_ARTIFACT_ID = "apache-karaf";

public static final String KARAF_VERSION = "3.0.3";

public static final String KARAF_NAME = "Apache Karaf";

public KarafTestSupport() {
Expand Down Expand Up @@ -105,10 +103,6 @@ protected String karafArtifactId() {
return KARAF_ARTIFACT_ID;
}

protected String karafVersion() {
return KARAF_VERSION;
}

protected String karafName() {
return KARAF_NAME;
}
Expand All @@ -117,14 +111,15 @@ protected Option addBootFeature(final String feature) {
return editConfigurationFileExtend("etc/org.apache.karaf.features.cfg", "featuresBoot", "," + feature);
}

protected String featureRepository() {
protected String featureRepositories() {
return "mvn:org.apache.sling/org.apache.sling.launchpad.karaf-features/0.1.1-SNAPSHOT/xml/features";
}

protected Option karafTestSupportBundle() {
return streamBundle(
bundle()
.add(KarafTestSupport.class)
.set(Constants.BUNDLE_MANIFESTVERSION, "2")
.set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.sling.launchpad.karaf-integration-tests")
.set(Constants.EXPORT_PACKAGE, "org.apache.sling.launchpad.karaf.testing")
.set(Constants.IMPORT_PACKAGE, "javax.inject, org.apache.karaf.features, org.ops4j.pax.exam, org.ops4j.pax.exam.options, org.ops4j.pax.exam.util, org.ops4j.pax.tinybundles.core, org.osgi.framework, org.osgi.service.cm")
Expand All @@ -139,26 +134,25 @@ protected Option[] baseConfiguration() {
final int httpPort = findFreePort();
return options(
karafDistributionConfiguration()
.frameworkUrl(maven().groupId(karafGroupId()).artifactId(karafArtifactId()).version(karafVersion()).type("tar.gz"))
.karafVersion(karafVersion())
.frameworkUrl(maven().groupId(karafGroupId()).artifactId(karafArtifactId()).versionAsInProject().type("tar.gz"))
.useDeployFolder(false)
.name(karafName())
.unpackDirectory(new File("target/paxexam/" + getClass().getSimpleName())),
keepRuntimeFolder(),
logLevel(LogLevelOption.LogLevel.INFO),
editConfigurationFileExtend("etc/org.apache.karaf.features.cfg", "featuresRepositories", "," + featureRepository()),
editConfigurationFileExtend("etc/org.apache.karaf.features.cfg", "featuresRepositories", "," + featureRepositories()),
editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", Integer.toString(rmiRegistryPort)),
editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", Integer.toString(rmiServerPort)),
editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", Integer.toString(sshPort)),
editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", Integer.toString(httpPort)),
mavenBundle().groupId("org.ops4j.pax.tinybundles").artifactId("tinybundles").version("2.1.1"),
mavenBundle().groupId("biz.aQute.bnd").artifactId("biz.aQute.bndlib").version("2.4.1"),
mavenBundle().groupId("org.ops4j.pax.tinybundles").artifactId("tinybundles").versionAsInProject(),
mavenBundle().groupId("biz.aQute.bnd").artifactId("biz.aQute.bndlib").versionAsInProject(),
karafTestSupportBundle()
);
}

protected Option withDerby() {
return mavenBundle().groupId("org.apache.derby").artifactId("derby").version("10.11.1.1");
return mavenBundle().groupId("org.apache.derby").artifactId("derby").versionAsInProject();
}

}

0 comments on commit 35a0786

Please sign in to comment.