Merge "Fix checkstyle warnings in yang-test."
authorTony Tkacik <ttkacik@cisco.com>
Tue, 9 Dec 2014 15:46:37 +0000 (15:46 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Dec 2014 15:46:37 +0000 (15:46 +0000)
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpcElementResolvedTest.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImplTest.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiator.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/NetconfUtilTest.java
opendaylight/netconf/pom.xml

index 3c4213c..6ed2861 100644 (file)
@@ -32,30 +32,30 @@ public class RuntimeRpcElementResolvedTest {
     @Parameterized.Parameters(name = "{index}: parsed({0}) contains moduleName:{1} and instanceName:{2}")
     public static Collection<Object[]> data() {
         return Arrays.asList(new Object[][] {
-                // With namespaces
-                { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']",
-                        new HashMap<>(ImmutableMap.of("listener-state", "127.0.0.1"))},
-                { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']",
-                        null},
+            // With namespaces
+            { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']",
+                new HashMap<>(ImmutableMap.of("listener-state", "127.0.0.1"))},
+            { "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']",
+                null},
 
-                // Without namespaces
-                { "/modules/module[name=instanceName][type=moduleType]", null},
-                { "/modules/module[type=moduleType][name='instanceName']", null},
-                { "/modules/module[name=\'instanceName\'][type=\"moduleType\"]", null},
-                { "/modules/module[type=moduleType and name=instanceName]", null},
-                { "/modules/module[name=\"instanceName\" and type=moduleType]", null},
-                { "/modules/module[type=\"moduleType\" and name=instanceName]", null},
-                { "/modules/module[name=\'instanceName\' and type=\"moduleType\"]", null},
+            // Without namespaces
+            { "/modules/module[name=instanceName][type=moduleType]", null},
+            { "/modules/module[type=moduleType][name='instanceName']", null},
+            { "/modules/module[name=\'instanceName\'][type=\"moduleType\"]", null},
+            { "/modules/module[type=moduleType and name=instanceName]", null},
+            { "/modules/module[name=\"instanceName\" and type=moduleType]", null},
+            { "/modules/module[type=\"moduleType\" and name=instanceName]", null},
+            { "/modules/module[name=\'instanceName\' and type=\"moduleType\"]", null},
 
-                // With inner beans
-                { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key=b]", Collections.singletonMap("inner", "b")},
-                { "/modules/module[name=instanceName and type=moduleType]/inner[key=b]", Collections.singletonMap("inner", "b")},
-                { "/modules/module[name=instanceName and type=moduleType]/inner[key=\'b\']", Collections.singletonMap("inner", "b")},
-                { "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", Collections.singletonMap("inner", "b")},
+            // With inner beans
+            { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key=b]", Collections.singletonMap("inner", "b")},
+            { "/modules/module[name=instanceName and type=moduleType]/inner[key=b]", Collections.singletonMap("inner", "b")},
+            { "/modules/module[name=instanceName and type=moduleType]/inner[key=\'b\']", Collections.singletonMap("inner", "b")},
+            { "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", Collections.singletonMap("inner", "b")},
 
-                { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]",
-                        new HashMap<>(ImmutableMap.of("inner", "a", "inner2", "b"))
-                },
+            { "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]",
+                new HashMap<>(ImmutableMap.of("inner", "a", "inner2", "b"))
+            },
         });
     }
 
index 03bf4e3..413aa5c 100644 (file)
@@ -20,9 +20,9 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Map;
 import java.util.Set;
+import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Test;
-import org.hamcrest.CoreMatchers;
 import org.opendaylight.controller.config.api.LookupRegistry;
 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
 import org.opendaylight.yangtools.yang.common.QName;
index 2f72ad4..0dd79e2 100644 (file)
@@ -30,7 +30,7 @@ public class NetconfServerSessionNegotiator
         AbstractNetconfSessionNegotiator<NetconfServerSessionPreferences, NetconfServerSession, NetconfServerSessionListener> {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfServerSessionNegotiator.class);
-    
+
     private static final String UNKNOWN = "unknown";
 
     protected NetconfServerSessionNegotiator(
index c16046c..c5d5bed 100644 (file)
@@ -1,14 +1,13 @@
 package org.opendaylight.controller.netconf.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import io.netty.channel.local.LocalAddress;
+import java.net.InetSocketAddress;
 import org.apache.sshd.common.SshdSocketAddress;
 import org.junit.Test;
 
-import java.net.InetSocketAddress;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
 public class NetconfServerSessionNegotiatorTest {
 
     @Test
index fdc9a02..5f316d1 100644 (file)
@@ -25,7 +25,6 @@ import io.netty.channel.EventLoopGroup;
 import io.netty.channel.local.LocalAddress;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.concurrent.GlobalEventExecutor;
-import java.io.File;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.nio.file.Files;
@@ -78,7 +77,6 @@ public class NetconfITSecureTest extends AbstractNetconfConfigTest {
     public static final String USERNAME = "user";
     public static final String PASSWORD = "pwd";
 
-    private File sshKeyPair;
     private SshProxyServer sshProxyServer;
 
     private ExecutorService nioExec;
@@ -87,8 +85,6 @@ public class NetconfITSecureTest extends AbstractNetconfConfigTest {
 
     @Before
     public void setUp() throws Exception {
-        sshKeyPair = Files.createTempFile("sshKeyPair", ".pem").toFile();
-        sshKeyPair.deleteOnExit();
         nioExec = Executors.newFixedThreadPool(1);
         clientGroup = new NioEventLoopGroup();
         minaTimerEx = Executors.newScheduledThreadPool(1);
@@ -98,12 +94,13 @@ public class NetconfITSecureTest extends AbstractNetconfConfigTest {
                         .setBindingAddress(TLS_ADDRESS)
                         .setLocalAddress(NetconfConfigUtil.getNetconfLocalAddress())
                         .setAuthenticator(new PasswordAuthenticator() {
-            @Override
-            public boolean authenticate(final String username, final String password, final ServerSession session) {
-                return true;
-            }
-        })
-                        .setKeyPairProvider(new PEMGeneratorHostKeyProvider(sshKeyPair.toPath().toAbsolutePath().toString()))
+                            @Override
+                            public boolean authenticate(final String username, final String password, final ServerSession session) {
+                                return true;
+                            }
+                        }
+                    )
+                        .setKeyPairProvider(new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString()))
                         .setIdleTimeout(Integer.MAX_VALUE)
                         .createSshProxyServerConfiguration());
     }
index dc175c5..007dfdc 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.controller.netconf.util;
 
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
-import static org.hamcrest.CoreMatchers.containsString;
 
 import org.junit.Test;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
index 8b14adf..e1aa6ce 100644 (file)
         <artifactId>maven-checkstyle-plugin</artifactId>
         <configuration>
           <failsOnError>false</failsOnError>
-          <failOnViolation>false</failOnViolation>
+          <failOnViolation>true</failOnViolation>
           <configLocation>checkstyle-logging.xml</configLocation>
           <consoleOutput>true</consoleOutput>
           <includeTestSourceDirectory>true</includeTestSourceDirectory>