当前位置: 首页>>代码示例>>Java>>正文


Java AsyncDataChangeEvent类代码示例

本文整理汇总了Java中org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java AsyncDataChangeEvent类的具体用法?Java AsyncDataChangeEvent怎么用?Java AsyncDataChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AsyncDataChangeEvent类属于org.opendaylight.controller.md.sal.common.api.data包,在下文中一共展示了AsyncDataChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putTopLevelOneNested

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();

    assertNotNull(change);

    /*
     * Created data must not contain nested-list item, since that is two-level deep.
     */
    assertNotContains(change.getCreatedData(), TOP_LEVEL,path(FOO, BAR));
    assertContains(change.getCreatedData(), path(FOO) );

    assertEmpty(change.getUpdatedData());
    assertEmpty(change.getRemovedPaths());

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:WildcardedScopeBaseTest.java

示例2: replaceTopLevelNestedChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
        ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
    assertNotNull(change);
    /*
     * Created data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getCreatedData(), path(FOO, BAZ));
    assertContains(change.getUpdatedData(), path(FOO));
    assertNotContains(change.getUpdatedData(), TOP_LEVEL);
    /*
     * Removed data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getRemovedPaths(), path(FOO, BAR));

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedScopeBaseTest.java

示例3: nestedListExistsRootDeleted

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
        ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();

    assertEmpty(change.getCreatedData());
    assertEmpty(change.getUpdatedData());

    assertNotContains(change.getUpdatedData(), TOP_LEVEL);
    /*
     *  Scope base listener event should contain top-level-list item and nested list path
     *  and should not contain baz, bar which are two-level deep
     */
    assertContains(change.getRemovedPaths(), path(FOO));
    assertNotContains(change.getRemovedPaths(),path(FOO, BAZ),path(FOO,BAR));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:WildcardedScopeBaseTest.java

