Merge "Bug 8153: Enforce check-style rules for netconf-api"
authorTomas Cere <tcere@cisco.com>
Thu, 27 Apr 2017 16:38:21 +0000 (16:38 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 27 Apr 2017 16:38:21 +0000 (16:38 +0000)
18 files changed:
netconf/netconf-api/pom.xml
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfClientSessionPreferences.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfDeserializerException.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfDocumentedException.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfExiSession.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfServerSessionPreferences.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfSessionListener.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfSessionPreferences.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/messages/NetconfHelloMessage.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/messages/NetconfHelloMessageAdditionalHeader.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/monitoring/NetconfMonitoringService.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/monitoring/SessionEvent.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/monitoring/SessionListener.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/util/NetconfConstants.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/xml/XmlNetconfConstants.java
netconf/netconf-api/src/test/java/org/opendaylight/netconf/api/NetconfDocumentedExceptionTest.java
netconf/netconf-api/src/test/java/org/opendaylight/netconf/api/messages/NetconfHelloMessageAdditionalHeaderTest.java
netconf/netconf-api/src/test/java/org/opendaylight/netconf/api/messages/NetconfHelloMessageTest.java

index 1c88866d07598a7322916cdbd1dfc64208698f58..11f44453c7e2f4c3d53280319dc562f074dde349 100644 (file)
       <artifactId>mockito-configuration</artifactId>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>
index 3f63db448020093892d398d66ae266d24f74b04b..0c444a1fed94154f78f4731b140821412ea43522 100644 (file)
@@ -18,12 +18,14 @@ public final class NetconfClientSessionPreferences extends NetconfSessionPrefere
     private final NetconfMessage startExiMessage;
 
     public NetconfClientSessionPreferences(final NetconfHelloMessage helloMessage,
-                                     final NetconfMessage startExiMessage) {
+                                           final NetconfMessage startExiMessage) {
         super(helloMessage);
         this.startExiMessage = startExiMessage;
     }
 
     /**
+     * Getter for {@code NetconfMessage}.
+     *
      * @return the startExiMessage
      */
     public NetconfMessage getStartExiMessage() {
index 4eb5be39d1e60f21d7acebfb49dcdaf41f5d058d..9e93f8fb26b16a0e45bce19c459c04c134f6618f 100644 (file)
@@ -20,7 +20,7 @@ public class NetconfDeserializerException extends Exception {
         super(message);
     }
 
-    public NetconfDeserializerException(final String message, final Exception e) {
-        super(message, e);
+    public NetconfDeserializerException(final String message, final Exception exception) {
+        super(message, exception);
     }
 }
index 10f1020bde55be5a20d6cc021a5390834d1ad1ed..94735b07249e9a3acad2fcfc50bc713f498c0b19 100644 (file)
@@ -22,27 +22,33 @@ public class NetconfDocumentedException extends DocumentedException {
         super(message);
     }
 
-    public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
+    public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                      final ErrorSeverity errorSeverity) {
         super(message, errorType, errorTag, errorSeverity);
     }
 
-    public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag, final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
+    public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                      final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
         super(message, errorType, errorTag, errorSeverity, errorInfo);
     }
 
-    public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType, final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
+    public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
+                                      final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
         super(message, cause, errorType, errorTag, errorSeverity);
     }
 
-    public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType, final ErrorTag errorTag, final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
+    public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
+                                      final ErrorTag errorTag, final ErrorSeverity errorSeverity,
+                                      final Map<String, String> errorInfo) {
         super(message, cause, errorType, errorTag, errorSeverity, errorInfo);
     }
 
