Fixed bug when SAL Proxy service was not returned to the consumer 80/2080/3
authorTony Tkacik <ttkacik@cisco.com>
Tue, 22 Oct 2013 15:53:14 +0000 (17:53 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 23 Oct 2013 00:39:55 +0000 (00:39 +0000)
Change-Id: I5ba2e330c86925e8e893734a7f5b64ca1eb4c1e4
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend
opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java

index 740ae887b0588bcc7648aaba49bb7f63eef5b53a..bd7f25c02ffb866376515165e5adbe18eee34273 100644 (file)
@@ -199,6 +199,8 @@ class BindingAwareBrokerImpl implements BindingAwareBroker {
 
         // Updating internal structure of registration
         routingTable.updateRoute(path, registration.instance)
+        // Update routing table / send announce to message bus
+        
         val success = paths.put(context, path);
     }
 
@@ -231,6 +233,11 @@ class BindingAwareBrokerImpl implements BindingAwareBroker {
 
         }
     }
+    
+    def createDelegate(Class<? extends RpcService> type) {
+        getManagedDirectProxy(type);
+    }
+    
 }
 
 class RoutedRpcRegistrationImpl<T extends RpcService> extends AbstractObjectRegistration<T> implements RoutedRpcRegistration<T> {
index a9031240c777961e9fdb5ad5bcb642b70c311f0a..bc53108675798173dd271b9bf18bf6db6fd3bb65 100644 (file)
@@ -44,6 +44,9 @@ class OsgiConsumerContext implements ConsumerContext {
             if (false == services.empty) {
                 val ref = services.iterator().next() as ServiceReference<T>;
                 return bundleContext.getService(ref) as T;
+            } else {
+                broker.createDelegate(module);
+                return getRpcService(module);
             }
         } catch (InvalidSyntaxException e) {
             log.error("Created filter was invalid:", e.message, e)
index f83b600fe961edfadc1ae0c7fc723b5a90976cf9..d8031e52f222fd9936deacec8f41922a61dee04c 100644 (file)
@@ -37,10 +37,9 @@ public class ToasterTest {
     @Test
     public void properInitialized() throws Exception {
 
-        Collection<ServiceReference<ToasterService>> references = ctx.getServiceReferences(ToasterService.class, null);
-        assertEquals(2, references.size());
+        Thread.sleep(500); // Waiting for services to get wired.
 
-        consumer.createToast(WhiteBread.class, 5);
+        assertTrue(consumer.createToast(WhiteBread.class, 5));
 
     }