Use uint types in itm-impl tests 66/92766/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 29 Sep 2020 10:36:46 +0000 (12:36 +0200)
committerChetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Fri, 30 Oct 2020 03:48:43 +0000 (03:48 +0000)
Migrate tests to use proper types, eliminating associated warnings.

Change-Id: Ic50bfdbe31848856f47c12ecb8a51ad8109b19e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/cli/TepCommandHelperTest.java
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/impl/ItmExternalTunnelAddTest.java
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/impl/ItmExternalTunnelDeleteTest.java
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/impl/ItmInternalTunnelAddTest.java
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/impl/ItmInternalTunnelDeleteTest.java
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/impl/ItmManagerRpcServiceTest.java
itm/itm-impl/src/test/java/org/opendaylight/genius/itm/tests/OvsdbTestUtil.java

index 10394183b1a1ef50d8cec04044bda126a6ebb8e2..c220d9181566d6c6f0cf4df04a8c897e51d9dc61 100644 (file)
@@ -68,6 +68,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transp
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsKey;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -77,7 +78,7 @@ public class TepCommandHelperTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(TepCommandHelper.class);
 
-    private final int interval = 1000;
+    private final Uint16 interval = Uint16.valueOf(1000);
     private final Boolean enabled = false ;
     private final Class<? extends TunnelMonitoringTypeBase> monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
     private final String tepIp1 = "192.168.56.30";
