aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1077856 - in /aries/trunk/spi-fly: ./ spi-fly-core/ spi-fly-core/src/test/java/org/apache/aries/spifly/ spi-fly-core/src/test/resources/ spi-fly-core/src/test/resources/org/ spi-fly-core/src/test/resources/org/apache/ spi-fly-core/src/test...
Date Fri, 04 Mar 2011 09:30:06 GMT
Author: davidb
Date: Fri Mar  4 09:30:05 2011
New Revision: 1077856

URL: http://svn.apache.org/viewvc?rev=1077856&view=rev
Log:
Enabling the remainder of the new unit tests for SPI-Fly

Added:
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/services/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/services/org.apache.aries.mytest.MySPI
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.AltSPI
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.MySPI
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/services/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/services/org.apache.aries.mytest.MySPI
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/services/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.AltSPI
    aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.MySPI
Modified:
    aries/trunk/spi-fly/pom.xml
    aries/trunk/spi-fly/spi-fly-core/pom.xml
    aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ClientWeavingHookTest.java

Modified: aries/trunk/spi-fly/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/pom.xml?rev=1077856&r1=1077855&r2=1077856&view=diff
==============================================================================
--- aries/trunk/spi-fly/pom.xml (original)
+++ aries/trunk/spi-fly/pom.xml Fri Mar  4 09:30:05 2011
@@ -45,87 +45,6 @@
         <url>http://svn.apache.org/viewvc/aries/trunk/spi-fly</url>
     </scm>
 
-    <!--
-    <repositories>
-        <!- - The SpringSource bundle repository is required in order to be able to download
osgified AspectJ bundles - ->
-        <repository>
-            <id>com.springsource.repository.bundles.external</id>
-            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
-            <url>http://repository.springsource.com/maven/bundles/external</url>
-        </repository> 
-    </repositories>
-    -->
-
-    <!--
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>org.apache.felix.configadmin</artifactId>
-                <version>1.2.4</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.felix</groupId>
-                        <artifactId>org.osgi.compendium</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>org.apache.felix</groupId>
-                        <artifactId>org.osgi.core</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.aries</groupId>
-                <artifactId>org.apache.aries.util</artifactId>
-                <version>0.4-SNAPSHOT</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.aries.testsupport</groupId>
-                <artifactId>org.apache.aries.testsupport.unit</artifactId>
-                <version>0.4-SNAPSHOT</version>
-                <scope>test</scope>
-            </dependency>
-
-            <dependency>
-                <groupId>org.aspectj</groupId>
-                <artifactId>com.springsource.org.aspectj.weaver</artifactId>
-                <version>1.6.2.RELEASE</version>
-            </dependency>
-            <dependency>
-                <groupId>org.aspectj</groupId>
-                <artifactId>com.springsource.org.aspectj.runtime</artifactId>
-                <version>1.6.2.RELEASE</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.easymock</groupId>
-                <artifactId>easymock</artifactId>
-                <version>2.5.2</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.easymock</groupId>
-                <artifactId>easymockclassextension</artifactId>
-                <version>2.5.2</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.ops4j.pax.swissbox</groupId>
-                <artifactId>pax-swissbox-tinybundles</artifactId>
-                <version>1.2.0</version>
-                <scope>test</scope>
-            </dependency>
-
-            <!- - internal - ->
-            <dependency>
-                <groupId>org.apache.aries.spifly</groupId>
-                <artifactId>org.apache.aries.spifly.core</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-    -->
-
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
@@ -137,9 +56,5 @@
     <modules>
         <module>spi-fly-deps</module>
         <module>spi-fly-core</module>
-        <!--
-        <module>spi-fly-itests</module>
-        -->
     </modules>
-
 </project>

Modified: aries/trunk/spi-fly/spi-fly-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/pom.xml?rev=1077856&r1=1077855&r2=1077856&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-core/pom.xml Fri Mar  4 09:30:05 2011
@@ -59,17 +59,4 @@ JRE through META-INF/services resources)
             <scope>test</scope>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <includes>
-                        <include>**/UtilTest.java</include>
-                    </includes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>

Modified: aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ClientWeavingHookTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ClientWeavingHookTest.java?rev=1077856&r1=1077855&r2=1077856&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ClientWeavingHookTest.java
(original)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ClientWeavingHookTest.java
Fri Mar  4 09:30:05 2011
@@ -18,21 +18,20 @@
  */
 package org.apache.aries.spifly;
 
+import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Enumeration;
-import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.aries.spifly.api.SpiFlyConstants;
 import org.easymock.EasyMock;
@@ -498,29 +497,33 @@ public class ClientWeavingHookTest {
         return spiFlyBundle;
     }
 
