import org.junit.Test;
import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
import org.opendaylight.controller.remote.rpc.TerminationMonitor;
-import org.opendaylight.controller.remote.rpc.registry.gossip.Messages.GossiperMessages.GossipEnvelope;
-import org.opendaylight.controller.remote.rpc.registry.gossip.Messages.GossiperMessages.GossipStatus;
public class GossiperTest {
@After
public void resetMocks() {
reset(mockGossiper);
-
}
@Test
@SuppressWarnings("unchecked")
@Test
public void testReceiveGossipStatus_WhenSenderIsNonMemberShouldIgnore() {
-
Address nonMember = new Address("tcp", "non-member");
GossipStatus remoteStatus = new GossipStatus(nonMember, mock(Map.class));
verify(mockGossiper, times(0)).getSender();
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings("unchecked")
@Test
public void testReceiveGossipWhenNotAddressedToSelfShouldIgnore() {
- Address notSelf = new Address("tcp", "not-self");
-
- GossipEnvelope envelope = new GossipEnvelope(notSelf, notSelf, mock(Map.class));
doNothing().when(mockGossiper).updateRemoteBuckets(anyMap());
- mockGossiper.receiveGossip(envelope);
+ Address notSelf = new Address("tcp", "not-self");
+ mockGossiper.receiveGossip(new GossipEnvelope(notSelf, notSelf, mock(Map.class)));
verify(mockGossiper, times(0)).updateRemoteBuckets(anyMap());
}
* @return instance of Gossiper class
*/
private static Gossiper createGossiper() {
- final Props props = Gossiper.testProps(new RemoteRpcProviderConfig(system.settings().config()));
+ final RemoteRpcProviderConfig config =
+ new RemoteRpcProviderConfig.Builder("unit-test")
+ .withConfigReader(ConfigFactory::load).build();
+ final Props props = Gossiper.testProps(config);
final TestActorRef<Gossiper> testRef = TestActorRef.create(system, props, "testGossiper");
return testRef.underlyingActor();