X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fit%2FNetconfITTest.java;h=a573b3e65f8f13d8905f1ceee809e40d008b7759;hb=refs%2Fchanges%2F61%2F2161%2F1;hp=117735dd1c9268be8f9c39dcc0ab1e1d9c61502c;hpb=62e7aa285e7e33f597176173673d3fdc7fcb2d74;p=controller.git diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java index 117735dd1c..a573b3e65f 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java @@ -8,35 +8,11 @@ package org.opendaylight.controller.netconf.it; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.internal.util.Checks.checkNotNull; +import com.google.common.base.Optional; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import io.netty.channel.ChannelFuture; import io.netty.util.HashedWheelTimer; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.management.ManagementFactory; -import java.net.InetSocketAddress; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import javax.management.ObjectName; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.xml.parsers.ParserConfigurationException; - import org.junit.After; import org.junit.Before; import org.junit.Ignore; @@ -51,21 +27,11 @@ import org.opendaylight.controller.config.spi.ModuleFactory; import org.opendaylight.controller.config.util.ConfigTransactionJMXClient; import org.opendaylight.controller.config.yang.store.api.YangStoreException; import org.opendaylight.controller.config.yang.store.impl.HardcodedYangStoreService; -import org.opendaylight.controller.config.yang.test.impl.Asdf; -import org.opendaylight.controller.config.yang.test.impl.DepTestImplModuleFactory; -import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplModuleFactory; -import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplModuleMXBean; -import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplRuntimeMXBean; -import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplRuntimeRegistrator; -import org.opendaylight.controller.config.yang.test.impl.TestImplModuleFactory; +import org.opendaylight.controller.config.yang.test.impl.*; import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.client.NetconfClient; import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl; -import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer; -import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; -import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory; -import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory; -import org.opendaylight.controller.netconf.impl.SessionIdProvider; +import org.opendaylight.controller.netconf.impl.*; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; import org.opendaylight.controller.netconf.persist.impl.ConfigPersisterNotificationHandler; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; @@ -78,9 +44,27 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.xml.sax.SAXException; -import com.google.common.base.Optional; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; +import javax.management.ObjectName; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.io.InputStream; +import java.lang.management.ManagementFactory; +import java.net.InetSocketAddress; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.internal.util.Checks.checkNotNull; public class NetconfITTest extends AbstractConfigTest { @@ -176,6 +160,21 @@ public class NetconfITTest extends AbstractConfigTest { new NetconfTestImplModuleFactory()); } + @Test + public void testNetconfClientDemonstration() throws Exception { + try (NetconfClient netconfClient = new NetconfClient("client", tcpAddress, 4000)) { + + Set capabilitiesFromNetconfServer = netconfClient.getCapabilities(); + long sessionId = netconfClient.getSessionId(); + + // NetconfMessage can be created : + // new NetconfMessage(XmlUtil.readXmlToDocument("")); + + NetconfMessage response = netconfClient.sendMessage(getConfig); + response.getDocument(); + } + } + @Test public void testTwoSessions() throws Exception { try (NetconfClient netconfClient = new NetconfClient("1", tcpAddress, 4000)) {