use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method flowCreateRequestTest.
@Test
public void flowCreateRequestTest() throws IOException, ClassNotFoundException {
FlowCreateRequest data = new FlowCreateRequest(flowModel);
System.out.println(data);
CommandMessage command = new CommandMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
serialize(command);
Message message = (Message) deserialize();
assertTrue(message instanceof CommandMessage);
CommandMessage resultCommand = (CommandMessage) message;
assertTrue(resultCommand.getData() instanceof FlowCreateRequest);
FlowCreateRequest resultData = (FlowCreateRequest) resultCommand.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(flowModel.hashCode(), resultData.getPayload().hashCode());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method eventPathInfoTest.
@Test
public void eventPathInfoTest() throws IOException, ClassNotFoundException {
PathInfoData data = new PathInfoData();
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 PathInfoData);
PathInfoData resultData = (PathInfoData) resultInfo.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method flowUpdateRequestTest.
@Test
public void flowUpdateRequestTest() throws IOException, ClassNotFoundException {
FlowUpdateRequest data = new FlowUpdateRequest(flowModel);
System.out.println(data);
CommandMessage command = new CommandMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
serialize(command);
Message message = (Message) deserialize();
assertTrue(message instanceof CommandMessage);
CommandMessage resultCommand = (CommandMessage) message;
assertTrue(resultCommand.getData() instanceof FlowUpdateRequest);
FlowUpdateRequest resultData = (FlowUpdateRequest) resultCommand.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(flowModel.hashCode(), resultData.getPayload().hashCode());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method flowDeleteRequestTest.
@Test
public void flowDeleteRequestTest() throws IOException, ClassNotFoundException {
Flow deleteFlow = new Flow();
deleteFlow.setFlowId(flowName);
FlowDeleteRequest data = new FlowDeleteRequest(deleteFlow);
System.out.println(data);
CommandMessage command = new CommandMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
serialize(command);
Message message = (Message) deserialize();
assertTrue(message instanceof CommandMessage);
CommandMessage resultCommand = (CommandMessage) message;
assertTrue(resultCommand.getData() instanceof FlowDeleteRequest);
FlowDeleteRequest resultData = (FlowDeleteRequest) resultCommand.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(deleteFlow.hashCode(), resultData.getPayload().hashCode());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method eventPortInfoTest.
@Test
public void eventPortInfoTest() throws IOException, ClassNotFoundException {
PortInfoData data = new PortInfoData(SWITCH_ID, INPUT_PORT, 0, PORT_CHANGE);
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 PortInfoData);
PortInfoData resultData = (PortInfoData) resultInfo.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
}
Aggregations