use of org.openkilda.persistence.repositories.RepositoryFactory in project open-kilda by telstra.
the class RerouteServiceTest method processManualRerouteRequest.
@Test
public void processManualRerouteRequest() {
FlowRepository flowRepository = mock(FlowRepository.class);
when(flowRepository.findById(regularFlow.getFlowId())).thenReturn(Optional.of(regularFlow));
RepositoryFactory repositoryFactory = mock(RepositoryFactory.class);
when(repositoryFactory.createFlowRepository()).thenReturn(flowRepository);
PersistenceManager persistenceManager = mock(PersistenceManager.class);
when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
when(persistenceManager.getTransactionManager()).thenReturn(transactionManager);
RerouteService rerouteService = new RerouteService(persistenceManager);
FlowRerouteRequest request = new FlowRerouteRequest(regularFlow.getFlowId(), true, true, false, Collections.emptySet(), "reason", true);
rerouteService.processRerouteRequest(carrier, CORRELATION_ID, request);
FlowThrottlingData expected = FlowThrottlingData.builder().correlationId(CORRELATION_ID).priority(regularFlow.getPriority()).timeCreate(regularFlow.getTimeCreate()).affectedIsl(Collections.emptySet()).force(true).effectivelyDown(true).reason("reason").build();
verify(carrier).emitManualRerouteCommand(eq(regularFlow.getFlowId()), eq(expected));
}
use of org.openkilda.persistence.repositories.RepositoryFactory in project open-kilda by telstra.
the class YFlowValidatorTest method setup.
@BeforeClass
public static void setup() {
RepositoryFactory repositoryFactory = mock(RepositoryFactory.class);
when(repositoryFactory.createFlowRepository()).thenReturn(mock(FlowRepository.class));
when(repositoryFactory.createSwitchRepository()).thenReturn(mock(SwitchRepository.class));
when(repositoryFactory.createIslRepository()).thenReturn(mock(IslRepository.class));
when(repositoryFactory.createSwitchPropertiesRepository()).thenReturn(mock(SwitchPropertiesRepository.class));
when(repositoryFactory.createFlowMirrorPathRepository()).thenReturn(mock(FlowMirrorPathRepository.class));
when(repositoryFactory.createYFlowRepository()).thenReturn(mock(YFlowRepository.class));
PersistenceManager persistenceManager = mock(PersistenceManager.class);
when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
yFlowValidator = new YFlowValidator(persistenceManager);
}
use of org.openkilda.persistence.repositories.RepositoryFactory in project open-kilda by telstra.
the class IslLatencyBolt method init.
@Override
protected void init() {
TransactionManager transactionManager = persistenceManager.getTransactionManager();
RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory();
islLatencyService = new IslLatencyService(transactionManager, repositoryFactory, latencyUpdateInterval, latencyUpdateTimeRange);
}
Aggregations