-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionSerializerKeyTest {\r
-\r
- /**\r
- * Test ActionSerializerKey equals and hashCode\r
- */\r
- @Test\r
- public void test() {\r
- ActionSerializerKey<CopyTtlIn> key1 =\r
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
- ActionSerializerKey<?> key2 =\r
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
- Assert.assertTrue("Wrong equals", key1.equals(key2));\r
- Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, null);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOut.class, 42L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlIn.class, 55L);\r
- Assert.assertFalse("Wrong equals", key1.equals(key2));\r
- Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
- }\r
- \r
- /**\r
- * Test ActionDeserializerKey equals - additional test\r
- */\r
- @Test\r
- public void testEquals(){\r
- ActionSerializerKey<CopyTtlIn> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
- ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
- \r
- Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
- \r
- Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));\r
- \r
- key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
- Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
- }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionSerializerKeyTest {
+
+ /**
+ * Test ActionSerializerKey equals and hashCode
+ */
+ @Test
+ public void test() {
+ ActionSerializerKey<CopyTtlIn> key1 =
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+ ActionSerializerKey<?> key2 =
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOut.class, 42L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlIn.class, 55L);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test ActionSerializerKey equals - additional test
+ */
+ @Test
+ public void testEquals(){
+ ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+
+ 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);
+ Assert.assertTrue("Wrong equal by action type", key1.equals(key2));
+ key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+ Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+ Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+ }
+
+ /**
+ * Test ActionSerializerKey toString()
+ */
+ @Test
+ public void testToString(){
+ ActionSerializerKey<CopyTtlIn> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+
+ Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ + ".openflow.common.action.rev130731.actions.grouping.Action action type: org.opendaylight.yang.gen.v1.urn"
+ + ".opendaylight.openflow.common.action.rev130731.CopyTtlIn experimenterID: 42", key1.toString());
+ }