Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / applications / topology-lldp-discovery / src / test / java / org / opendaylight / openflowplugin / applications / topology / lldp / LLDPLinkAgerTest.java
index 5c259265a0e8a2d8ac0d311a84ccc1cad33fe85a..f72371e80b35b2284ce5dfb3ebead63269844bba 100644 (file)
@@ -1,11 +1,10 @@
-/**
+/*
  * 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.applications.topology.lldp;
 
 import static org.junit.Assert.assertFalse;
@@ -19,7 +18,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.eos.binding.api.Entity;
@@ -37,27 +36,21 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfigBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * Test for {@link LLDPLinkAger}.
  */
 @RunWith(MockitoJUnitRunner.class)
 public class LLDPLinkAgerTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LLDPLinkAgerTest.class);
-
-    private static final long LLDP_INTERVAL = 5L;
-    private static final long LINK_EXPIRATION_TIME = 10L;
+    private static final Uint32 LLDP_INTERVAL = Uint32.valueOf(5);
+    private static final Uint32 LINK_EXPIRATION_TIME = Uint32.TEN;
 
     /**
      * We need to wait while other tasks are finished before we can check anything in LLDPAgingTask.
      */
     private static final int SLEEP = 100;
 
-    private LLDPLinkAger lldpLinkAger;
-
     @Mock
     private LinkDiscovered link;
     @Mock
@@ -66,9 +59,8 @@ public class LLDPLinkAgerTest {
     private EntityOwnershipService eos;
     @Mock
     private DataBroker dataBroker;
-    @Mock
-    private LinkRemoved linkRemoved;
 
+    private LLDPLinkAger lldpLinkAger;
 
     @Before
     public void setUp() {
@@ -102,14 +94,14 @@ public class LLDPLinkAgerTest {
         verify(notificationService).putNotification(any(LinkRemoved.class));
     }
 
-    private TopologyLldpDiscoveryConfig getConfig() {
+    private static TopologyLldpDiscoveryConfig getConfig() {
         TopologyLldpDiscoveryConfigBuilder cfgBuilder = new TopologyLldpDiscoveryConfigBuilder();
         cfgBuilder.setTopologyLldpInterval(new NonZeroUint32Type(LLDP_INTERVAL));
         cfgBuilder.setTopologyLldpExpirationInterval(new NonZeroUint32Type(LINK_EXPIRATION_TIME));
         return cfgBuilder.build();
     }
 
-    private ConfigurationService getConfigurationService() {
+    private static ConfigurationService getConfigurationService() {
         final ConfigurationService configurationService = Mockito.mock(ConfigurationService.class);
         final TopologyLldpDiscoveryConfig config = getConfig();