You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by da...@apache.org on 2010/12/14 17:55:49 UTC

svn commit: r1049157 - in /incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook: SpiFly/src/org/apache/aries/spifly/ SpiFlyTests/src/org/apache/aries/spifly/

Author: davidb
Date: Tue Dec 14 16:55:49 2010
New Revision: 1049157

URL: http://svn.apache.org/viewvc?rev=1049157&view=rev
Log:
Support for selecting a specific provider by the consumer through the following header:
  SPI-Consumer: java.util.ServiceLoader#load(java.lang.Class);bundle=impl2
Only selects the bundle with BSN impl2

Removed:
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/org.apache.aries.mytest.MySPI
Modified:
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ClientWeavingHook.java
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Util.java
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ClientWeavingHookTest.java
    incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java Tue Dec 14 16:55:49 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.spifly;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -45,9 +46,12 @@ public class Activator implements Bundle
     private List<LogService> logServices = new CopyOnWriteArrayList<LogService>();
     private BundleTracker<List<ServiceRegistration<?>>> bt;
 
-    private final ConcurrentMap<String, SortedMap<Long, Bundle>>registeredSPIs = 
+    private final ConcurrentMap<String, SortedMap<Long, Bundle>>registeredProviders = 
             new ConcurrentHashMap<String, SortedMap<Long, Bundle>>();
 
+    private final ConcurrentMap<Bundle, Collection<Bundle>> registeredConsumers = 
+            new ConcurrentHashMap<Bundle, Collection<Bundle>>();
+
     public synchronized void start(BundleContext context) throws Exception {
         lst = new LogServiceTracker(context);
         lst.open();
@@ -104,14 +108,26 @@ public class Activator implements Bundle
         }        
     }
 
