X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Ffactories%2Fmultipart%2FMultipartReplyExperimenterTest.java;h=28fecce1448c5294dc2923b715ac966e5091e7aa;hb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;hp=61110453433c9cfd00cfdde0633ad96094158084;hpb=947b220207ef75e679d72595b9d120fd8a1c8192;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java index 61110453..28fecce1 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java @@ -1,63 +1,53 @@ -/* - * 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.junit.runner.RunWith; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; -import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey; -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.protocol.rev130731.MultipartReplyMessage; - -/** - * @author michal.polkorab - * - */ -@RunWith(MockitoJUnitRunner.class) -public class MultipartReplyExperimenterTest { - - @Mock DeserializerRegistry registry; - - private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory(); - - /** - * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO - */ - @Test - public void testMultipartReplyExperimenter() { - factory.injectDeserializerRegistry(registry); - ByteBuf bb = BufferHelper.buildBuffer("FF FF 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", 65535, builtByFactory.getType().getIntValue()); - Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE()); - - Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class)); - } +/* + * 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.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; +import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey; +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.protocol.rev130731.MultipartReplyMessage; + +/** + * @author michal.polkorab + * + */ +@RunWith(MockitoJUnitRunner.class) +public class MultipartReplyExperimenterTest { + + @Mock DeserializerRegistry registry; + + private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory(); + + /** + * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO + */ + @Test + public void testMultipartReplyExperimenter() { + factory.injectDeserializerRegistry(registry); + ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 " + + "00 00 00 01 00 00 00 02"); // expID, expType + MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb); + + BufferHelper.checkHeaderV13(builtByFactory); + Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue()); + Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE()); + + Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class)); + } } \ No newline at end of file