Author: ldywicki
Date: Mon Oct 10 16:42:26 2011
New Revision: 1181062

URL: http://svn.apache.org/viewvc?rev=1181062&view=rev
Log:
First integration test. It covers feature installation.

Added:
    karaf/webconsole/trunk/itest/
    karaf/webconsole/trunk/itest/pom.xml
    karaf/webconsole/trunk/itest/src/
    karaf/webconsole/trunk/itest/src/test/
    karaf/webconsole/trunk/itest/src/test/java/
    karaf/webconsole/trunk/itest/src/test/java/org/
    karaf/webconsole/trunk/itest/src/test/java/org/apache/
    karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/
    karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/
    
karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/itest/
    
karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java
    karaf/webconsole/trunk/itest/src/test/resources/
    karaf/webconsole/trunk/itest/src/test/resources/log4j.properties
Modified:
    karaf/webconsole/trunk/pom.xml

Added: karaf/webconsole/trunk/itest/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/itest/pom.xml?rev=1181062&view=auto
==============================================================================
--- karaf/webconsole/trunk/itest/pom.xml (added)
+++ karaf/webconsole/trunk/itest/pom.xml Mon Oct 10 16:42:26 2011
@@ -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>
+

Added: 
karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java?rev=1181062&view=auto
==============================================================================
--- 
karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java
 (added)
+++ 
karaf/webconsole/trunk/itest/src/test/java/org/apache/karaf/webconsole/itest/FeaturesIntegrationTest.java
 Mon Oct 10 16:42:26 2011
@@ -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"));
+    }
+}

Added: karaf/webconsole/trunk/itest/src/test/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/itest/src/test/resources/log4j.properties?rev=1181062&view=auto
==============================================================================
--- karaf/webconsole/trunk/itest/src/test/resources/log4j.properties (added)
+++ karaf/webconsole/trunk/itest/src/test/resources/log4j.properties Mon Oct 10 
16:42:26 2011
@@ -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

Modified: karaf/webconsole/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/karaf/webconsole/trunk/pom.xml?rev=1181062&r1=1181061&r2=1181062&view=diff
==============================================================================
--- karaf/webconsole/trunk/pom.xml (original)
+++ karaf/webconsole/trunk/pom.xml Mon Oct 10 16:42:26 2011
@@ -51,6 +51,7 @@
 
         <module>examples</module>
         <module>manual</module>
+        <module>itest</module>
     </modules>
 
     <build>


Reply via email to