2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
11 import io.netty.buffer.ByteBuf;
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.junit.runner.RunWith;
16 import org.mockito.Matchers;
17 import org.mockito.Mock;
18 import org.mockito.Mockito;
19 import org.mockito.runners.MockitoJUnitRunner;
20 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
21 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
22 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;
23 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
27 * @author michal.polkorab
30 @RunWith(MockitoJUnitRunner.class)
31 public class OF10StatsReplyExperimenterTest {
33 @Mock DeserializerRegistry registry;
36 * Tests {@link OF10StatsReplyMessageFactory} for experimenter body translation
40 OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory();
41 factory.injectDeserializerRegistry(registry);
43 ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "
44 + "00 00 00 01"); // expID
45 MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
47 BufferHelper.checkHeaderV10(builtByFactory);
48 Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
49 Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
50 Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));