You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2009/04/30 09:04:50 UTC

svn commit: r770093 - in /felix/trunk/karaf: ./ itests/ itests/src/test/filtered-resources/ itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/ itests/src/test/resources/org/

Author: gnodet
Date: Thu Apr 30 07:04:50 2009
New Revision: 770093

URL: http://svn.apache.org/viewvc?rev=770093&view=rev
Log:
FELIX-1099: finish the switch to pax-exam

Added:
    felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/FeaturesTest.java
Removed:
    felix/trunk/karaf/itests/src/test/filtered-resources/
    felix/trunk/karaf/itests/src/test/resources/org/
Modified:
    felix/trunk/karaf/itests/pom.xml
    felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/AbstractIntegrationTest.java
    felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java
    felix/trunk/karaf/pom.xml

Modified: felix/trunk/karaf/itests/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/itests/pom.xml?rev=770093&r1=770092&r2=770093&view=diff
==============================================================================
--- felix/trunk/karaf/itests/pom.xml (original)
+++ felix/trunk/karaf/itests/pom.xml Thu Apr 30 07:04:50 2009
@@ -22,12 +22,12 @@
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.apache.servicemix.kernel.gshell</groupId>
-        <artifactId>gshell</artifactId>
+        <groupId>org.apache.servicemix.kernel</groupId>
+        <artifactId>kernel</artifactId>
         <version>1.2.0-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.servicemix.kernel.gshell</groupId>
+    <groupId>org.apache.servicemix.kernel</groupId>
     <artifactId>itests</artifactId>
     <packaging>jar</packaging>
     <version>1.2.0-SNAPSHOT</version>
@@ -38,31 +38,31 @@
     </description>
 
     <dependencies>
+        <!-- This is required to be first so that pax-exam classloader is not messed up with a newer version of felix
+              which would lead to java.lang.NoSuchMethodError: org.apache.felix.framework.Logger.<init>(I)V -->
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.framework</artifactId>
             <version>1.0.0</version>
         </dependency>
+        <!-- This is required to be first so that pax-exam classloader is not messed up with a newer version of felix
+              which would lead to java.lang.RuntimeException: Could not create [service.obr] -->
         <dependency>
-            <groupId>org.apache.servicemix.kernel.gshell</groupId>
-            <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.servicemix.kernel.gshell</groupId>
-            <artifactId>org.apache.servicemix.kernel.gshell.log</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.servicemix.kernel.gshell</groupId>
-            <artifactId>org.apache.servicemix.kernel.gshell.osgi</artifactId>
-            <scope>test</scope>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+            <version>1.2.1</version>
         </dependency>
+
+        <!-- The assembly and all the dependencies -->
         <dependency>
-            <groupId>org.apache.servicemix.kernel.jaas</groupId>
-            <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
+            <groupId>org.apache.servicemix.kernel</groupId>
+            <artifactId>apache-servicemix-kernel</artifactId>
+            <type>xml</type>
+            <classifier>features</classifier>
             <scope>test</scope>
         </dependency>
+
+        <!-- Pax EXAM -->
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam</artifactId>
@@ -87,6 +87,7 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.5</version>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
@@ -112,27 +113,6 @@
 
     <build>
         <plugins>
-            <plugin>
-        <artifactId>maven-resources-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-resources</id>
-            <phase>validate</phase>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${pom.basedir}/target/test-classes/</outputDirectory>
-              <resources>          
-                <resource>
-                  <directory>${pom.basedir}/src/test/filtered-resources</directory>
-                  <filtering>true</filtering>
-                </resource>
-              </resources>              
-            </configuration>            
-          </execution>
-        </executions>
-      </plugin>
             <!-- generate dependencies versions -->
             <plugin>
                 <groupId>org.apache.servicemix.tooling</groupId>

Modified: felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/AbstractIntegrationTest.java?rev=770093&r1=770092&r2=770093&view=diff
==============================================================================
--- felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/AbstractIntegrationTest.java (original)
+++ felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/AbstractIntegrationTest.java Thu Apr 30 07:04:50 2009
@@ -18,6 +18,20 @@
 
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.OptionUtils;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.logProfile;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.configProfile;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.systemPackages;
+import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.mavenConfiguration;
+import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -90,4 +104,50 @@
         return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
     }
 