-    public void registerSPIProviderBundle(String registrationClassName, Bundle bundle) {        
-        registeredSPIs.putIfAbsent(registrationClassName, Collections.synchronizedSortedMap(new TreeMap<Long, Bundle>()));
-        SortedMap<Long, Bundle> map = registeredSPIs.get(registrationClassName);
+    public void registerProviderBundle(String registrationClassName, Bundle bundle) {        
+        registeredProviders.putIfAbsent(registrationClassName, Collections.synchronizedSortedMap(new TreeMap<Long, Bundle>()));
+        SortedMap<Long, Bundle> map = registeredProviders.get(registrationClassName);
         map.put(bundle.getBundleId(), bundle);
     }
 
-    public Collection<Bundle> findSPIProviderBundles(String name) {
-        SortedMap<Long, Bundle> map = registeredSPIs.get(name);
+    public Collection<Bundle> findProviderBundles(String name) {
+        SortedMap<Long, Bundle> map = registeredProviders.get(name);
         return map == null ? Collections.<Bundle>emptyList() : map.values();
     }
+    
+    // TODO unRegisterProviderBundle();
+    
+    public void registerConsumerBundle(Bundle consumer, Collection<Bundle> spiProviders) {
+        registeredConsumers.put(consumer, spiProviders);
+    }
+    
+    public Collection<Bundle> findConsumerRestrictions(Bundle consumer) {
+        return registeredConsumers.get(consumer);
+    }
+    
+    // TODO unRegisterConsumerBundle();
 }

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ClientWeavingHook.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ClientWeavingHook.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ClientWeavingHook.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ClientWeavingHook.java Tue Dec 14 16:55:49 2010
@@ -18,6 +18,11 @@
  */
 package org.apache.aries.spifly;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.aries.spifly.HeaderParser.PathElement;
 import org.apache.aries.spifly.api.SpiFlyConstants;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
@@ -28,9 +33,12 @@ import org.osgi.framework.hooks.weaving.
 import org.osgi.service.log.LogService;
 
 public class ClientWeavingHook implements WeavingHook {
+    private final BundleContext bundleContext;
     private final String addedImport;
     
     ClientWeavingHook(BundleContext context) {
+        bundleContext = context;
+        
         Bundle b = context.getBundle();
         String bver = b.getVersion().toString();
         String bsn = b.getSymbolicName();
@@ -42,9 +50,15 @@ public class ClientWeavingHook implement
     
 	@Override
 	public void weave(WovenClass wovenClass) {
-	    if (wovenClass.getBundleWiring().getBundle().getHeaders().get(SpiFlyConstants.SPI_CONSUMER_HEADER) != null) {
-	        Activator.activator.log(LogService.LOG_DEBUG, "Weaving class " + wovenClass.getClassName());
-	        System.out.println("*** WovenClass: " + wovenClass.getClassName());
+	    Bundle consumerBundle = wovenClass.getBundleWiring().getBundle();
+        String consumerHeader = consumerBundle.getHeaders().get(SpiFlyConstants.SPI_CONSUMER_HEADER);
+        if (consumerHeader != null) {
+	        Activator activator = Activator.activator;
+            activator.log(LogService.LOG_DEBUG, "Weaving class " + wovenClass.getClassName());            
+            
+	        if (!"true".equalsIgnoreCase(consumerHeader)) {
+	             activator.registerConsumerBundle(consumerBundle, parseHeader(consumerHeader));	            
+	        }
 	        
 	        ClassReader cr = new ClassReader(wovenClass.getBytes());
 	        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
@@ -54,4 +68,22 @@ public class ClientWeavingHook implement
 	        wovenClass.getDynamicImports().add(addedImport);
 	    }			
 	}
+
+    private Collection<Bundle> parseHeader(String consumerHeader) {
+        List<Bundle> selectedBundles = new ArrayList<Bundle>();
+
+        for (PathElement element : HeaderParser.parseHeader(consumerHeader)) {
+            String bsn = element.getAttribute("bundle");
+            if (bsn != null) {
+                for (Bundle b : bundleContext.getBundles()) {
+                    if (b.getSymbolicName().equals(bsn)) {
+                        selectedBundles.add(b);
+                        break;                        
+                    }
+                }
+            }
+        }
+        
+        return selectedBundles;
+    }
 }

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java Tue Dec 14 16:55:49 2010
@@ -29,7 +29,8 @@ import java.util.Map;
  * Stolen from Aries Blueprint Core (blueprint.utils). Need to give it back! 
  */
 public class HeaderParser  {
-
+    private HeaderParser() {}
+    
     /**
      * Parse a given OSGi header into a list of paths
      *

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java Tue Dec 14 16:55:49 2010
@@ -98,7 +98,7 @@ public class ProviderBundleTrackerCustom
                         .registerService(registrationClassName, o, props);
                 registrations.add(reg);
 
-                activator.registerSPIProviderBundle(registrationClassName, bundle);
+                activator.registerProviderBundle(registrationClassName, bundle);
                 log(LogService.LOG_INFO, "Registered service: " + reg);                
             } catch (Exception e) {
                 log(LogService.LOG_WARNING,

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Util.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Util.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Util.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Util.java Tue Dec 14 16:55:49 2010
@@ -20,9 +20,11 @@ package org.apache.aries.spifly;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleReference;
 import org.osgi.framework.wiring.BundleWiring;
 import org.osgi.service.log.LogService;
 
@@ -43,9 +45,15 @@ public class Util {
     }
         
     public static void fixContextClassloader(String cls, String method, Class<?> clsArg, ClassLoader bundleLoader) {
-        System.out.println("~~~ cls: " + cls + " method: " + method + " clarg:" + clsArg + " cl:" + bundleLoader);
+        if (!(bundleLoader instanceof BundleReference)) {
+            Activator.activator.log(LogService.LOG_WARNING, "Classloader of consuming bundle doesn't implement BundleReference: " + bundleLoader);
+            return;
+        }
+
+        BundleReference br = ((BundleReference) bundleLoader);
+        System.out.println("~~~ cls: " + cls + " method: " + method + " clarg:" + clsArg + " cl:" + bundleLoader + " clientBundle: " + br.getBundle().getSymbolicName());        
         
-        ClassLoader cl = findClassloader(clsArg);
+        ClassLoader cl = findContextClassloader(clsArg, br.getBundle());
         if (cl != null) {
             Activator.activator.log(LogService.LOG_INFO, "Temporarily setting Thread Context Classloader to: " + cl);
             Thread.currentThread().setContextClassLoader(cl);
@@ -54,14 +62,20 @@ public class Util {
         }
     }
     
-    private static ClassLoader findClassloader(Class<?> cls) {
+    private static ClassLoader findContextClassloader(Class<?> cls, Bundle consumerBundle) {
         Activator activator = Activator.activator;
         
-        Collection<Bundle> bundles = activator.findSPIProviderBundles(cls.getName());
+        Collection<Bundle> bundles = new ArrayList<Bundle>(activator.findProviderBundles(cls.getName()));
         activator.log(LogService.LOG_DEBUG, "Found bundles providing " + cls + ": " + bundles);
-        
-        if (bundles == null)
-            return null;
+                
+        Collection<Bundle> allowedBundles = activator.findConsumerRestrictions(consumerBundle);
+        if (allowedBundles != null) {
+            for (Iterator<Bundle> it = bundles.iterator(); it.hasNext(); ) {
+                if (!allowedBundles.contains(it.next())) {
+                    it.remove();
+                }
+            }
+        }
         
         switch (bundles.size()) {
         case 0:

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ClientWeavingHookTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ClientWeavingHookTest.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ClientWeavingHookTest.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ClientWeavingHookTest.java Tue Dec 14 16:55:49 2010
@@ -19,6 +19,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleReference;
 import org.osgi.framework.Version;
 import org.osgi.framework.hooks.weaving.WeavingHook;
 import org.osgi.framework.hooks.weaving.WovenClass;
@@ -54,7 +55,7 @@ public class ClientWeavingHookTest {
                 
         // ok the weaving is done, now prepare the registry for the call
         Bundle providerBundle = mockProviderBundle("impl1", 1, "META-INF/services/org.apache.aries.mytest.MySPI");        
-        Activator.activator.registerSPIProviderBundle("org.apache.aries.mytest.MySPI", providerBundle);
+        Activator.activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle);
         
         // Invoke the woven class and check that it propertly sets the TCCL so that the 
         // META-INF/services/org.apache.aries.mytest.MySPI file from impl1 is visible.
@@ -66,26 +67,23 @@ public class ClientWeavingHookTest {
 
     @Test
     public void testClientWeavingHookMultipleProviders() throws Exception {
-        BundleContext spiFlyBundleContext = mockSpiFlyBundle("spifly", Version.parseVersion("1.9.4"));               
-        
         Dictionary<String, String> headers = new Hashtable<String, String>();
         headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "true");
         Bundle consumerBundle = mockConsumerBundle(headers);
 
-        WeavingHook wh = new ClientWeavingHook(spiFlyBundleContext);
+        WeavingHook wh = new ClientWeavingHook(mockSpiFlyBundle());
 
         // Weave the TestClient class.
         URL clsUrl = getClass().getResource("TestClient.class");
         WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
-        Assert.assertEquals("Precondition", 0, wc.getDynamicImports().size());
         wh.weave(wc);
 
         Bundle providerBundle1 = mockProviderBundle("impl1", 1, "META-INF/services/org.apache.aries.mytest.MySPI");
         Bundle providerBundle2 = mockProviderBundle("impl2", 2, "META-INF/services/org.apache.aries.mytest.MySPI");
         
         // Register in reverse order to make sure the order in which bundles are sorted is correct
-        Activator.activator.registerSPIProviderBundle("org.apache.aries.mytest.MySPI", providerBundle2);
-        Activator.activator.registerSPIProviderBundle("org.apache.aries.mytest.MySPI", providerBundle1);
+        Activator.activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle2);
+        Activator.activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle1);
 
         // Invoke the woven class and check that it propertly sets the TCCL so that the 
         // META-INF/services/org.apache.aries.mytest.MySPI files from impl1 and impl2 are visible.
@@ -95,14 +93,47 @@ public class ClientWeavingHookTest {
         Assert.assertEquals("All three services should be invoked in the correct order", "ollehHELLO5", result);        
     }
     
-    private BundleContext mockSpiFlyBundle(String bsn, Version version) {
+    @Test
+    public void testClientSpecifyingProvider() throws Exception {
+        Dictionary<String, String> headers = new Hashtable<String, String>();
+        headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "java.util.ServiceLoader#load(java.lang.Class);bundle=impl2");
+        Bundle consumerBundle = mockConsumerBundle(headers);
+
+        Bundle providerBundle1 = mockProviderBundle("impl1", 1, "META-INF/services/org.apache.aries.mytest.MySPI");
+        Bundle providerBundle2 = mockProviderBundle("impl2", 2, "META-INF/services/org.apache.aries.mytest.MySPI");
+        Activator.activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle1);
+        Activator.activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle2);
+
+        WeavingHook wh = new ClientWeavingHook(mockSpiFlyBundle(consumerBundle, providerBundle1, providerBundle2));
+
+        // Weave the TestClient class.
+        URL clsUrl = getClass().getResource("TestClient.class");
+        WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
+        wh.weave(wc);
+
+        // Invoke the woven class and check that it propertly sets the TCCL so that the 
+        // META-INF/services/org.apache.aries.mytest.MySPI file from impl2 is visible.
+        Class<?> cls = wc.getDefinedClass();
+        Method method = cls.getMethod("test", new Class [] {String.class});
+        Object result = method.invoke(cls.newInstance(), "hello");
+        Assert.assertEquals("Only the services from bundle impl2 should be selected", "HELLO5", result);        
+    }
+    
+    private BundleContext mockSpiFlyBundle(Bundle ... bundles) {
+        return mockSpiFlyBundle("spifly", new Version(1, 0, 0), bundles);
+    }
+    
+    private BundleContext mockSpiFlyBundle(String bsn, Version version, Bundle ... bundles) {
         Bundle spiFlyBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.expect(spiFlyBundle.getSymbolicName()).andReturn(bsn);
+        EasyMock.expect(spiFlyBundle.getSymbolicName()).andReturn(bsn).anyTimes();
         EasyMock.expect(spiFlyBundle.getVersion()).andReturn(version);
         EasyMock.replay(spiFlyBundle);
 
         BundleContext spiFlyBundleContext = EasyMock.createMock(BundleContext.class);
         EasyMock.expect(spiFlyBundleContext.getBundle()).andReturn(spiFlyBundle);
+        List<Bundle> allBundles = new ArrayList<Bundle>(Arrays.asList(bundles));
+        allBundles.add(spiFlyBundle);
+        EasyMock.expect(spiFlyBundleContext.getBundles()).andReturn(allBundles.toArray(new Bundle [] {}));
         EasyMock.replay(spiFlyBundleContext);
         return spiFlyBundleContext;
     }
@@ -119,6 +150,7 @@ public class ClientWeavingHookTest {
         
         Bundle providerBundle = EasyMock.createMock(Bundle.class);
         EasyMock.expect(providerBundle.adapt(BundleWiring.class)).andReturn(bw);
+        EasyMock.expect(providerBundle.getSymbolicName()).andReturn(subdir).anyTimes();
         EasyMock.expect(providerBundle.getBundleId()).andReturn(id);
         EasyMock.replay(providerBundle);
         return providerBundle;
@@ -127,7 +159,7 @@ public class ClientWeavingHookTest {
     private Bundle mockConsumerBundle(Dictionary<String, String> headers) {
         // Create a mock object for the client bundle which holds the code that uses ServiceLoader.load().
         Bundle consumerBundle = EasyMock.createMock(Bundle.class);
-
+        EasyMock.expect(consumerBundle.getSymbolicName()).andReturn("testConsumer").anyTimes();
         EasyMock.expect(consumerBundle.getHeaders()).andReturn(headers);
         EasyMock.replay(consumerBundle);        
         
@@ -211,7 +243,7 @@ public class ClientWeavingHookTest {
         public Class<?> getDefinedClass() {
             try {
                 weavingComplete = true;
-                return new MyWovenClassClassLoader(className, getBytes(), getClass().getClassLoader()).loadClass(className);
+                return new MyWovenClassClassLoader(className, getBytes(), getClass().getClassLoader(), bundleContainingOriginalClass).loadClass(className);
             } catch (ClassNotFoundException e) {
                 e.printStackTrace();
                 return null;
@@ -227,14 +259,16 @@ public class ClientWeavingHookTest {
         }
     }
     
-    private static class MyWovenClassClassLoader extends ClassLoader {
+    private static class MyWovenClassClassLoader extends ClassLoader implements BundleReference {
         private final String className;
+        private final Bundle bundle;
         private final byte [] bytes;
         
-        public MyWovenClassClassLoader(String className, byte[] bytes, ClassLoader parent) {
+        public MyWovenClassClassLoader(String className, byte[] bytes, ClassLoader parent, Bundle bundle) {
             super(parent);
             
             this.className = className;
+            this.bundle = bundle;
             this.bytes = bytes;            
         }
         
@@ -252,5 +286,10 @@ public class ClientWeavingHookTest {
         public Class<?> loadClass(String name) throws ClassNotFoundException {
             return loadClass(name, false);
         }
+
+        @Override
+        public Bundle getBundle() {
+            return bundle;
+        }
     }    
 }

Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java?rev=1049157&r1=1049156&r2=1049157&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFlyTests/src/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java Tue Dec 14 16:55:49 2010
@@ -58,10 +58,10 @@ public class ProviderBundleTrackerCustom
         
         EasyMock.replay(implBundle);
         
-        Assert.assertEquals("Precondition", 0, a.findSPIProviderBundles("org.apache.aries.mytest.MySPI").size());
+        Assert.assertEquals("Precondition", 0, a.findProviderBundles("org.apache.aries.mytest.MySPI").size());
         // Call addingBundle();
         List<ServiceRegistration<?>> registrations = customizer.addingBundle(implBundle, null);
-        Collection<Bundle> bundles = a.findSPIProviderBundles("org.apache.aries.mytest.MySPI");
+        Collection<Bundle> bundles = a.findProviderBundles("org.apache.aries.mytest.MySPI");
         Assert.assertEquals(1, bundles.size());
         Assert.assertSame(implBundle, bundles.iterator().next());