import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class WriteActionsInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
private OFDeserializer<Instruction> deserializer;
@Override
+ @SuppressWarnings("checkstyle:LineLength")
protected void init() {
deserializer = getRegistry().getDeserializer(
new MessageCodeActionExperimenterKey(EncodeConstants.OF13_VERSION_ID, getType(), Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
- null));
+ ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS,
+ null));
}
@Test
- public void testDeserialize() throws Exception {
+ public void testDeserialize() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
// Header
in.setShort(index, in.writerIndex() - startIndex);
final Instruction instruction = deserializer.deserialize(in);
- assertEquals(WriteActionsCase.class, instruction.getImplementedInterface());
- final WriteActionsCase actionCase = WriteActionsCase.class.cast(instruction);
+ assertEquals(WriteActionsCase.class, instruction.implementedInterface());
+ final WriteActionsCase actionCase = (WriteActionsCase) instruction;
assertEquals(1, actionCase.getWriteActions().getAction().size());
- assertEquals(PopPbbActionCase.class, actionCase.getWriteActions().getAction().get(0)
- .getAction().getImplementedInterface());
+ assertEquals(PopPbbActionCase.class, actionCase.getWriteActions().nonnullAction().values().iterator().next()
+ .getAction().implementedInterface());
assertEquals(0, in.readableBytes());
}