Search in sources :

Example 11 with FlowResponse

use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.

the class FlowTopologyTest method createFlowCommandBoltTest.

@Test
public void createFlowCommandBoltTest() throws Exception {
    ConsumerRecord<String, String> record;
    String flowId = UUID.randomUUID().toString();
    createFlow(flowId);
    record = cacheConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    InfoMessage message = objectMapper.readValue(record.value(), InfoMessage.class);
    ImmutablePair<Flow, Flow> flow = getFlowPayload(message);
    assertNotNull(flow);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
    FlowResponse response = (FlowResponse) infoMessage.getData();
    assertNotNull(response);
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) RemoveFlow(org.openkilda.messaging.command.flow.RemoveFlow) Flow(org.openkilda.messaging.model.Flow) InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 12 with FlowResponse

use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.

the class AbstractSerializerTest method flowResponseTest.

@Test
public void flowResponseTest() throws IOException, ClassNotFoundException {
    FlowResponse data = new FlowResponse(flowModel);
    System.out.println(data);
    InfoMessage info = new InfoMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
    serialize(info);
    Message message = (Message) deserialize();
    assertTrue(message instanceof InfoMessage);
    InfoMessage resultInfo = (InfoMessage) message;
    assertTrue(resultInfo.getData() instanceof FlowResponse);
    FlowResponse resultData = (FlowResponse) resultInfo.getData();
    System.out.println(resultData);
    assertEquals(data, resultData);
    assertEquals(data.hashCode(), resultData.hashCode());
    assertEquals(flowModel.hashCode(), resultData.getPayload().hashCode());
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) CommandMessage(org.openkilda.messaging.command.CommandMessage) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) InfoMessage(org.openkilda.messaging.info.InfoMessage) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) Test(org.junit.Test)

Aggregations

InfoMessage (org.openkilda.messaging.info.InfoMessage)12 FlowResponse (org.openkilda.messaging.info.flow.FlowResponse)12 Test (org.junit.Test)6 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)6 RemoveFlow (org.openkilda.messaging.command.flow.RemoveFlow)6 Flow (org.openkilda.messaging.model.Flow)6 Message (org.openkilda.messaging.Message)5 CommandMessage (org.openkilda.messaging.command.CommandMessage)5 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)5 Ignore (org.junit.Ignore)1 FlowCreateRequest (org.openkilda.messaging.command.flow.FlowCreateRequest)1 FlowGetRequest (org.openkilda.messaging.command.flow.FlowGetRequest)1 FlowUpdateRequest (org.openkilda.messaging.command.flow.FlowUpdateRequest)1 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)1 MessageException (org.openkilda.messaging.error.MessageException)1 PathInfoData (org.openkilda.messaging.info.event.PathInfoData)1 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)1 Flow (org.openkilda.topology.domain.Flow)1