@Test public void testSendOpenFlowMessageToCore() { Mockito.doCallRealMethod().when(shimRelay).sendOpenFlowMessageToCore(coreConnector, msg, ofVersion, 1L, 1, 1); shimRelay.sendOpenFlowMessageToCore(coreConnector, msg, ofVersion, 1L, 1, 1); Mockito.verify(factory).messageToBuffer(Mockito.eq(ofVersion), Matchers.any(ByteBuf.class), Mockito.eq(msg)); Mockito.verify(coreConnector).SendData(Matchers.any(byte[].class)); }
public void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId, long datapathId, int moduleId) { SerializationFactory factory = createSerializationFactory(); SerializerRegistry registry = new SerializerRegistryImpl(); registry.init(); ByteBuf output = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.setSerializerTable(registry); factory.messageToBuffer(ofVersion, output, msg); byte[] bytes = new byte[output.readableBytes()]; output.readBytes(bytes); Message message = new Message(NetIPUtils.StubHeaderFromPayload(bytes), bytes); message.getHeader().setMessageType(MessageType.OPENFLOW); message.getHeader().setDatapathId(datapathId); message.getHeader().setModuleId(moduleId); message.getHeader().setTransactionId((int) xId); coreConnector.SendData(message.toByteRepresentation()); }
ShimRelay { public void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId, long datapathId, int moduleId) { SerializationFactory factory = createSerializationFactory(); SerializerRegistry registry = new SerializerRegistryImpl(); registry.init(); ByteBuf output = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.setSerializerTable(registry); factory.messageToBuffer(ofVersion, output, msg); byte[] bytes = new byte[output.readableBytes()]; output.readBytes(bytes); Message message = new Message(NetIPUtils.StubHeaderFromPayload(bytes), bytes); message.getHeader().setMessageType(MessageType.OPENFLOW); message.getHeader().setDatapathId(datapathId); message.getHeader().setModuleId(moduleId); message.getHeader().setTransactionId((int) xId); coreConnector.SendData(message.toByteRepresentation()); } }
ShimRelay { public void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId, long datapathId, int moduleId) { SerializationFactory factory = createSerializationFactory(); SerializerRegistry registry = new SerializerRegistryImpl(); registry.init(); ByteBuf output = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.setSerializerTable(registry); factory.messageToBuffer(ofVersion, output, msg); byte[] bytes = new byte[output.readableBytes()]; output.readBytes(bytes); Message message = new Message(NetIPUtils.StubHeaderFromPayload(bytes), bytes); message.getHeader().setMessageType(MessageType.OPENFLOW); message.getHeader().setDatapathId(datapathId); message.getHeader().setModuleId(moduleId); message.getHeader().setTransactionId((int) xId); coreConnector.SendData(message.toByteRepresentation()); }  }
ShimRelay { public void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId, long datapathId, int moduleId) { SerializationFactory factory = createSerializationFactory(); SerializerRegistry registry = new SerializerRegistryImpl(); registry.init(); ByteBuf output = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.setSerializerTable(registry); factory.messageToBuffer(ofVersion, output, msg); byte[] bytes = new byte[output.readableBytes()]; output.readBytes(bytes); Message message = new Message(NetIPUtils.StubHeaderFromPayload(bytes), bytes); message.getHeader().setMessageType(MessageType.OPENFLOW); message.getHeader().setDatapathId(datapathId); message.getHeader().setModuleId(moduleId); message.getHeader().setTransactionId((int) xId); coreConnector.SendData(message.toByteRepresentation()); }  SerializationFactory createSerializationFactory(); DeserializationFactory createDeserializationFactory(); void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId,
            long datapathId, int moduleId); void sendToSwitch(ConnectionAdapter connectionAdapter, ByteBuf input, short ofVersion,
            ZeroMQBaseConnector coreConnector, long datapathId, int moduleId); void sendDataObjectToSwitch(ConnectionAdapter connectionAdapter, DataObject msg, short ofVersion,
            ZeroMQBaseConnector coreConnector, long datapathId, int moduleId); String getImplementedInterface(DataObject message); void sendResponseToCore(Future<RpcResult<E>> switchReply,
            final ZeroMQBaseConnector coreConnector, final short ofVersion, final long xId, final long datapathId,
            final int moduleId); }
ShimRelay { public void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId, long datapathId, int moduleId) { SerializationFactory factory = createSerializationFactory(); SerializerRegistry registry = new SerializerRegistryImpl(); registry.init(); ByteBuf output = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.setSerializerTable(registry); factory.messageToBuffer(ofVersion, output, msg); byte[] bytes = new byte[output.readableBytes()]; output.readBytes(bytes); Message message = new Message(NetIPUtils.StubHeaderFromPayload(bytes), bytes); message.getHeader().setMessageType(MessageType.OPENFLOW); message.getHeader().setDatapathId(datapathId); message.getHeader().setModuleId(moduleId); message.getHeader().setTransactionId((int) xId); coreConnector.SendData(message.toByteRepresentation()); }  SerializationFactory createSerializationFactory(); DeserializationFactory createDeserializationFactory(); void sendOpenFlowMessageToCore(ZeroMQBaseConnector coreConnector, DataObject msg, short ofVersion, long xId,
            long datapathId, int moduleId); void sendToSwitch(ConnectionAdapter connectionAdapter, ByteBuf input, short ofVersion,
            ZeroMQBaseConnector coreConnector, long datapathId, int moduleId); void sendDataObjectToSwitch(ConnectionAdapter connectionAdapter, DataObject msg, short ofVersion,
            ZeroMQBaseConnector coreConnector, long datapathId, int moduleId); String getImplementedInterface(DataObject message); void sendResponseToCore(Future<RpcResult<E>> switchReply,
            final ZeroMQBaseConnector coreConnector, final short ofVersion, final long xId, final long datapathId,
            final int moduleId);  }