示例4: replaceTopLevelNestedChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Override
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
        ExecutionException {

    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
    assertNotNull(change);
    /*
     * Created data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getCreatedData(), path(FOO, BAZ));
    assertContains(change.getUpdatedData(), path(FOO),path(FOO).node(NestedList.QNAME));
    assertNotContains(change.getUpdatedData(), TOP_LEVEL);
    /*
     * Removed data must NOT contain nested-list item since scope is base, and change is two
     * level deep.
     */
    assertNotContains(change.getRemovedPaths(), path(FOO, BAR));

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedScopeOneTest.java

示例5: dataChanged

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void dataChanged(Object message) {

    // Do nothing if notifications are not enabled
    if (!notificationsEnabled) {
        LOG.debug("Notifications not enabled for listener {} - dropping change notification", listener);
        return;
    }

    DataChanged reply = (DataChanged) message;
    AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = reply.getChange();

    LOG.debug("Sending change notification {} to listener {}", change, listener);

    notificationCount++;

    try {
        this.listener.onDataChanged(change);
    } catch (RuntimeException e) {
        LOG.error(String.format("Error notifying listener %s", this.listener), e);
    }

    if (isValidSender(getSender())) {
        getSender().tell(DataChangedReply.INSTANCE, getSelf());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:DataChangeListener.java

示例6: testDataChangedWhenNotificationsAreEnabled

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
    new JavaTestKit(getSystem()) {
        {
            final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
            final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
            final Props props = DataChangeListener.props(mockListener, TEST_PATH);
            final ActorRef subject = getSystem().actorOf(props, "testDataChangedNotificationsEnabled");

            // Let the DataChangeListener know that notifications should be
            // enabled
            subject.tell(new EnableNotification(true, "test"), getRef());

            subject.tell(new DataChanged(mockChangeEvent), getRef());

            expectMsgClass(DataChangedReply.class);

            Mockito.verify(mockListener).onDataChanged(mockChangeEvent);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:DataChangeListenerTest.java

示例7: testDataChangedWhenNotificationsAreDisabled

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWhenNotificationsAreDisabled() {
    new JavaTestKit(getSystem()) {
        {
            final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
            final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
            final Props props = DataChangeListener.props(mockListener, TEST_PATH);
            final ActorRef subject = getSystem().actorOf(props, "testDataChangedNotificationsDisabled");

            subject.tell(new DataChanged(mockChangeEvent), getRef());

            new Within(duration("1 seconds")) {
                @Override
                protected void run() {
                    expectNoMsg();

                    Mockito.verify(mockListener, Mockito.never())
                            .onDataChanged(Mockito.any(AsyncDataChangeEvent.class));
                }
            };
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DataChangeListenerTest.java

示例8: testSeparateWrites

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void testSeparateWrites() throws InterruptedException, TimeoutException, ExecutionException {

    DataBroker dataBroker = testContext.getDataBroker();

    final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject>> eventFuture =
            SettableFuture.create();
    dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, DEEP_WILDCARDED_PATH,
        dataChangeEvent -> eventFuture.set(dataChangeEvent), DataChangeScope.SUBTREE);

    final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_0_CWU_PATH, CWU, true);
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_0_LVU_PATH, LVU, true);
    transaction.put(LogicalDatastoreType.OPERATIONAL, NODE_1_LVU_PATH, LVU, true);
    transaction.submit().get(5, TimeUnit.SECONDS);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = eventFuture.get(1000, TimeUnit.MILLISECONDS);

    validateEvent(event);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:WildcardedDataChangeListenerTest.java

示例9: deleteChildListenParent

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void deleteChildListenParent() throws InterruptedException, ExecutionException, TimeoutException {
    DataBroker dataBroker = testContext.getDataBroker();
    final WriteTransaction initTx = dataBroker.newWriteOnlyTransaction();

    initTx.put(LogicalDatastoreType.OPERATIONAL, LIST11_PATH, createList11(), true);
    initTx.submit().get(5, TimeUnit.SECONDS);

    final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject>> event = SettableFuture.create();
    dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, LIST11_PATH,
        change -> event.set(change), DataChangeScope.SUBTREE);

    final WriteTransaction deleteTx = dataBroker.newWriteOnlyTransaction();
    deleteTx.delete(LogicalDatastoreType.OPERATIONAL, LIST11_PATH.augmentation(List11SimpleAugment.class));
    deleteTx.submit().get(5, TimeUnit.SECONDS);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> receivedEvent = event.get();
    assertFalse(receivedEvent.getRemovedPaths().contains(TLL_COMPLEX_AUGMENT_PATH));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:DeleteNestedAugmentationListenParentTest.java

示例10: leafOnlyAugmentationUpdatedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void leafOnlyAugmentationUpdatedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
    assertCommit(writeTx.submit());
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE);
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf changed"));
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getUpdatedData(), SIMPLE_AUGMENT);
    assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
    assertEmpty(event.getCreatedData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:Bug1418AugmentationTest.java

示例11: leafOnlyAugmentationDeletedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void leafOnlyAugmentationDeletedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
    assertCommit(writeTx.submit());
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE);
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT);
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getRemovedPaths(), SIMPLE_AUGMENT);
    assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
    assertEmpty(event.getCreatedData());
    assertEmpty(event.getUpdatedData());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:Bug1418AugmentationTest.java

示例12: complexAugmentationCreatedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void complexAugmentationCreatedTest() {
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE, false);
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY));
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT);
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
    assertEmpty(event.getUpdatedData());
    assertEmpty(event.getOriginalData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:Bug1418AugmentationTest.java

示例13: complexAugmentationUpdatedTest

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void complexAugmentationUpdatedTest() {
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
    writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY));
    assertCommit(writeTx.submit());
    TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
            AsyncDataBroker.DataChangeScope.SUBTREE);
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY_MOD));
    assertCommit(writeTx.submit());
    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
    assertContains(event.getUpdatedData(), COMPLEX_AUGMENT);
    assertContains(event.getCreatedData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY_MOD));
    assertContains(event.getRemovedPaths(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
    assertContains(event.getOriginalData(), COMPLEX_AUGMENT);
    assertContains(event.getOriginalData(), COMPLEX_AUGMENT.child(ListViaUses.class, LIST_VIA_USES_KEY));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:Bug1418AugmentationTest.java

示例14: testDataChangeListener

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangeListener() throws Exception {
    DataChangeListener listener = mock(DataChangeListener.class);
    InstanceIdentifier<ListItem> wildCard = InstanceIdentifier.builder(ListenerTest.class)
            .child(ListItem.class).build();
    ListenerRegistration<DataChangeListener> reg = getDataBroker().registerDataChangeListener(
            LogicalDatastoreType.OPERATIONAL, wildCard, listener, AsyncDataBroker.DataChangeScope.SUBTREE);

    final ListItem item = writeListItem();

    ArgumentCaptor<AsyncDataChangeEvent> captor = ArgumentCaptor.forClass(AsyncDataChangeEvent.class);

    verify(listener, timeout(100)).onDataChanged(captor.capture());

    AsyncDataChangeEvent event = captor.getValue();
    assertEquals("createdData", 1, event.getCreatedData().size());
    assertEquals("ListItem", item, event.getCreatedData().values().iterator().next());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:Bug4513Test.java

示例15: writeTopWithListItemAugmentedListenTopSubtree

import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; //导入依赖的package包/类
@Test
public void writeTopWithListItemAugmentedListenTopSubtree() {
    TestListener listener = createListener(CONFIGURATION,TOP_PATH, DataChangeScope.SUBTREE, false);

    writeTopWithListItem(CONFIGURATION);

    AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();

    assertContains(event.getCreatedData(), TOP_PATH);
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, TreeComplexUsesAugment.class));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_ONE_KEY));
    assertContains(event.getCreatedData(), path(TOP_FOO_KEY, USES_TWO_KEY));

    assertEmpty(event.getUpdatedData());
    assertEmpty(event.getRemovedPaths());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:Bug1333DataChangeListenerTest.java


注:本文中的org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。