Update MRI upstreams for Phosphorus
[openflowplugin.git] / extension / openflowplugin-extension-nicira / src / test / java / org / opendaylight / openflowplugin / extension / vendor / nicira / convertor / action / CtClearConvertorTest.java
1 /*
2  * Copyright (c) 2018 Redhat, Inc. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
9
10 import org.junit.Assert;
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.junit.runner.RunWith;
14 import org.mockito.Mock;
15 import org.mockito.Mockito;
16 import org.mockito.junit.MockitoJUnitRunner;
17 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.aug.nx.action.ActionCtClear;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.ct.clear.grouping.NxActionCtClear;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionCtClearNodesNodeTableFlowWriteActionsCase;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.ct.clear.grouping.NxCtClear;
23
24 /**
25  * Test for {@link CtClearConvertor}.
26  */
27 @RunWith(MockitoJUnitRunner.class)
28 public class CtClearConvertorTest {
29     @Mock
30     private NxActionCtClearNodesNodeTableFlowWriteActionsCase actionsCase;
31
32     @Mock
33     private Action action;
34
35     private CtClearConvertor ctClearConvertor;
36
37     @Before
38     public void setUp() {
39         final NxCtClear nxCtClear = Mockito.mock(NxCtClear.class);
40
41         final ActionCtClear actionCtClear = Mockito.mock(ActionCtClear.class);
42         final NxActionCtClear nxActionCtClear = Mockito.mock(NxActionCtClear.class);
43
44         ctClearConvertor = new CtClearConvertor();
45     }
46
47     @Test
48     public void testConvert() {
49         final ActionCtClear actionCtClear = (ActionCtClear) ctClearConvertor.convert(actionsCase).getActionChoice();
50         Assert.assertNotNull(actionCtClear);
51     }
52
53     @Test
54     public void testConvert1() {
55         final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
56                 = ctClearConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
57         Assert.assertNotNull(actionResult);
58         final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
59                 = ctClearConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
60         Assert.assertNotNull(actionResult1);
61         final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
62                 = ctClearConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
63         Assert.assertNotNull(actionResult2);
64         final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
65                 = ctClearConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
66         Assert.assertNotNull(actionResult3);
67         final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
68                 = ctClearConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
69         Assert.assertNotNull(actionResult4);
70         final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
71                 = ctClearConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
72         Assert.assertNotNull(actionResult5);
73     }
74 }