this.msgType2 = value2;\r
}\r
\r
+ @Override\r
+ public int hashCode() {\r
+ final int prime = 31;\r
+ int result = super.hashCode();\r
+ result = prime * result + msgType2;\r
+ return result;\r
+ }\r
+\r
@Override\r
public boolean equals(Object obj) {\r
if (this == obj)\r
public String toString() {\r
return super.toString() + " msgType2: " + msgType2;\r
}\r
-}\r
+}
\ No newline at end of file
/**\r
* @param msgVersion protocol wire version\r
* @param experimenterId experimenter / vendor ID\r
+ * @param actionSubType vendor defined subtype\r
*/\r
public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {\r
super(msgVersion, Experimenter.class, experimenterId);\r
--- /dev/null
+/*\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.extensibility;\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.protocol.rev130731.BarrierInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class EnhancedMessageCodeKeyTest {\r
+\r
+ /**\r
+ * Test EnhancedMessageCodeKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ EnhancedMessageCodeKey key1 =\r
+ new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
+ EnhancedMessageCodeKey key2 =\r
+ new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, 8, BarrierInput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierOutput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, 8, BarrierInput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 16, BarrierInput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.extensibility;\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.Output;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class EnhancedMessageTypeKeyTest {\r
+\r
+ /**\r
+ * Test EnhancedMessageTypeKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ EnhancedMessageTypeKey<?,?> key1 =\r
+ new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
+ EnhancedMessageTypeKey<?,?> key2 =\r
+ new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, Output.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null, Output.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Instruction.class, Output.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, SetField.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.extensibility;\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.protocol.rev130731.BarrierInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class MessageCodeKeyTest {\r
+\r
+ /**\r
+ * Test MessageCodeKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ MessageCodeKey key1 =\r
+ new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
+ MessageCodeKey key2 =\r
+ new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, BarrierInput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierOutput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, BarrierInput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.extensibility;\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.protocol.rev130731.BarrierInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class MessageTypeKeyTest {\r
+\r
+ /**\r
+ * Test MessageTypeKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ MessageTypeKey<?> key1 =\r
+ new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
+ MessageTypeKey<?> key2 =\r
+ new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, BarrierInput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierOutput.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ActionDeserializerKeyTest {\r
+\r
+ /**\r
+ * Test ActionDeserializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
+ ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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
+}
\ No newline at end of file
--- /dev/null
+/*\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
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class InstructionDeserializerKeyTest {\r
+\r
+ /**\r
+ * Test InstructionDeserializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
+ InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.instruction.rev130731.ApplyActions;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class InstructionSerializerKeyTest {\r
+\r
+ /**\r
+ * Test InstructionSerializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ InstructionSerializerKey<?> key1 =\r
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
+ InstructionSerializerKey<?> key2 =\r
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, WriteActions.class, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 55L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ApplyActions.class, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
-package org.opendaylight.openflowjava.protocol.api.keys.extensibility;
+package org.opendaylight.openflowjava.protocol.api.keys;
import junit.framework.Assert;
--- /dev/null
+/*\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
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class MatchEntryDeserializerKeyTest {\r
+\r
+ /**\r
+ * Test MatchEntryDeserializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
+ MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 0);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
+ key2.setExperimenterId(158L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
+ key2.setExperimenterId(158L);\r
+ key1.setExperimenterId(158L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.oxm.rev130731.InPhyPort;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class MatchEntrySerializerKeyTest {\r
+\r
+ /**\r
+ * Test MatchEntrySerializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>\r
+ (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
+ MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>\r
+ (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
+ OpenflowBasicClass.class, InPhyPort.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
+ Nxm0Class.class, InPort.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ OpenflowBasicClass.class, InPhyPort.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
+ OpenflowBasicClass.class, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
+ null, InPhyPort.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.experimenter;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterActionDeserializerKeyTest {\r
+\r
+ /**\r
+ * Test ExperimenterActionDeserializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterActionDeserializerKey key1 =\r
+ new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ ExperimenterActionDeserializerKey key2 =\r
+ new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.experimenter;\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.ExperimenterActionSubType;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterActionSerializerKeyTest {\r
+\r
+ /**\r
+ * Test ExperimenterActionSerializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterActionSerializerKey key1 =\r
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
+ ExperimenterActionSerializerKey key2 =\r
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+\r
+ private static class TestSubType extends ExperimenterActionSubType {\r
+ // empty class - only used in test for comparation\r
+ }\r
+\r
+ private static class TestSubType2 extends ExperimenterActionSubType {\r
+ // empty class - only used in test for comparation\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.experimenter;\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.protocol.rev130731.ErrorMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterIdDeserializerKeyTest {\r
+\r
+ /**\r
+ * Test ExperimenterIdDeserializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterIdDeserializerKey key1 =\r
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
+ ExperimenterIdDeserializerKey key2 =\r
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.experimenter;\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.protocol.rev130731.ErrorMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterIdSerializerKeyTest {\r
+\r
+ /**\r
+ * Test ExperimenterIdSerializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterIdSerializerKey<?> key1 =\r
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
+ ExperimenterIdSerializerKey<?> key2 =\r
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.experimenter;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterInstructionDeserializerKeyTest {\r
+\r
+ /**\r
+ * Test ExperimenterInstructionDeserializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterInstructionDeserializerKey key1 =\r
+ new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ ExperimenterInstructionDeserializerKey key2 =\r
+ new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.experimenter;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterInstructionSerializerKeyTest {\r
+\r
+ /**\r
+ * Test ExperimenterInstructionSerializerKey equals and hashCode\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterInstructionSerializerKey key1 =\r
+ new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ ExperimenterInstructionSerializerKey key2 =\r
+ new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ Assert.assertTrue("Wrong equals", key1.equals(key2));\r
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+ key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
+ Assert.assertFalse("Wrong equals", key1.equals(key2));\r
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
+\r
+ }\r
+}
\ No newline at end of file
import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
\r
* @author michal.polkorab\r
*\r
*/\r
-public class ExperimenterDeserializerKeyFactory {\r
+public abstract class ExperimenterDeserializerKeyFactory {\r
\r
/**\r
* @param version openflow wire version\r
*/\r
public static ExperimenterIdDeserializerKey createMultipartReplyMessageDeserializerKey(\r
short version, Long experimenterId) {\r
- return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyMessage.class);\r
+ return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyExperimenterCase.class);\r
}\r
\r
/**\r
* @author michal.polkorab\r
*\r
*/\r
-public class ExperimenterSerializerKeyFactory {\r
+public abstract class ExperimenterSerializerKeyFactory {\r
\r
/**\r
* @param msgVersion openflow wire version\r
--- /dev/null
+/*\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.util;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterDeserializerKeyFactoryTest {\r
+\r
+ /**\r
+ * Test ExperimenterDeserializerKeyFactory key creation\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory\r
+ .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ ExperimenterIdDeserializerKey comparationKey =\r
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, ErrorMessage.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, 43L);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ 43L, ExperimenterMessage.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, ExperimenterMessage.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, 44L);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ 44L, MeterBandExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, MeterBandExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, 45L);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ 45L, MultipartReplyExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, MultipartReplyExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, TableFeatureProperties.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, TableFeatureProperties.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, QueueProperty.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
+ null, QueueProperty.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\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.util;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterSerializerKeyFactoryTest {\r
+\r
+ /**\r
+ * Test ExperimenterSerializerKeyFactory key creation\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory\r
+ .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
+ ExperimenterIdSerializerKey<?> comparationKey =\r
+ new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ null, ExperimenterInput.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, 43L);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ 43L, MeterBandExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ null, MeterBandExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, 44L);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ 44L, MultipartRequestExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ null, MultipartRequestExperimenterCase.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, 45L);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ 45L, TableFeatureProperties.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(\r
+ EncodeConstants.OF10_VERSION_ID, null);\r
+ comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
+ null, TableFeatureProperties.class);\r
+ Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
+ }\r
+}
\ No newline at end of file