-/**
+/*
* Copyright (c) 2016 Cisco Systems, Inc. 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.nx.codec.action;
import static org.junit.Assert.assertNull;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.openflowjava.nx.NiciraExtensionCodecRegistratorImpl;
import org.opendaylight.openflowjava.nx.api.NiciraActionDeserializerKey;
import org.opendaylight.openflowjava.nx.api.NiciraConstants;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yangtools.yang.common.Uint32;
@RunWith(MockitoJUnitRunner.class)
public class ActionDeserializerTest {
private static final short VERSION = 4;
- private static final long EXPERIMENT_ID = NiciraConstants.NX_VENDOR_ID;
+ private static final Uint32 EXPERIMENT_ID = NiciraConstants.NX_VENDOR_ID;
private static final byte SUBTYPE = 10;
@Before
actionDeserializer = new ActionDeserializer(VERSION);
buffer = ByteBufAllocator.DEFAULT.buffer();
providers = new LinkedList<>();
-
-
}
-
/**
* If NiciraExtensionCodecRegistratorImpl.getActionDeserializer(actionSerializerKey) returns NULL
- * then NULL should be returned
+ * then NULL should be returned.
*/
@Test
public void deserializeTest() {
}
/**
- * If experimentId is different from NiciraConstants.NX_VENDOR_ID
- * then exception should be thrown
+ * If experimentId is different from NiciraConstants.NX_VENDOR_ID then exception should be thrown.
*/
@Test(expected = IllegalStateException.class)
public void deserializeTest1() {
Mockito.verify(deserializer).deserialize(buffer);
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
//size of experiment type
message.writeShort(1);
//size of length
message.writeShort(13);
//experimentId
- message.writeInt((int)EXPERIMENT_ID);
+ message.writeInt(EXPERIMENT_ID.intValue());
//subtype
message.writeShort(SUBTYPE);
}
- private void createBufferWithWrongExperimentId(ByteBuf message) {
+ private static void createBufferWithWrongExperimentId(ByteBuf message) {
//size of experiment type
message.writeShort(1);
//size of length
niciraExtensionCodecRegistrator.registerActionDeserializer(key, deserializer);
}
-}
\ No newline at end of file
+}