-    public NetconfDocumentedException(DocumentedException e) {
-        super(e.getMessage(), (Exception) e.getCause(), e.getErrorType(), e.getErrorTag(), e.getErrorSeverity(), e.getErrorInfo());
+    public NetconfDocumentedException(DocumentedException exception) {
+        super(exception.getMessage(), (Exception) exception.getCause(), exception.getErrorType(),
+                exception.getErrorTag(), exception.getErrorSeverity(), exception.getErrorInfo());
     }
 
-    public static NetconfDocumentedException fromXMLDocument( Document fromDoc) {
+    public static NetconfDocumentedException fromXMLDocument(Document fromDoc) {
         return new NetconfDocumentedException(DocumentedException.fromXMLDocument(fromDoc));
     }
 }
index 66fcc8723748d982f9c05735e6ca6fe0509dbebc..11b3012a8d86dc181e2bef78683819a1ea97cd52 100644 (file)
@@ -8,18 +8,19 @@
 package org.opendaylight.netconf.api;
 
 /**
- * Session capable of exi communication according to http://tools.ietf.org/html/draft-varga-netconf-exi-capability-02
+ * Session capable of exi communication according to http://tools.ietf.org/html/draft-varga-netconf-exi-capability-02.
  */
 public interface NetconfExiSession {
 
     /**
-     * Start exi communication with parameters included in start-exi message
+     * Start exi communication with parameters included in start-exi message.
+     *
      * @param startExiMessage start exi message
      */
     void startExiCommunication(NetconfMessage startExiMessage);
 
     /**
-     * Stop exi communication, initiated by stop-exi message
+     * Stop exi communication, initiated by stop-exi message.
      */
     void stopExiCommunication();
 }
index 348c273750e596a9e2abfb419f5a06140e274e53..72f9813f03cd1a46537fcf41ae96b6f720c35f00 100644 (file)
@@ -17,8 +17,7 @@ public final class NetconfServerSessionPreferences extends NetconfSessionPrefere
 
     private final long sessionId;
 
-    public NetconfServerSessionPreferences(final NetconfHelloMessage helloMessage,
-                                           long sessionId) {
+    public NetconfServerSessionPreferences(final NetconfHelloMessage helloMessage, long sessionId) {
         super(helloMessage);
         this.sessionId = sessionId;
     }
index 6b6af960f0864dbeb330ee5f03e8b342a3be872b..bfd1dbf0af210457e7baf357dc279aa5ccd8346d 100644 (file)
@@ -10,5 +10,6 @@ package org.opendaylight.netconf.api;
 
 import org.opendaylight.protocol.framework.SessionListener;
 
-public interface NetconfSessionListener<S extends NetconfSession> extends SessionListener<NetconfMessage, S, NetconfTerminationReason> {
+public interface NetconfSessionListener
+        <S extends NetconfSession> extends SessionListener<NetconfMessage, S, NetconfTerminationReason> {
 }
index 26c612840a6b9fba9bbdea7aba22cb4bf4df003f..4360fbfde6c6d8f3c5b54a6a5ad151b42eeb97f7 100644 (file)
@@ -19,6 +19,8 @@ public class NetconfSessionPreferences {
     }
 
     /**
+     * Getter for {@code NetconfHelloMessage}.
+     *
      * @return the helloMessage
      */
     public NetconfHelloMessage getHelloMessage() {
index a1ad34673b71e399ea6699d960480553a1fe9610..34c20e6f4373d434d3281fe9054bd281cc409ee0 100644 (file)
@@ -22,7 +22,8 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /**
- * NetconfMessage that can carry additional header with session metadata. See {@link NetconfHelloMessageAdditionalHeader}
+ * NetconfMessage that can carry additional header with session metadata.
+ * See {@link NetconfHelloMessageAdditionalHeader}
  */
 public final class NetconfHelloMessage extends NetconfMessage {
 
@@ -30,7 +31,8 @@ public final class NetconfHelloMessage extends NetconfMessage {
 
     private final NetconfHelloMessageAdditionalHeader additionalHeader;
 
-    public NetconfHelloMessage(Document doc, NetconfHelloMessageAdditionalHeader additionalHeader) throws NetconfDocumentedException {
+    public NetconfHelloMessage(Document doc, NetconfHelloMessageAdditionalHeader additionalHeader)
+            throws NetconfDocumentedException {
         super(doc);
         checkHelloMessage(doc);
         this.additionalHeader = additionalHeader;
@@ -41,7 +43,8 @@ public final class NetconfHelloMessage extends NetconfMessage {
     }
 
     public Optional<NetconfHelloMessageAdditionalHeader> getAdditionalHeader() {
-        return additionalHeader== null ? Optional.<NetconfHelloMessageAdditionalHeader>absent() : Optional.of(additionalHeader);
+        return additionalHeader == null ? Optional.<NetconfHelloMessageAdditionalHeader>absent()
+                : Optional.of(additionalHeader);
     }
 
     private static void checkHelloMessage(Document doc) {
@@ -51,7 +54,7 @@ public final class NetconfHelloMessage extends NetconfMessage {
     }
 
     public static NetconfHelloMessage createClientHello(Iterable<String> capabilities,
-                                                        Optional<NetconfHelloMessageAdditionalHeader> additionalHeaderOptional) throws NetconfDocumentedException {
+            Optional<NetconfHelloMessageAdditionalHeader> additionalHeaderOptional) throws NetconfDocumentedException {
         Document doc = createHelloMessageDoc(capabilities);
         return additionalHeaderOptional.isPresent() ? new NetconfHelloMessage(doc, additionalHeaderOptional.get())
                 : new NetconfHelloMessage(doc);
@@ -77,7 +80,8 @@ public final class NetconfHelloMessage extends NetconfMessage {
         return doc;
     }
 
-    public static NetconfHelloMessage createServerHello(Set<String> capabilities, long sessionId) throws NetconfDocumentedException {
+    public static NetconfHelloMessage createServerHello(Set<String> capabilities, long sessionId)
+            throws NetconfDocumentedException {
         Document doc = createHelloMessageDoc(capabilities);
         Element sessionIdElement = doc.createElementNS(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0,
                 XmlNetconfConstants.SESSION_ID);
@@ -95,8 +99,9 @@ public final class NetconfHelloMessage extends NetconfMessage {
         XmlElement element = XmlElement.fromDomElement(document.getDocumentElement());
         try {
             // accept even if hello has no namespace
-            return element.getName().equals(HELLO_TAG) &&
-                    (!element.hasNamespace() || element.getNamespace().equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
+            return element.getName().equals(HELLO_TAG)
+                    && (!element.hasNamespace()
+                    || element.getNamespace().equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
         } catch (DocumentedException e) {
             // Cannot happen, since we check for hasNamespace
             throw new IllegalStateException(e);
index 32557653c0e5913621cac2f6ba7b7c60a05fe328..2dbc49fe83ddee6ada9035a4ff10b70cf514d43d 100644 (file)
@@ -38,7 +38,8 @@ public class NetconfHelloMessageAdditionalHeader {
     private final String transport;
     private final String sessionIdentifier;
 
-    public NetconfHelloMessageAdditionalHeader(String userName, String hostAddress, String port, String transport, String sessionIdentifier) {
+    public NetconfHelloMessageAdditionalHeader(String userName, String hostAddress, String port,
+                                               String transport, String sessionIdentifier) {
         this.userName = userName;
         this.hostAddress = hostAddress;
         this.port = port;
@@ -67,7 +68,7 @@ public class NetconfHelloMessageAdditionalHeader {
     }
 
     /**
-     * Format additional header into a string suitable as a prefix for netconf hello message
+     * Format additional header into a string suitable as a prefix for netconf hello message.
      */
     public String toFormattedString() {
         Preconditions.checkNotNull(userName);
@@ -94,10 +95,11 @@ public class NetconfHelloMessageAdditionalHeader {
     private static final Pattern PATTERN = Pattern
             .compile("\\[(?<username>[^;]+);(?<address>.+)[:/](?<port>[0-9]+);(?<transport>[a-z]+)[^\\]]+\\]");
     private static final Pattern CUSTOM_HEADER_PATTERN = Pattern
-            .compile("\\[(?<username>[^;]+);(?<address>.+)[:/](?<port>[0-9]+);(?<transport>[a-z]+);(?<sessionIdentifier>[a-z]+)[^\\]]+\\]");
+            .compile("\\[(?<username>[^;]+);"
+                    + "(?<address>.+)[:/](?<port>[0-9]+);(?<transport>[a-z]+);(?<sessionIdentifier>[a-z]+)[^\\]]+\\]");
 
     /**
-     * Parse additional header from a formatted string
+     * Parse additional header from a formatted string.
      */
     public static NetconfHelloMessageAdditionalHeader fromString(String additionalHeader) {
         String additionalHeaderTrimmed = additionalHeader.trim();
index e60b71eb1f2dcdd0a7476fc0e20744da55605def..03d1d36e1b77b586e6b707d75f050f6827f29612 100644 (file)
@@ -19,7 +19,9 @@ public interface NetconfMonitoringService {
     Sessions getSessions();
 
     /**
-     * Returns session monitoring service session listener, which is used to notify monitoring service about state of session.
+     * Returns session monitoring service session listener, which is used to notify monitoring service about state of
+     * session.
+     *
      * @return session listener
      */
     SessionListener getSessionListener();
@@ -31,7 +33,9 @@ public interface NetconfMonitoringService {
     Capabilities getCapabilities();
 
     /**
-     * Allows push based capabilities information transfer. After the listener is registered, current state is pushed to the listener.
+     * Allows push based capabilities information transfer. After the listener is registered, current state is pushed
+     * to the listener.
+     *
      * @param listener Monitoring listener
      * @return listener registration
      */
@@ -39,6 +43,7 @@ public interface NetconfMonitoringService {
 
     /**
      * Allows push based sessions information transfer.
+     *
      * @param listener Monitoring listener
      * @return listener registration
      */
@@ -47,13 +52,15 @@ public interface NetconfMonitoringService {
     interface CapabilitiesListener {
 
         /**
-         * Callback used to notify about a change in used capabilities
+         * Callback used to notify about a change in used capabilities.
+         *
          * @param capabilities resulting capabilities
          */
         void onCapabilitiesChanged(Capabilities capabilities);
 
         /**
-         * Callback used to notify about a change in used schemas
+         * Callback used to notify about a change in used schemas.
+         *
          * @param schemas resulting schemas
          */
         void onSchemasChanged(Schemas schemas);
@@ -61,13 +68,15 @@ public interface NetconfMonitoringService {
 
     interface SessionsListener {
         /**
-         * Callback used to notify about netconf session start
+         * Callback used to notify about netconf session start.
+         *
          * @param session started session
          */
         void onSessionStarted(Session session);
 
         /**
-         * Callback used to notify about netconf session end
+         * Callback used to notify about netconf session end.
+         *
          * @param session ended session
          */
         void onSessionEnded(Session session);
@@ -76,6 +85,7 @@ public interface NetconfMonitoringService {
          * Callback used to notify about activity in netconf session, like
          * rpc or notification. It is triggered at regular time interval. Session parameter
          * contains only sessions which state was changed.
+         *
          * @param sessions updated sessions
          */
         void onSessionsUpdated(Collection<Session> sessions);
index bd30c22ea2d395ccfc16e5b242943587d71cc9de..d6c87c3ed82c81c329712fc8a5730cdfa4abc30e 100644 (file)
@@ -20,7 +20,8 @@ public class SessionEvent {
     }
 
     /**
-     * Returns session, where event occurred
+     * Returns session, where event occurred.
+     *
      * @return session
      */
     public NetconfManagementSession getSession() {
@@ -28,7 +29,8 @@ public class SessionEvent {
     }
 
     /**
-     * Returns event type
+     * Returns event type.
+     *
      * @return type
      */
     public Type getType() {
@@ -52,17 +54,17 @@ public class SessionEvent {
     }
 
     /**
-     * Session event type
+     * Session event type.
      */
     public enum Type {
 
         /**
-         * Correct rpc message received
+         * Correct rpc message received.
          */
         IN_RPC_SUCCESS,
 
         /**
-         * Incorrect rpc message received
+         * Incorrect rpc message received.
          */
         IN_RPC_FAIL,
 
@@ -72,7 +74,7 @@ public class SessionEvent {
         OUT_RPC_ERROR,
 
         /**
-         *  Notification message sent
+         * Notification message sent.
          */
         NOTIFICATION
     }
index 74df29cc789b0c977ad4eccd9b3fa910cf4df74e..1bfd3c976da16eb65fd2215569a2b6f3351189d5 100644 (file)
@@ -14,20 +14,23 @@ package org.opendaylight.netconf.api.monitoring;
 public interface SessionListener {
 
     /**
-     * Callback used to notify about netconf session start
+     * Callback used to notify about netconf session start.
+     *
      * @param session started session
      */
     void onSessionUp(NetconfManagementSession session);
 
     /**
-     * Callback used to notify about netconf session end
+     * Callback used to notify about netconf session end.
+     *
      * @param session ended session
      */
     void onSessionDown(NetconfManagementSession session);
 
     /**
      * Callback used to notify about activity in netconf session, like
-     * rpc or notification
+     * rpc or notification.
+     *
      * @param event session event, contains session and type of event
      */
     void onSessionEvent(SessionEvent event);
index 36b1b128eb397bbbcc0c99084d56fef9b22ab4e9..e3ffdd0ae5e213ad7919489d44b50896c261fc99 100644 (file)
@@ -13,7 +13,7 @@ import java.util.Set;
 
 /**
  * These constants mark operation service factories that are auto wired with netconf endpoint
- * for config subsystem
+ * for config subsystem.
  */
 public final class NetconfConstants {
     /*
@@ -25,5 +25,6 @@ public final class NetconfConstants {
     public static final String NETCONF_MONITORING = "ietf-netconf-monitoring";
     public static final String NETCONF_NOTIFICATION = "ietf-netconf-notifications";
 
-    public static final Set<String> CONFIG_SERVICE_MARKERS = Sets.newHashSet(SERVICE_NAME, CONFIG_NETCONF_CONNECTOR, NETCONF_MONITORING, NETCONF_NOTIFICATION);
+    public static final Set<String> CONFIG_SERVICE_MARKERS = Sets.newHashSet(SERVICE_NAME, CONFIG_NETCONF_CONNECTOR,
+            NETCONF_MONITORING, NETCONF_NOTIFICATION);
 }
index 33bbef5cd5523cba29567db02e56d5c59b5a7033..955127c938352095ecabf838ef55d74b3937d6ec 100644 (file)
@@ -32,12 +32,16 @@ public final class XmlNetconfConstants {
     public static final String GET = "get";
     public static final String GET_CONFIG = "get-config";
 
-    public static final String URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0 = XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
+    public static final String URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0 =
+            XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
     public static final String URN_IETF_PARAMS_NETCONF_BASE_1_0 = "urn:ietf:params:netconf:base:1.0";
     public static final String URN_IETF_PARAMS_NETCONF_BASE_1_1 = "urn:ietf:params:netconf:base:1.1";
     public static final String URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0 = "urn:ietf:params:xml:ns:netconf:exi:1.0";
-    public static final String URN_IETF_PARAMS_NETCONF_CAPABILITY_NOTIFICATION_1_0 = "urn:ietf:params:netconf:capability:notification:1.0";
+    public static final String URN_IETF_PARAMS_NETCONF_CAPABILITY_NOTIFICATION_1_0 =
+            "urn:ietf:params:netconf:capability:notification:1.0";
 
-    public static final String URN_IETF_PARAMS_NETCONF_CAPABILITY_EXI_1_0 = "urn:ietf:params:netconf:capability:exi:1.0";
-    public static final String URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring";
+    public static final String URN_IETF_PARAMS_NETCONF_CAPABILITY_EXI_1_0 =
+            "urn:ietf:params:netconf:capability:exi:1.0";
+    public static final String URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING =
+            "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring";
 }
index 777186b0587ad5473c52d938df89ab49dbf65bee..7876a5cadb67324f05df84255d5f0b1fcd5a639c 100644 (file)
@@ -40,10 +40,10 @@ public class NetconfDocumentedExceptionTest {
     public void setUp() throws Exception {
         final XPathFactory xPathfactory = XPathFactory.newInstance();
         xpath = xPathfactory.newXPath();
-        xpath.setNamespaceContext( new NamespaceContext() {
+        xpath.setNamespaceContext(new NamespaceContext() {
             @Override
             public Iterator<?> getPrefixes(final String namespaceURI) {
-                return Collections.singletonList( "netconf" ).iterator();
+                return Collections.singletonList("netconf").iterator();
             }
 
             @Override
@@ -55,67 +55,67 @@ public class NetconfDocumentedExceptionTest {
             public String getNamespaceURI(final String prefix) {
                 return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
             }
-        } );
+        });
     }
 
     @Test
     public void testToAndFromXMLDocument() throws XPathExpressionException {
         final String errorMessage = "mock error message";
-        DocumentedException ex = new NetconfDocumentedException( errorMessage, null,
+        DocumentedException ex = new NetconfDocumentedException(errorMessage, null,
                 DocumentedException.ErrorType.PROTOCOL,
                 DocumentedException.ErrorTag.DATA_EXISTS,
                 DocumentedException.ErrorSeverity.WARNING,
-                ImmutableMap.of( "foo", "bar" ) );
+                ImmutableMap.of("foo", "bar"));
 
         final Document doc = ex.toXMLDocument();
-        assertNotNull( "Document is null", doc );
+        assertNotNull("Document is null", doc);
 
         final Node rootNode = doc.getDocumentElement();
 
-        assertEquals( "getNamespaceURI", "urn:ietf:params:xml:ns:netconf:base:1.0", rootNode.getNamespaceURI() );
-        assertEquals( "getLocalName", "rpc-reply", rootNode.getLocalName() );
+        assertEquals("getNamespaceURI", "urn:ietf:params:xml:ns:netconf:base:1.0", rootNode.getNamespaceURI());
+        assertEquals("getLocalName", "rpc-reply", rootNode.getLocalName());
 
         final Node rpcErrorNode = getNode("/netconf:rpc-reply/netconf:rpc-error", rootNode);
-        assertNotNull( "rpc-error not found", rpcErrorNode );
+        assertNotNull("rpc-error not found", rpcErrorNode);
 
         final Node errorTypeNode = getNode("netconf:error-type", rpcErrorNode);
-        assertNotNull( "error-type not found", errorTypeNode );
+        assertNotNull("error-type not found", errorTypeNode);
         assertEquals("error-type", DocumentedException.ErrorType.PROTOCOL.getTypeValue(),
-                      errorTypeNode.getTextContent() );
+                errorTypeNode.getTextContent());
 
         final Node errorTagNode = getNode("netconf:error-tag", rpcErrorNode);
-        assertNotNull( "error-tag not found", errorTagNode );
+        assertNotNull("error-tag not found", errorTagNode);
         assertEquals("error-tag", DocumentedException.ErrorTag.DATA_EXISTS.getTagValue(),
-                      errorTagNode.getTextContent() );
+                errorTagNode.getTextContent());
 
         final Node errorSeverityNode = getNode("netconf:error-severity", rpcErrorNode);
-        assertNotNull( "error-severity not found", errorSeverityNode );
+        assertNotNull("error-severity not found", errorSeverityNode);
         assertEquals("error-severity", DocumentedException.ErrorSeverity.WARNING.getSeverityValue(),
-                      errorSeverityNode.getTextContent() );
+                errorSeverityNode.getTextContent());
 
         final Node errorInfoNode = getNode("netconf:error-info/netconf:foo", rpcErrorNode);
-        assertNotNull( "foo not found", errorInfoNode );
-        assertEquals( "foo", "bar", errorInfoNode.getTextContent() );
+        assertNotNull("foo not found", errorInfoNode);
+        assertEquals("foo", "bar", errorInfoNode.getTextContent());
 
         final Node errorMsgNode = getNode("netconf:error-message", rpcErrorNode);
-        assertNotNull( "error-message not found", errorMsgNode );
-        assertEquals( "error-message", errorMessage, errorMsgNode.getTextContent() );
+        assertNotNull("error-message not found", errorMsgNode);
+        assertEquals("error-message", errorMessage, errorMsgNode.getTextContent());
 
         // Test fromXMLDocument
 
-        ex = DocumentedException.fromXMLDocument( doc );
+        ex = DocumentedException.fromXMLDocument(doc);
 
-        assertNotNull( "NetconfDocumentedException is null", ex );
+        assertNotNull("NetconfDocumentedException is null", ex);
         assertEquals("getErrorSeverity", DocumentedException.ErrorSeverity.WARNING, ex.getErrorSeverity());
         assertEquals("getErrorTag", DocumentedException.ErrorTag.DATA_EXISTS, ex.getErrorTag());
         assertEquals("getErrorType", DocumentedException.ErrorType.PROTOCOL, ex.getErrorType());
-        assertEquals( "getLocalizedMessage", errorMessage, ex.getLocalizedMessage() );
-        assertEquals( "getErrorInfo", ImmutableMap.of( "foo", "bar" ), ex.getErrorInfo() );
+        assertEquals("getLocalizedMessage", errorMessage, ex.getLocalizedMessage());
+        assertEquals("getErrorInfo", ImmutableMap.of("foo", "bar"), ex.getErrorInfo());
     }
 
     @SuppressWarnings("unchecked")
     <T> T getNode(final String xpathExp, final Node node) throws XPathExpressionException {
-        return (T)xpath.compile( xpathExp ).evaluate( node, XPathConstants.NODE );
+        return (T) xpath.compile(xpathExp).evaluate(node, XPathConstants.NODE);
     }
 }
 
index 4e2fbf086ddce48899cdc401eea5719d7f39be0e..b7b2b2db209530dd9c111ecdf6ca67a7cbaf6b8a 100644 (file)
@@ -35,8 +35,8 @@ public class NetconfHelloMessageAdditionalHeaderTest {
 
     @Test
     public void testStaticConstructor() throws Exception {
-        NetconfHelloMessageAdditionalHeader h = NetconfHelloMessageAdditionalHeader.fromString(customHeader);
-        assertEquals(h.toString(), header.toString());
-        assertEquals(h.toFormattedString(), header.toFormattedString());
+        NetconfHelloMessageAdditionalHeader header = NetconfHelloMessageAdditionalHeader.fromString(customHeader);
+        assertEquals(header.toString(), this.header.toString());
+        assertEquals(header.toFormattedString(), this.header.toFormattedString());
     }
 }
index 0384808743e7a8745f8b6b2ea738b27f33b0e739..8d5107dc5f65efe7b708208773d7f00d1c312938 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.netconf.api.messages;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -30,7 +29,8 @@ public class NetconfHelloMessageTest {
 
     @Test
     public void testConstructor() throws NetconfDocumentedException {
-        NetconfHelloMessageAdditionalHeader additionalHeader = new NetconfHelloMessageAdditionalHeader("name","host","1","transp","id");
+        NetconfHelloMessageAdditionalHeader additionalHeader = new NetconfHelloMessageAdditionalHeader("name",
+                "host", "1", "transp", "id");
         NetconfHelloMessage message = NetconfHelloMessage.createClientHello(caps, Optional.of(additionalHeader));
         assertTrue(NetconfHelloMessage.isHelloMessage(message));
         assertEquals(Optional.of(additionalHeader), message.getAdditionalHeader());