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/17 23:04:10 UTC

svn commit: r1185377 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/ axiom-dom/ axiom-osgi-tests/ axiom-parent/

Author: veithen
Date: Mon Oct 17 21:04:10 2011
New Revision: 1185377

URL: http://svn.apache.org/viewvc?rev=1185377&view=rev
Log:
Use the Geronimo StAX API bundle (instead of the one from ServiceMix) in the OSGi tests. Note that this requires the StAX 1.2 version because the 1.0 is not fully OSGi aware.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/ParentLastURLClassLoader.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/pom.xml
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml
    webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java?rev=1185377&r1=1185376&r2=1185377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java Mon Oct 17 21:04:10 2011
@@ -193,7 +193,8 @@ public class DialectTest extends TestSui
         // is not reliable (because it may be null). Hence the check on ParentLastURLClassLoader.
         if (classLoader instanceof ParentLastURLClassLoader
                 && factory.getClass().getClassLoader() != classLoader) {
-            throw new FactoryConfigurationError("Wrong factory!");
+            throw new FactoryConfigurationError("Wrong factory: got " + factory.getClass().getName()
+                    + " loaded from " + factory.getClass().getClassLoader());
         }
         return factory;
     }
@@ -226,7 +227,8 @@ public class DialectTest extends TestSui
         }
         if (classLoader != ClassLoader.getSystemClassLoader()
                 && factory.getClass().getClassLoader() != classLoader) {
-            throw new FactoryConfigurationError("Wrong factory!");
+            throw new FactoryConfigurationError("Wrong factory: got " + factory.getClass().getName()
+                    + " loaded from " + factory.getClass().getClassLoader());
         }
         return factory;
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/ParentLastURLClassLoader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/ParentLastURLClassLoader.java?rev=1185377&r1=1185376&r2=1185377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/ParentLastURLClassLoader.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/ParentLastURLClassLoader.java Mon Oct 17 21:04:10 2011
@@ -18,8 +18,11 @@
  */
 package org.apache.axiom.util.stax.dialect;
 
+import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Enumeration;
+import java.util.Vector;
 
 public class ParentLastURLClassLoader extends URLClassLoader {
     public ParentLastURLClassLoader(URL[] urls, ClassLoader parent) {
@@ -33,6 +36,22 @@ public class ParentLastURLClassLoader ex
         }
         return url;
     }
+    
+    public Enumeration getResources(String name) throws IOException {
+        // Make sure that we return our own resources first. Otherwise, if an API performs
+        // JDK 1.3 service discovery using getResources instead of getResource, we would
+        // have a problem.
+        Vector resources = new Vector();
+        Enumeration e = findResources(name);
+        while (e.hasMoreElements()) {
+            resources.add(e.nextElement());
+        }
+        e = getParent().getResources(name);
+        while (e.hasMoreElements()) {
+            resources.add(e.nextElement());
+        }
+        return resources.elements();
+    }
 
     protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
         if (name.startsWith("javax.")) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/pom.xml?rev=1185377&r1=1185376&r2=1185377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/pom.xml Mon Oct 17 21:04:10 2011
@@ -75,10 +75,6 @@
             <artifactId>commons-logging</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-stax-api_1.0_spec</artifactId>
-        </dependency>
-        <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-api</artifactId>
             <classifier>tests</classifier>

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml?rev=1185377&r1=1185376&r2=1185377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-osgi-tests/pom.xml Mon Oct 17 21:04:10 2011
@@ -48,10 +48,22 @@
             <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>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-stax-api_1.2_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <!-- Used by geronimo-stax-api_1.2_spec to locate the StAX implementation;
+                 only required in an OSGi environment -->
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-registry</artifactId>
+            <version>1.1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.log</artifactId>
+            <version>1.0.1</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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=1185377&r1=1185376&r2=1185377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml Mon Oct 17 21:04:10 2011
@@ -321,6 +321,10 @@
     </build>
     <dependencyManagement>
         <dependencies>
+            <!-- We use the 1.0 version of the StAX API as Maven dependency (because
+                 we need to ensure compatibility with that StAX version), but we need
+                 the 1.2 version because Geronimo's 1.0 bundles are not fully OSGi aware
+                 (they don't locate StAX implementations that are deployed as bundles). -->
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-stax-api_1.0_spec</artifactId>
@@ -328,6 +332,12 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-stax-api_1.2_spec</artifactId>
+                <version>1.1</version>
+            </dependency>
+            
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-activation_1.1_spec</artifactId>
                 <version>1.0.2</version>
             </dependency>