Fix checkstyle warnings in netconf-cli 56/12856/2
authorMarian Dubai <mdubai@cisco.com>
Fri, 14 Nov 2014 14:15:05 +0000 (15:15 +0100)
committerMarian Dubai <mdubai@cisco.com>
Wed, 19 Nov 2014 13:59:01 +0000 (13:59 +0000)
Change-Id: Ic434bf4aac666c312e41781588aa9fca94acca4e
Signed-off-by: Marian Dubai <mdubai@cisco.com>
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Main.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Disconnect.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/BasicDataHolderReader.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ConsoleIOTestImpl.java
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/NetconfCliTest.java
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/io/IOUtilTest.java

index 8605501..79c083c 100644 (file)
@@ -105,8 +105,7 @@ public class Main {
     }
 
     private static void handleException(final Exception e, final String message) {
-        System.err.println(message);
-        e.printStackTrace(System.err);
+        // FIXME syserr the exception and stacktrace
     }
 
     private static void writeStatus(final ConsoleIO io, final String blueprint, final Object... args) {
index e938388..73088b4 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.netconf.cli.commands.local;
 
+import com.google.common.collect.Lists;
 import org.opendaylight.controller.netconf.cli.NetconfDeviceConnectionManager;
 import org.opendaylight.controller.netconf.cli.commands.AbstractCommand;
 import org.opendaylight.controller.netconf.cli.commands.Command;
@@ -20,8 +21,6 @@ import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
 import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 
-import com.google.common.collect.Lists;
-
 /**
  * Local disconnect command
  */
index ef41e7f..b44ec41 100644 (file)
@@ -245,11 +245,11 @@ public abstract class BasicDataHolderReader<T extends DataSchemaNode> extends Ab
 
             return new StringsCompleter(Collections2.transform(((IdentityrefTypeDefinition) getType()).getIdentity()
                     .getDerivedIdentities(), new Function<IdentitySchemaNode, String>() {
-                @Override
-                public String apply(final IdentitySchemaNode input) {
-                    return identityMap.inverse().get(input.getQName());
-                }
-            })).complete(buffer, cursor, candidates);
+                        @Override
+                        public String apply(final IdentitySchemaNode input) {
+                            return identityMap.inverse().get(input.getQName());
+                        }
+                    })).complete(buffer, cursor, candidates);
         }
     }
 }
index a05a169..2a00101 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.netconf.cli.reader.impl;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
+import java.util.List;
 import jline.console.completer.Completer;
 import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
 import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
@@ -19,8 +20,6 @@ import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
-import java.util.List;
-
 class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
         GenericListEntryReader<LeafListSchemaNode> {
 
index ef29a76..2c7c23e 100644 (file)
@@ -13,12 +13,12 @@ import java.util.List;
 import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
 import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
 import org.opendaylight.controller.netconf.cli.writer.WriteException;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
-import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
index 29d7abd..368e942 100644 (file)
@@ -33,7 +33,7 @@ public class ConsoleIOTestImpl extends ConsoleIOImpl {
     public String read() throws IOException {
         final String prompt = buildPrompt();
         output.append(prompt);
-        System.out.print(prompt);
+        System.console().writer().print(prompt);
 
         String value = inputValues.get(prompt).pollFirst();
         if (value == null) {
@@ -43,7 +43,7 @@ public class ConsoleIOTestImpl extends ConsoleIOImpl {
         value = value != null ? value : "****NO VALUE****";
 
         output.append(value + "\n");
-        System.out.print(value + "\n");
+        System.console().writer().println(value + "\n");
         return value;
     }
 
@@ -69,14 +69,14 @@ public class ConsoleIOTestImpl extends ConsoleIOImpl {
     public void write(final CharSequence data) throws IOException {
         output.append(data);
         lastMessage = (String) data;
-        System.out.print(data);
+        System.console().writer().print(data);
     }
 
     @Override
     public void writeLn(final CharSequence data) throws IOException {
         write(data);
         output.append("\n");
-        System.out.print("\n");
+        System.console().writer().print("\n");
     }
 
     public String getConsoleOutput() {
index 7d85aa4..874669e 100644 (file)
@@ -61,7 +61,6 @@ public class NetconfCliTest {
         return parser.parseFiles(testFiles);
     }
 
-    // @Ignore
     @Test
     public void cliTest() throws ReadingException, IOException, WriteException, URISyntaxException {
 
@@ -112,12 +111,11 @@ public class NetconfCliTest {
         final List<Node<?>> redData = new GenericReader(console, new CommandArgHandlerRegistry(console,
                 new SchemaContextRegistry(schemaContext)), schemaContext).read(cont1);
         assertNotNull(redData);
-       assertEquals(1, redData.size());
+        assertEquals(1, redData.size());
 
         assertTrue(redData.get(0) instanceof CompositeNode);
         final CompositeNode redTopLevelNode = (CompositeNode) redData.get(0);
 
-        System.out.println("============================");
         new NormalizedNodeWriter(console, new OutFormatter()).write(cont1, redData);
 
     }
index 5a24452..d6dabb9 100644 (file)
@@ -7,16 +7,13 @@
  */
 package org.opendaylight.controller.netconf.cli.io;
 
+import com.google.common.collect.Maps;
 import java.util.Map;
-
 import junit.framework.Assert;
-
 import org.junit.Test;
 import org.opendaylight.controller.netconf.cli.commands.CommandConstants;
 import org.opendaylight.yangtools.yang.common.QName;
 
-import com.google.common.collect.Maps;
-
 public class IOUtilTest {
 
     @Test