+    @Configuration
+    public static Option[] configuration() {
+        Option[] options = options(
+            // install log service using pax runners profile abstraction (there are more profiles, like DS)
+            logProfile(),
+            configProfile(),
+            profile("spring.dm").version("1.2.0-rc1"),
+
+            // this is how you set the default log level when using pax logging (logProfile)
+            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+            systemProperty("servicemix.name").value("root"),
+            systemProperty("servicemix.base").value("target/smx.base"),
+            systemProperty("servicemix.startLocalConsole").value("false"),
+            systemProperty("servicemix.startRemoteShell").value("false"),
+
+            // hack system packages
+            systemPackages("org.apache.servicemix.kernel.main.spi;version=1.0.0", "org.apache.servicemix.kernel.jaas.boot"),
+            bootClasspathLibrary(mavenBundle("org.apache.servicemix.kernel.jaas", "org.apache.servicemix.kernel.jaas.boot")).afterFramework(),
+            bootClasspathLibrary(mavenBundle("org.apache.servicemix.kernel", "org.apache.servicemix.kernel.main")).afterFramework(),
+
+            // Bundles
+            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jline"),
+            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-httpclient"),
+            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-jexl"),
+            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-vfs"),
+            mavenBundle("org.apache.mina", "mina-core"),
+            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.oro"),
+            mavenBundle("org.apache.servicemix.kernel.jaas", "org.apache.servicemix.kernel.jaas.config"),
+            mavenBundle("org.apache.sshd", "sshd-core"),
+            mavenBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.core"),
+            mavenBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.osgi"),
+            mavenBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.log").noStart(),
+
+
+//            mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
+
+            scanFeatures(
+                    maven().groupId("org.apache.servicemix.kernel").artifactId("apache-servicemix-kernel").type("xml").classifier("features").versionAsInProject(),
+                    "obr", "wrapper"
+            ),
+
+            felix()
+        );
+        return options;
+    }
+
 }

Modified: felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java?rev=770093&r1=770092&r2=770093&view=diff
==============================================================================
--- felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java (original)
+++ felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java Thu Apr 30 07:04:50 2009
@@ -24,17 +24,7 @@
 import static org.junit.Assert.fail;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import static org.ops4j.pax.exam.CoreOptions.felix;
-import static org.ops4j.pax.exam.CoreOptions.mavenConfiguration;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemPackages;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.configProfile;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.logProfile;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.osgi.framework.Bundle;
@@ -65,7 +55,7 @@
 
         shell.execute("log/display");
 
-        b.uninstall();
+        b.stop();
 
         try {
             shell.execute("log/display");
@@ -84,86 +74,19 @@
         shell.execute("..");
     }
     
