use of org.openkilda.messaging.command.CommandMessage 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.command.CommandMessage 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.command.CommandMessage 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.command.CommandMessage 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.command.CommandMessage 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());
}
Aggregations