From: Robert Varga Date: Tue, 18 Feb 2014 08:53:30 +0000 (+0100) Subject: Fix a few more warnings X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~418 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=95ee56abd547a6b4809e644c2a4e1e3dc5847873 Fix a few more warnings - Remove unused string constants - Add type arguments - Removed unused field Change-Id: I8fbbd238a805d9445eecc4d7c65176ce4ff36b6d Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java b/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java index 4e4416777b..e8a52d069d 100644 --- a/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java +++ b/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java @@ -23,8 +23,6 @@ public class TestHelper { public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model"; public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model"; - private static final String OPENDAYLIGHT_SNAPSHOT = "http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/"; - private static final String OPENDAYLIGHT_RELEASE = "http://nexus.opendaylight.org/content/repositories/opendaylight.release/"; public static Option mdSalCoreBundles() { return new DefaultCompositeOption( // diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java index 274f084f01..9001aaa4de 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/RoutingUtils.java @@ -16,28 +16,28 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; public class RoutingUtils { - + public static RouteChange removalChange(C context,P path) { final ImmutableMap> announcements = ImmutableMap.>of(); final ImmutableMap> removals = ImmutableMap.>of(context, ImmutableSet.of(path)); return new RouteChangeImpl(announcements, removals); } - + public static RouteChange announcementChange(C context,P path) { final ImmutableMap> announcements = ImmutableMap.>of(context, ImmutableSet.of(path)); final ImmutableMap> removals = ImmutableMap.>of(); return new RouteChangeImpl(announcements, removals); } - - + + public static RouteChange change(Map> announcements, Map> removals) { final ImmutableMap> immutableAnnouncements = ImmutableMap.>copyOf(announcements); final ImmutableMap> immutableRemovals = ImmutableMap.>copyOf(removals); return new RouteChangeImpl(immutableAnnouncements, immutableRemovals); } - - + + private static class RouteChangeImpl implements RouteChange { private final Map> removal; private final Map> announcement; @@ -52,7 +52,7 @@ public class RoutingUtils { public Map> getAnnouncements() { return announcement; } - + @Override public Map> getRemovals() { return removal; @@ -78,7 +78,7 @@ public class RoutingUtils { if (getClass() != obj.getClass()) { return false; } - RouteChangeImpl other = (RouteChangeImpl) obj; + RouteChangeImpl other = (RouteChangeImpl) obj; if (announcement == null) { if (other.announcement != null) return false; @@ -95,5 +95,5 @@ public class RoutingUtils { } - + } diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java index 0037981a3e..ff2efed128 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java @@ -7,9 +7,27 @@ */ package org.opendaylight.controller.netconf.it; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; +import static junit.framework.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; import io.netty.channel.ChannelFuture; + +import java.io.IOException; +import java.io.InputStream; +import java.net.InetSocketAddress; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; + +import javax.management.InstanceNotFoundException; +import javax.management.Notification; +import javax.management.NotificationListener; + import org.apache.commons.lang3.StringUtils; import org.junit.After; import org.junit.Assert; @@ -44,33 +62,13 @@ import org.opendaylight.controller.netconf.monitoring.osgi.NetconfMonitoringOper import org.opendaylight.controller.netconf.persist.impl.ConfigPersisterNotificationHandler; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; import org.opendaylight.controller.netconf.util.xml.XmlUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Element; -import javax.management.InstanceNotFoundException; -import javax.management.Notification; -import javax.management.NotificationListener; -import java.io.IOException; -import java.io.InputStream; -import java.net.InetSocketAddress; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.regex.Pattern; - -import static junit.framework.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; public class NetconfConfigPersisterITTest extends AbstractNetconfConfigTest { - private static final Logger logger = LoggerFactory.getLogger(NetconfConfigPersisterITTest.class); - private static final InetSocketAddress tcpAddress = new InetSocketAddress("127.0.0.1", 12023); @@ -230,7 +228,7 @@ public class NetconfConfigPersisterITTest extends AbstractNetconfConfigTest { public VerifyingPersister() throws IOException { Persister mockedAggregator = mock(Persister.class); - doAnswer(new Answer() { + doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { ConfigSnapshotHolder configSnapshot = (ConfigSnapshotHolder) invocation.getArguments()[0]; diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java index be2c32e34f..7a840be02a 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java @@ -7,11 +7,23 @@ */ package org.opendaylight.controller.netconf.it; -import com.google.common.base.Charsets; -import com.google.common.base.Optional; -import com.google.common.collect.Sets; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; import io.netty.channel.ChannelFuture; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.Collection; +import java.util.List; +import java.util.Set; + import junit.framework.Assert; + import org.junit.Before; import org.junit.Test; import org.junit.matchers.JUnitMatchers; @@ -41,19 +53,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.Collection; -import java.util.List; -import java.util.Set; - -import static org.mockito.Matchers.anyLong; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; +import com.google.common.base.Charsets; +import com.google.common.base.Optional; +import com.google.common.collect.Sets; public class NetconfMonitoringITTest extends AbstractNetconfConfigTest { @@ -162,6 +164,8 @@ public class NetconfMonitoringITTest extends AbstractNetconfConfigTest { } } + sock.close(); + org.junit.Assert.assertThat(responseBuilder.toString(), JUnitMatchers.containsString("urn:ietf:params:netconf:capability:candidate:1.0")); org.junit.Assert.assertThat(responseBuilder.toString(), JUnitMatchers.containsString("tomas")); }