You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jv...@apache.org on 2009/05/01 10:08:56 UTC

svn commit: r770572 - in /incubator/sling/whiteboard/jvazquez/testing: pom.xml src/test/java/org/apache/sling/itest/ src/test/java/org/apache/sling/itest/DummyPaxExamTest.java src/test/java/org/apache/sling/itest/PaxExamTestBase.java

Author: jvazquez
Date: Fri May  1 08:08:56 2009
New Revision: 770572

URL: http://svn.apache.org/viewvc?rev=770572&view=rev
Log:
firsts steps with Pax Exam

Added:
    incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/
    incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/DummyPaxExamTest.java
    incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/PaxExamTestBase.java
Modified:
    incubator/sling/whiteboard/jvazquez/testing/pom.xml

Modified: incubator/sling/whiteboard/jvazquez/testing/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/testing/pom.xml?rev=770572&r1=770571&r2=770572&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/testing/pom.xml (original)
+++ incubator/sling/whiteboard/jvazquez/testing/pom.xml Fri May  1 08:08:56 2009
@@ -27,7 +27,7 @@
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
-    <artifactId>org.apache.sling.launchpad.testing</artifactId>
+    <artifactId>org.apache.sling.launchpad.testing.paxbased</artifactId>
     <packaging>war</packaging>
     <version>4-incubator-SNAPSHOT</version>
 
@@ -523,5 +523,81 @@
             <artifactId>servlet-api</artifactId>
             <scope>test</scope>
         </dependency>
+        
+        <!-- Pax Exam tests based dependencies -->
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+            <version>1.2.1</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam</artifactId>
+            <version>0.5.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit</artifactId>
+            <version>0.5.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-default</artifactId>
+            <version>0.5.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit-extender-impl</artifactId>
+            <version>0.5.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.runner.profiles</groupId>
+            <artifactId>log</artifactId>
+            <version>1.3.0</version>
+            <type>composite</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.runner.profiles</groupId>
+            <artifactId>felix.config</artifactId>
+            <version>1.0.10</version>
+            <type>composite</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+        
     </dependencies>
+    
+    <repositories>
+        <repository>
+            <id>ops4j.releases</id>
+            <url>http://repository.ops4j.org/maven2</url>
+        </repository>
+        <repository>
+            <id>ops4j.profiles</id>
+            <url>http://scm.ops4j.org/repos/ops4j/projects/pax/runner-repository</url>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>ops4j.releases</id>
+            <url>http://repository.ops4j.org/maven2</url>
+        </pluginRepository>
+    </pluginRepositories>
+    
 </project>

Added: incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/DummyPaxExamTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/DummyPaxExamTest.java?rev=770572&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/DummyPaxExamTest.java (added)
+++ incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/DummyPaxExamTest.java Fri May  1 08:08:56 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.sling.itest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.Bundle;
+
+@RunWith(JUnit4TestRunner.class)
+public class DummyPaxExamTest extends PaxExamTestBase {
+    
+    public Log logger = LogFactory.getLog(DummyPaxExamTest.class);
+    
+    @Test
+    public void testDummy() throws Exception {
+        logger.info( "This is running inside Felix. With all configuration set up like you specified. " );
+        for(Bundle b : bundleContext.getBundles() ) {
+            logger.info( "Bundle " + b.getBundleId() + " : " + b.getSymbolicName() );
+        }
+    }
+
+}

Added: incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/PaxExamTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/PaxExamTestBase.java?rev=770572&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/PaxExamTestBase.java (added)
+++ incubator/sling/whiteboard/jvazquez/testing/src/test/java/org/apache/sling/itest/PaxExamTestBase.java Fri May  1 08:08:56 2009
@@ -0,0 +1,79 @@
+/*
+ * 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.sling.itest;
+
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.*;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.*;
+
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.osgi.framework.BundleContext;
+
+public abstract class PaxExamTestBase {
+    
+    @Inject
+    protected BundleContext bundleContext;
+    
+    @Configuration
+    public static Option[] configuration() {
+        Option[] options = options(
+            // install log service using pax runners profile abstraction (there are more profiles, like DS)
+            logProfile(),
+            // this is how you set the default log level when using pax logging (logProfile)
+            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+            
+            /**
+             * Bundles
+             */
+            
+            // Level 1
+            mavenBundle("org.ops4j.pax.web", "pax-web-service", "0.6.0"),
+            mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "2.0.3-incubator-SNAPSHOT"),
+            
+            // Level 5
+            mavenBundle("org.apache.felix", "org.apache.felix.webconsole", "1.2.8"),
+            mavenBundle("org.apache.sling", "org.apache.sling.commons.json", "2.0.3-incubator-SNAPSHOT"),
+            mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository", "1.4.0"),
+            mavenBundle("org.apache.sling", "org.apache.sling.extensions.threaddump", "0.1.0-incubator-SNAPSHOT"),
+            
+            // Level 10
+            mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.0.0"),
+            mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.0.7-SNAPSHOT"),
+            mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.0.10"),
+            mavenBundle("org.apache.felix", "org.apache.felix.metatype", "1.0.2"),
+            
+            // Level 15
+            mavenBundle("org.apache.sling", "org.apache.sling.jcr.api", "2.0.2-incubator"),
+            mavenBundle("org.apache.sling", "org.apache.sling.jcr.base", "2.0.3-incubator-SNAPSHOT"),
+            mavenBundle("org.apache.jackrabbit", "jackrabbit-api", "1.5.0"),
+            mavenBundle("org.apache.sling", "org.apache.sling.jcr.jackrabbit.server", "2.0.3-incubator-SNAPSHOT"),
+            mavenBundle("org.apache.sling", "org.apache.sling.jcr.jackrabbit.usermanager", "2.0.0-incubator-SNAPSHOT"),
+            mavenBundle("org.apache.sling", "org.apache.sling.jcr.jackrabbit.accessmanager", "2.0.0-incubator-SNAPSHOT"),
+            mavenBundle("org.apache.jackrabbit", "jackrabbit-jcr-commons", "1.5.0"),
+            mavenBundle("org.apache.sling", "org.apache.sling.jcr.webdav", "2.0.3-incubator-SNAPSHOT"),
+            
+            felix()
+        );
+        return options;
+    }
+    
+}