use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class AbstractSerializerTest method flowsResponseTest.
@Test
public void flowsResponseTest() throws IOException, ClassNotFoundException {
FlowsResponse data = new FlowsResponse(Collections.singletonList(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 FlowsResponse);
FlowsResponse resultData = (FlowsResponse) resultInfo.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(Collections.singletonList(flowModel).hashCode(), resultData.getPayload().hashCode());
}
use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class FlowServiceImpl method getFlows.
/**
* {@inheritDoc}
*/
@Override
public List<FlowPayload> getFlows(final String correlationId) {
LOGGER.debug("\n\n\nGet flows: ENTER {}={}\n", CORRELATION_ID, correlationId);
// TODO: why does FlowsGetRequest use empty FlowIdStatusPayload? Delete if not needed.
FlowsGetRequest data = new FlowsGetRequest(new FlowIdStatusPayload());
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageConsumer.clear();
messageProducer.send(topic, request);
Message message = (Message) messageConsumer.poll(correlationId);
FlowsResponse response = (FlowsResponse) validateInfoMessage(request, message, correlationId);
List<FlowPayload> result = Converter.buildFlowsPayloadByFlows(response.getPayload());
logger.debug("\nGet flows: EXIT {}={}, num_flows {}\n\n\n", CORRELATION_ID, correlationId, result.size());
return result;
}
Aggregations