Search in sources :

Example 1 with TwoLevelListChanged

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();
}
Also used : TopLevelListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListBuilder) TwoLevelListChangedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChangedBuilder) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey)

Example 2 with TwoLevelListChanged

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();
}
Also used : TwoLevelListChanged(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged) CountDownLatch(java.util.concurrent.CountDownLatch) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException) AbstractNotificationBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest) Test(org.junit.Test)

Example 3 with TwoLevelListChanged

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();
}
Also used : TwoLevelListChanged(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged) CountDownLatch(java.util.concurrent.CountDownLatch) NotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener) Test(org.junit.Test) AbstractNotificationBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest)

Example 4 with TwoLevelListChanged

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();
}
Also used : TopLevelListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListBuilder) TwoLevelListChangedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChangedBuilder) TopLevelListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey)

Example 5 with TwoLevelListChanged

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();
}
Also used : TwoLevelListChanged(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged) CountDownLatch(java.util.concurrent.CountDownLatch) AbstractNotificationBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest) Test(org.junit.Test)

Aggregations

CountDownLatch (java.util.concurrent.CountDownLatch)4 Test (org.junit.Test)4 AbstractNotificationBrokerTest (org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest)4 TwoLevelListChanged (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChanged)4 TwoLevelListChangedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelListChangedBuilder)2 TopLevelListBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListBuilder)2 TopLevelListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey)2 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 NotificationListener (org.opendaylight.yangtools.yang.binding.NotificationListener)1