use of org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData in project open-kilda by telstra.
the class OperationQueueServiceTest method shouldAddLast.
@Test
public void shouldAddLast() {
service.addLast(TEST_FLOW_ID, TEST_CORRELATION_ID_A, createManualFlowRerouteRequest(TEST_FLOW_ID, false, false, ""));
service.addLast(TEST_FLOW_ID, TEST_CORRELATION_ID_B, createManualFlowRerouteRequest(TEST_FLOW_ID, false, false, ""));
FlowQueueData flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_A, flowQueueData.getTaskInProgress());
assertEquals(1, flowQueueData.getQueue().size());
service.operationCompleted(TEST_FLOW_ID, null);
flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_B, flowQueueData.getTaskInProgress());
assertEquals(0, flowQueueData.getQueue().size());
service.operationCompleted(TEST_FLOW_ID, null);
Map<String, FlowQueueData> flowCommands = service.getFlowCommands();
assertEquals(0, flowCommands.size());
}
use of org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData in project open-kilda by telstra.
the class OperationQueueServiceTest method shouldHandleTimeout.
@Test
public void shouldHandleTimeout() {
service.addLast(TEST_FLOW_ID, TEST_CORRELATION_ID_A, createManualFlowRerouteRequest(TEST_FLOW_ID, false, false, ""));
service.addLast(TEST_FLOW_ID, TEST_CORRELATION_ID_B, createManualFlowRerouteRequest(TEST_FLOW_ID, false, false, ""));
FlowQueueData flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_A, flowQueueData.getTaskInProgress());
assertEquals(1, flowQueueData.getQueue().size());
service.handleTimeout(TEST_CORRELATION_ID_A);
flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_B, flowQueueData.getTaskInProgress());
assertEquals(0, flowQueueData.getQueue().size());
service.operationCompleted(TEST_FLOW_ID, null);
Map<String, FlowQueueData> flowCommands = service.getFlowCommands();
assertEquals(0, flowCommands.size());
}
use of org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData in project open-kilda by telstra.
the class OperationQueueServiceTest method shouldAddFirst.
@Test
public void shouldAddFirst() {
service.addLast(TEST_FLOW_ID, TEST_CORRELATION_ID_A, createManualFlowRerouteRequest(TEST_FLOW_ID, false, false, ""));
service.addLast(TEST_FLOW_ID, TEST_CORRELATION_ID_C, createManualFlowRerouteRequest(TEST_FLOW_ID, false, false, ""));
FlowQueueData flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_A, flowQueueData.getTaskInProgress());
assertEquals(1, flowQueueData.getQueue().size());
service.addFirst(TEST_FLOW_ID, TEST_CORRELATION_ID_B, new FlowPathSwapRequest(TEST_FLOW_ID, false));
service.operationCompleted(TEST_FLOW_ID, null);
flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_B, flowQueueData.getTaskInProgress());
assertEquals(1, flowQueueData.getQueue().size());
service.operationCompleted(TEST_FLOW_ID, null);
flowQueueData = service.getFlowCommands().get(TEST_FLOW_ID);
assertEquals(TEST_CORRELATION_ID_C, flowQueueData.getTaskInProgress());
assertEquals(0, flowQueueData.getQueue().size());
service.operationCompleted(TEST_FLOW_ID, null);
Map<String, FlowQueueData> flowCommands = service.getFlowCommands();
assertEquals(0, flowCommands.size());
}
Aggregations