geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r924365 [2/3] - in /geronimo/specs/trunk: geronimo-activation_1.1_spec/src/main/java/javax/activation/ geronimo-ejb_3.1_spec/src/main/java/javax/ejb/embeddable/ geronimo-el_2.2_spec/src/main/java/javax/el/ geronimo-jacc_1.1_spec/src/main/ja...
Date Wed, 17 Mar 2010 16:52:06 GMT
Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml Wed Mar 17 16:52:03 2010
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-osgi-support</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.specs</groupId>
+    <artifactId>geronimo-osgi-itestb</artifactId>
+    <packaging>bundle</packaging>
+    <name>Geronimo OSGi integration tests</name>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <description>
+Separately built test bundle for use in the various integration tests.  This
+bundle will have provider and services definitions used to test different class
+provider resolution scenarios.
+    </description>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${groupId}.${artifactId};singleton=true</Bundle-SymbolicName>
+                        <Private-Package>org.apache.geronimo.osgi.testb</Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.itestb;
+
+public class TestTarget {
+    public TestTarget() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.itestb;
+
+public class TestTarget2 {
+    public TestTarget2() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget2";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget2.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.itestb;
+
+public class TestTarget3 {
+    public TestTarget3() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget3";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTarget3.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.itestb;
+
+public class TestTargetTwo {
+    public TestTargetTwo() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTargetTwo";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/java/org/apache/geronimo/osgi/itestb/TestTargetTwo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.MultiTarget
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.MultiTarget?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.MultiTarget (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.MultiTarget Wed Mar 17 16:52:03 2010
@@ -0,0 +1,3 @@
+# Tests normal class mapping for multiple providers
+org.apache.geronimo.osgi.itestb.TestTarget
+org.apache.geronimo.osgi.itestb.TestTarget2

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.TestTarget
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.TestTarget?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.TestTarget (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/META-INF/services/org.apache.geronimo.osgi.registry.itest.TestTarget Wed Mar 17 16:52:03 2010
@@ -0,0 +1,4 @@
+# Tests normal class mapping...NOTE:  this uses
+# TestTarget2 to ensure we're picking up the
+# services version, not the providers one.
+org.apache.geronimo.osgi.itestb.TestTarget2

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget Wed Mar 17 16:52:03 2010
@@ -0,0 +1,2 @@
+# Tests normal class mapping....
+org.apache.geronimo.osgi.itestb.TestTarget

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget2
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget2?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget2 (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget2 Wed Mar 17 16:52:03 2010
@@ -0,0 +1 @@
+org.apache.geronimo.osgi.itestb.TestTargetTwo  # Used as an override to map TestTarget to TestTargetTwo

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget4
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget4?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget4 (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-itestb/src/main/resources/OSGI-INF/providers/org.apache.geronimo.osgi.registry.itest.TestTarget4 Wed Mar 17 16:52:03 2010
@@ -0,0 +1,4 @@
+# Tests normal class mapping....
+org.apache.geronimo.osgi.itestb.TestTarget
+# using multiple provider definitions for a single key
+org.apache.geronimo.osgi.itestb.TestTarget2

Modified: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/pom.xml?rev=924365&r1=924364&r2=924365&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/pom.xml Wed Mar 17 16:52:03 2010
@@ -47,6 +47,16 @@ function without error.
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-itesta</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-itestb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,218 @@
+/*
+ * 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.geronimo.osgi.loader.itest;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
+public class NonOSGiLocatorTest {
+    @Test
+    public void testLocator() throws Exception {
+        // this is verifying that the ProviderLocater can be called when used outside of
+        // an OSGi framework without causing an exception.  This will verify that the OSGi
+        // classes are not on the classpath before attempting this.
+        try {
+            this.getClass().getClassLoader().loadClass("org.osgi.util.tracker.ServiceTracker");
+            fail("OSGi framework classes must not be on the class path for this test");
+        } catch (ClassNotFoundException e) {
+            // this should happen if the test is run correctly.
+        }
+
+        // Run outside of an OSGi framework, this should just return null without
+        // causing an error
+        Class<?> target = ProviderLocator.locate("org.apache.geronimo.osgi.locator.itest.TestTarget");
+        assertNull(target);
+
+        // this should be located on our local classpath, so it should get a good return
+        target = ProviderLocator.loadClass("org.apache.geronimo.osgi.locator.itest.TestTarget");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.locator.itest.TestTarget", target.getName());
+
+        // this will be on our dependency class path, so it should still be located.
+        target = ProviderLocator.loadClass("org.apache.geronimo.osgi.itesta.TestTarget");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName());
+
+
+        // this should not be located at all
+        try {
+            target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.ClassNotFound");
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+
+        // now testing the services lookup and instantiation mechanism
+        Object service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(service);
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", service.getClass().getName());
+
+        // we expect a new instance on each call.  Verify that the instances are different
+        Object service2 = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(service2);
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", service2.getClass().getName());
+        assertNotSame(service, service2);
+
+        // now testing a multiple instances get.  This should pick up a definition from both
+        // jars on the class path
+        List services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(services);
+        assertEquals(2, services.size());
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", services.get(0).getClass().getName());
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", services.get(1).getClass().getName());
+        assertNotSame(service, services.get(0));
+
+        // this is multiple instances defined in a single services file.
+        services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.MultiTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(services);
+        assertEquals(2, services.size());
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget", services.get(0).getClass().getName());
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", services.get(1).getClass().getName());
+
+        // this should not be found
+        service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNull(service);
+
+        // again, not found.  Should return an empty list
+        services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(services);
+        assertEquals(0, services.size());
+
+        // this should result in an exception
+        try {
+            service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+
+        // as should this
+        try {
+            services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+
+        // this should result in an exception
+        try {
+            service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.BadClass", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected Exception not thrown");
+        } catch (NullPointerException e) {
+        }
+
+        // as should this
+        try {
+            services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.BadClass", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected Exception not thrown");
+        } catch (NullPointerException e) {
+        }
+
+        // this should result in an exception
+        try {
+            service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoConstructor", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected Exception not thrown");
+        } catch (InstantiationException e) {
+        }
+
+        // as should this
+        try {
+            services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoConstructor", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected Exception not thrown");
+        } catch (InstantiationException e) {
+        }
+
+        // this should result in an exception
+        try {
+            service = ProviderLocator.getService("org.apache.geronimo.osgi.registry.itest.NoAccess", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected Exception not thrown");
+        } catch (IllegalAccessException e) {
+        }
+
+        // as should this
+        try {
+            services = ProviderLocator.getServices("org.apache.geronimo.osgi.registry.itest.NoAccess", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected Exception not thrown");
+        } catch (IllegalAccessException e) {
+        }
+
+        // same set of tests, but this time we're looking for classes, not instances
+        target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(target);
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", target.getName());
+
+        // now testing a multiple instances get.  This should pick up a definition from both
+        // jars on the class path
+        List<Class<?>> classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(classes);
+        assertEquals(2, classes.size());
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", classes.get(0).getName());
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", classes.get(1).getName());
+
+        // this is multiple instances defined in a single services file.
+        classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.MultiTarget", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(classes);
+        assertEquals(2, classes.size());
+        // this should return an instance created from the services definition
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget", classes.get(0).getName());
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget2", classes.get(1).getName());
+
+        // this should not be found
+        target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNull(target);
+
+        // again, not found.  Should return an empty list
+        classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.NotFound", this.getClass(), Thread.currentThread().getContextClassLoader());
+        assertNotNull(classes);
+        assertEquals(0, classes.size());
+
+        // this should result in an exception
+        try {
+            target = ProviderLocator.getServiceClass("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+
+        // as should this
+        try {
+            classes = ProviderLocator.getServiceClasses("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass(), Thread.currentThread().getContextClassLoader());
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/NonOSGiLocatorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.locator.itest;
+
+public class TestTarget {
+    public TestTarget() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator-itests/src/test/java/org/apache/geronimo/osgi/locator/itest/TestTarget.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/ProviderLocator.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/ProviderLocator.java?rev=924365&r1=924364&r2=924365&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/ProviderLocator.java (original)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/ProviderLocator.java Wed Mar 17 16:52:03 2010
@@ -18,8 +18,20 @@
  */
 package org.apache.geronimo.osgi.locator;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Properties;
+import java.util.Set;
 
 import org.apache.geronimo.osgi.registry.api.ProviderRegistry;
 import org.osgi.framework.Bundle;
@@ -125,7 +137,22 @@ public class ProviderLocator {
      *                   Thrown if the class cannot be located.
      */
     static public Class<?> loadClass(String className) throws ClassNotFoundException {
-        return loadClass(className, Thread.currentThread().getContextClassLoader());
+        return loadClass(className, null, Thread.currentThread().getContextClassLoader());
+    }
+
+    /**
+     * Utility class for locating a class with OSGi registry
+     * support.  Uses the thread context classloader as part of
+     * the search order.
+     *
+     * @param className The name of the target class.
+     *
+     * @return The loaded class.
+     * @exception ClassNotFoundException
+     *                   Thrown if the class cannot be located.
+     */
+    static public Class<?> loadClass(String className, Class<?> contextClass) throws ClassNotFoundException {
+        return loadClass(className, contextClass, Thread.currentThread().getContextClassLoader());
     }
 
     /**
@@ -139,8 +166,18 @@ public class ProviderLocator {
      * @exception ClassNotFoundException
      *                   Thrown if the class cannot be loaded.
      */
-    static public Class<?> loadClass(String className, ClassLoader loader) throws ClassNotFoundException {
+    static public Class<?> loadClass(String className, Class<?>contextClass, ClassLoader loader) throws ClassNotFoundException {
+        if (loader != null) {
+            try {
+                return loader.loadClass(className);
+            } catch (ClassNotFoundException x) {
+            }
+        }
+        if (contextClass != null) {
+            loader = contextClass.getClassLoader();
+        }
         try {
+            // try again using the class context loader
             return Class.forName(className, true, loader);
         } catch (ClassNotFoundException x) {
             // last gasp, use the OSGi locator to try to find this
@@ -151,4 +188,414 @@ public class ProviderLocator {
             return cls;
         }
     }
+
+
+    /**
+     * Get a single service instance that matches an interface
+     * definition.
+     *
+     * @param iface  The name of the required interface.
+     * @param contextClass
+     *               The class requesting the lookup (used for class resolution).
+     * @param loader A class loader to use for searching for service definitions
+     *               and loading classes.
+     *
+     * @return The service instance, or null if no matching services
+     *         can be found.
+     * @exception Exception Thrown for any classloading or exceptions thrown
+     *                      trying to instantiate a service instance.
+     */
+    static public Object getService(String iface, Class<?> contextClass, ClassLoader loader) throws Exception {
+        // try for a classpath locatable instance first.  If we find an appropriate class mapping,
+        // create an instance and return it.
+        Class<?> cls = locateServiceClass(iface, contextClass, loader);
+        if (cls != null) {
+            return cls.newInstance();
+        }
+
+        // if not initialized in an OSGi environment, this is a failure
+        if (registryTracker == null) {
+            return null;
+        }
+        // get the service, if it exists.  NB:  if the tracker exists, then we
+        // were able to load the interface class in the first place, so we don't
+        // need to protect against that.
+        ProviderRegistry registry = (ProviderRegistry)((ServiceTracker)registryTracker).getService();
+        // it is also a failure if the service is not there.
+        if (registry == null) {
+            return null;
+        }
+        // the rest of the work is done by the registry
+        return registry.getService(iface);
+    }
+
+
+    /**
+     * Locate a service class that matches an interface
+     * definition.
+     *
+     * @param iface  The name of the required interface.
+     * @param contextClass
+     *               The class requesting the lookup (used for class resolution).
+     * @param loader A class loader to use for searching for service definitions
+     *               and loading classes.
+     *
+     * @return The located class, or null if no matching services
+     *         can be found.
+     * @exception Exception Thrown for any classloading exceptions thrown
+     *                      trying to load the class.
+     */
+    static public Class<?> getServiceClass(String iface, Class<?> contextClass, ClassLoader loader) throws ClassNotFoundException {
+        // try for a classpath locatable instance first.  If we find an appropriate class mapping,
+        // create an instance and return it.
+        Class<?> cls = locateServiceClass(iface, contextClass, loader);
+        if (cls != null) {
+            return cls;
+        }
+
+        // if not initialized in an OSGi environment, this is a failure
+        if (registryTracker == null) {
+            return null;
+        }
+        // get the service, if it exists.  NB:  if the tracker exists, then we
+        // were able to load the interface class in the first place, so we don't
+        // need to protect against that.
+        ProviderRegistry registry = (ProviderRegistry)((ServiceTracker)registryTracker).getService();
+        // it is also a failure if the service is not there.
+        if (registry == null) {
+            return null;
+        }
+        // the rest of the work is done by the registry
+        return registry.getServiceClass(iface);
+    }
+
+
+    /**
+     * Get a list of services that match a given interface
+     * name.  This searches both the current class path and
+     * the global repository for matches.
+     *
+     * @param iface  The name of the required interface.
+     * @param contextClass
+     *               The class requesting the lookup (used for class resolution).
+     * @param loader A class loader to use for searching for service definitions
+     *               and loading classes.
+     *
+     * @return A list of matching services.  Returns an empty list if there
+     *         are no matches.
+     * @exception Exception Thrown for any classloading or exceptions thrown
+     *                      trying to instantiate a service instance.
+     */
+    static public List<Object> getServices(String iface, Class<?> contextClass, ClassLoader loader) throws Exception {
+        List<Object> services = new ArrayList<Object>();
+
+        // try for a classpath locatable instance first.  If we find an appropriate class mapping,
+        // create an instance and return it.
+        Collection<Class<?>> classes = locateServiceClasses(iface, contextClass, loader);
+        if (classes != null) {
+            // create an instance of each of these classes
+            for (Class<?> cls : classes) {
+                services.add(cls.newInstance());
+            }
+        }
+
+        // if not initialized in an OSGi environment, we're finished
+        if (registryTracker == null) {
+            return services;
+        }
+        // get the service, if it exists.  NB:  if the tracker exists, then we
+        // were able to load the interface class in the first place, so we don't
+        // need to protect against that.
+        ProviderRegistry registry = (ProviderRegistry)((ServiceTracker)registryTracker).getService();
+        // it is also the end if the service is not there.
+        if (registry == null) {
+            return services;
+        }
+
+        // get any registered service instances now
+        List<Object> globalServices = registry.getServices(iface);
+        // add to our list also
+        if (globalServices != null) {
+            services.addAll(globalServices);
+        }
+        // now return the merged set
+        return services;
+    }
+
+
+    /**
+     * Get a list of service class implementations that match
+     * an interface name.  This searches both the current class path and
+     * the global repository for matches.
+     *
+     * @param iface  The name of the required interface.
+     * @param contextClass
+     *               The class requesting the lookup (used for class resolution).
+     * @param loader A class loader to use for searching for service definitions
+     *               and loading classes.
+     *
+     * @return A list of matching provider classes.  Returns an empty list if there
+     *         are no matches.
+     * @exception Exception Thrown for any classloading exceptions thrown
+     *                      trying to load a provider class.
+     */
+    static public List<Class<?>> getServiceClasses(String iface, Class<?> contextClass, ClassLoader loader) throws Exception {
+        Set<Class<?>> serviceClasses = new LinkedHashSet<Class<?>>();
+        // try for a classpath locatable classes first.  If we find an appropriate class mapping,
+        // add this to our return collection.
+        Collection<Class<?>> classes = locateServiceClasses(iface, contextClass, loader);
+        if (classes != null) {
+            serviceClasses.addAll(classes);
+        }
+
+        // if not initialized in an OSGi environment, we're finished
+        if (registryTracker == null) {
+            return new ArrayList(serviceClasses);
+        }
+        // get the service, if it exists.  NB:  if the tracker exists, then we
+        // were able to load the interface class in the first place, so we don't
+        // need to protect against that.
+        ProviderRegistry registry = (ProviderRegistry)((ServiceTracker)registryTracker).getService();
+        // it is also the end if the service is not there.
+        if (registry == null) {
+            return new ArrayList(serviceClasses);
+        }
+
+        // get any registered service provider classes now
+        List<Class<?>> globalServices = registry.getServiceClasses(iface);
+        // add to our list also
+        if (globalServices != null) {
+            serviceClasses.addAll(globalServices);
+        }
+        // now return the merged set
+        return new ArrayList(serviceClasses);
+    }
+
+
+    /**
+     * Locate the first class name for a META-INF/services definition
+     * of a given class.  The first matching provider is
+     * returned.
+     *
+     * @param iface  The interface class name used for the match.
+     * @param loader The classloader for locating resources.
+     *
+     * @return The mapped provider name, if found.  Returns null if
+     *         no mapping is located.
+     */
+    static private String locateServiceClassName(String iface, Class<?> contextClass, ClassLoader loader) {
+        // search first with the loader class path
+        String name = locateServiceClassName(iface, loader);
+        if (name != null) {
+            return name;
+        }
+        // then with the context class, if there is one
+        if (contextClass != null) {
+            name = locateServiceClassName(iface, contextClass.getClassLoader());
+            if (name != null) {
+                return name;
+            }
+        }
+        // not found
+        return null;
+    }
+
+
+    static private String locateServiceClassName(String iface, ClassLoader loader) {
+        if (loader != null) {
+            try {
+                // we only look at resources that match the file name, using the specified loader
+                String service = "META-INF/services/" + iface;
+                Enumeration<URL> providers = loader.getResources(service);
+
+                while (providers.hasMoreElements()) {
+                    List<String>providerNames = parseServiceDefinition(providers.nextElement());
+                    // if there is something defined here, return the first entry
+                    if (!providerNames.isEmpty()) {
+                        return providerNames.get(0);
+                    }
+                }
+            } catch (IOException e) {
+            }
+        }
+        // not found
+        return null;
+    }
+
+
+    /**
+     * Locate the first class for a META-INF/services definition
+     * of a given interface class.  The first matching provider is
+     * returned.
+     *
+     * @param iface  The interface class name used for the match.
+     * @param loader The classloader for locating resources.
+     *
+     * @return The mapped provider class, if found.  Returns null if
+     *         no mapping is located.
+     */
+    static public Class<?> locateServiceClass(String iface, Class<?> contextClass, ClassLoader loader) throws ClassNotFoundException {
+        String className = locateServiceClassName(iface, contextClass, loader);
+        if (className == null) {
+            return null;
+        }
+
+        // we found a name, try loading the class.  This will throw an exception if there is an error
+        return loadClass(className, contextClass, loader);
+    }
+
+
+    /**
+     * Locate all class names name for a META-INF/services definition
+     * of a given class.
+     *
+     * @param iface  The interface class name used for the match.
+     * @param loader The classloader for locating resources.
+     *
+     * @return The mapped provider name, if found.  Returns null if
+     *         no mapping is located.
+     */
+    static private Collection<String> locateServiceClassNames(String iface, Class<?> contextClass, ClassLoader loader) {
+        Set<String> names = new LinkedHashSet<String>();
+
+        locateServiceClassNames(iface, loader, names);
+        if (contextClass != null) {
+            locateServiceClassNames(iface, contextClass.getClassLoader(), names);
+        }
+
+        return names;
+    }
+
+
+    /**
+     * Locate all class names name for a META-INF/services definition
+     * of a given class.
+     *
+     * @param iface  The interface class name used for the match.
+     * @param loader The classloader for locating resources.
+     *
+     * @return The mapped provider name, if found.  Returns null if
+     *         no mapping is located.
+     */
+    static void locateServiceClassNames(String iface, ClassLoader loader, Set names) {
+        if (loader != null) {
+
+            try {
+                // we only look at resources that match the file name, using the specified loader
+                String service = "META-INF/services/" + iface;
+                Enumeration<URL> providers = loader.getResources(service);
+
+                while (providers.hasMoreElements()) {
+                    List<String>providerNames = parseServiceDefinition(providers.nextElement());
+                    // just add all of these to the list
+                    names.addAll(providerNames);
+                }
+            } catch (IOException e) {
+            }
+        }
+    }
+
+
+    /**
+     * Locate all classes that map to a given provider class definition.  This will
+     * search both the services directories, as well as the provider classes from the
+     * OSGi provider registry.
+     *
+     * @param iface  The interface class name used for the match.
+     * @param loader The classloader for locating resources.
+     *
+     * @return A list of all mapped classes, if found.  Returns an empty list if
+     *         no mappings are found.
+     */
+    static private Collection<Class<?>> locateServiceClasses(String iface, Class<?> contextClass, ClassLoader loader) throws ClassNotFoundException {
+        // get the set of names from services definitions on the classpath
+        Collection<String> classNames = locateServiceClassNames(iface, contextClass, loader);
+        Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
+
+        // load each class and add to our return set
+        for (String name : classNames) {
+            classes.add(loadClass(name, contextClass, loader));
+        }
+        return classes;
+    }
+
+
+    /**
+     * Parse a definition file and return the names of all included implementation classes
+     * contained within the file.
+     *
+     * @param u      The URL of the file
+     *
+     * @return A list of all matching classes.  Returns an empty list
+     *         if no matches are found.
+     */
+    static private List<String> parseServiceDefinition(URL u) {
+        final String url = u.toString();
+        List<String> classes = new ArrayList<String>();
+        // ignore directories
+        if (url.endsWith("/")) {
+            return classes;
+        }
+        // the identifier used for the provider is the last item in the URL.
+        final String providerId = url.substring(url.lastIndexOf("/") + 1);
+        try {
+            BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream(), "UTF-8"));
+            // the file can be multiple lines long, with comments.  A single file can define multiple providers
+            // for a single key, so we might need to create multiple entries.  If the file does not contain any
+            // definition lines, then as a default, we use the providerId as an implementation class also.
+            String line = br.readLine();
+            while (line != null) {
+                // we allow comments on these lines, and a line can be all comment
+                int comment = line.indexOf('#');
+                if (comment != -1) {
+                    line = line.substring(0, comment);
+                }
+                line = line.trim();
+                // if there is nothing left on the line after stripping white space and comments, skip this
+                if (line.length() > 0) {
+                    // add this to our list
+                    classes.add(line);
+                }
+                // keep reading until the end.
+                line = br.readLine();
+            }
+            br.close();
+        } catch (IOException e) {
+            // ignore errors and handle as default
+        }
+        return classes;
+    }
+
+    /**
+     * Perform a service class discovery by looking for a
+     * property in a target properties file located in the
+     * java.home directory.
+     *
+     * @param path     The relative path to the desired properties file.
+     * @param property The name of the required property.
+     *
+     * @return The value of the named property within the properties file.  Returns
+     *         null if the property doesn't exist or the properties file doesn't exist.
+     */
+    public static String lookupByJREPropertyFile(String path, String property) throws IOException {
+        String jreDirectory = System.getProperty("java.home");
+        File configurationFile = new File(jreDirectory + File.separator + path);
+        if (configurationFile.exists() && configurationFile.canRead()) {
+            Properties properties = new Properties();
+            InputStream in = null;
+            try {
+                in = new FileInputStream(configurationFile);
+                properties.load(in);
+                return properties.getProperty(property);
+            } finally {
+                if (in != null) {
+                    try {
+                        in.close();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        }
+        return null;
+    }
 }

Modified: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/pom.xml?rev=924365&r1=924364&r2=924365&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/pom.xml Wed Mar 17 16:52:03 2010
@@ -49,6 +49,16 @@ Tests for the OSGi provider registry ins
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-itesta</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-itestb</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
             <scope>test</scope>
@@ -142,10 +152,6 @@ Tests for the OSGi provider registry ins
                 <configuration>
                     <redirectTestOutputToFile>true</redirectTestOutputToFile>
                     <failIfNoTests>false</failIfNoTests>
-                    <includes>
-                        <include>**/OSGiLocatorTest.java</include>
-                        <include>**/OSGiLocatorMultipleProviderTest.java</include>
-                    </includes>
                 </configuration>
             </plugin>
         </plugins>

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,148 @@
+/*
+ * 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.geronimo.osgi.registry.itest;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.geronimo.osgi.locator.Activator;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import org.ops4j.pax.exam.Customizer;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+@RunWith(JUnit4TestRunner.class)
+public class OSGiLocatorMultipleProviderTest {
+    @Inject
+    protected BundleContext bundleContext;
+
+    @org.ops4j.pax.exam.junit.Configuration
+    public static Option[] configuration() throws Exception {
+        Option[] options = options(
+            // the target code we're testing
+            mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry"),
+            mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itesta"),
+            mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itestb"),
+            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+            felix(),
+            equinox().version("3.5.0"),
+            // we want to specify an activator for the test probe bundle that
+            // is the standard one for adding the locator service to a spec
+            // bundle.  We'll use our activator instance to perform class lookups
+            new Customizer()
+            {
+                @Override
+                public InputStream customizeTestProbe( InputStream testProbe )
+                    throws IOException
+                {
+                    return modifyBundle(testProbe)
+                        // these two classes need to be in every participating bundle
+                        .add(org.apache.geronimo.osgi.locator.Activator.class)
+                        .add(org.apache.geronimo.osgi.locator.ProviderLocator.class)
+                        // set the required activator also
+                        .set(Constants.BUNDLE_ACTIVATOR, org.apache.geronimo.osgi.locator.Activator.class.getName())
+                        // we need an import for activator to function properly.
+                        .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.osgi.registry.api")
+                        .build();
+                }
+            }
+        );
+        options = updateOptions(options);
+        return options;
+    }
+
+
+    @Test
+    public void testLocator() throws Exception {
+        Bundle bundle1 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itesta");
+        Bundle bundle2 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itestb");
+        // check for the target class a verify we got the correct one
+        Class<?> target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName());
+
+        // now stop the first bundle, which should shuffle the deck
+        bundle1.stop();
+
+        // The returned class should now be from the second provisioned bundle
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itestb.TestTarget", target.getName());
+
+        // now stop the the second bundle.  There should not be anything registred with that name now.
+        bundle2.stop();
+
+        // The returned class should now be null since there are no registered providers
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        assertNull(target);
+    }
+
+    protected Bundle getInstalledBundle(String symbolicName) {
+        for (Bundle b : bundleContext.getBundles()) {
+            if (b.getSymbolicName().equals(symbolicName)) {
+                return b;
+            }
+        }
+        return null;
+    }
+
+    public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) {
+        return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
+    }
+
+    protected static Option[] updateOptions(Option[] options) {
+        // We need to add pax-exam-junit here when running with the ibm
+        // jdk to avoid the following exception during the test run:
+        // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
+        if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+            Option[] ibmOptions = options(
+                wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit"))
+            );
+            options = combine(ibmOptions, options);
+        }
+
+        return options;
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorMultipleProviderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,228 @@
+/*
+ * 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.geronimo.osgi.registry.itest;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.geronimo.osgi.locator.Activator;
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import org.ops4j.pax.exam.Customizer;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+@RunWith(JUnit4TestRunner.class)
+public class OSGiLocatorTest {
+    @Inject
+    protected BundleContext bundleContext;
+
+    @org.ops4j.pax.exam.junit.Configuration
+    public static Option[] configuration() throws Exception {
+        Option[] options = options(
+            // the target code we're testing...
+            mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry"),
+            // bundle containing test resources
+            mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-itesta"),
+            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+            felix(),
+            equinox().version("3.5.0"),
+            // we want to specify an activator for the test probe bundle that
+            // is the standard one for adding the locator service to a spec
+            // bundle.  We'll use our activator instance to perform class lookups
+            new Customizer()
+            {
+                @Override
+                public InputStream customizeTestProbe( InputStream testProbe )
+                    throws IOException
+                {
+                    return modifyBundle(testProbe)
+                        // these two classes need to be in every participating bundle
+                        .add(org.apache.geronimo.osgi.locator.Activator.class)
+                        .add(org.apache.geronimo.osgi.locator.ProviderLocator.class)
+                        // we don't have any direct references to this class, so force it to be
+                        // included.
+                        .add(org.apache.geronimo.osgi.registry.itest.TestTargetLocal.class)
+                        // set the required activator also
+                        .set(Constants.BUNDLE_ACTIVATOR, org.apache.geronimo.osgi.locator.Activator.class.getName())
+                        // we need an import for activator to function properly.
+                        .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.osgi.registry.api")
+                        .build();
+                }
+            }
+        );
+        options = updateOptions(options);
+        return options;
+    }
+
+
+    @Test
+    public void testLocator() throws Exception {
+        Bundle bundle1 = getInstalledBundle("org.apache.geronimo.specs.geronimo-osgi-itesta");
+        // check for the target class a verify we got the correct one
+        Class<?> target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName());
+
+        List<Class<?>> targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        // should return one entry and it should be the same class mapping
+        assertEquals(1, targets.size());
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", targets.get(0).getName());
+
+        // now load the second target interface.  This is really the same as the first, but
+        // uses a different commenting style.
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget2");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTargetTwo", target.getName());
+
+        targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget2");
+        // should return one entry and it should be the same class mapping
+        assertEquals(1, targets.size());
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTargetTwo", targets.get(0).getName());
+
+        // This is not in the provider registry, so it should just return null.
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.ClassNotFound");
+        assertNull(target);
+
+        // This is in the provider registry, but the class cannot be loaded.  This should still
+        // return null.
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.NoClass");
+        assertNull(target);
+
+        // Now test some of the class loading support.  This will search the bundle classpath first,
+        // then the provider registry.  Since there is a matching local class this time, it should
+        // find that test class rather than the registered one.
+        // check for the target class a verify we got the correct one
+        target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTarget", this.getClass());
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals(TestTarget.class.getName(), target.getName());
+        // similar to the above, but since the context class is not provided, this will fail to resolve the
+        // locally resident class.
+        target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTarget", null);
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName());
+
+        // this one should be handled from the provider registry and resolve to a class
+        // defined in the test bundle.
+        target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.TestTarget4", this.getClass());
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName());
+
+        // this should not be located at all
+        try {
+            target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.ClassNotFound", this.getClass());
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+
+        // this is in the registry, but there is an error resolving the class
+        try {
+            target = ProviderLocator.loadClass("org.apache.geronimo.osgi.registry.itest.NoClass", this.getClass());
+            fail("Expected ClassNotFoundException not thrown");
+        } catch (ClassNotFoundException e) {
+        }
+
+
+        // this mapping defines multiple classes for the single key.  The first should be returned for
+        // a singleton request, the locate all should return in definition order
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget4");
+        assertNotNull(target);
+        // this should return the given class instance
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", target.getName());
+
+        targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget4");
+        // should return one entry and it should be the same class mapping
+        assertEquals(2, targets.size());
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget", targets.get(0).getName());
+        assertEquals("org.apache.geronimo.osgi.itesta.TestTarget2", targets.get(1).getName());
+
+        // now stop the first bundle, which should shuffle the deck
+        bundle1.stop();
+
+        // The returned class should now be null since there are no registered providers
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        assertNull(target);
+
+        targets = ProviderLocator.locateAll("org.apache.geronimo.osgi.registry.itest.TestTarget");
+        // should return an empty list
+        assertNotNull(targets);
+        assertEquals(0, targets.size());
+
+        // This is in the provider registry, but the class cannot be loaded.  This should still
+        // return null.
+        target = ProviderLocator.locate("org.apache.geronimo.osgi.registry.itest.NoClass");
+        assertNull(target);
+    }
+
+    protected Bundle getInstalledBundle(String symbolicName) {
+        for (Bundle b : bundleContext.getBundles()) {
+            if (b.getSymbolicName().equals(symbolicName)) {
+                return b;
+            }
+        }
+        return null;
+    }
+
+    public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) {
+        return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
+    }
+
+    protected static Option[] updateOptions(Option[] options) {
+        // We need to add pax-exam-junit here when running with the ibm
+        // jdk to avoid the following exception during the test run:
+        // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
+        if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+            Option[] ibmOptions = options(
+                wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit"))
+            );
+            options = combine(ibmOptions, options);
+        }
+
+        return options;
+    }
+}

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/OSGiLocatorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.registry.itest;
+
+public class TestTarget {
+    public TestTarget() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.registry.itest;
+
+public class TestTarget2 {
+    public TestTarget2() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget2";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget2.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java?rev=924365&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java (added)
+++ geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java Wed Mar 17 16:52:03 2010
@@ -0,0 +1,37 @@
+/**
+ * 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.geronimo.osgi.registry.itest;
+
+public class TestTarget3 {
+    public TestTarget3() {
+    }
+
+    @Override
+    /**
+     * The toString method is a simple means for determining
+     * which class has been instantiated without requiring
+     * interface classes to be exported by the test bundles.
+     *
+     * @return The unique identifier for this class.
+     */
+    public String toString() {
+        return "TestTarget3";
+    }
+}
+

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry-itests/src/test/java/org/apache/geronimo/osgi/registry/itest/TestTarget3.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message