Merge "Remove redundant type specifiers"
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / util / NodeConnectorRefToPortTranslatorTest.java
index 9245bbbe01a4ca8308bd7d8b53e5551fd80caf37..75b499dd5404e5d1a8dfcaea699ff96739b385ce 100644 (file)
@@ -1,20 +1,20 @@
+/*
+ * 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.openflowplugin.impl.util;
 
 import com.google.common.collect.Lists;
+import java.math.BigInteger;
 import junit.framework.TestCase;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
-import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;
@@ -24,32 +24,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
-import static org.mockito.Mockito.*;
-
-import java.math.BigInteger;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Created by Tomas Slusny on 24.3.2016.
- */
 @RunWith(MockitoJUnitRunner.class)
 public class NodeConnectorRefToPortTranslatorTest extends TestCase {
 
-    static final String PACKET_DATA = "Test_Data";
-    static final Long PORT_NO = 5l;
-    static final Long SECOND_PORT_NO = 6l;
-    static final BigInteger DATA_PATH_ID = BigInteger.TEN;
-    static final short OF_VERSION = OFConstants.OFP_VERSION_1_3;
-    static final String ID_VALUE = "openflow:" + DATA_PATH_ID;
-    static final Long TABLE_ID = 42L;
+    private static final String PACKET_DATA = "Test_Data";
+    private static final Long PORT_NO = 5L;
+    private static final BigInteger DATA_PATH_ID = BigInteger.TEN;
+    private static final short OF_VERSION = OFConstants.OFP_VERSION_1_3;
+    private static final Long TABLE_ID = 42L;
 
     private static PacketIn createPacketIn(long portNo) {
         InPortBuilder inPortBuilder = new InPortBuilder()
@@ -78,27 +63,6 @@ public class NodeConnectorRefToPortTranslatorTest extends TestCase {
                 .build();
     }
 
-    @Before
-    public void setUp() throws Exception {
-        // Initialize the OpenFlow version/port map
-        OpenflowPortsUtil.init();
-    }
-
-    @Test(expected = NullPointerException.class)
-    public void testForNotNullablePacketInInGetPortNo() throws Exception {
-        NodeConnectorRefToPortTranslator.getPortNoFromPacketIn(null);
-    }
-
-    @Test(expected = NullPointerException.class)
-    public void testForNotNullablePacketInInToNodeConnectorRef() throws Exception {
-        NodeConnectorRefToPortTranslator.toNodeConnectorRef(null, DATA_PATH_ID);
-    }
-
-    @Test(expected = NullPointerException.class)
-    public void testForNotNullableNodeConnectorRefInFromNodeConnectorRef() throws Exception {
-        NodeConnectorRefToPortTranslator.fromNodeConnectorRef(null, OF_VERSION);
-    }
-
     @Test
     public void testGetPortNoFromPacketIn() throws Exception {
         PacketIn packetIn = createPacketIn(PORT_NO);
@@ -126,4 +90,4 @@ public class NodeConnectorRefToPortTranslatorTest extends TestCase {
         // Check if 2 NodeConnectorRef created from same PacketIn but different datapaths do not have same value
         assertNotSame(ref, NodeConnectorRefToPortTranslator.toNodeConnectorRef(packetIn, BigInteger.ONE));
     }
-}
\ No newline at end of file
+}