use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput in project openflowplugin by opendaylight.
the class VendorInputMessageFactoryTest method test.
/**
* Tests {@link VendorInputMessageFactory#serialize(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
* .protocol.rev130731.ExperimenterOfMessage, ByteBuf)}.
*/
@Test
public void test() {
Mockito.when(registry.getSerializer(Matchers.<MessageTypeKey<?>>any())).thenReturn(serializer);
VendorInputMessageFactory factory = new VendorInputMessageFactory();
factory.injectSerializerRegistry(registry);
final ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
builder.setXid(12345L);
builder.setExperimenter(new ExperimenterId(42L));
builder.setExpType(84L);
builder.setExperimenterDataOfChoice(vendorData);
ExperimenterInput experimenterInput = builder.build();
Mockito.when(registry.getSerializer(Matchers.<ExperimenterIdSerializerKey<ExperimenterDataOfChoice>>any())).thenReturn(foundSerializer);
factory.serialize(experimenterInput, buffer);
Mockito.verify(foundSerializer, Mockito.times(1)).serialize(experimenterInput.getExperimenterDataOfChoice(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput in project openflowplugin by opendaylight.
the class ExperimenterInputMessageFactoryTest method testV13.
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
* lookup and serialization.
*/
@Test
public void testV13() throws Exception {
startUp(false);
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setExperimenter(new ExperimenterId(42L));
builder.setExpType(21L);
builder.setExperimenterDataOfChoice(vendorData);
ExperimenterInput input = builder.build();
Mockito.when(registry.getSerializer((ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
expFactory.serialize(input, out);
Mockito.verify(serializer, Mockito.times(1)).serialize(input.getExperimenterDataOfChoice(), out);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput in project openflowplugin by opendaylight.
the class ExperimenterInputMessageFactoryTest method testV10.
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
* lookup and serialization.
*/
@Test
public void testV10() throws Exception {
startUp(false);
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setExperimenter(new ExperimenterId(42L));
builder.setExpType(21L);
builder.setExperimenterDataOfChoice(vendorData);
ExperimenterInput input = builder.build();
Mockito.when(registry.getSerializer((ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
expFactory.serialize(input, out);
Mockito.verify(serializer, Mockito.times(1)).serialize(input.getExperimenterDataOfChoice(), out);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput in project openflowplugin by opendaylight.
the class ExperimenterInputMessageFactoryTest method testV10Real.
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
* lookup and serialization.
*/
@Test(expected = IllegalStateException.class)
public void testV10Real() throws Exception {
startUp(true);
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setExperimenter(new ExperimenterId(42L));
builder.setExpType(21L);
builder.setExperimenterDataOfChoice(vendorData);
ExperimenterInput input = builder.build();
expFactory.serialize(input, out);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput in project openflowplugin by opendaylight.
the class ExperimenterInputMessageFactoryTest method testV13Real.
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
* lookup and serialization.
*/
@Test(expected = IllegalStateException.class)
public void testV13Real() throws Exception {
startUp(true);
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setExperimenter(new ExperimenterId(42L));
builder.setExpType(22L);
builder.setExperimenterDataOfChoice(vendorData);
ExperimenterInput input = builder.build();
expFactory.serialize(input, out);
}
Aggregations