Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / multipart / MultipartReplyGroupFeaturesTest.java
index 906d87fd8b224826739681e8bc8d0815c5234861..5ac385c750f2fc9f459b12331b6bd0cc3b51e0d6 100644 (file)
-/*\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.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;\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.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyGroupFeaturesTest {\r
-\r
-    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyGroupFeatures() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+\r
-                                              "00 00 00 0F "+// types\r
-                                              "00 00 00 0F "+// capabilities\r
-                                              "00 00 00 01 "+// max groups\r
-                                              "00 00 00 02 "+// max groups\r
-                                              "00 00 00 03 "+// max groups\r
-                                              "00 00 00 04 "+// max groups\r
-                                              "0F FF 98 01 "+// actions bitmap (all actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00"// actions bitmap (no actions included)\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyGroupFeaturesCase messageCase =\r
-                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();\r
-        Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());\r
-        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true),\r
-                message.getCapabilities());\r
-        Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());\r
-        Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());\r
-        Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());\r
-        Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true,\r
-                true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     * (with different group types and capabilities)\r
-     */\r
-    @Test\r
-    public void testMultipartReplyGroupFeatures2() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+\r
-                                              "00 00 00 00 "+// types\r
-                                              "00 00 00 00 "+// capabilities\r
-                                              "00 00 00 01 "+// max groups\r
-                                              "00 00 00 02 "+// max groups\r
-                                              "00 00 00 03 "+// max groups\r
-                                              "00 00 00 04 "+// max groups\r
-                                              "00 00 00 00 "+// actions bitmap (all actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00"// actions bitmap (no actions included)\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyGroupFeaturesCase messageCase =\r
-                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();\r
-        Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());\r
-        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false),\r
-                message.getCapabilities());\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.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyGroupFeaturesTest {
+
+    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyGroupFeatures() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+
+                                              "00 00 00 0F "+// types
+                                              "00 00 00 0F "+// capabilities
+                                              "00 00 00 01 "+// max groups
+                                              "00 00 00 02 "+// max groups
+                                              "00 00 00 03 "+// max groups
+                                              "00 00 00 04 "+// max groups
+                                              "0F FF 98 01 "+// actions bitmap (all actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00"// actions bitmap (no actions included)
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyGroupFeaturesCase messageCase =
+                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
+        Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());
+        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true),
+                message.getCapabilities());
+        Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());
+        Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());
+        Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());
+        Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true,
+                true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     * (with different group types and capabilities)
+     */
+    @Test
+    public void testMultipartReplyGroupFeatures2() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+
+                                              "00 00 00 00 "+// types
+                                              "00 00 00 00 "+// capabilities
+                                              "00 00 00 01 "+// max groups
+                                              "00 00 00 02 "+// max groups
+                                              "00 00 00 03 "+// max groups
+                                              "00 00 00 04 "+// max groups
+                                              "00 00 00 00 "+// actions bitmap (all actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00"// actions bitmap (no actions included)
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyGroupFeaturesCase messageCase =
+                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
+        Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());
+        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false),
+                message.getCapabilities());
+    }
 }
\ No newline at end of file