First integration test. It covers feature installation.

git-svn-id: https://svn.apache.org/repos/asf/karaf/webconsole/trunk@1181062 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/itest/pom.xml b/itest/pom.xml
new file mode 100644
index 0000000..2049f99
--- /dev/null
+++ b/itest/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+   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.
+-->
+<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/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.apache.karaf</groupId>
+        <artifactId>webconsole</artifactId>
+        <version>0.3.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.karaf.webconsole</groupId>
+    <artifactId>itest</artifactId>
+    <name>Apache Karaf :: WebConsole :: Integration tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.webconsole</groupId>
+            <artifactId>features</artifactId>
+            <version>${project.version}</version>
+            <classifier>features</classifier>
+            <type>xml</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.openengsb.labs.paxexam.karaf</groupId>
+            <artifactId>paxexam-karaf-container</artifactId>
+            <version>0.2.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>2.3.0.M1</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.karaf.features</groupId>
+            <artifactId>org.apache.karaf.features.core</artifactId>
+            <version>2.2.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
+
diff --git a/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java b/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java
new file mode 100644
index 0000000..f60fd71
--- /dev/null
+++ b/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java
@@ -0,0 +1,49 @@
+package org.apache.karaf.webconsole.itest;
+
+import static junit.framework.Assert.assertTrue;
+import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.karaf.features.Feature;
+import org.apache.karaf.features.FeaturesService;
+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;
+
+@RunWith(JUnit4TestRunner.class)
+public class FeaturesIntegrationTest {
+
+    @Inject
+    private FeaturesService features;
+
+    @Configuration
+    public Option[] config() {
+        return new Option[] {
+            karafDistributionConfiguration().frameworkUrl(
+                maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("zip").version("2.2.0")
+            ),
+        };
+    }
+
+    @Test
+    public void someTest() throws Exception {
+        features.addRepository(new URI(maven("org.apache.karaf.webconsole", "features").version("0.3.0-SNAPSHOT").classifier("features").type("xml").getURL()));
+
+        features.installFeature("webconsole-wicket");
+
+        List<String> installed = new ArrayList<String>();
+        for (Feature feature : features.listInstalledFeatures()) {
+            installed.add(feature.getName());
+        }
+
+        assertTrue("Webconsole feature should be installed", installed.contains("webconsole-wicket"));
+    }
+}
diff --git a/itest/src/test/resources/log4j.properties b/itest/src/test/resources/log4j.properties
new file mode 100644
index 0000000..02b12a6
--- /dev/null
+++ b/itest/src/test/resources/log4j.properties
@@ -0,0 +1,13 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+log4j.logger.org.ops4j.pax.scanner=WARN
+log4j.logger.org.ops4j.pax.runner=WARN
+log4j.logger.org.ops4j.pax.url=WARN
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index abb7f73..7ff5c3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,7 @@
 
         <module>examples</module>
         <module>manual</module>
+        <module>itest</module>
     </modules>
 
     <build>