From: Tony Tkacik Date: Tue, 22 Oct 2013 15:53:14 +0000 (+0200) Subject: Fixed bug when SAL Proxy service was not returned to the consumer X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-1~585 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=ee7b48483f602adb6179960baad1ba76e20770c3 Fixed bug when SAL Proxy service was not returned to the consumer Change-Id: I5ba2e330c86925e8e893734a7f5b64ca1eb4c1e4 Signed-off-by: Tony Tkacik --- diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend index 740ae887b0..bd7f25c02f 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend @@ -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 type) { + getManagedDirectProxy(type); + } + } class RoutedRpcRegistrationImpl extends AbstractObjectRegistration implements RoutedRpcRegistration { diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend index a9031240c7..bc53108675 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiConsumerContext.xtend @@ -44,6 +44,9 @@ class OsgiConsumerContext implements ConsumerContext { if (false == services.empty) { val ref = services.iterator().next() as ServiceReference; 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) diff --git a/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java b/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java index f83b600fe9..d8031e52f2 100644 --- a/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java +++ b/opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java @@ -37,10 +37,9 @@ public class ToasterTest { @Test public void properInitialized() throws Exception { - Collection> 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)); }