X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowjava%2Fopenflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fcore%2Fconnection%2FSwitchConnectionProviderImplTest.java;h=fee78164daae887f0450475eeebc2db27b0f46e5;hb=777c94332871b8c34f56f7f2010de1536cb759ba;hp=54bcfa304c9d1f380cf9208586eca60802ee9933;hpb=9da2ccf7745c4ece86f84d355c9dfdd74b22832d;p=openflowplugin.git diff --git a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java index 54bcfa304c..fee78164da 100644 --- a/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java +++ b/openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java @@ -8,17 +8,19 @@ package org.opendaylight.openflowjava.protocol.impl.core.connection; -import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListenableFuture; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Assert; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnitRunner; +import org.opendaylight.openflowjava.protocol.api.connection.OpenflowDiagStatusProvider; import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler; import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration; import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl; @@ -34,9 +36,11 @@ import org.slf4j.LoggerFactory; * * @author michal.polkorab */ +@RunWith(MockitoJUnitRunner.class) public class SwitchConnectionProviderImplTest { @Mock SwitchConnectionHandler handler; + @Mock OpenflowDiagStatusProvider openflowPluginDiagStatusProvider; private static final int SWITCH_IDLE_TIMEOUT = 2000; private static final int WAIT_TIMEOUT = 2000; @@ -49,13 +53,13 @@ public class SwitchConnectionProviderImplTest { * Creates new {@link SwitchConnectionProvider} instance for each test. * @param protocol communication protocol */ + public void startUp(final TransportProtocol protocol) throws UnknownHostException { - MockitoAnnotations.initMocks(this); config = null; if (protocol != null) { createConfig(protocol); } - provider = new SwitchConnectionProviderImpl(config); + provider = new SwitchConnectionProviderImpl(config, openflowPluginDiagStatusProvider); } private void createConfig(final TransportProtocol protocol) throws UnknownHostException { @@ -66,7 +70,7 @@ public class SwitchConnectionProviderImplTest { tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS, "/selfSignedController", PathType.CLASSPATH, - Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")) ; + List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")); } config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT, true, false, CHANNEL_OUTBOUND_QUEUE_SIZE); @@ -77,8 +81,8 @@ public class SwitchConnectionProviderImplTest { * Tests provider startup - without configuration and {@link SwitchConnectionHandler}. */ @Test - public void testStartup1() { - provider = new SwitchConnectionProviderImpl(config); + public void testStartup1() throws UnknownHostException { + startUp(null); final ListenableFuture future = provider.startup(); try { future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);