You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/09/13 17:21:53 UTC
svn commit: r1384367 - in /karaf/branches/karaf-2.3.x: ./ itests/
itests/src/ itests/src/test/ itests/src/test/java/
itests/src/test/java/org/ itests/src/test/java/org/apache/
itests/src/test/java/org/apache/karaf/
itests/src/test/java/org/apache/karaf...
Author: jbonofre
Date: Thu Sep 13 15:21:52 2012
New Revision: 1384367
URL: http://svn.apache.org/viewvc?rev=1384367&view=rev
Log:
[KARAF-1798] Add standard features and wrapper itests
Added:
karaf/branches/karaf-2.3.x/itests/NOTICE
karaf/branches/karaf-2.3.x/itests/pom.xml
karaf/branches/karaf-2.3.x/itests/src/
karaf/branches/karaf-2.3.x/itests/src/test/
karaf/branches/karaf-2.3.x/itests/src/test/java/
karaf/branches/karaf-2.3.x/itests/src/test/java/org/
karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/
karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/
karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/
karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/StandardFeaturesTest.java
karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/WrapperTest.java
Modified:
karaf/branches/karaf-2.3.x/pom.xml
karaf/branches/karaf-2.3.x/tooling/exam/container/pom.xml
Added: karaf/branches/karaf-2.3.x/itests/NOTICE
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/itests/NOTICE?rev=1384367&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/itests/NOTICE (added)
+++ karaf/branches/karaf-2.3.x/itests/NOTICE Thu Sep 13 15:21:52 2012
@@ -0,0 +1,48 @@
+Apache Karaf
+Copyright 2010-2012 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
Added: karaf/branches/karaf-2.3.x/itests/pom.xml
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/itests/pom.xml?rev=1384367&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/itests/pom.xml (added)
+++ karaf/branches/karaf-2.3.x/itests/pom.xml Thu Sep 13 15:21:52 2012
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <!--
+
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>karaf</artifactId>
+ <version>2.3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.karaf.itests</groupId>
+ <artifactId>itests</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Karaf :: Integration Tests</name>
+
+ <properties>
+ <appendedResourcesDirectory>${basedir}/../etc/appended-resources</appendedResourcesDirectory>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>apache-karaf</artifactId>
+ <version>${project.version}</version>
+ <type>tar.gz</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.gogo.runtime</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.tooling.exam</groupId>
+ <artifactId>org.apache.karaf.tooling.exam.container</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java?rev=1384367&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java (added)
+++ karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java Thu Sep 13 15:21:52 2012
@@ -0,0 +1,205 @@
+/*
+ * Licensed 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.karaf.itests;
+
+import org.apache.felix.service.command.CommandProcessor;
+import org.apache.felix.service.command.CommandSession;
+import org.apache.karaf.tooling.exam.options.LogLevelOption;
+import org.ops4j.pax.exam.MavenUtils;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.ProbeBuilder;
+import org.osgi.framework.*;
+import org.osgi.util.tracker.ServiceTracker;
+
+import javax.inject.Inject;
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.PrintStream;
+import java.util.*;
+import java.util.concurrent.*;
+
+import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.logLevel;
+
+import static org.ops4j.pax.exam.CoreOptions.maven;
+
+public class KarafTestSupport {
+
+ static final Long COMMAND_TIMEOUT = 10000L;
+ static final Long SERVICE_TIMEOUT = 30000L;
+
+ ExecutorService executor = Executors.newCachedThreadPool();
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+ probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
+ return probe;
+ }
+
+ @Configuration
+ public Option[] config() {
+ return new Option[]{
+ karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz"))
+ .karafVersion(MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf")).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+ keepRuntimeFolder(),
+ logLevel(LogLevelOption.LogLevel.ERROR) };
+ }
+
+ /**
+ * Executes a shell command and returns output as a String.
+ * Commands have a default timeout of 10 seconds.
+ *
+ * @param command
+ * @return
+ */
+ protected String executeCommand(final String command) {
+ return executeCommand(command, COMMAND_TIMEOUT, false);
+ }
+
+ /**
+ * Executes a shell command and returns output as a String.
+ * Commands have a default timeout of 10 seconds.
+ *
+ * @param command The command to execute.
+ * @param timeout The amount of time in millis to wait for the command to execute.
+ * @param silent Specifies if the command should be displayed in the screen.
+ * @return
+ */
+ protected String executeCommand(final String command, final Long timeout, final Boolean silent) {
+ String response;
+ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ final PrintStream printStream = new PrintStream(byteArrayOutputStream);
+ final CommandProcessor commandProcessor = getOsgiService(CommandProcessor.class);
+ final CommandSession commandSession = commandProcessor.createSession(System.in, printStream, System.err);
+ FutureTask<String> commandFuture = new FutureTask<String>(
+ new Callable<String>() {
+ public String call() {
+ try {
+ if (!silent) {
+ System.err.println(command);
+ }
+ commandSession.execute(command);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+ printStream.flush();
+ return byteArrayOutputStream.toString();
+ }
+ });
+
+ try {
+ executor.submit(commandFuture);
+ response = commandFuture.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ response = "SHELL COMMAND TIMED OUT: ";
+ }
+
+ return response;
+ }
+
+
+ protected <T> T getOsgiService(Class<T> type, long timeout) {
+ return getOsgiService(type, null, timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, null, SERVICE_TIMEOUT);
+ }
+
+ protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
+ ServiceTracker tracker = null;
+ try {
+ String flt;
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")";
+ } else {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))";
+ }
+ } else {
+ flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ Filter osgiFilter = FrameworkUtil.createFilter(flt);
+ tracker = new ServiceTracker(bundleContext, osgiFilter, null);
+ tracker.open(true);
+ // Note that the tracker is not closed to keep the reference
+ // This is buggy, as the service reference may change i think
+ Object svc = type.cast(tracker.waitForService(timeout));
+ if (svc == null) {
+ Dictionary dic = bundleContext.getBundle().getHeaders();
+ System.err.println("Test bundle headers: " + explode(dic));
+
+ for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, null))) {
+ System.err.println("ServiceReference: " + ref);
+ }
+
+ for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) {
+ System.err.println("Filtered ServiceReference: " + ref);
+ }
+
+ throw new RuntimeException("Gave up waiting for service " + flt);
+ }
+ return type.cast(svc);
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /*
+ * Explode the dictionary into a ,-delimited list of key=value pairs
+ */
+ private static String explode(Dictionary dictionary) {
+ Enumeration keys = dictionary.keys();
+ StringBuffer result = new StringBuffer();
+ while (keys.hasMoreElements()) {
+ Object key = keys.nextElement();
+ result.append(String.format("%s=%s", key, dictionary.get(key)));
+ if (keys.hasMoreElements()) {
+ result.append(", ");
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Provides an iterable collection of references, even if the original array is null
+ */
+ private static Collection<ServiceReference> asCollection(ServiceReference[] references) {
+ return references != null ? Arrays.asList(references) : Collections.<ServiceReference>emptyList();
+ }
+
+ public JMXConnector getJMXConnector() throws Exception {
+ JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root");
+ Hashtable env = new Hashtable();
+ String[] credentials = new String[]{ "karaf", "karaf" };
+ env.put("jmx.remote.credentials", credentials);
+ JMXConnector connector = JMXConnectorFactory.connect(url, env);
+ return connector;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/StandardFeaturesTest.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/StandardFeaturesTest.java?rev=1384367&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/StandardFeaturesTest.java (added)
+++ karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/StandardFeaturesTest.java Thu Sep 13 15:21:52 2012
@@ -0,0 +1,232 @@
+/*
+ * Licensed 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.karaf.itests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.ExamReactorStrategy;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
+
+import static org.junit.Assert.assertFalse;
+
+@RunWith(JUnit4TestRunner.class)
+@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
+public class StandardFeaturesTest extends KarafTestSupport {
+
+ @Test
+ public void testBootFeatures() throws Exception {
+ // config
+ String configFeatureStatus = executeCommand("feature:list -i | grep config");
+ System.out.println(configFeatureStatus);
+ assertFalse("config feature is not installed", configFeatureStatus.isEmpty());
+ // ssh
+ String sshFeatureStatus = executeCommand("feature:list -i | grep ssh");
+ System.out.println(sshFeatureStatus);
+ assertFalse("ssh feature is not installed", sshFeatureStatus.isEmpty());
+ // management
+ String managementFeatureStatus = executeCommand("feature:list -i | grep management");
+ System.out.println(managementFeatureStatus);
+ assertFalse("management feature is not installed", managementFeatureStatus.isEmpty());
+ // kar
+ String karFeatureStatus = executeCommand("feature:list -i | grep i kar");
+ System.out.println(karFeatureStatus);
+ assertFalse("kar feature is not installed", karFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring"));
+ String springFeatureStatus = executeCommand("feature:list -i | grep spring");
+ System.out.println(springFeatureStatus);
+ assertFalse("spring feature is not installed", springFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringAspectsFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-aspects"));
+ String springAspectsFeatureStatus = executeCommand("feature:list -i | grep spring-aspects");
+ System.out.println(springAspectsFeatureStatus);
+ assertFalse("spring-aspects feature is not installed", springAspectsFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringDmFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-dm"));
+ String springDmFeatureStatus = executeCommand("feature:list -i | grep spring-dm");
+ System.out.println(springDmFeatureStatus);
+ assertFalse("spring-dm feature is not installed", springDmFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringDmWebFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-dm-web"));
+ String springDmWebFeatureStatus = executeCommand("feature:list -i | grep spring-dm-web");
+ System.out.println(springDmWebFeatureStatus);
+ assertFalse("spring-dm-web feature is not installed", springDmWebFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringInstrumentFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-instrument"));
+ String springInstrumentFeatureStatus = executeCommand("feature:list -i | grep spring-instrument");
+ System.out.println(springInstrumentFeatureStatus);
+ assertFalse("spring-instrument feature is not installed", springInstrumentFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringJdbcFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-jdbc"));
+ String springJdbcFeatureStatus = executeCommand("feature:list -i | grep spring-jdbc");
+ System.out.println(springJdbcFeatureStatus);
+ assertFalse("spring-jdbc feature is not installed", springJdbcFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringJmsFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-jms"));
+ String springJmsFeatureStatus = executeCommand("feature:list -i | grep spring-jms");
+ System.out.println(springJmsFeatureStatus);
+ assertFalse("spring-jms feature is not installed", springJmsFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringStrutsFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-struts"));
+ String springStrutsFeatureStatus = executeCommand("feature:list -i | grep spring-struts");
+ System.out.println(springStrutsFeatureStatus);
+ assertFalse("spring-struts feature is not installed", springStrutsFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringTestFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-test"));
+ String springTestFeatureStatus = executeCommand("feature:list -i | grep spring-test");
+ System.out.println(springTestFeatureStatus);
+ assertFalse("spring-test feature is not installed", springTestFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringOrmFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-orm"));
+ String springOrmFeatureStatus = executeCommand("feature:list -i | grep spring-orm");
+ System.out.println(springOrmFeatureStatus);
+ assertFalse("spring-orm feature is not installed", springOrmFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringOxmFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-oxm"));
+ String springOxmFeatureStatus = executeCommand("feature:list -i | grep spring-oxm");
+ System.out.println(springOxmFeatureStatus);
+ assertFalse("spring-oxm feature is not installed", springOxmFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringTxFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-tx"));
+ String springTxFeatureStatus = executeCommand("feature:list -i | grep spring-tx");
+ System.out.println(springTxFeatureStatus);
+ assertFalse("spring-tx feature is not installed", springTxFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringWebFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-web"));
+ String springWebFeatureStatus = executeCommand("feature:list -i | grep spring-web");
+ System.out.println(springWebFeatureStatus);
+ assertFalse("spring-web feature is not installed", springWebFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testSpringWebPortletFeature() throws Exception {
+ System.out.println(executeCommand("feature:install spring-web-portlet"));
+ String springWebPortletFeatureStatus = executeCommand("feature:list -i | grep spring-web-portlet");
+ System.out.println(springWebPortletFeatureStatus);
+ assertFalse("spring-web-portlet feature is not installed", springWebPortletFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testWrapperFeature() throws Exception {
+ System.out.println(executeCommand("feature:install wrapper"));
+ String wrapperFeatureStatus = executeCommand("feature:list -i | grep wrapper");
+ System.out.println(wrapperFeatureStatus);
+ assertFalse("wrapper feature is not installed", wrapperFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testObrFeature() throws Exception {
+ System.out.println(executeCommand("feature:install obr"));
+ String obrFeatureStatus = executeCommand("feature:list -i | grep obr");
+ System.out.println(obrFeatureStatus);
+ assertFalse("obr feature is not installed", obrFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testJettyFeature() throws Exception {
+ System.out.println(executeCommand("feature:install jetty"));
+ String jettyFeatureStatus = executeCommand("feature:list -i | grep jetty");
+ System.out.println(jettyFeatureStatus);
+ assertFalse("jetty feature is not installed", jettyFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testHttpFeature() throws Exception {
+ System.out.println(executeCommand("feature:install http"));
+ String httpFeatureStatus = executeCommand("feature:list -i | grep http");
+ System.out.println(httpFeatureStatus);
+ assertFalse("http feature is not installed", httpFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testHttpWhiteboardFeature() throws Exception {
+ System.out.println(executeCommand("feature:install http-whiteboard"));
+ String httpWhiteboardFeatureStatus = executeCommand("feature:list -i | grep http-whiteboard");
+ System.out.println(httpWhiteboardFeatureStatus);
+ assertFalse("http-whiteboard feature is not installed", httpWhiteboardFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testWarFeature() throws Exception {
+ System.out.println(executeCommand("feature:install war"));
+ String warFeatureStatus = executeCommand("feature:list -i | grep war");
+ System.out.println(warFeatureStatus);
+ assertFalse("war feature is not installed", warFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testWebconsoleFeature() throws Exception {
+ System.out.println(executeCommand("feature:install webconsole"));
+ String webconsoleFeatureStatus = executeCommand("feature:list -i | grep webconsole");
+ System.out.println(webconsoleFeatureStatus);
+ assertFalse("webconsole feature is not installed", webconsoleFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testEventadminFeature() throws Exception {
+ System.out.println(executeCommand("feature:install eventadmin"));
+ String eventadminFeatureStatus = executeCommand("feature:list -i | grep eventadmin");
+ System.out.println(eventadminFeatureStatus);
+ assertFalse("eventadmin feature is not installed", eventadminFeatureStatus.isEmpty());
+ }
+
+ @Test
+ public void testJasyptEncryptionFeature() throws Exception {
+ System.out.println(executeCommand("feature:install jasypt-encryption"));
+ String jasyptEncryptionFeatureStatus = executeCommand("feature:list -i | grep jasypt-encryption");
+ System.out.println(jasyptEncryptionFeatureStatus);
+ assertFalse("jasypt-encryption feature is not installed", jasyptEncryptionFeatureStatus.isEmpty());
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/WrapperTest.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/WrapperTest.java?rev=1384367&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/WrapperTest.java (added)
+++ karaf/branches/karaf-2.3.x/itests/src/test/java/org/apache/karaf/itests/WrapperTest.java Thu Sep 13 15:21:52 2012
@@ -0,0 +1,59 @@
+/*
+ * Licensed 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.karaf.itests;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.ExamReactorStrategy;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+
+import static org.junit.Assert.assertFalse;
+
+@RunWith(JUnit4TestRunner.class)
+@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
+public class WrapperTest extends KarafTestSupport {
+
+ @Before
+ public void installWrapperFeature() throws Exception {
+ System.out.println(executeCommand("feature:install wrapper"));
+ }
+
+ @Test
+ public void installCommand() throws Exception {
+ String installOutput = executeCommand("wrapper:install");
+ System.out.println(installOutput);
+ assertFalse(installOutput.isEmpty());
+ }
+
+ @Test
+ public void installViaMBean() throws Exception {
+ JMXConnector connector = null;
+ try {
+ connector = this.getJMXConnector();
+ MBeanServerConnection connection = connector.getMBeanServerConnection();
+ ObjectName name = new ObjectName("org.apache.karaf:type=wrapper,name=root");
+ connection.invoke(name, "install", new Object[]{}, new String[]{});
+ } finally {
+ if (connector != null)
+ connector.close();
+ }
+ }
+
+}
Modified: karaf/branches/karaf-2.3.x/pom.xml
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/pom.xml?rev=1384367&r1=1384366&r2=1384367&view=diff
==============================================================================
--- karaf/branches/karaf-2.3.x/pom.xml (original)
+++ karaf/branches/karaf-2.3.x/pom.xml Thu Sep 13 15:21:52 2012
@@ -49,8 +49,10 @@
<module>assemblies</module>
<module>demos</module>
<module>tooling</module>
+ <module>itests</module>
<module>archetypes</module>
<module>diagnostic</module>
+ <module>manual</module>
</modules>
<scm>
@@ -111,6 +113,7 @@
<commons-io.version>1.3.2</commons-io.version>
<commons-lang.version>2.6</commons-lang.version>
<icu4j.version>4.8.1.1</icu4j.version>
+ <injection.bundle.version>1.0</injection.bundle.version>
<jasypt.bundle.version>1.9.0_1</jasypt.bundle.version>
<jetty.version>7.6.5.v20120716</jetty.version>
<junit.bundle.version>4.10_1</junit.bundle.version>
@@ -932,6 +935,11 @@
<artifactId>pax-exam-inject</artifactId>
<version>${pax.exam.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${injection.bundle.version}</version>
+ </dependency>
<dependency>
<groupId>org.ops4j.pax.swissbox</groupId>
Modified: karaf/branches/karaf-2.3.x/tooling/exam/container/pom.xml
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/pom.xml?rev=1384367&r1=1384366&r2=1384367&view=diff
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/pom.xml (original)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/pom.xml Thu Sep 13 15:21:52 2012
@@ -91,6 +91,10 @@
<artifactId>guava</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-inject</artifactId>
</dependency>