use of org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey in project openflowplugin by opendaylight.
the class ExperimenterDeserializerKeyFactoryTest method testCreateExperimenterMessageDeserializerKey.
@Test
public void testCreateExperimenterMessageDeserializerKey() throws Exception {
ExperimenterIdDeserializerKey createdKey;
ExperimenterIdDeserializerKey comparationKey;
createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(EncodeConstants.OF10_VERSION_ID, 43L, 1L);
comparationKey = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 43L, 1L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
}
use of org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey in project openflowplugin by opendaylight.
the class ExperimenterDeserializerKeyFactoryTest method testCreateVendorMessageDeserializerKey.
@Test
public void testCreateVendorMessageDeserializerKey() throws Exception {
ExperimenterIdDeserializerKey createdKey;
ExperimenterIdDeserializerKey comparationKey;
createdKey = ExperimenterDeserializerKeyFactory.createVendorMessageDeserializerKey(EncodeConstants.OF10_VERSION_ID, 43L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 43L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
}
use of org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey in project openflowplugin by opendaylight.
the class ExperimenterDeserializerKeyFactoryTest method testCreateMultipartReplyMessageDeserializerKey.
@Test
public void testCreateMultipartReplyMessageDeserializerKey() throws Exception {
ExperimenterIdDeserializerKey createdKey;
ExperimenterIdDeserializerKey comparationKey;
createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(EncodeConstants.OF10_VERSION_ID, 45L, 1L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 45L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
}
use of org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey in project openflowplugin by opendaylight.
the class ExperimenterIdDeserializerKeyTest method testEquals.
/**
* Test ExperimenterIdDeserializerKey equals - additional test.
*/
@Test
public void testEquals() {
ExperimenterIdDeserializerKey key1 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
ExperimenterIdDeserializerKey key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
}
use of org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey in project openflowplugin by opendaylight.
the class ExperimenterIdDeserializerKeyTest method test.
/**
* Test ExperimenterIdDeserializerKey equals and hashCode.
*/
@Test
public void test() {
ExperimenterIdDeserializerKey key1 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
ExperimenterIdDeserializerKey key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
Aggregations