use of org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply in project controller by opendaylight.
the class DataTreeChangeListenerActorTest method testDataChangedWithNoSender.
@Test
public void testDataChangedWithNoSender() {
new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
final DOMDataTreeChangeListener mockListener = Mockito.mock(DOMDataTreeChangeListener.class);
final Props props = DataTreeChangeListenerActor.props(mockListener, TEST_PATH);
final ActorRef subject = getSystem().actorOf(props, "testDataTreeChangedWithNoSender");
getSystem().eventStream().subscribe(getRef(), DeadLetter.class);
subject.tell(new DataTreeChanged(mockCandidates), ActorRef.noSender());
// Make sure no DataChangedReply is sent to DeadLetters.
while (true) {
DeadLetter deadLetter;
try {
deadLetter = expectMsgClass(duration("1 seconds"), DeadLetter.class);
} catch (AssertionError e) {
// Timed out - got no DeadLetter - this is good
break;
}
// We may get DeadLetters for other messages we don't care
// about.
Assert.assertFalse("Unexpected DataTreeChangedReply", deadLetter.message() instanceof DataTreeChangedReply);
}
}
};
}
Aggregations