X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FConcurrentClientsTest.java;h=3b83daa693fb926a7e28831fcf64f6761d3cdd7d;hp=ea2bb9c34e4801f5c66b33ef108110602ba5c60b;hb=3931d16f10d8e41921c8463e7f01c9956828c113;hpb=803d525860fbb1974b65ba5605ba5a9dfe1928a4 diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java index ea2bb9c34e..3b83daa693 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java @@ -50,12 +50,13 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfMessage; +import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.client.NetconfClientDispatcher; import org.opendaylight.controller.netconf.client.NetconfClientDispatcherImpl; import org.opendaylight.controller.netconf.client.SimpleNetconfClientSessionListener; +import org.opendaylight.controller.netconf.client.TestingNetconfClient; import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration; import org.opendaylight.controller.netconf.client.conf.NetconfClientConfigurationBuilder; -import org.opendaylight.controller.netconf.client.test.TestingNetconfClient; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService; import org.opendaylight.controller.netconf.mapping.api.Capability; @@ -68,7 +69,6 @@ import org.opendaylight.controller.netconf.nettyutil.handler.exi.NetconfStartExi import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader; import org.opendaylight.controller.netconf.util.messages.NetconfMessageUtil; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; -import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.opendaylight.protocol.framework.NeverReconnectStrategy; import org.slf4j.Logger; @@ -77,7 +77,7 @@ import org.w3c.dom.Document; @RunWith(Parameterized.class) public class ConcurrentClientsTest { - private static final Logger logger = LoggerFactory.getLogger(ConcurrentClientsTest.class); + private static final Logger LOG = LoggerFactory.getLogger(ConcurrentClientsTest.class); private static ExecutorService clientExecutor; @@ -96,16 +96,14 @@ public class ConcurrentClientsTest { @Parameterized.Parameters() public static Collection data() { - return Arrays.asList(new Object[][]{ - {4, TestingNetconfClientRunnable.class, NetconfServerSessionNegotiatorFactory.DEFAULT_BASE_CAPABILITIES}, - {1, TestingNetconfClientRunnable.class, NetconfServerSessionNegotiatorFactory.DEFAULT_BASE_CAPABILITIES}, - // empty set of capabilities = only base 1.0 netconf capability - {4, TestingNetconfClientRunnable.class, Collections.emptySet()}, - {4, TestingNetconfClientRunnable.class, getOnlyExiServerCaps()}, - {4, TestingNetconfClientRunnable.class, getOnlyChunkServerCaps()}, - - {4, BlockingClientRunnable.class, getOnlyExiServerCaps()}, - {1, BlockingClientRunnable.class, getOnlyExiServerCaps()}, + return Arrays.asList(new Object[][]{{4, TestingNetconfClientRunnable.class, NetconfServerSessionNegotiatorFactory.DEFAULT_BASE_CAPABILITIES}, + {1, TestingNetconfClientRunnable.class, NetconfServerSessionNegotiatorFactory.DEFAULT_BASE_CAPABILITIES}, + // empty set of capabilities = only base 1.0 netconf capability + {4, TestingNetconfClientRunnable.class, Collections.emptySet()}, + {4, TestingNetconfClientRunnable.class, getOnlyExiServerCaps()}, + {4, TestingNetconfClientRunnable.class, getOnlyChunkServerCaps()}, + {4, BlockingClientRunnable.class, getOnlyExiServerCaps()}, + {1, BlockingClientRunnable.class, getOnlyExiServerCaps()}, }); } @@ -171,7 +169,7 @@ public class ConcurrentClientsTest { try { nettyGroup.shutdownGracefully().get(); } catch (InterruptedException | ExecutionException e) { - logger.warn("Ignoring exception while cleaning up after test", e); + LOG.warn("Ignoring exception while cleaning up after test", e); } } @@ -195,7 +193,7 @@ public class ConcurrentClientsTest { } catch (InterruptedException e) { throw new IllegalStateException(e); } catch (ExecutionException e) { - logger.error("Thread for testing client failed", e); + LOG.error("Thread for testing client failed", e); fail("Client failed: " + e.getMessage()); } } @@ -238,7 +236,7 @@ public class ConcurrentClientsTest { @Override public Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException { try { - logger.info("Handling netconf message from test {}", XmlUtil.toString(requestMessage)); + LOG.info("Handling netconf message from test {}", XmlUtil.toString(requestMessage)); counter.getAndIncrement(); return XmlUtil.readXmlToDocument(""); } catch (Exception e) { @@ -307,7 +305,7 @@ public class ConcurrentClientsTest { while (sb.toString().endsWith("]]>]]>") == false) { sb.append((char) inFromServer.read()); } - logger.info(sb.toString()); + LOG.info(sb.toString()); outToServer.write(IOUtils.toByteArray(clientHello)); outToServer.write("]]>]]>".getBytes()); @@ -321,7 +319,7 @@ public class ConcurrentClientsTest { while (sb.toString().endsWith("]]>]]>") == false) { sb.append((char) inFromServer.read()); } - logger.info(sb.toString()); + LOG.info(sb.toString()); clientSocket.close(); } } @@ -337,19 +335,19 @@ public class ConcurrentClientsTest { final TestingNetconfClient netconfClient = new TestingNetconfClient(Thread.currentThread().getName(), netconfClientDispatcher, getClientConfig()); long sessionId = netconfClient.getSessionId(); - logger.info("Client with session id {}: hello exchanged", sessionId); + LOG.info("Client with session id {}: hello exchanged", sessionId); final NetconfMessage getMessage = XmlFileLoader .xmlFileToNetconfMessage("netconfMessages/getConfig.xml"); NetconfMessage result = netconfClient.sendRequest(getMessage).get(); - logger.info("Client with session id {}: got result {}", sessionId, result); + LOG.info("Client with session id {}: got result {}", sessionId, result); Preconditions.checkState(NetconfMessageUtil.isErrorMessage(result) == false, "Received error response: " + XmlUtil.toString(result.getDocument()) + " to request: " + XmlUtil.toString(getMessage.getDocument())); netconfClient.close(); - logger.info("Client with session id {}: ended", sessionId); + LOG.info("Client with session id {}: ended", sessionId); } catch (final Exception e) { throw new IllegalStateException(Thread.currentThread().getName(), e); }