use of org.openkilda.testing.service.lockkeeper.LockKeeperService in project open-kilda by telstra.
the class StubServiceFactory method getLockKeeperStub.
/**
* Get a stub for {@link LockKeeperService}. The instance is tied to the factory state.
*/
public LockKeeperService getLockKeeperStub() {
LockKeeperService serviceMock = mock(LockKeeperService.class);
List<ASwitchFlow> aswitchFlows = topologyDefinition.getIslsForActiveSwitches().stream().filter(isl -> isl.getAswitch() != null).map(isl -> {
ASwitchFlow asw = isl.getAswitch();
return Arrays.asList(new ASwitchFlow(asw.getInPort(), asw.getOutPort()), new ASwitchFlow(asw.getOutPort(), asw.getInPort()));
}).flatMap(List::stream).collect(toList());
when(serviceMock.getAllFlows()).thenReturn(aswitchFlows);
return serviceMock;
}
Aggregations