-//    @Test
-//    public void testInstallFeature() throws Exception {
-//        Shell shell = getOsgiService(Shell.class);
-//
-//        try {
-//            shell.execute("obr");
-//            fail("command should not exist");
-//        } catch (CommandLineExecutionFailed e) {
-//            assertNotNull(e.getCause());
-//            assertTrue(e.getCause() instanceof NoSuchCommandException);
-//        }
-//        try {
-//            shell.execute("wrapper");
-//            fail("command should not exist");
-//        } catch (CommandLineExecutionFailed e) {
-//            assertNotNull(e.getCause());
-//            assertTrue(e.getCause() instanceof NoSuchCommandException);
-//        }
-//        String url = getClass().getClassLoader().getResource("features.xml").toString();
-//        addFeatureRepo(url);
-//        installFeature("obr");
-//        installFeature("wrapper");
-//        shell.execute("obr");
-//        shell.execute("wrapper");
-//    }
-
-    /**
-     * TODO: This test seems to fail, there must be a timing issue somewhere
-     *
+    @Test
     public void testCommandGroupAfterInstall() throws Exception {
-        Bundle b = installBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.log", null, "jar");
+        Bundle b = getInstalledBundle("org.apache.servicemix.kernel.gshell.log");
+        b.start();
         Shell shell = getOsgiService(Shell.class);
         shell.execute("log");
         shell.execute("help");
         shell.execute("..");
     }
-     */
 
     @Configuration
     public static Option[] configuration() {
-        Option[] options = options(
-            // install log service using pax runners profile abstraction (there are more profiles, like DS)
-            logProfile(),
-            configProfile(),
-            profile("spring.dm").version("1.2.0-rc1"),
-
-            // this is how you set the default log level when using pax logging (logProfile)
-            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
-            systemProperty("servicemix.name").value("root"),
-            systemProperty("servicemix.base").value("target/smx.base"),
-            systemProperty("servicemix.startLocalConsole").value("false"),
-            systemProperty("servicemix.startRemoteShell").value("false"),
-
-            // hack system packages
-            systemPackages("org.apache.servicemix.kernel.main.spi;version=1.0.0", "org.apache.servicemix.kernel.jaas.boot"),
-            bootClasspathLibrary(mavenBundle("org.apache.servicemix.kernel.jaas", "org.apache.servicemix.kernel.jaas.boot")).afterFramework(),
-            bootClasspathLibrary(mavenBundle("org.apache.servicemix.kernel", "org.apache.servicemix.kernel.main")).afterFramework(),
-
-            // Bundles
-            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jline"),
-            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-httpclient"),
-            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-jexl"),
-            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-vfs"),
-            mavenBundle("org.apache.mina", "mina-core"),
-            mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.oro"),
-            mavenBundle("org.apache.servicemix.kernel.jaas", "org.apache.servicemix.kernel.jaas.config"),
-            mavenBundle("org.apache.sshd", "sshd-core"),
-            mavenBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.core"),
-            mavenBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.osgi"),
-            mavenBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.log").noStart(),
-
-            felix()
-        );
-
-        // use config generated by the Maven plugin (until PAXEXAM-62/64 get resolved)
-        if (CoreTest.class.getClassLoader().getResource("META-INF/maven/paxexam-config.args") != null) {
-            options = OptionUtils.combine(options, mavenConfiguration());
-        }
-
-        return options;
+        return AbstractIntegrationTest.configuration();
     }
 
 }

Added: felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/FeaturesTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/FeaturesTest.java?rev=770093&view=auto
==============================================================================
--- felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/FeaturesTest.java (added)
+++ felix/trunk/karaf/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/FeaturesTest.java Thu Apr 30 07:04:50 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.servicemix.kernel.gshell.itests;
+
+import org.apache.geronimo.gshell.shell.Shell;
+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 FeaturesTest extends AbstractIntegrationTest {
+
+    @Test
+    public void testFeatures() throws Exception {
+        Shell shell = getOsgiService(Shell.class);
+        shell.execute("obr");
+        shell.execute("wrapper");
+    }
+
+    @Configuration
+    public static Option[] configuration() {
+        return AbstractIntegrationTest.configuration();
+    }
+
+}

Modified: felix/trunk/karaf/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/pom.xml?rev=770093&r1=770092&r2=770093&view=diff
==============================================================================
--- felix/trunk/karaf/pom.xml (original)
+++ felix/trunk/karaf/pom.xml Thu Apr 30 07:04:50 2009
@@ -42,9 +42,9 @@
         <module>jaas</module>
         <module>client</module>
         <module>management</module>
-        <module>itests</module>
         <module>assembly</module>
         <module>demos</module>
+        <module>itests</module>
     </modules>
 
     <scm>
@@ -267,16 +267,6 @@
                 <version>${pom.version}</version>
             </dependency>
             <dependency>
-                <groupId>org.apache.servicemix.kernel.testing</groupId>
-                <artifactId>org.apache.servicemix.kernel.testing.support</artifactId>
-                <version>${pom.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.servicemix.kernel.testing</groupId>
-                <artifactId>org.apache.servicemix.kernel.testing.itests</artifactId>
-                <version>${pom.version}</version>
-            </dependency>
-            <dependency>
                 <groupId>org.apache.servicemix.kernel.demos</groupId>
                 <artifactId>smx4web</artifactId>
                 <version>${pom.version}</version>
@@ -293,6 +283,13 @@
                 <version>${pom.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.servicemix.kernel</groupId>
+                <artifactId>apache-servicemix-kernel</artifactId>
+                <classifier>features</classifier>
+                <type>xml</type>
+                <version>${pom.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>org.apache.felix.framework</artifactId>
                 <version>${felix.framework.version}</version>