use of org.opendaylight.controller.cluster.datastore.utils.MockDataChangeListener in project controller by opendaylight.
the class DataChangeListenerSupportTest method testInitialChangeListenerEventWithWildcardedListPath.
@Test
public void testInitialChangeListenerEventWithWildcardedListPath() throws Exception {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> actor = actorFactory.createTestActor(newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testInitialChangeListenerEventWithWildcardedListPath");
waitUntilLeader(actor);
final Shard shard = actor.underlyingActor();
mergeToStore(shard.getDataStore(), TEST_PATH, testNodeWithOuter(1, 2));
writeToStore(shard.getDataStore(), OUTER_CONTAINER_PATH, ImmutableNodes.containerNode(OUTER_CONTAINER_QNAME));
final MockDataChangeListener listener = new MockDataChangeListener(1);
final YangInstanceIdentifier path = OUTER_LIST_PATH.node(OUTER_LIST_QNAME);
final ActorRef dclActor = actorFactory.createActor(DataChangeListener.props(listener, path), "testInitialChangeListenerEventWithWildcardedListPath-DataChangeListener");
final DataChangeListenerSupport support = new DataChangeListenerSupport(shard);
support.onMessage(new RegisterChangeListener(path, dclActor, DataChangeScope.ONE, false), true, true);
listener.waitForChangeEvents();
listener.verifyCreatedData(0, outerEntryPath(1));
listener.verifyCreatedData(0, outerEntryPath(2));
listener.verifyNoCreatedData(0, OUTER_CONTAINER_PATH);
}
};
}
Aggregations