X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fimpl%2Ftest%2FForwardedNotificationAdapterTest.java;h=cf7ad16ad3afdc7c0a340cb646ecda9d2ae8ef25;hb=66a6b6f931af3fcd1ce61263c457304cfbdc2bb5;hp=c2cdc0caaaddff9e813e7f8f22457ea104b21844;hpb=919145b1bf7d68e436efa9b22c174965005a174a;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java index c2cdc0caaa..cf7ad16ad3 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java @@ -8,6 +8,7 @@ package org.opendaylight.controller.md.sal.binding.impl.test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; import com.google.common.collect.ImmutableList; @@ -15,8 +16,12 @@ import com.google.common.collect.ImmutableSet; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import org.junit.Assert; import org.junit.Test; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.OpendaylightMdsalListTestListener; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged; @@ -26,9 +31,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.YangModuleInfo; import org.opendaylight.yangtools.yang.binding.util.BindingReflections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ForwardedNotificationAdapterTest extends AbstractNotificationBrokerTest { + private static final Logger LOG = LoggerFactory.getLogger(ForwardedNotificationAdapterTest.class); + @Override protected Iterable getModuleInfos() throws Exception { return ImmutableSet.of(BindingReflections.getModuleInfo(TwoLevelListChanged.class)); @@ -66,7 +75,12 @@ public class ForwardedNotificationAdapterTest extends AbstractNotificationBroker final TestNotifListener testNotifListener = new TestNotifListener(latch); final ListenerRegistration listenerRegistration = getNotificationService() .registerNotificationListener(testNotifListener); - assertTrue(getNotificationPublishService().offerNotification(testData)); + try { + getNotificationPublishService().offerNotification(testData).get(1, TimeUnit.SECONDS); + } catch (ExecutionException | TimeoutException e) { + LOG.error("Notification delivery failed", e); + Assert.fail("notification should be delivered"); + } latch.await(); assertTrue(testNotifListener.getReceivedNotifications().size() == 1); @@ -83,7 +97,8 @@ public class ForwardedNotificationAdapterTest extends AbstractNotificationBroker final TestNotifListener testNotifListener = new TestNotifListener(latch); final ListenerRegistration listenerRegistration = getNotificationService() .registerNotificationListener(testNotifListener); - assertTrue(getNotificationPublishService().offerNotification(testData, 5, TimeUnit.SECONDS)); + assertNotSame(NotificationPublishService.REJECTED, + getNotificationPublishService().offerNotification(testData, 5, TimeUnit.SECONDS)); latch.await(); assertTrue(testNotifListener.getReceivedNotifications().size() == 1);