@@ -122,7 +123,7 @@ public class TepCommandHelperTest {
     private final List<InternalTunnel> internalTunnelList = new ArrayList<>();
     private final List<StateTunnelList> stateTunnelList = new ArrayList<>() ;
     private final List<String> lowerLayerIfList = new ArrayList<>();
-    private final List<InstanceIdentifier> instanceIdentifierList = new ArrayList<>();
+    private final List<InstanceIdentifier<?>> instanceIdentifierList = new ArrayList<>();
     private final java.lang.Class<? extends TunnelTypeBase> tunnelType1 = TunnelTypeVxlan.class;
     private final java.lang.Class<? extends TunnelTypeBase> tunnelType2 = TunnelTypeGre.class;
 
@@ -233,7 +234,7 @@ public class TepCommandHelperTest {
         mergeParentTransportZoneListGre.add(mergeTransportZoneGre);
         mergeParentTransportZonesGre = new TransportZonesBuilder().setTransportZone(mergeParentTransportZoneListGre)
                 .build();
-        tunnelMonitorInterval = new TunnelMonitorIntervalBuilder().setInterval(10000).build();
+        tunnelMonitorInterval = new TunnelMonitorIntervalBuilder().setInterval(Uint16.valueOf(10000)).build();
         tunnelMonitorParams = new TunnelMonitorParamsBuilder().setEnabled(true).build();
         InternalTunnel internalTunnelTest = new InternalTunnelBuilder().setSourceDPN(dpId1).setDestinationDPN(dpId2)
                 .setTunnelInterfaceNames(Collections.singletonList(tunnelInterfaceName))
@@ -251,7 +252,7 @@ public class TepCommandHelperTest {
                 .setIfIndex(100).setLowerLayerIf(lowerLayerIfList).setType(L2vlan.class).build();
         interfaceTestNew = ItmUtils.buildTunnelInterface(dpId1, tunnelInterfaceName, destinationDevice, enabled,
                 TunnelTypeVxlan.class, ipAddress1, ipAddress2, true, enabled,monitorProtocol,
-                interval, false, null);
+                interval.toJava(), false, null);
         doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
         doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
         lenient().doReturn(FluentFutures.immediateNullFluentFuture()).when(mockWriteTx).commit();
@@ -350,7 +351,7 @@ public class TepCommandHelperTest {
 
         TunnelMonitorInterval tunnelMonitor = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
 
-        tepCommandHelper.configureTunnelMonitorInterval(interval);
+        tepCommandHelper.configureTunnelMonitorInterval(interval.toJava());
 
         verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION,tunnelMonitorIntervalIdentifier);
         verify(mockWriteTx).mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION,
@@ -452,7 +453,7 @@ public class TepCommandHelperTest {
     public void testShowTepsWithTransportZone() {
 
         try {
-            tepCommandHelper.showTeps(enabled, interval);
+            tepCommandHelper.showTeps(enabled, interval.toJava());
         } catch (TepException e) {
             LOG.error(e.getMessage());
         }
@@ -471,7 +472,7 @@ public class TepCommandHelperTest {
 
         String output = null;
         try {
-            tepCommandHelper.showTeps(enabled, interval);
+            tepCommandHelper.showTeps(enabled, interval.toJava());
         } catch (TepException e) {
             output = e.getMessage();
         }
index b2e7afcc8d7d8febf243e368d9d9fc5dabbef9ad..cf808017e1026cf51c02d02b6bd43d81e14ee8fb 100644 (file)
@@ -84,6 +84,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -91,7 +92,7 @@ public class ItmExternalTunnelAddTest {
 
     Uint64 dpId1 = Uint64.ONE;
     int vlanId = 100 ;
-    int interval = 1000;
+    Uint16 interval = Uint16.valueOf(1000);
     String portName1 = "phy0";
     String tepIp1 = "192.168.56.30";
     String tepIp2 = "192.168.56.40";
@@ -144,17 +145,17 @@ public class ItmExternalTunnelAddTest {
             InstanceIdentifier.create(TunnelMonitorInterval.class);
     InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier = null;
     InstanceIdentifier<DpnEndpoints> dpnEndpointsIdentifier = InstanceIdentifier.builder(DpnEndpoints.class).build();
-    AllocateIdOutput expectedId1 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("100")).build();
+    AllocateIdOutput expectedId1 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(100)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional1 ;
-    AllocateIdOutput expectedId2 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("101")).build();
+    AllocateIdOutput expectedId2 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(101)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional2 ;
-    AllocateIdOutput expectedId3 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("102")).build();
+    AllocateIdOutput expectedId3 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(102)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional3 ;
-    AllocateIdOutput expectedId4 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("103")).build();
+    AllocateIdOutput expectedId4 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(103)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional4 ;
-    AllocateIdOutput expectedId5 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("104")).build();
+    AllocateIdOutput expectedId5 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(104)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional5 ;
-    AllocateIdOutput expectedId6 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("105")).build();
+    AllocateIdOutput expectedId6 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(105)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional6 ;
     Optional<DpnEndpoints> optionalDpnEndPoints ;
     Optional<TunnelMonitorParams> tunnelMonitorParamsOptional;
index aa318b754180f784b781335f7d3db83087e95da4..96907f5ce73e605e61b4a34fd3e8432493f9d7dd 100644 (file)
@@ -75,6 +75,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -121,21 +122,21 @@ public class ItmExternalTunnelDeleteTest {
     List<Vteps> vtepsList = new ArrayList<>();
     java.lang.Class<? extends TunnelTypeBase> tunnelType1 = TunnelTypeVxlan.class;
 
-    AllocateIdOutput expectedId1 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("100")).build();
+    AllocateIdOutput expectedId1 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(100)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional1 ;
-    AllocateIdOutput expectedId2 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("101")).build();
+    AllocateIdOutput expectedId2 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(101)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional2 ;
-    AllocateIdOutput expectedId3 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("102")).build();
+    AllocateIdOutput expectedId3 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(102)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional3 ;
-    AllocateIdOutput expectedId4 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("103")).build();
+    AllocateIdOutput expectedId4 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(103)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional4 ;
-    AllocateIdOutput expectedId5 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("104")).build();
+    AllocateIdOutput expectedId5 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(104)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional5 ;
-    AllocateIdOutput expectedId6 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("105")).build();
+    AllocateIdOutput expectedId6 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(105)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional6 ;
-    AllocateIdOutput expectedId7 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("105")).build();
+    AllocateIdOutput expectedId7 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(105)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional7 ;
-    AllocateIdOutput expectedId8 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("106")).build();
+    AllocateIdOutput expectedId8 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(106)).build();
     Future<RpcResult<AllocateIdOutput>> idOutputOptional8 ;
     InstanceIdentifier<Interface> trunkIdentifier ;
     InstanceIdentifier<ExternalTunnel> path ;
