use of org.openkilda.persistence.tx.TransactionCallback in project open-kilda by telstra.
the class NetworkBfdSessionServiceTest method setUp.
@Before
public void setUp() throws Exception {
RepositoryFactory repositoryFactory = Mockito.mock(RepositoryFactory.class);
when(repositoryFactory.createSwitchRepository()).thenReturn(switchRepository);
when(repositoryFactory.createBfdSessionRepository()).thenReturn(bfdSessionRepository);
when(persistenceManager.getTransactionManager()).thenReturn(transactionManager);
doAnswer(invocation -> {
TransactionCallbackWithoutResult<?> tr = invocation.getArgument(0);
tr.doInTransaction();
return null;
}).when(transactionManager).doInTransaction(Mockito.any(TransactionCallbackWithoutResult.class));
doAnswer(invocation -> {
TransactionCallback<?, ?> tr = invocation.getArgument(0);
return tr.doInTransaction();
}).when(transactionManager).doInTransaction(Mockito.any(TransactionCallback.class));
when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
switchOnlineStatusMonitor = new SwitchOnlineStatusMonitor();
endpointStatusMonitor = new EndpointStatusMonitor();
setupCarrier();
service = new NetworkBfdSessionService(persistenceManager, switchOnlineStatusMonitor, endpointStatusMonitor, carrier);
}
Aggregations