if (getClass() != obj.getClass()) {
return false;
}
- ExperimenterIdMeterSubTypeSerializerKey other = (ExperimenterIdMeterSubTypeSerializerKey) obj;
+ ExperimenterIdMeterSubTypeSerializerKey<?> other = (ExperimenterIdMeterSubTypeSerializerKey<?>) obj;
if (meterSubType == null) {
if (other.meterSubType != null) {
return false;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.api.keys;
import org.junit.Assert;
* @author michal.polkorab
*/
public class ActionSerializerKeyTest {
+ private static final Uint32 FORTY_TWO = Uint32.valueOf(42);
+ private static final Uint32 FIFTY_FIVE = Uint32.valueOf(55);
/**
* Test ActionSerializerKey equals and hashCode.
@Test
public void test() {
ActionSerializerKey<CopyTtlInCase> key1 =
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 42L);
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, FORTY_TWO);
ActionSerializerKey<?> key2 =
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 42L);
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, FORTY_TWO);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, (Uint32) null);
key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, (Uint32) null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOutCase.class, 42L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOutCase.class, FORTY_TWO);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 55L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, FIFTY_FIVE);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
- key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlInCase.class, 55L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlInCase.class, FIFTY_FIVE);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
}
*/
@Test
public void testEquals() {
- ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, FORTY_TWO);
ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
- CopyTtlInCase.class, 42L);
+ CopyTtlInCase.class, FORTY_TWO);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, FORTY_TWO);
Assert.assertTrue("Wrong equal by action type", key1.equals(key2));
key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, (Uint32) null);
Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
@Test
public void testToString() {
ActionSerializerKey<CopyTtlInCase> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
- CopyTtlInCase.class, 42L);
+ CopyTtlInCase.class, FORTY_TWO);
Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"
+ ".opendaylight.openflow.common.action.rev150203.actions.grouping.Action action type:"
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Unit tests for keys.
@Test
public void testEqualsAndHashcodeOfActionDeserializerKeys() {
ActionSerializerKey<ExperimenterIdCase> actionSerializerKey = new ActionSerializerKey<>(
- EncodeConstants.OF13_VERSION_ID, ExperimenterIdCase.class, 1L);
+ EncodeConstants.OF13_VERSION_ID, ExperimenterIdCase.class, Uint32.ONE);
ExperimenterActionSerializerKey experimenterActionSerializerKey = new ExperimenterActionSerializerKey(
- EncodeConstants.OF13_VERSION_ID, 1L, ExpSubType.class);
+ EncodeConstants.OF13_VERSION_ID, Uint32.ONE, ExpSubType.class);
Assert.assertFalse(actionSerializerKey.equals(experimenterActionSerializerKey));
Assert.assertFalse(experimenterActionSerializerKey.equals(actionSerializerKey));
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
import org.junit.Assert;
* @author michal.polkorab
*/
public class ExperimenterActionSerializerKeyTest {
+ private static final Uint32 FORTY_TWO = Uint32.valueOf(42);
+ private static final Uint32 FIFTY_FIVE = Uint32.valueOf(55);
/**
* Test ExperimenterActionSerializerKey equals and hashCode.
@Test
public void test() {
ExperimenterActionSerializerKey key1 =
- new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType.class);
ExperimenterActionSerializerKey key2 =
- new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType.class);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, FORTY_TWO, TestSubType.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, (Uint32) null, TestSubType.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FIFTY_FIVE, TestSubType.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FIFTY_FIVE, null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FIFTY_FIVE, TestSubType2.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
public void testEquals() {
ExperimenterActionSerializerKey key1;
ExperimenterActionSerializerKey key2;
- key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);
+ key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, null);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType2.class);
Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
- key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType.class);
Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
}
private interface TestSubType2 extends ExperimenterActionSubType {
// empty class - only used in test for comparation
}
-
-
}