use of org.opendaylight.genius.alivenessmonitor.internal.AlivenessMonitor in project genius by opendaylight.
the class AlivenessMonitorTest method setUp.
@SuppressWarnings("unchecked")
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(idManager.createIdPool(any(CreateIdPoolInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder.<Void>success().build()));
AlivenessProtocolHandlerRegistry alivenessProtocolHandlerRegistry = new AlivenessProtocolHandlerRegistryImpl();
alivenessMonitor = new AlivenessMonitor(dataBroker, idManager, notificationPublishService, alivenessProtocolHandlerRegistry);
arpHandler = new AlivenessProtocolHandlerARP(dataBroker, interfaceManager, alivenessProtocolHandlerRegistry, arpService);
lldpHandler = new AlivenessProtocolHandlerLLDP(dataBroker, alivenessProtocolHandlerRegistry, packetProcessingService);
mockId = 1L;
when(idManager.allocateId(any(AllocateIdInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder.success(new AllocateIdOutputBuilder().setIdValue(mockId++).build()).build()));
when(idManager.releaseId(any(ReleaseIdInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder.<Void>success().build()));
doReturn(readTx).when(dataBroker).newReadOnlyTransaction();
doReturn(writeTx).when(dataBroker).newWriteOnlyTransaction();
doReturn(readWriteTx).when(dataBroker).newReadWriteTransaction();
doNothing().when(writeTx).put(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class));
doReturn(Futures.immediateCheckedFuture(null)).when(writeTx).submit();
doReturn(Futures.immediateCheckedFuture(null)).when(readWriteTx).submit();
}
Aggregations