first attempt at creating karaf integration test

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1206238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-11-25 15:57:41 +00:00
parent 49718ed8a6
commit 33bb129bee
2 changed files with 159 additions and 1 deletions

View File

@ -37,14 +37,87 @@
<dom4j-bundle-version>1.6.1_2</dom4j-bundle-version>
<xstream-bundle-version>1.3_3</xstream-bundle-version>
<servicemix.specs.version>1.8.0</servicemix.specs.version>
<pax-exam-version>1.2.4</pax-exam-version>
</properties>
<dependencies>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-service</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Pax-Exam dependencies -->
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<version>${pax-exam-version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
<version>${pax-exam-version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default</artifactId>
<version>${pax-exam-version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit-extender-impl</artifactId>
<version>${pax-exam-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.bundlerepository</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>org.apache.karaf.tooling.testing</artifactId>
<version>${karaf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>org.apache.karaf.features.command</artifactId>
<version>${karaf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>${karaf-version}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
@ -71,6 +144,17 @@
<artifactId>activemq-pool</artifactId>
</dependency>
<!-- used for testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -137,6 +221,15 @@
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/KarafIntegrationTest.*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -0,0 +1,65 @@
/**
* 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.activemq.karaf;
import org.apache.karaf.testing.AbstractIntegrationTest;
import org.apache.karaf.testing.Helper;
import org.junit.Test;
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 static org.ops4j.pax.exam.CoreOptions.*;
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;
@RunWith(JUnit4TestRunner.class)
public class KarafIntegrationTest extends AbstractIntegrationTest {
@Configuration
public static Option[] configuration() throws Exception {
return combine(
// Default karaf environment
Helper.getDefaultOptions(
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG")),
scanFeatures(
maven().groupId("org.apache.activemq").artifactId("activemq-karaf").type("xml").classifier("features").versionAsInProject(),
"activemq"
),
workingDirectory("target/paxrunner/features/"),
waitForFrameworkStartup(),
// Test on both equinox and felix
equinox(), felix()
);
}
@Test
public void testFeatures() throws Exception {
// Run some commands to make sure they are installed properly
// CommandProcessor cp = getOsgiService(CommandProcessor.class);
// CommandSession cs = cp.createSession(System.in, System.out, System.err);
// Object res = cs.execute("osgi:list");
// System.out.println(res);
// cs.close();
}
}