You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/10/08 18:28:25 UTC

svn commit: r1180404 - in /webservices/commons/trunk/modules/axiom: ./ modules/axiom-osgi-tests/ modules/axiom-osgi-tests/etc/ modules/axiom-osgi-tests/src/ modules/axiom-osgi-tests/src/test/ modules/axiom-osgi-tests/src/test/java/ modules/axiom-osgi-t...

Author: veithen
Date: Sat Oct  8 16:28:24 2011
New Revision: 1180404

URL: http://svn.apache.org/viewvc?rev=1180404&view=rev
Log:
Refactored the OSGi tests to use Pax Exam instead of junit4osgi.

Reasons:
* junit4osgi is not actively maintained. The only available release is 1.0.0.
* With Pax Exam there is no need to have multiple Maven modules.
* Pax Exam supports more recent versions of Felix.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/logging.properties   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml
      - copied, changed from r1180375, webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-run/pom.xml
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/
      - copied from r1180369, webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-build/src/main/java/
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi/
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/ServiceTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/StAXOMBuilderTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml
    webservices/commons/trunk/modules/axiom/pom.xml

Added: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/logging.properties
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/logging.properties?rev=1180404&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/logging.properties (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/logging.properties Sat Oct  8 16:28:24 2011
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+# Turn logging off
+handlers=
+

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/etc/logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml (from r1180375, webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-run/pom.xml)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml?p2=webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml&p1=webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-run/pom.xml&r1=1180375&r2=1180404&rev=1180404&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-run/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml Sat Oct  8 16:28:24 2011
@@ -21,111 +21,153 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.ws.commons.axiom</groupId>
-        <artifactId>axiom-osgi</artifactId>
+        <artifactId>axiom-parent</artifactId>
         <version>1.2.13-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <relativePath>../axiom-parent/pom.xml</relativePath>
     </parent>
-    <artifactId>axiom-osgi-run</artifactId>
-    <name>Axiom OSGI Test Suite - Run</name>
+    <artifactId>axiom-osgi-tests</artifactId>
+    <name>Axiom OSGi Tests</name>
+    <packaging>jar</packaging>
+    <!-- This needs to be set explicitly because the project structure implies that the Maven calculated defaults are wrong -->
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests</developerConnection>
+        <url>http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests</url>
+    </scm>
+    <!-- This also needs to be set explicitly because the Maven calculated URL would point to nowhere -->
+    <url>http://ws.apache.org/axiom/</url>
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-activation_1.1_spec</artifactId>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-javamail_1.4_spec</artifactId>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <!-- An OSGI aware version of the StAX API -->
             <groupId>org.apache.servicemix.specs</groupId>
             <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
             <version>1.1.1</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-api</artifactId>
             <version>${project.version}</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-impl</artifactId>
             <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>axiom-osgi-build</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-dom</artifactId>
             <version>${project.version}</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
          <dependency>
             <groupId>org.codehaus.woodstox</groupId>
             <artifactId>stax2-api</artifactId>
             <version>3.0.1</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.codehaus.woodstox</groupId>
             <artifactId>woodstox-core-asl</artifactId>
             <version>4.0.1</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
             <artifactId>apache-mime4j-core</artifactId>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
-
-        <!--
-            I'd prefer to use these slf4j bundles rather than the springsource
-            repackaged commons-logging but there seems to be a bug in the version
-            of Apache Felix that the plugin pulls in which means slf4j won't
-            work. <dependency> <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-nop</artifactId> <version>1.5.6</version>
-            <scope>test</scope> </dependency> <dependency>
-            <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId>
-            <version>1.5.6</version> <scope>test</scope> </dependency>
-            <dependency> <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId> <version>1.5.6</version>
-            <scope>test</scope> </dependency>
-        -->
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>com.springsource.org.apache.commons.logging</artifactId>
             <version>1.1.1</version>
-            <scope>test</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr</artifactId>
             <version>1.0.6</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-default</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <version>1.5.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <properties>
+        <exam.version>1.2.4</exam.version>
+    </properties>
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-junit4osgi-plugin</artifactId>
-                <version>1.0.0</version>
+                <groupId>org.ops4j.pax.exam</groupId>
+                <artifactId>maven-paxexam-plugin</artifactId>
+                <version>${exam.version}</version>
                 <executions>
                     <execution>
                         <goals>
-                            <goal>test</goal>
+                            <goal>generate-config</goal>
                         </goals>
                     </execution>
                 </executions>
+                <configuration>
+                    <settings>
+                        <platform>felix</platform>
+                        <profiles>log,url</profiles>
+                    </settings>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemPropertyVariables>
+                        <java.util.logging.config.file>${basedir}/etc/logging.properties</java.util.logging.config.file>
+                    </systemPropertyVariables>
+                </configuration>
             </plugin>
         </plugins>
     </build>

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java?rev=1180404&r1=1180369&r2=1180404&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/OMAbstractFactoryTest.java Sat Oct  8 16:28:24 2011
@@ -18,19 +18,26 @@
  */
 package org.apache.axiom.test;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import static org.junit.Assert.assertNotNull;
 
-public class OMAbstractFactoryTest extends OSGiTestCase {
+import org.apache.axiom.om.OMAbstractFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 
+@RunWith(MavenConfiguredJUnit4TestRunner.class)
+public class OMAbstractFactoryTest {
+    @Test
 	public void testgetOMFactory() throws Exception {
 		assertNotNull(OMAbstractFactory.getOMFactory());
 	}
 
+    @Test
 	public void testgetSOAP11Factory() throws Exception {
 		assertNotNull(OMAbstractFactory.getSOAP11Factory());
 	}
 
+    @Test
 	public void testgetSOAP12Factory() throws Exception {
 		assertNotNull(OMAbstractFactory.getSOAP12Factory());
 	}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/ServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/ServiceTest.java?rev=1180404&r1=1180369&r2=1180404&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/ServiceTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/ServiceTest.java Sat Oct  8 16:28:24 2011
@@ -18,11 +18,21 @@
  */
 package org.apache.axiom.test;
 
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
-public class ServiceTest extends OSGiTestCase {
+@RunWith(MavenConfiguredJUnit4TestRunner.class)
+public class ServiceTest {
+    @Inject BundleContext context;
 	
+    @Test
 	public void testLLOMMetaFactoryServicePresent() throws Exception {
 		ServiceReference[] omfactRefs = context
 				.getServiceReferences("org.apache.axiom.om.OMMetaFactory", "(implementationName=llom)");
@@ -30,6 +40,7 @@ public class ServiceTest extends OSGiTes
 		assertEquals(1, omfactRefs.length);
 	}
 	
+    @Test
 	public void testDOOMMetaFactoryServicePresent() throws Exception {
 		ServiceReference[] omfactRefs = context
 				.getServiceReferences("org.apache.axiom.om.OMMetaFactory", "(implementationName=doom)");

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/StAXOMBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/StAXOMBuilderTest.java?rev=1180404&r1=1180369&r2=1180404&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/StAXOMBuilderTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/src/test/java/org/apache/axiom/test/StAXOMBuilderTest.java Sat Oct  8 16:28:24 2011
@@ -18,16 +18,22 @@
  */
 package org.apache.axiom.test;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.ByteArrayInputStream;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 
-public class StAXOMBuilderTest extends OSGiTestCase {
+@RunWith(MavenConfiguredJUnit4TestRunner.class)
+public class StAXOMBuilderTest {
 	
 	private String xmlString = "<a:testElement xmlns:a=\"http://test/namespace\" />";
 	
+    @Test
 	public void testLLOMOMFactoryServicePresent() throws Exception {
 		ByteArrayInputStream bais = new ByteArrayInputStream(xmlString.getBytes());
 		StAXOMBuilder sb = new StAXOMBuilder(bais);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml?rev=1180404&r1=1180403&r2=1180404&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml Sat Oct  8 16:28:24 2011
@@ -252,7 +252,7 @@
                 </plugin>
                 <plugin>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.4.3</version>
+                    <version>2.10</version>
                     <configuration>
                         <includes>
                             <include>**/*Test.java</include>

Modified: webservices/commons/trunk/modules/axiom/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/pom.xml?rev=1180404&r1=1180403&r2=1180404&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/pom.xml Sat Oct  8 16:28:24 2011
@@ -558,7 +558,7 @@
         <module>modules/axiom-dom</module>
         <module>modules/axiom-c14n</module>
         <module>modules/axiom-tests</module>
-        <module>modules/axiom-osgi</module>
+        <module>modules/axiom-osgi-tests</module>
         <module>modules/axiom-integration</module>
     </modules>
 </project>