-    private Bundle mockProviderBundle(String subdir, long id) {
+    private Bundle mockProviderBundle(String subdir, long id) throws Exception {
         return mockProviderBundle(subdir, id, Version.emptyVersion);
     }
     
-    private Bundle mockProviderBundle(String subdir, long id, Version version) {
-        // Discover all the relevant resources in the META-INF/services directory of specified
subdir
-        String location = getClass().getPackage().getName().replace('.', '/') + "/" + subdir
+ "/META-INF/services";
-        Bundle testBundle = ((BundleReference) getClass().getClassLoader()).getBundle();
-        
-        Set<String> resources = new HashSet<String>(); // findEntries happens
to sometimes return duplicates in Eclipse
-        // This findEntries call is quite slow, can we do something that's a bit faster?
-        Enumeration<URL> entries = testBundle.findEntries("/", null, true);
-        for (URL entry : Collections.list(entries)) {
-            String s = entry.toExternalForm();
-            if (s.contains(location)) {
-                int idx = s.lastIndexOf("META-INF/services");
-                String resource = s.substring(idx);
-                if (!resource.endsWith("META-INF/services") && !resource.endsWith("META-INF/services/")
&& 
-                    !resource.substring("META-INF/services/".length()).contains("/")) {
-                    resources.add(resource);
-                }
+    private Bundle mockProviderBundle(String subdir, long id, Version version) throws Exception
{
+        URL url = getClass().getResource("/" + getClass().getName().replace('.', '/') + ".class");
+        File classFile = new File(url.getFile());
+        File baseDir = new File(classFile.getParentFile(), subdir);
+        File directory = new File(baseDir, "/META-INF/services");
+
+        // Do a directory listing of the applicable META-INF/services directory
+        List<String> resources = new ArrayList<String>();
+        for (File f : directory.listFiles()) {
+            String fileName = f.getName();
+            if (fileName.startsWith(".") || fileName.endsWith("."))
+                continue;
+            
+            
+            // Needs to be something like: META-INF/services/org.apache.aries.mytest.MySPI
+            String path = f.getAbsolutePath().substring(baseDir.getAbsolutePath().length());
+            path = path.replace('\\', '/');
+            if (path.startsWith("/")) {
+                path = path.substring(1);
             }
+            resources.add(path);
         }
+            
         // Set up the classloader that will be used by the ASM-generated code as the TCCL.

         // It can load a META-INF/services file
         ClassLoader cl = new TestImplClassLoader(subdir, resources.toArray(new String []
{}));

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/services/org.apache.aries.mytest.MySPI
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/services/org.apache.aries.mytest.MySPI?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/services/org.apache.aries.mytest.MySPI
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl1/META-INF/services/org.apache.aries.mytest.MySPI
Fri Mar  4 09:30:05 2011
@@ -0,0 +1 @@
+org.apache.aries.spifly.impl1.MySPIImpl1

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.AltSPI
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.AltSPI?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.AltSPI
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.AltSPI
Fri Mar  4 09:30:05 2011
@@ -0,0 +1 @@
+org.apache.aries.spifly.impl2.AltSPIImpl1

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.MySPI
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.MySPI?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.MySPI
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2/META-INF/services/org.apache.aries.mytest.MySPI
Fri Mar  4 09:30:05 2011
@@ -0,0 +1,2 @@
+org.apache.aries.spifly.impl2.MySPIImpl2
+org.apache.aries.spifly.impl2.MySPIImpl3
\ No newline at end of file

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/services/org.apache.aries.mytest.MySPI
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/services/org.apache.aries.mytest.MySPI?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/services/org.apache.aries.mytest.MySPI
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl2_123/META-INF/services/org.apache.aries.mytest.MySPI
Fri Mar  4 09:30:05 2011
@@ -0,0 +1 @@
+org.apache.aries.spifly.impl2_123.MySPIImpl2B
\ No newline at end of file

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/services/javax.xml.parsers.DocumentBuilderFactory?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl3/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
Fri Mar  4 09:30:05 2011
@@ -0,0 +1 @@
+org.apache.aries.spifly.impl3.MyAltDocumentBuilderFactory

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.AltSPI
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.AltSPI?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.AltSPI
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.AltSPI
Fri Mar  4 09:30:05 2011
@@ -0,0 +1 @@
+org.apache.aries.spifly.impl4.AltSPIImpl2

Added: aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.MySPI
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.MySPI?rev=1077856&view=auto
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.MySPI
(added)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/resources/org/apache/aries/spifly/impl4/META-INF/services/org.apache.aries.mytest.MySPI
Fri Mar  4 09:30:05 2011
@@ -0,0 +1,2 @@
+org.apache.aries.spifly.impl4.MySPIImpl4
+



Mime
View raw message