use of org.opendaylight.controller.cluster.datastore.messages.DataChangedReply in project controller by opendaylight.
the class DataChangeListenerTest method testDataChangedWithNoSender.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWithNoSender() {
new TestKit(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, "testDataChangedWithNoSender");
getSystem().eventStream().subscribe(getRef(), DeadLetter.class);
subject.tell(new DataChanged(mockChangeEvent), 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 DataChangedReply", deadLetter.message() instanceof DataChangedReply);
}
}
};
}
Aggregations