Bump upstreams
[lispflowmapping.git] / mappingservice / southbound / src / test / java / org / opendaylight / lispflowmapping / southbound / LispSouthboundPluginTest.java
index 754ccbb14e3f804f7e571d741b5b7cf3e61638e7..3b0a7ab329c2dd42c3e0dbc45ec0fe91a3c4fb42 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary;
@@ -39,6 +39,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev16
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MessageType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 public class LispSouthboundPluginTest {
 
@@ -59,19 +60,18 @@ public class LispSouthboundPluginTest {
     private static final IpAddressBinary IPV6_BINARY = new IpAddressBinary(new Ipv6AddressBinary(IPV6_BYTES));
     private static final TransportAddress TRANSPORT_ADDRESS_IPV4 = new TransportAddressBuilder()
             .setIpAddress(IPV4_BINARY)
-            .setPort(new PortNumber(PORT)).build();
+            .setPort(new PortNumber(Uint16.valueOf(PORT))).build();
     private static final TransportAddress TRANSPORT_ADDRESS_IPV6 = new TransportAddressBuilder()
             .setIpAddress(IPV6_BINARY)
-            .setPort(new PortNumber(PORT)).build();
+            .setPort(new PortNumber(Uint16.valueOf(PORT))).build();
 
     @Before
     public void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException {
         lispSouthboundPlugin = new LispSouthboundPlugin(
                 Mockito.mock(DataBroker.class),
                 Mockito.mock(NotificationPublishService.class),
-                Mockito.mock(ClusterSingletonServiceProvider.class));
-        lispSouthboundPlugin.setBindingAddress(ADDRESS_1);
-        lispSouthboundPlugin.setMapRegisterCacheEnabled(false);
+                Mockito.mock(ClusterSingletonServiceProvider.class),
+                ADDRESS_1, false, 0);
 
         channel = Mockito.mock(NioDatagramChannel.class);
         xtrChannel = Mockito.mock(NioDatagramChannel.class);
@@ -143,8 +143,8 @@ public class LispSouthboundPluginTest {
         injectField("bootstrap", BOOTSTRAP_MOCK);
         lispSouthboundPlugin.setLispAddress(ADDRESS_1);
 
-        Mockito.verifyZeroInteractions(BOOTSTRAP_MOCK);
-        Mockito.verifyZeroInteractions(channel);
+        Mockito.verifyNoInteractions(BOOTSTRAP_MOCK);
+        Mockito.verifyNoInteractions(channel);
     }
 
     /**
@@ -164,7 +164,7 @@ public class LispSouthboundPluginTest {
     public void shouldListenOnXtrPortTest_false() throws NoSuchFieldException, IllegalAccessException {
         lispSouthboundPlugin.shouldListenOnXtrPort(false);
 
-        Mockito.verifyZeroInteractions(xtrChannel);
+        Mockito.verifyNoInteractions(xtrChannel);
     }
 
     /**
@@ -199,7 +199,6 @@ public class LispSouthboundPluginTest {
         Mockito.verify(elgMock).shutdownGracefully();
         Mockito.verify(handlerMock).close();
         assertNull(getField("lispSouthboundHandler"));
-        assertNull(getField("lispXtrSouthboundHandler"));
         Channel[] channels = getField("channel");
         assertNull(channels[0]);
     }
@@ -216,7 +215,7 @@ public class LispSouthboundPluginTest {
         xtrChannelField.set(lispSouthboundPlugin, xtrChannel);
     }
 
-    private static ByteBuffer parseHexString(String packet) {
+    private static ByteBuffer parseHexString(final String packet) {
         final String[] tokens = packet.split("\\s+");
         final ByteBuffer buffer = ByteBuffer.allocate(tokens.length);
         for (String token : tokens) {
@@ -226,14 +225,15 @@ public class LispSouthboundPluginTest {
         return buffer;
     }
 
-    private static <T> void injectField(String fieldName, T obj) throws NoSuchFieldException, IllegalAccessException {
+    private static <T> void injectField(final String fieldName, final T obj)
+            throws NoSuchFieldException, IllegalAccessException {
         Field field = LispSouthboundPlugin.class.getDeclaredField(fieldName);
         field.setAccessible(true);
         field.set(lispSouthboundPlugin, obj);
     }
 
     @SuppressWarnings("unchecked")
-    private static <T> T getField(String fieldName) throws NoSuchFieldException, IllegalAccessException {
+    private static <T> T getField(final String fieldName) throws NoSuchFieldException, IllegalAccessException {
         Field field = LispSouthboundPlugin.class.getDeclaredField(fieldName);
         field.setAccessible(true);