use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged in project controller by opendaylight.
the class ForwardedNotificationAdapterTest method createTestData.
private TwoLevelListChanged createTestData() {
final TwoLevelListChangedBuilder tb = new TwoLevelListChangedBuilder();
tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().setKey(new TopLevelListKey("test")).build()));
return tb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged in project controller by opendaylight.
the class ForwardedNotificationAdapterTest method testNotifSubscription2.
@Test
public void testNotifSubscription2() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
final TwoLevelListChanged testData = createTestData();
final TestNotifListener testNotifListener = new TestNotifListener(latch);
final ListenerRegistration<TestNotifListener> listenerRegistration = getNotificationService().registerNotificationListener(testNotifListener);
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);
assertEquals(testData, testNotifListener.getReceivedNotifications().get(0));
listenerRegistration.close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged in project controller by opendaylight.
the class BackwardsCompatibleNotificationBrokerTest method testNotifSubscriptionForwarded.
@Test
public void testNotifSubscriptionForwarded() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
final TwoLevelListChanged testData = createTestData();
final NotifTestListenerChild testNotifListener = new NotifTestListenerChild(latch);
final ListenerRegistration<NotificationListener> listenerRegistration = notificationProviderService.registerNotificationListener(testNotifListener);
notificationProviderService.publish(testData);
latch.await(500L, TimeUnit.MILLISECONDS);
assertTrue(testNotifListener.getReceivedNotifications().size() == 1);
assertEquals(testData, testNotifListener.getReceivedNotifications().get(0));
listenerRegistration.close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged in project controller by opendaylight.
the class BackwardsCompatibleNotificationBrokerTest method createTestData.
private TwoLevelListChanged createTestData() {
final TwoLevelListChangedBuilder tb = new TwoLevelListChangedBuilder();
tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().setKey(new TopLevelListKey("test")).build()));
return tb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged in project controller by opendaylight.
the class ForwardedNotificationAdapterTest method testNotifSubscription3.
@Test
public void testNotifSubscription3() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
final TwoLevelListChanged testData = createTestData();
final TestNotifListener testNotifListener = new TestNotifListener(latch);
final ListenerRegistration<TestNotifListener> listenerRegistration = getNotificationService().registerNotificationListener(testNotifListener);
assertNotSame(NotificationPublishService.REJECTED, getNotificationPublishService().offerNotification(testData, 5, TimeUnit.SECONDS));
latch.await();
assertTrue(testNotifListener.getReceivedNotifications().size() == 1);
assertEquals(testData, testNotifListener.getReceivedNotifications().get(0));
listenerRegistration.close();
}
Aggregations