From 33bb129bee18e374d6cfd97a19432146e7072117 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Fri, 25 Nov 2011 15:57:41 +0000 Subject: [PATCH] first attempt at creating karaf integration test git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1206238 13f79535-47bb-0310-9956-ffa450edef68 --- activemq-karaf/pom.xml | 95 ++++++++++++++++++- .../activemq/karaf/KarafIntegrationTest.java | 65 +++++++++++++ 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 activemq-karaf/src/test/java/org/apache/activemq/karaf/KarafIntegrationTest.java diff --git a/activemq-karaf/pom.xml b/activemq-karaf/pom.xml index 0be5bc599c..099406d0de 100644 --- a/activemq-karaf/pom.xml +++ b/activemq-karaf/pom.xml @@ -37,14 +37,87 @@ 1.6.1_2 1.3_3 1.8.0 + 1.2.4 + + org.ops4j.pax.logging + pax-logging-api + 1.6.2 + + + org.ops4j.pax.logging + pax-logging-service + 1.6.2 + + + + + org.ops4j.pax.exam + pax-exam + ${pax-exam-version} + + + org.ops4j.pax.exam + pax-exam-junit + ${pax-exam-version} + + + org.ops4j.pax.exam + pax-exam-container-default + ${pax-exam-version} + + + org.ops4j.pax.exam + pax-exam-junit-extender-impl + ${pax-exam-version} + + + org.slf4j + slf4j-api + ${slf4j-version} + test + + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + test + + + + org.apache.felix + org.apache.felix.framework + 1.0.0 + + + + org.apache.felix + org.apache.felix.bundlerepository + 1.2.1 + + + + org.apache.karaf.tooling + org.apache.karaf.tooling.testing + ${karaf-version} + test + + + + org.apache.karaf.features + org.apache.karaf.features.command + ${karaf-version} + test + + org.apache.karaf.shell org.apache.karaf.shell.console ${karaf-version} + org.osgi org.osgi.core @@ -71,6 +144,17 @@ activemq-pool + + + junit + junit + test + + + + + + @@ -136,7 +220,16 @@ <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@))) - + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/KarafIntegrationTest.* + + + diff --git a/activemq-karaf/src/test/java/org/apache/activemq/karaf/KarafIntegrationTest.java b/activemq-karaf/src/test/java/org/apache/activemq/karaf/KarafIntegrationTest.java new file mode 100644 index 0000000000..027dcbbb49 --- /dev/null +++ b/activemq-karaf/src/test/java/org/apache/activemq/karaf/KarafIntegrationTest.java @@ -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(); + } +}