use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method flowsGetRequestTest.
@Test
public void flowsGetRequestTest() throws IOException, ClassNotFoundException {
FlowsGetRequest data = new FlowsGetRequest(flowsIdStatusRequest);
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 FlowsGetRequest);
FlowsGetRequest resultData = (FlowsGetRequest) resultCommand.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(flowsIdStatusRequest.hashCode(), resultData.getPayload().hashCode());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method eventSwitchInfoTest.
@Test
public void eventSwitchInfoTest() throws IOException, ClassNotFoundException {
SwitchInfoData data = new SwitchInfoData(SWITCH_ID, SWITCH_EVENT, "127.0.0.1", "localhost", "sw", "controller");
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 SwitchInfoData);
SwitchInfoData resultData = (SwitchInfoData) 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 removeCommandTest.
@Test
public void removeCommandTest() throws IOException, ClassNotFoundException {
RemoveFlow data = new RemoveFlow(TIMESTAMP, FLOW_NAME, COOKIE, SWITCH_ID, METER_ID);
System.out.println(data);
CommandMessage command = new CommandMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
command.setData(data);
serialize(command);
Message message = (Message) deserialize();
assertTrue(message instanceof CommandMessage);
CommandMessage resultCommand = (CommandMessage) message;
assertTrue(resultCommand.getData() != null);
RemoveFlow resultData = (RemoveFlow) resultCommand.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 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());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method dumpNetworkResponseTest.
@Test
public void dumpNetworkResponseTest() throws IOException, ClassNotFoundException {
NetworkInfoData data = new NetworkInfoData(requester, new HashSet<>(Arrays.asList(sw1, sw2)), new HashSet<>(), Collections.singleton(isl), Collections.singleton(new ImmutablePair<>(flowModel, flowModel)));
System.out.println(data);
InfoMessage info = new InfoMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
info.setData(data);
serialize(info);
Message message = (Message) deserialize();
assertTrue(message instanceof InfoMessage);
InfoMessage resultInfo = (InfoMessage) message;
assertTrue(resultInfo.getData() != null);
NetworkInfoData resultData = (NetworkInfoData) resultInfo.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
}
Aggregations