use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class AbstractSerializerTest method flowRerouteCommandTest.
@Test
public void flowRerouteCommandTest() throws IOException, ClassNotFoundException {
FlowRerouteRequest data = new FlowRerouteRequest(flowModel, FlowOperation.CREATE);
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);
FlowRerouteRequest resultData = (FlowRerouteRequest) 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 serializeInstallTransitFlowMessageTest.
@Test
public void serializeInstallTransitFlowMessageTest() throws IOException, ClassNotFoundException {
InstallTransitFlow data = new InstallTransitFlow(TIMESTAMP, FLOW_NAME, COOKIE, SWITCH_ID, INPUT_PORT, OUTPUT_PORT, TRANSIT_VLAN_ID);
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 InstallTransitFlow);
InstallTransitFlow resultData = (InstallTransitFlow) 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 serializeInstallIngressFlowMessageTest.
@Test
public void serializeInstallIngressFlowMessageTest() throws IOException, ClassNotFoundException {
InstallIngressFlow data = new InstallIngressFlow(TIMESTAMP, FLOW_NAME, COOKIE, SWITCH_ID, INPUT_PORT, OUTPUT_PORT, INPUT_VLAN_ID, TRANSIT_VLAN_ID, OUTPUT_VLAN_TYPE, (long) BANDWIDTH, METER_ID);
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 InstallIngressFlow);
InstallIngressFlow resultData = (InstallIngressFlow) 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 serializeInstallOneSwitchFlowMessageTest.
@Test
public void serializeInstallOneSwitchFlowMessageTest() throws IOException, ClassNotFoundException {
InstallOneSwitchFlow data = new InstallOneSwitchFlow(TIMESTAMP, FLOW_NAME, COOKIE, SWITCH_ID, INPUT_PORT, OUTPUT_PORT, INPUT_VLAN_ID, OUTPUT_VLAN_ID, OUTPUT_VLAN_TYPE, (long) BANDWIDTH, METER_ID);
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 InstallOneSwitchFlow);
InstallOneSwitchFlow resultData = (InstallOneSwitchFlow) 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 eventIslInfoTest.
@Test
public void eventIslInfoTest() throws IOException, ClassNotFoundException {
PathNode payload = new PathNode(SWITCH_ID, INPUT_PORT, 0);
IslInfoData data = new IslInfoData(0L, Collections.singletonList(payload), 1000000L, IslChangeType.DISCOVERED, 900000L);
assertEquals(SWITCH_ID + "_" + String.valueOf(INPUT_PORT), data.getId());
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 IslInfoData);
IslInfoData resultData = (IslInfoData) resultInfo.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(payload.hashCode(), resultData.getPath().get(0).hashCode());
}
Aggregations