index ce5e509e987fc5b3f5dc18c602e0c6751e6f7768..0486fe02cf860bd2275350645069c31d53c34c1b 100644 (file)
@@ -70,6 +70,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.OperationFailedException;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -85,7 +87,7 @@ public class ItmInternalTunnelAddTest {
     String portName1 = "phy0";
     String portName2 = "phy1" ;
     int vlanId = 100 ;
-    int interval = 1000;
+    Uint16 interval = Uint16.valueOf(1000);
     String tepIp1 = "192.168.56.101";
     String tepIp2 = "192.168.56.102";
     String gwyIp1 = "0.0.0.0";
@@ -140,10 +142,10 @@ public class ItmInternalTunnelAddTest {
     InstanceIdentifier<InternalTunnel> internalTunnelIdentifierGre2 = InstanceIdentifier.create(
             TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(dpId1, dpId2, tunnelType2));
 
-    AllocateIdOutput expectedId1 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("100")).build();
-    AllocateIdOutput expectedId2 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("200")).build();
-    AllocateIdOutput expectedDstID1 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("1")).build();
-    AllocateIdOutput expectedDstID2 = new AllocateIdOutputBuilder().setIdValue(Long.valueOf("2")).build();
+    AllocateIdOutput expectedId1 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(100)).build();
+    AllocateIdOutput expectedId2 = new AllocateIdOutputBuilder().setIdValue(Uint32.valueOf(200)).build();
+    AllocateIdOutput expectedDstID1 = new AllocateIdOutputBuilder().setIdValue(Uint32.ONE).build();
+    AllocateIdOutput expectedDstID2 = new AllocateIdOutputBuilder().setIdValue(Uint32.TWO).build();
 
     Future<RpcResult<AllocateIdOutput>> idOutputOptional1;
     Future<RpcResult<AllocateIdOutput>> idOutputOptional2;
index 4ac6d586f4211e4bf6110812993e2d051e7d0b23..2dd4059bb955ad2c8acf03ec855ea3755773a9ce 100644 (file)
@@ -68,6 +68,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tun
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint64;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -76,7 +77,7 @@ public class ItmInternalTunnelDeleteTest {
     Uint64 dpId1 = Uint64.ONE;
     Uint64 dpId2 = Uint64.valueOf(2);
     int vlanId = 100 ;
-    int interval = 1000;
+    Uint16 interval = Uint16.valueOf(1000);
     String portName1 = "phy0";
     String portName2 = "phy1" ;
     String parentInterfaceName = "1:phy0:100" ;
index 5648a2cb51e55a03409b1d6129fc8431cd2c8b3b..616717b8be3604f5bdd9f72738b526b49adb5e5b 100644 (file)
@@ -106,12 +106,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.R
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveTerminatingServiceActionsInputBuilder;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint64;
 
 @RunWith(MockitoJUnitRunner.class)
 public class ItmManagerRpcServiceTest {
 
-    int vlanId = 100 ;
+    Uint16 vlanId = Uint16.valueOf(100);
     String portName1 = "phy0";
     String sourceDevice = "abc";
     String destinationDevice = "xyz";
index 6005d0ab8d197b197011931f73d79c6b800de340..5a81c51b7d782659d6d6f008ef336c9f1cb0aff4 100644 (file)
@@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 public final class OvsdbTestUtil {
     private OvsdbTestUtil() {
@@ -47,7 +48,7 @@ public final class OvsdbTestUtil {
     /* methods */
     public static ConnectionInfo getConnectionInfo(int port, String strIpAddress) {
         IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(strIpAddress);
-        PortNumber portNumber = new PortNumber(port);
+        PortNumber portNumber = new PortNumber(Uint16.valueOf(port));
 
         ConnectionInfo connectionInfo =
             new ConnectionInfoBuilder().setRemoteIp(ipAddress).setRemotePort(portNumber).build();