Fix star import and enable checkstyle rule to prevent it.
[controller.git] / opendaylight / netconf / netconf-it / src / test / java / org / opendaylight / controller / netconf / it / NetconfITTest.java
index d7f96a876148299d5a09ab765de1e558fbf8cb8e..4388982f9beb39dd61d4b9490b0b63b59f6eba83 100644 (file)
@@ -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;
@@ -78,9 +54,31 @@ 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.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+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 {
 
@@ -171,12 +169,26 @@ public class NetconfITTest extends AbstractConfigTest {
     protected List<ModuleFactory> getModuleFactories() {
         return getModuleFactoriesS();
     }
-
     static List<ModuleFactory> getModuleFactoriesS() {
         return Lists.newArrayList(new TestImplModuleFactory(), new DepTestImplModuleFactory(),
                 new NetconfTestImplModuleFactory());
     }
 
+    @Test
+    public void testNetconfClientDemonstration() throws Exception {
+        try (NetconfClient netconfClient = new NetconfClient("client", tcpAddress, 4000)) {
+
+            Set<String> capabilitiesFromNetconfServer = netconfClient.getCapabilities();
+            long sessionId = netconfClient.getSessionId();
+
+            // NetconfMessage can be created :
+            // new NetconfMessage(XmlUtil.readXmlToDocument("<xml/>"));
+
+            NetconfMessage response = netconfClient.sendMessage(getConfig);
+            response.getDocument();
+        }
+    }
+
     @Test
     public void testTwoSessions() throws Exception {
         try (NetconfClient netconfClient = new NetconfClient("1", tcpAddress, 4000)) {