aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1299649 - in /aries/trunk/spi-fly/spi-fly-core/src: main/java/org/apache/aries/spifly/ main/java/org/apache/aries/spifly/api/ test/java/org/apache/aries/spifly/
Date Mon, 12 Mar 2012 12:29:34 GMT
Author: davidb
Date: Mon Mar 12 12:29:33 2012
New Revision: 1299649

URL: http://svn.apache.org/viewvc?rev=1299649&view=rev
Log:
Update serviceloader.url -> serviceloader.mediator service registration property

Modified:
    aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java
    aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/api/SpiFlyConstants.java
    aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerGenericCapabilityTest.java
    aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java

Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java?rev=1299649&r1=1299648&r2=1299649&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java
(original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizer.java
Mon Mar 12 12:29:33 2012
@@ -165,7 +165,7 @@ public class ProviderBundleTrackerCustom
                             properties = findServiceRegistrationProperties(bundle.getHeaders(),
registrationClassName, className);
 
                         if (properties != null) {
-                            properties.put(SpiFlyConstants.SERVICELOADER_URL_PROPERTY, serviceFile);
+                            properties.put(SpiFlyConstants.SERVICELOADER_MEDIATOR_PROPERTY,
spiBundle.getBundleId());
                             ServiceRegistration reg = bundle.getBundleContext()
                                     .registerService(registrationClassName, o, properties);
                             registrations.add(reg);

Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/api/SpiFlyConstants.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/api/SpiFlyConstants.java?rev=1299649&r1=1299648&r2=1299649&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/api/SpiFlyConstants.java
(original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/api/SpiFlyConstants.java
Mon Mar 12 12:29:33 2012
@@ -35,7 +35,7 @@ public interface SpiFlyConstants {
     String REGISTER_DIRECTIVE = "register";
 
     // Service registration property
-    String SERVICELOADER_URL_PROPERTY = "serviceloader.url";
+    String SERVICELOADER_MEDIATOR_PROPERTY = "serviceloader.mediator";
 
     // The names of the extenders involved
     String PROCESSOR_EXTENDER_NAME = "osgi.serviceloader.processor";

Modified: aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerGenericCapabilityTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerGenericCapabilityTest.java?rev=1299649&r1=1299648&r2=1299649&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerGenericCapabilityTest.java
(original)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerGenericCapabilityTest.java
Mon Mar 12 12:29:33 2012
@@ -56,14 +56,15 @@ import org.osgi.framework.ServiceRegistr
 public class ProviderBundleTrackerCustomizerGenericCapabilityTest {
     @Test
     public void testAddingRemovedBundle() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         ServiceRegistration sreg = EasyMock.createMock(ServiceRegistration.class);
         sreg.unregister();
@@ -96,14 +97,15 @@ public class ProviderBundleTrackerCustom
 
     @Test
     public void testCustomAttributesBundle() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         ServiceRegistration sreg = EasyMock.createMock(ServiceRegistration.class);
         EasyMock.replay(sreg);
@@ -128,14 +130,15 @@ public class ProviderBundleTrackerCustom
 
     @Test
     public void testNonServiceRegistryBundle() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         ServiceRegistration sreg = EasyMock.createMock(ServiceRegistration.class);
         EasyMock.replay(sreg);
@@ -166,15 +169,16 @@ public class ProviderBundleTrackerCustom
 
     @Test
     public void testServiceSubsetSelectionAndRegistrationProperties() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
 
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         BundleContext implBC = mockSPIBundleContext4();
         Dictionary<String, String> headers = new Hashtable<String, String>();
@@ -187,21 +191,22 @@ public class ProviderBundleTrackerCustom
         List<ServiceRegistration> registrations = customizer.addingBundle(implBundle,
null);
         assertEquals(1, registrations.size());
         assertEquals("org.apache.aries.mytest.MySPI2", registrations.iterator().next().getReference().getProperty(Constants.OBJECTCLASS));
-        assertNotNull(registrations.iterator().next().getReference().getProperty(SpiFlyConstants.SERVICELOADER_URL_PROPERTY));
+        assertNotNull(registrations.iterator().next().getReference().getProperty(SpiFlyConstants.SERVICELOADER_MEDIATOR_PROPERTY));
         assertEquals("yeah", registrations.iterator().next().getReference().getProperty("approval"));
     }
 
     @Test
     public void testProvidedSPIDirective() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
 
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         BundleContext implBC = mockSPIBundleContext4();
         Dictionary<String, String> headers = new Hashtable<String, String>();
@@ -222,7 +227,7 @@ public class ProviderBundleTrackerCustom
         boolean foundMySPI2 = false;
         for (ServiceRegistration sr : registrations) {
             actualObjectClasses.add((String) sr.getReference().getProperty(Constants.OBJECTCLASS));
-            assertNotNull(sr.getReference().getProperty(SpiFlyConstants.SERVICELOADER_URL_PROPERTY));
+            assertNotNull(sr.getReference().getProperty(SpiFlyConstants.SERVICELOADER_MEDIATOR_PROPERTY));
             if ("org.apache.aries.mytest.MySPI".equals(sr.getReference().getProperty(Constants.OBJECTCLASS)))
{
                 assertEquals("yeah", sr.getReference().getProperty("approval"));
                 foundMySPI = true;
@@ -239,15 +244,16 @@ public class ProviderBundleTrackerCustom
 
     @Test
     public void testMultipleServiceInstancesAndTypes() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
 
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         BundleContext implBC = mockSPIBundleContext4();
         Dictionary<String, String> headers = new Hashtable<String, String>();
@@ -286,14 +292,15 @@ public class ProviderBundleTrackerCustom
 
     @Test
     public void testNoServiceRegistration() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         ServiceRegistration sreg = EasyMock.createMock(ServiceRegistration.class);
         EasyMock.replay(sreg);
@@ -311,14 +318,15 @@ public class ProviderBundleTrackerCustom
     @Test
     @SuppressWarnings("unchecked")
     public void testAddingBundleWithBundleClassPath() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         BundleContext implBC = EasyMock.createMock(BundleContext.class);
         EasyMock.<Object>expect(implBC.registerService(

Modified: aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java?rev=1299649&r1=1299648&r2=1299649&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java
(original)
+++ aries/trunk/spi-fly/spi-fly-core/src/test/java/org/apache/aries/spifly/ProviderBundleTrackerCustomizerTest.java
Mon Mar 12 12:29:33 2012
@@ -46,14 +46,15 @@ import org.osgi.framework.ServiceRegistr
 public class ProviderBundleTrackerCustomizerTest {
     @Test
     public void testAddingRemovedBundle() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         ServiceRegistration sreg = EasyMock.createMock(ServiceRegistration.class);
         sreg.unregister();
@@ -100,14 +101,15 @@ public class ProviderBundleTrackerCustom
     @Test
     @SuppressWarnings("unchecked")
     public void testAddingBundleWithBundleClassPath() throws Exception {
-        Bundle spiBundle = EasyMock.createMock(Bundle.class);
-        EasyMock.replay(spiBundle);
+        Bundle mediatorBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mediatorBundle.getBundleId()).andReturn(42l).anyTimes();
+        EasyMock.replay(mediatorBundle);
         BaseActivator activator = new BaseActivator() {
             @Override
             public void start(BundleContext context) throws Exception {}
         };
 
-        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
spiBundle);
+        ProviderBundleTrackerCustomizer customizer = new ProviderBundleTrackerCustomizer(activator,
mediatorBundle);
 
         BundleContext implBC = EasyMock.createMock(BundleContext.class);
         EasyMock.<Object>expect(implBC.registerService(



Mime
View raw message