Search in sources :

Example 1 with FlowQueueData

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());
}
Also used : FlowQueueData(org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData) Test(org.junit.Test)

Example 2 with FlowQueueData

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());
}
Also used : FlowQueueData(org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData) Test(org.junit.Test)

Example 3 with FlowQueueData

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());
}
Also used : FlowQueueData(org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData) FlowPathSwapRequest(org.openkilda.messaging.command.flow.FlowPathSwapRequest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 FlowQueueData (org.openkilda.wfm.topology.reroute.service.OperationQueueService.FlowQueueData)3 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)1