Enable checkstyle on yang-data-codec-gson 76/62576/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 2 Sep 2017 12:25:23 +0000 (14:25 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 2 Sep 2017 17:07:09 +0000 (19:07 +0200)
Gneeral cleanup and enable checkstyle.

Change-Id: Ib63901ef099b1b457504e2b8e11341ab357a394a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 files changed:
yang/yang-data-codec-gson/pom.xml
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodec.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodecFactory.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterContext.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterNamedObjectContext.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterObjectContext.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterQNameContext.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonWriterFactory.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/NumberJSONCodec.java
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/UnionJSONCodec.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AnyXmlSupportTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug7246Test.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonStreamToNormalizedNodeTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/StreamToNormalizedNodeTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java

index 8e9de4c512ec9b1beebb6eaa613b741b04187a78..a5143b87d61cac7e9b78e49d5afb2570ec0ee5a9 100644 (file)
         </dependency>
     </dependencies>
 
-  <!--
-      Maven Site Configuration
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+    <!--
+        Maven Site Configuration
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+
+    <distributionManagement>
+      <site>
+        <id>opendaylight-site</id>
+        <url>${nexus.site.url}/${project.artifactId}/</url>
+      </site>
+    </distributionManagement>
 </project>
index e32f10846ccf24356807a8b6d4478133ff0998ba..e84cff42feef160f8c334f4c99f4eaa043c1747f 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec;
 
 interface JSONCodec<T> extends TypeAwareCodec<T, Object, JsonWriter> {
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      *
      * @throws IOException if the write fails
      */
index c24db7699414d8d762b6e4a78e70d77547e7df5e..7769eb1ed7da8a850946850f21881d43ef4a9a92 100644 (file)
@@ -52,6 +52,7 @@ import org.slf4j.LoggerFactory;
  * Factory for creating JSON equivalents of codecs. Each instance of this object is bound to
  * a particular {@link SchemaContext}, but can be reused by multiple {@link JSONNormalizedNodeStreamWriter}s.
  *
+ * <p>
  * There are multiple implementations available, each with distinct thread-safety, CPU/memory trade-offs and reuse
  * characteristics. See {@link #getShared(SchemaContext)}, {@link #getPrecomputed(SchemaContext)},
  * {@link #createLazy(SchemaContext)} and {@link #createSimple(SchemaContext)} for details.
@@ -129,11 +130,13 @@ public final class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>> {
      * used by multiple threads concurrently. If the SchemaContext instance does not have a cached instance
      * of {@link JSONCodecFactory}, it will be completely precomputed before this method will return.
      *
+     * <p>
      * Choosing this implementation is appropriate when the memory overhead of keeping a full codec tree is not as
      * great a concern as predictable performance. When compared to the implementation returned by
      * {@link #getShared(SchemaContext)}, this implementation is expected to offer higher performance and have lower
      * peak memory footprint when most of the SchemaContext is actually in use.
      *
+     * <p>
      * For call sites which do not want to pay the CPU cost of pre-computing this implementation, but still would like
      * to use it if is available (by being populated by some other caller), you can use
      * {@link #getPrecomputedIfAvailable(SchemaContext)}.
@@ -166,6 +169,7 @@ public final class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>> {
      * return the same instance as long as the associated SchemaContext is present or the factory is not invalidated
      * by memory pressure. Returned object can be safely used by multiple threads concurrently.
      *
+     * <p>
      * Choosing this implementation is a safe default, as it will not incur prohibitive blocking, nor will it tie up
      * memory in face of pressure.
      *
@@ -182,6 +186,7 @@ public final class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>> {
      * return distinct objects every time it is invoked. Returned object may not be used from multiple threads
      * concurrently.
      *
+     * <p>
      * This implementation is appropriate for one-off serialization from a single thread. It will aggressively cache
      * codecs for reuse and will tie them up in memory until the factory is freed.
      *
@@ -197,6 +202,7 @@ public final class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>> {
      * Create a simplistic, thread-safe {@link JSONCodecFactory} for a {@link SchemaContext}. This method will return
      * distinct objects every time it is invoked. Returned object may be use from multiple threads concurrently.
      *
+     * <p>
      * This implementation exists mostly for completeness only, as it does not perform any caching at all and each codec
      * is computed every time it is requested. This may be useful in extremely constrained environments, where memory
      * footprint is more critical than performance.
index a3ba148e568d6e6a1a1796b9396a9662defc2767..70cb77f871e7a6de54dc233b5afbabe1ce2ad0eb 100644 (file)
@@ -35,8 +35,8 @@ import org.w3c.dom.NodeList;
 /**
  * This implementation will create JSON output as output stream.
  *
+ * <p>
  * Values of leaf and leaf-list are NOT translated according to codecs.
- *
  */
 public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStreamWriter {
     /**
@@ -58,8 +58,9 @@ public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStrea
     private final JsonWriter writer;
     private JSONStreamWriterContext context;
 
-    private JSONNormalizedNodeStreamWriter(final JSONCodecFactory codecFactory, final SchemaPath path, final JsonWriter JsonWriter, final JSONStreamWriterRootContext rootContext) {
-        this.writer = Preconditions.checkNotNull(JsonWriter);
+    private JSONNormalizedNodeStreamWriter(final JSONCodecFactory codecFactory, final SchemaPath path,
+            final JsonWriter writer, final JSONStreamWriterRootContext rootContext) {
+        this.writer = Preconditions.checkNotNull(writer);
         this.codecs = Preconditions.checkNotNull(codecFactory);
         this.tracker = SchemaTracker.create(codecFactory.getSchemaContext(), path);
         this.context = Preconditions.checkNotNull(rootContext);
@@ -68,11 +69,14 @@ public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStrea
     /**
      * Create a new stream writer, which writes to the specified output stream.
      *
+     * <p>
      * The codec factory can be reused between multiple writers.
      *
+     * <p>
      * Returned writer is exclusive user of JsonWriter, which means it will start
      * top-level JSON element and ends it.
      *
+     * <p>
      * This instance of writer can be used only to emit one top level element,
      * otherwise it will produce incorrect JSON.
      *
@@ -82,15 +86,19 @@ public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStrea
      * @param jsonWriter JsonWriter
      * @return A stream writer instance
      */
-    public static NormalizedNodeStreamWriter createExclusiveWriter(final JSONCodecFactory codecFactory, final SchemaPath path, final URI initialNs, final JsonWriter jsonWriter) {
-        return new JSONNormalizedNodeStreamWriter(codecFactory, path, jsonWriter, new JSONStreamWriterExclusiveRootContext(initialNs));
+    public static NormalizedNodeStreamWriter createExclusiveWriter(final JSONCodecFactory codecFactory,
+            final SchemaPath path, final URI initialNs, final JsonWriter jsonWriter) {
+        return new JSONNormalizedNodeStreamWriter(codecFactory, path, jsonWriter,
+            new JSONStreamWriterExclusiveRootContext(initialNs));
     }
 
     /**
      * Create a new stream writer, which writes to the specified output stream.
      *
+     * <p>
      * The codec factory can be reused between multiple writers.
      *
+     * <p>
      * Returned writer can be used emit multiple top level element,
      * but does not start / close parent JSON object, which must be done
      * by user providing {@code jsonWriter} instance in order for
@@ -102,8 +110,10 @@ public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStrea
      * @param jsonWriter JsonWriter
      * @return A stream writer instance
      */
-    public static NormalizedNodeStreamWriter createNestedWriter(final JSONCodecFactory codecFactory, final SchemaPath path, final URI initialNs, final JsonWriter jsonWriter) {
-        return new JSONNormalizedNodeStreamWriter(codecFactory, path, jsonWriter, new JSONStreamWriterSharedRootContext(initialNs));
+    public static NormalizedNodeStreamWriter createNestedWriter(final JSONCodecFactory codecFactory,
+            final SchemaPath path, final URI initialNs, final JsonWriter jsonWriter) {
+        return new JSONNormalizedNodeStreamWriter(codecFactory, path, jsonWriter,
+            new JSONStreamWriterSharedRootContext(initialNs));
     }
 
     @Override
@@ -221,15 +231,8 @@ public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStrea
     }
 
     @SuppressWarnings("unchecked")
-    private void writeValue(final Object value, final JSONCodec<?> codec)
-            throws IOException {
-        try {
-            ((JSONCodec<Object>) codec).writeValue(writer, value);
-        } catch (IOException | RuntimeException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
+    private void writeValue(final Object value, final JSONCodec<?> codec) throws IOException {
+        ((JSONCodec<Object>) codec).writeValue(writer, value);
     }
 
     private void writeAnyXmlValue(final DOMSource anyXmlValue) throws IOException {
@@ -273,7 +276,7 @@ public final class JSONNormalizedNodeStreamWriter implements NormalizedNodeStrea
                     writer.beginObject();
                     inObject = true;
                     // name
-                } else if (!inArray){
+                } else if (!inArray) {
                     writer.name(childNode.getNodeName());
                 }
             }
index 5449f4c4c70869706316a6bb52158a2fabd18bfc..11ac84f1d9471fa176629d45d53a2d2364957811 100644 (file)
@@ -17,9 +17,8 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
- * Abstract base class for a single level of {@link JSONNormalizedNodeStreamWriter}
- * recursion. Provides the base API towards the writer, which is then specialized
- * by subclasses.
+ * Abstract base class for a single level of {@link JSONNormalizedNodeStreamWriter} recursion. Provides the base API
+ * towards the writer, which is then specialized by subclasses.
  */
 abstract class JSONStreamWriterContext {
     private final JSONStreamWriterContext parent;
@@ -46,15 +45,15 @@ abstract class JSONStreamWriterContext {
     }
 
     /**
-     * Write a child JSON node identifier, optionally prefixing it with the module name
-     * corresponding to its namespace.
+     * Write a child JSON node identifier, optionally prefixing it with the module name corresponding to its namespace.
      *
      * @param schema Schema context
      * @param writer Output writer
      * @param qname Namespace/name tuple
      * @throws IOException when the writer reports it
      */
-    final void writeChildJsonIdentifier(final SchemaContext schema, final JsonWriter writer, final QName qname) throws IOException {
+    final void writeChildJsonIdentifier(final SchemaContext schema, final JsonWriter writer, final QName qname)
+            throws IOException {
 
         final StringBuilder sb = new StringBuilder();
         // Prepend module name if namespaces do not match
@@ -72,15 +71,15 @@ abstract class JSONStreamWriterContext {
     }
 
     /**
-     * Write our JSON node identifier, optionally prefixing it with the module name
-     * corresponding to its namespace.
+     * Write our JSON node identifier, optionally prefixing it with the module name corresponding to its namespace.
      *
      * @param schema Schema context
      * @param writer Output writer
      * @param qname Namespace/name tuple
      * @throws IOException when the writer reports it
      */
-    protected final void writeMyJsonIdentifier(final SchemaContext schema, final JsonWriter writer, final QName qname) throws IOException {
+    protected final void writeMyJsonIdentifier(final SchemaContext schema, final JsonWriter writer, final QName qname)
+            throws IOException {
         parent.writeChildJsonIdentifier(schema, writer, qname);
     }
 
@@ -96,18 +95,18 @@ abstract class JSONStreamWriterContext {
      *
      * @param schema Schema context
      * @param writer Output writer
-     * @throws IOException
+     * @throws IOException when the writer reports it
      */
-    protected abstract void emitStart(final SchemaContext schema, final JsonWriter writer) throws IOException;
+    protected abstract void emitStart(SchemaContext schema, JsonWriter writer) throws IOException;
 
     /**
      * Emit the end of an element.
      *
      * @param schema Schema context
      * @param writer Output writer
-     * @throws IOException
+     * @throws IOException when writer reports it
      */
-    protected abstract void emitEnd(final JsonWriter writer) throws IOException;
+    protected abstract void emitEnd(JsonWriter writer) throws IOException;
 
     private void emitMyself(final SchemaContext schema, final JsonWriter writer) throws IOException {
         if (!emittedMyself) {
index fe08410cafa5620cc7b3e2b1a1d8dfa72f0455df..cac95796c7463fb9d26bee9cff68991e3853ff2b 100644 (file)
@@ -12,14 +12,14 @@ import java.io.IOException;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-
 /**
  * A recursion level of {@link JSONNormalizedNodeStreamWriter}, which represents
  * a JSON object which has to be prefixed with its identifier -- such as a
  * container.
  */
 final class JSONStreamWriterNamedObjectContext extends JSONStreamWriterObjectContext {
-    protected JSONStreamWriterNamedObjectContext(final JSONStreamWriterContext parent, final PathArgument arg, final boolean mandatory) {
+    protected JSONStreamWriterNamedObjectContext(final JSONStreamWriterContext parent, final PathArgument arg,
+            final boolean mandatory) {
         super(parent, arg, mandatory);
     }
 
index fb4e48ed6091073550c02154113496c318e8016c..c24be1cc31509957cfc00da974e184654d3b1aa6 100644 (file)
@@ -19,7 +19,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * as when it is in a containing list.
  */
 class JSONStreamWriterObjectContext extends JSONStreamWriterQNameContext {
-    protected JSONStreamWriterObjectContext(final JSONStreamWriterContext parent, final PathArgument arg, final boolean mandatory) {
+    protected JSONStreamWriterObjectContext(final JSONStreamWriterContext parent, final PathArgument arg,
+            final boolean mandatory) {
         super(Preconditions.checkNotNull(parent), arg.getNodeType(), mandatory);
     }
 
index 3cee46f7bbc1ed714a3a6d110fa9160e38afa0b4..90c472800a9459dd11a925d9f73083581557c5e5 100644 (file)
@@ -21,7 +21,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 abstract class JSONStreamWriterQNameContext extends JSONStreamWriterContext {
     private final QName qname;
 
-    protected JSONStreamWriterQNameContext(final JSONStreamWriterContext parent, final QName qname, final boolean mandatory) {
+    protected JSONStreamWriterQNameContext(final JSONStreamWriterContext parent, final QName qname,
+            final boolean mandatory) {
         super(parent, mandatory);
         this.qname = Preconditions.checkNotNull(qname);
     }
index bc29d28a65bc94a9ded963e72d1590a77ab23c0e..cf02d07ac272f14b80d31295c07645d03b115aab 100644 (file)
@@ -19,10 +19,12 @@ import java.io.EOFException;
 import java.io.Flushable;
 import java.io.IOException;
 import java.net.URI;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayDeque;
 import java.util.Collections;
 import java.util.Deque;
 import java.util.HashSet;
+import java.util.Map.Entry;
 import java.util.Set;
 import javax.xml.transform.dom.DOMSource;
 import org.opendaylight.yangtools.util.xml.UntrustedXML;
@@ -157,10 +159,8 @@ public final class JsonParserStream implements Closeable, Flushable {
                     traverseAnyXmlValue(in, doc, childElement);
                 }
                 in.endObject();
-            case END_DOCUMENT:
-            case NAME:
-            case END_OBJECT:
-            case END_ARRAY:
+                break;
+            default:
                 break;
         }
     }
@@ -179,76 +179,75 @@ public final class JsonParserStream implements Closeable, Flushable {
 
     public void read(final JsonReader in, AbstractNodeDataWithSchema parent) throws IOException {
         switch (in.peek()) {
-        case STRING:
-        case NUMBER:
-            setValue(parent, in.nextString());
-            break;
-        case BOOLEAN:
-            setValue(parent, Boolean.toString(in.nextBoolean()));
-            break;
-        case NULL:
-            in.nextNull();
-            setValue(parent, null);
-            break;
-        case BEGIN_ARRAY:
-            in.beginArray();
-            while (in.hasNext()) {
-                if (parent instanceof LeafNodeDataWithSchema) {
-                    read(in, parent);
-                } else {
-                    final AbstractNodeDataWithSchema newChild = newArrayEntry(parent);
-                    read(in, newChild);
-                }
-            }
-            in.endArray();
-            return;
-        case BEGIN_OBJECT:
-            final Set<String> namesakes = new HashSet<>();
-            in.beginObject();
-            /*
-             * This allows parsing of incorrectly /as showcased/
-             * in testconf nesting of list items - eg.
-             * lists with one value are sometimes serialized
-             * without wrapping array.
-             *
-             */
-            if (isArray(parent)) {
-                parent = newArrayEntry(parent);
-            }
-            while (in.hasNext()) {
-                final String jsonElementName = in.nextName();
-                DataSchemaNode parentSchema = parent.getSchema();
-                if (parentSchema instanceof YangModeledAnyXmlSchemaNode) {
-                    parentSchema = ((YangModeledAnyXmlSchemaNode) parentSchema).getSchemaOfAnyXmlData();
+            case STRING:
+            case NUMBER:
+                setValue(parent, in.nextString());
+                break;
+            case BOOLEAN:
+                setValue(parent, Boolean.toString(in.nextBoolean()));
+                break;
+            case NULL:
+                in.nextNull();
+                setValue(parent, null);
+                break;
+            case BEGIN_ARRAY:
+                in.beginArray();
+                while (in.hasNext()) {
+                    if (parent instanceof LeafNodeDataWithSchema) {
+                        read(in, parent);
+                    } else {
+                        final AbstractNodeDataWithSchema newChild = newArrayEntry(parent);
+                        read(in, newChild);
+                    }
                 }
-                final NamespaceAndName namespaceAndName = resolveNamespace(jsonElementName, parentSchema);
-                final String localName = namespaceAndName.getName();
-                addNamespace(namespaceAndName.getUri());
-                if (!namesakes.add(jsonElementName)) {
-                    throw new JsonSyntaxException("Duplicate name " + jsonElementName + " in JSON input.");
+                in.endArray();
+                return;
+            case BEGIN_OBJECT:
+                final Set<String> namesakes = new HashSet<>();
+                in.beginObject();
+                /*
+                 * This allows parsing of incorrectly /as showcased/
+                 * in testconf nesting of list items - eg.
+                 * lists with one value are sometimes serialized
+                 * without wrapping array.
+                 *
+                 */
+                if (isArray(parent)) {
+                    parent = newArrayEntry(parent);
                 }
-
-                final Deque<DataSchemaNode> childDataSchemaNodes = ParserStreamUtils.findSchemaNodeByNameAndNamespace(
-                    parentSchema, localName, getCurrentNamespace());
-                Preconditions.checkState(!childDataSchemaNodes.isEmpty(),
-                    "Schema for node with name %s and namespace %s does not exist.", localName, getCurrentNamespace());
-
-                final AbstractNodeDataWithSchema newChild = ((CompositeNodeDataWithSchema) parent)
-                        .addChild(childDataSchemaNodes);
-                if (newChild instanceof AnyXmlNodeDataWithSchema) {
-                    readAnyXmlValue(in, (AnyXmlNodeDataWithSchema) newChild, jsonElementName);
-                } else {
-                    read(in, newChild);
+                while (in.hasNext()) {
+                    final String jsonElementName = in.nextName();
+                    DataSchemaNode parentSchema = parent.getSchema();
+                    if (parentSchema instanceof YangModeledAnyXmlSchemaNode) {
+                        parentSchema = ((YangModeledAnyXmlSchemaNode) parentSchema).getSchemaOfAnyXmlData();
+                    }
+                    final Entry<String, URI> namespaceAndName = resolveNamespace(jsonElementName, parentSchema);
+                    final String localName = namespaceAndName.getKey();
+                    addNamespace(namespaceAndName.getValue());
+                    if (!namesakes.add(jsonElementName)) {
+                        throw new JsonSyntaxException("Duplicate name " + jsonElementName + " in JSON input.");
+                    }
+
+                    final Deque<DataSchemaNode> childDataSchemaNodes =
+                            ParserStreamUtils.findSchemaNodeByNameAndNamespace(parentSchema, localName,
+                                getCurrentNamespace());
+                    Preconditions.checkState(!childDataSchemaNodes.isEmpty(),
+                        "Schema for node with name %s and namespace %s does not exist.", localName,
+                        getCurrentNamespace());
+
+                    final AbstractNodeDataWithSchema newChild = ((CompositeNodeDataWithSchema) parent)
+                            .addChild(childDataSchemaNodes);
+                    if (newChild instanceof AnyXmlNodeDataWithSchema) {
+                        readAnyXmlValue(in, (AnyXmlNodeDataWithSchema) newChild, jsonElementName);
+                    } else {
+                        read(in, newChild);
+                    }
+                    removeNamespace();
                 }
-                removeNamespace();
-            }
-            in.endObject();
-            return;
-        case END_DOCUMENT:
-        case NAME:
-        case END_OBJECT:
-        case END_ARRAY:
-            break;
+                in.endObject();
+                return;
+            default:
+                break;
         }
     }
 
@@ -263,7 +262,7 @@ public final class JsonParserStream implements Closeable, Flushable {
         } else if (parent instanceof LeafListNodeDataWithSchema) {
             newChild = new LeafListEntryNodeDataWithSchema(parent.getSchema());
         } else {
-            throw new IllegalStateException("Found an unexpected array nested under "+ parent.getSchema().getQName());
+            throw new IllegalStateException("Found an unexpected array nested under " + parent.getSchema().getQName());
         }
         ((CompositeNodeDataWithSchema) parent).addChild(newChild);
         return newChild;
@@ -293,7 +292,7 @@ public final class JsonParserStream implements Closeable, Flushable {
         namespaces.push(namespace);
     }
 
-    private NamespaceAndName resolveNamespace(final String childName, final DataSchemaNode dataSchemaNode) {
+    private Entry<String, URI> resolveNamespace(final String childName, final DataSchemaNode dataSchemaNode) {
         final int lastIndexOfColon = childName.lastIndexOf(':');
         String moduleNamePart = null;
         String nodeNamePart = null;
@@ -316,19 +315,21 @@ public final class JsonParserStream implements Closeable, Flushable {
             } else if (potentialUris.size() == 1) {
                 namespace = potentialUris.iterator().next();
             } else if (potentialUris.size() > 1) {
-                throw new IllegalStateException("Choose suitable module name for element "+nodeNamePart+":"+toModuleNames(potentialUris));
+                throw new IllegalStateException("Choose suitable module name for element " + nodeNamePart + ":"
+                        + toModuleNames(potentialUris));
             } else if (potentialUris.isEmpty()) {
-                throw new IllegalStateException("Schema node with name "+nodeNamePart+" wasn't found under "+dataSchemaNode.getQName()+".");
+                throw new IllegalStateException("Schema node with name " + nodeNamePart + " was not found under "
+                        + dataSchemaNode.getQName() + ".");
             }
         }
 
-        return new NamespaceAndName(nodeNamePart, namespace);
+        return new SimpleImmutableEntry<>(nodeNamePart, namespace);
     }
 
     private String toModuleNames(final Set<URI> potentialUris) {
         final StringBuilder builder = new StringBuilder();
         for (final URI potentialUri : potentialUris) {
-            builder.append("\n");
+            builder.append('\n');
             //FIXME how to get information about revision from JSON input? currently first available is used.
             builder.append(schema.findModuleByNamespace(potentialUri).iterator().next().getName());
         }
@@ -360,24 +361,6 @@ public final class JsonParserStream implements Closeable, Flushable {
         return namespaces.peek();
     }
 
-    private static class NamespaceAndName {
-        private final URI uri;
-        private final String name;
-
-        public NamespaceAndName(final String name, final URI uri) {
-            this.name = name;
-            this.uri = uri;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public URI getUri() {
-            return uri;
-        }
-    }
-
     @Override
     public void flush() throws IOException {
         writer.flush();
index 8d3eb258b8800b4617dc34ded9ca16429dc1b358..00f5538da60de4db52e449b9f4dbb0c793099aa4 100644 (file)
@@ -13,7 +13,7 @@ import com.google.gson.stream.JsonWriter;
 import java.io.Writer;
 
 /**
- * Factory Method class for JsonWriter creation
+ * Factory Method class for JsonWriter creation.
  */
 @Beta
 public final class JsonWriterFactory {
index 1e7235201283e1aa8a805160604e6d12a7516c66..9800476b7a4aa755f1508194292567fdb8b070a7 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yangtools.yang.data.impl.codec.DataStringCodec;
  *
  * @param <T> Deserialized value type
  */
-final class NumberJSONCodec<T extends Number> extends AbstractJSONCodec<T > {
+final class NumberJSONCodec<T extends Number> extends AbstractJSONCodec<T> {
     NumberJSONCodec(final DataStringCodec<T> codec) {
         super(codec);
     }
index 741db997ee82ef229260696f79027853e1e2a2d5..23af4462ebaef3d3bbe0ed7b1ae625a40c565d73 100644 (file)
@@ -77,6 +77,7 @@ abstract class UnionJSONCodec<T> implements JSONCodec<T> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public final T parseValue(final Object ctx, final String str) {
         for (JSONCodec<?> codec : codecs) {
             final Object ret;
@@ -94,6 +95,7 @@ abstract class UnionJSONCodec<T> implements JSONCodec<T> {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:illegalCatch")
     public final void writeValue(final JsonWriter ctx, final T value) throws IOException {
         for (JSONCodec<?> codec : codecs) {
             if (!codec.getDataType().isInstance(value)) {
index f64661b4121282b305a56ae02058245361834bf8..0970dde218eed3f1af071bce01a32103c09aeb1d 100644 (file)
@@ -86,9 +86,9 @@ public class AnyXmlSupportTest {
 
         // serialization
         final Writer writer = new StringWriter();
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
-                createExclusiveWriter(JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
-                        JsonWriterFactory.createJsonWriter(writer, 2));
+        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
+            JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
+            JsonWriterFactory.createJsonWriter(writer, 2));
         final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
         nodeWriter.write(transformedInput);
         nodeWriter.close();
@@ -128,9 +128,9 @@ public class AnyXmlSupportTest {
 
         // serialization
         final Writer writer = new StringWriter();
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
-                createExclusiveWriter(JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
-                        JsonWriterFactory.createJsonWriter(writer, 2));
+        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
+            JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
+            JsonWriterFactory.createJsonWriter(writer, 2));
         final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
         nodeWriter.write(transformedInput);
         nodeWriter.close();
@@ -145,8 +145,8 @@ public class AnyXmlSupportTest {
     private static DOMSource getParsedAnyXmlValue(final NormalizedNode<?, ?> transformedInput, final QName anyxmlName) {
         assertTrue(transformedInput instanceof ContainerNode);
         final ContainerNode cont1 = (ContainerNode) transformedInput;
-        final DataContainerChild<? extends PathArgument, ?> child = cont1.getChild(new NodeIdentifier(anyxmlName)).get();
-        assertNotNull(child);
+        final DataContainerChild<? extends PathArgument, ?> child = cont1.getChild(new NodeIdentifier(anyxmlName))
+                .get();
         assertTrue(child instanceof AnyXmlNode);
         final AnyXmlNode anyXmlNode = (AnyXmlNode) child;
         return anyXmlNode.getValue();
index 32ac33c24891097052824e4bc0bcc34611af06a9..945cd3c55efaa585d524197e5ac3aafd644e90a6 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.yangtools.yang.data.codec.gson;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+
 import com.google.common.base.Optional;
 import com.google.gson.stream.JsonReader;
 import java.io.File;
@@ -53,34 +54,34 @@ public class Bug4969Test {
 
         assertTrue(transformedInput instanceof ContainerNode);
         ContainerNode root = (ContainerNode) transformedInput;
-        Optional<DataContainerChild<? extends PathArgument, ?>> ref1 = root.getChild(NodeIdentifier.create((QName
-                .create("foo", "2016-01-22", "ref1"))));
-        Optional<DataContainerChild<? extends PathArgument, ?>> ref2 = root.getChild(NodeIdentifier.create((QName
-                .create("foo", "2016-01-22", "ref2"))));
-        Optional<DataContainerChild<? extends PathArgument, ?>> ref3 = root.getChild(NodeIdentifier.create((QName
-                .create("foo", "2016-01-22", "ref3"))));
-        Optional<DataContainerChild<? extends PathArgument, ?>> ref4 = root.getChild(NodeIdentifier.create((QName
-                .create("foo", "2016-01-22", "ref4"))));
+        final Optional<DataContainerChild<? extends PathArgument, ?>> ref1 = root.getChild(NodeIdentifier.create(
+            QName.create("foo", "2016-01-22", "ref1")));
+        final Optional<DataContainerChild<? extends PathArgument, ?>> ref2 = root.getChild(NodeIdentifier.create(
+            QName.create("foo", "2016-01-22", "ref2")));
+        final Optional<DataContainerChild<? extends PathArgument, ?>> ref3 = root.getChild(NodeIdentifier.create(
+            QName.create("foo", "2016-01-22", "ref3")));
+        final Optional<DataContainerChild<? extends PathArgument, ?>> ref4 = root.getChild(NodeIdentifier.create(
+            QName.create("foo", "2016-01-22", "ref4")));
 
         assertTrue(ref1.isPresent());
         assertTrue(ref2.isPresent());
         assertTrue(ref3.isPresent());
         assertTrue(ref4.isPresent());
 
-        Object value1 = ref1.get().getValue();
-        Object value2 = ref2.get().getValue();
-        Object value3 = ref3.get().getValue();
-        Object value4 = ref4.get().getValue();
+        final Object value1 = ref1.get().getValue();
+        final Object value2 = ref2.get().getValue();
+        final Object value3 = ref3.get().getValue();
+        final Object value4 = ref4.get().getValue();
 
         assertTrue(value1 instanceof Set);
         assertTrue(value2 instanceof Set);
         assertTrue(value3 instanceof Set);
         assertTrue(value4 instanceof Set);
 
-        Set<?> set1 = (Set<?>) value1;
-        Set<?> set2 = (Set<?>) value2;
-        Set<?> set3 = (Set<?>) value3;
-        Set<?> set4 = (Set<?>) value4;
+        final Set<?> set1 = (Set<?>) value1;
+        final Set<?> set2 = (Set<?>) value2;
+        final Set<?> set3 = (Set<?>) value3;
+        final Set<?> set4 = (Set<?>) value4;
 
         assertEquals(1, set1.size());
         assertEquals(2, set2.size());
index 682fcc676579556c14cd9c3f5a081bd9ec5eaaf4..511ab97bbef0f1005938781b515e93e9ca0e9c6c 100644 (file)
@@ -33,8 +33,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class Bug7246Test {
-    private static String NS = "my-namespace";
-    private static String REV = "1970-01-01";
+    private static final String NS = "my-namespace";
+    private static final String REV = "1970-01-01";
 
     @Test
     public void test() throws Exception {
@@ -55,7 +55,7 @@ public class Bug7246Test {
         assertEquals(expextedJson, serializedJson);
     }
 
-    private QName qN(final String localName) {
+    private static QName qN(final String localName) {
         return QName.create(NS, REV, localName);
     }
 
index 5ab681dc290ed29a6282ebf4edf2bb9ce7f17d00..bd852e288b88b80f826ed4ff58e00d311d07417c 100644 (file)
@@ -37,8 +37,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
- *
- * Each test tests whether json input is correctly transformed to normalized node structure
+ * Each test tests whether json input is correctly transformed to normalized node structure.
  */
 public class JsonStreamToNormalizedNodeTest {
 
@@ -85,11 +84,11 @@ public class JsonStreamToNormalizedNodeTest {
     }
 
     /**
-     * Test of translating internal augmentations to normalized nodes structure
+     * Test of translating internal augmentations to normalized nodes structure.
      *
+     * <p>
      * 2 nodes are added via internal augmentation A, 1 node via internal augmentation B and one node is originally
      * member of case.
-     *
      */
     @Test
     public void caseNodeAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
@@ -99,20 +98,18 @@ public class JsonStreamToNormalizedNodeTest {
     }
 
     /**
-     * also test using of namesakes (equal local names with different
-     *
-     * @throws IOException
-     * @throws URISyntaxException
+     * also test using of namesakes (equal local names with different.
      */
     @Test
     public void caseNodeExternalAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/case-node-external-augmentation-in-choice-in-container.json");
+        final String inputJson =
+                loadTextFile("/complexjson/case-node-external-augmentation-in-choice-in-container.json");
         verifyTransformationToNormalizedNode(inputJson,
                 TestingNormalizedNodeStructuresCreator.caseNodeExternalAugmentationInChoiceInContainer());
     }
 
     /**
-     * augmentation of choice - adding new case
+     * augmentation of choice - adding new case.
      */
     @Test
     public void choiceNodeAugmentationInContainer() throws IOException, URISyntaxException {
@@ -124,14 +121,15 @@ public class JsonStreamToNormalizedNodeTest {
     @Test
     public void unkeyedNodeInContainer() throws IOException, URISyntaxException {
         final String inputJson = loadTextFile("/complexjson/unkeyed-node-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson, TestingNormalizedNodeStructuresCreator.unkeyedNodeInContainer());
+        verifyTransformationToNormalizedNode(inputJson,
+            TestingNormalizedNodeStructuresCreator.unkeyedNodeInContainer());
     }
 
     /**
      * Top level JSON element contains no information about module name.
      *
+     * <p>
      * It should be possible to find out potential module name from available schema context.
-     *
      */
     @Test
     public void missingModuleInfoInTopLevelElement() throws IOException, URISyntaxException {
@@ -140,9 +138,9 @@ public class JsonStreamToNormalizedNodeTest {
     }
 
     /**
-     *
      * Exception expected.
      *
+     * <p>
      * It tests case when several elements with the same name and various namespaces exists and are in JSON specified
      * without module name prefix.
      */
@@ -173,9 +171,9 @@ public class JsonStreamToNormalizedNodeTest {
     }
 
     /**
-     *
      * Exception expected.
      *
+     * <p>
      * Json input contains element which doesn't exist in YANG schema
      */
     @Test
@@ -185,11 +183,10 @@ public class JsonStreamToNormalizedNodeTest {
             //second parameter isn't necessary because error will be raised before it is used.
             verifyTransformationToNormalizedNode(inputJson, null);
         } catch (final IllegalStateException e) {
-            assertTrue(e.getMessage().contains("Schema node with name dummy-element wasn't found"));
+            assertTrue(e.getMessage().contains("Schema node with name dummy-element was not found"));
         }
     }
 
-
     @Test
     public void listItemWithoutArray() throws IOException, URISyntaxException {
         final String inputJson = loadTextFile("/complexjson/keyed-list-restconf-behaviour.json");
@@ -216,7 +213,7 @@ public class JsonStreamToNormalizedNodeTest {
         assertNotNull(transformedInput);
     }
 
-   @Test
+    @Test
     public void multipleChoiceAugmentation() throws IOException, URISyntaxException {
         final String inputJson = loadTextFile("/complexjson/multiple-choice-augmentation-in-container.json");
 
@@ -271,5 +268,4 @@ public class JsonStreamToNormalizedNodeTest {
         assertEquals("Transformation of json input to normalized node wasn't successful.", awaitedStructure,
                 transformedInput);
     }
-
 }
index fcba4f921b6952cc8e1bb29b8744c09f4b92d11a..7271c929b339ff041fa9e4a8a504a09a099ac383 100644 (file)
@@ -46,7 +46,6 @@ import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
  * Each test tests whether json output obtained after transformation contains is corect. The transformation takes
  * normalized node data structure and transform it to json output. To make it easier validate json output it is loaded
  * via gson as structure of json elements which are walked and compared with awaited values.
- *
  */
 public class NormalizedNodeToJsonStreamTest {
 
@@ -54,10 +53,6 @@ public class NormalizedNodeToJsonStreamTest {
     private static final QName EMPTY_LEAF = QName.create(CONT_1, "empty");
     private static SchemaContext schemaContext;
 
-    public interface JsonValidator {
-        void validate(final String jsonOutput);
-    }
-
     @BeforeClass
     public static void initialization() throws IOException, URISyntaxException, ReactorException {
         schemaContext = YangParserTestUtils.parseYangSources("/complexjson/yang");
@@ -68,16 +63,13 @@ public class NormalizedNodeToJsonStreamTest {
         final Writer writer = new StringWriter();
         final NormalizedNode<?, ?> leafNodeInContainer = TestingNormalizedNodeStructuresCreator.leafNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafNodeInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-
-            final JsonPrimitive lf11 = childPrimitive(cont1, "complexjson:lf11", "lf11");
-            assertNotNull(lf11);
-            final int asInt = lf11.getAsInt();
-            assertEquals(453, asInt);
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
 
+        final JsonPrimitive lf11 = childPrimitive(cont1, "complexjson:lf11", "lf11");
+        assertNotNull(lf11);
+        final int asInt = lf11.getAsInt();
+        assertEquals(453, asInt);
     }
 
     @Test
@@ -86,22 +78,19 @@ public class NormalizedNodeToJsonStreamTest {
         final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator
                 .leafListNodeInContainerMultiline();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-            final JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
-            assertNotNull(lflst11);
-
-            final HashSet<Object> lflst11Values = Sets.newHashSet();
-            for (final JsonElement jsonElement : lflst11) {
-                assertTrue(jsonElement instanceof JsonPrimitive);
-                lflst11Values.add(jsonElement.getAsString());
-            }
-
-            assertEquals(Sets.newHashSet("lflst11 value2\r\nanother line 2", "lflst11 value1\nanother line 1"),
-                    lflst11Values);
-        }).validate(jsonOutput);
-
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+        final JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
+        assertNotNull(lflst11);
+
+        final HashSet<Object> lflst11Values = Sets.newHashSet();
+        for (final JsonElement jsonElement : lflst11) {
+            assertTrue(jsonElement instanceof JsonPrimitive);
+            lflst11Values.add(jsonElement.getAsString());
+        }
+
+        assertEquals(Sets.newHashSet("lflst11 value2\r\nanother line 2", "lflst11 value1\nanother line 1"),
+            lflst11Values);
     }
 
     @Test
@@ -110,16 +99,13 @@ public class NormalizedNodeToJsonStreamTest {
         final NormalizedNode<?, ?> leafNodeViaAugmentationInContainer = TestingNormalizedNodeStructuresCreator
                 .leafNodeViaAugmentationInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafNodeViaAugmentationInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-
-            final JsonPrimitive lf12_1 = childPrimitive(cont1, "complexjson:lf12_1", "lf12_1");
-            assertNotNull(lf12_1);
-            final String asString = lf12_1.getAsString();
-            assertEquals("lf12 value", asString);
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
 
+        final JsonPrimitive lf12_1 = childPrimitive(cont1, "complexjson:lf12_1", "lf12_1");
+        assertNotNull(lf12_1);
+        final String asString = lf12_1.getAsString();
+        assertEquals("lf12 value", asString);
     }
 
     @Test
@@ -128,20 +114,18 @@ public class NormalizedNodeToJsonStreamTest {
         final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator
                 .leafListNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-            final JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
-            assertNotNull(lflst11);
-
-            final HashSet<Object> lflst11Values = Sets.newHashSet();
-            for (final JsonElement jsonElement : lflst11) {
-                assertTrue(jsonElement instanceof JsonPrimitive);
-                lflst11Values.add(jsonElement.getAsString());
-            }
-
-            assertEquals(Sets.newHashSet("lflst11 value2", "lflst11 value1"), lflst11Values);
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+        final JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
+        assertNotNull(lflst11);
+
+        final HashSet<Object> lflst11Values = Sets.newHashSet();
+        for (final JsonElement jsonElement : lflst11) {
+            assertTrue(jsonElement instanceof JsonPrimitive);
+            lflst11Values.add(jsonElement.getAsString());
+        }
+
+        assertEquals(Sets.newHashSet("lflst11 value2", "lflst11 value1"), lflst11Values);
     }
 
     @Test
@@ -150,33 +134,31 @@ public class NormalizedNodeToJsonStreamTest {
         final NormalizedNode<?, ?> keyedListNodeInContainer = TestingNormalizedNodeStructuresCreator
                 .keyedListNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, keyedListNodeInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-            final JsonArray lst11 = childArray(cont1, "complexjson:lst11", "lst11");
-            assertNotNull(lst11);
-
-            final Iterator<JsonElement> iterator = lst11.iterator();
-            assertTrue(iterator.hasNext());
-            final JsonElement lst11Entry1Raw = iterator.next();
-            assertFalse(iterator.hasNext());
-            assertTrue(lst11Entry1Raw instanceof JsonObject);
-            final JsonObject lst11Entry1 = (JsonObject) lst11Entry1Raw;
-
-            final JsonPrimitive key111 = childPrimitive(lst11Entry1, "complexjson:key111", "key111");
-            assertNotNull(key111);
-            final JsonPrimitive lf112 = childPrimitive(lst11Entry1, "complexjson:lf112", "lf112");
-            assertNotNull(lf112);
-            final JsonPrimitive lf113 = childPrimitive(lst11Entry1, "complexjson:lf113", "lf113");
-            assertNotNull(lf113);
-            final JsonPrimitive lf111 = childPrimitive(lst11Entry1, "complexjson:lf111", "lf111");
-            assertNotNull(lf111);
-
-            assertEquals("key111 value", key111.getAsString());
-            assertEquals("/complexjson:cont1/complexjson:lflst11[.='foo']", lf112.getAsString());
-            assertEquals("lf113 value", lf113.getAsString());
-            assertEquals("lf111 value", lf111.getAsString());
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+        final JsonArray lst11 = childArray(cont1, "complexjson:lst11", "lst11");
+        assertNotNull(lst11);
+
+        final Iterator<JsonElement> iterator = lst11.iterator();
+        assertTrue(iterator.hasNext());
+        final JsonElement lst11Entry1Raw = iterator.next();
+        assertFalse(iterator.hasNext());
+        assertTrue(lst11Entry1Raw instanceof JsonObject);
+        final JsonObject lst11Entry1 = (JsonObject) lst11Entry1Raw;
+
+        final JsonPrimitive key111 = childPrimitive(lst11Entry1, "complexjson:key111", "key111");
+        assertNotNull(key111);
+        final JsonPrimitive lf112 = childPrimitive(lst11Entry1, "complexjson:lf112", "lf112");
+        assertNotNull(lf112);
+        final JsonPrimitive lf113 = childPrimitive(lst11Entry1, "complexjson:lf113", "lf113");
+        assertNotNull(lf113);
+        final JsonPrimitive lf111 = childPrimitive(lst11Entry1, "complexjson:lf111", "lf111");
+        assertNotNull(lf111);
+
+        assertEquals("key111 value", key111.getAsString());
+        assertEquals("/complexjson:cont1/complexjson:lflst11[.='foo']", lf112.getAsString());
+        assertEquals("lf113 value", lf113.getAsString());
+        assertEquals("lf111 value", lf111.getAsString());
     }
 
     @Test
@@ -185,27 +167,23 @@ public class NormalizedNodeToJsonStreamTest {
         final NormalizedNode<?, ?> choiceNodeInContainer = TestingNormalizedNodeStructuresCreator
                 .choiceNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, choiceNodeInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-            final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
-            assertNotNull(lf13);
-
-            assertEquals("lf13 value", lf13.getAsString());
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+        final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
+        assertNotNull(lf13);
+
+        assertEquals("lf13 value", lf13.getAsString());
     }
 
     /**
      * tested case when case c11A in choice choc11 is augmented (two leaves (augment A) and one leaf (augment B) are
-     * added)
-     *
-     * after running this test following exception is raised
+     * added).
      *
+     * <p>
+     * after running this test following exception is raised:
      * java.lang.IllegalArgumentException: Augmentation allowed only in DataNodeContainer
      * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
-     *
      */
-    // @Ignore
     @Test
     public void caseNodeAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
@@ -213,93 +191,81 @@ public class NormalizedNodeToJsonStreamTest {
                 .caseNodeAugmentationInChoiceInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
                 caseNodeAugmentationInChoiceInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-
-            final JsonPrimitive lf15_21 = childPrimitive(cont1, "complexjson:lf15_21", "lf15_21");
-            assertNotNull(lf15_21);
-            final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
-            assertNotNull(lf13);
-            final JsonPrimitive lf15_11 = childPrimitive(cont1, "complexjson:lf15_11", "lf15_11");
-            assertNotNull(lf15_11);
-            final JsonPrimitive lf15_12 = childPrimitive(cont1, "complexjson:lf15_12", "lf15_12");
-            assertNotNull(lf15_12);
-
-            assertEquals("lf15_21 value", lf15_21.getAsString());
-            assertEquals("lf13 value", lf13.getAsString());
-            assertTrue("one two".equals(lf15_11.getAsString()) || "two one".equals(lf15_11.getAsString()));
-            assertEquals("complexjson:lf11", lf15_12.getAsString());
-
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+
+        final JsonPrimitive lf15_21 = childPrimitive(cont1, "complexjson:lf15_21", "lf15_21");
+        assertNotNull(lf15_21);
+        final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
+        assertNotNull(lf13);
+        final JsonPrimitive lf15_11 = childPrimitive(cont1, "complexjson:lf15_11", "lf15_11");
+        assertNotNull(lf15_11);
+        final JsonPrimitive lf15_12 = childPrimitive(cont1, "complexjson:lf15_12", "lf15_12");
+        assertNotNull(lf15_12);
+
+        assertEquals("lf15_21 value", lf15_21.getAsString());
+        assertEquals("lf13 value", lf13.getAsString());
+        assertTrue("one two".equals(lf15_11.getAsString()) || "two one".equals(lf15_11.getAsString()));
+        assertEquals("complexjson:lf11", lf15_12.getAsString());
     }
 
     /**
      * tested case when case c11A in choice choc11 is augmented (two leaves (augment A) internally and one two leaves
-     * with the same names externally (augment B) are added)
-     *
-     * after running this test following exception is raised
+     * with the same names externally (augment B) are added).
      *
+     * <p>
+     * after running this test following exception is raised:
      * java.lang.IllegalArgumentException: Augmentation allowed only in DataNodeContainer
      * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
-     *
      */
-    // @Ignore
     @Test
     public void caseNodeExternalAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> caseNodeExternalAugmentationInChoiceInContainer = TestingNormalizedNodeStructuresCreator
-                .caseNodeExternalAugmentationInChoiceInContainer();
+        final NormalizedNode<?, ?> caseNodeExternalAugmentationInChoiceInContainer =
+                TestingNormalizedNodeStructuresCreator.caseNodeExternalAugmentationInChoiceInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
                 caseNodeExternalAugmentationInChoiceInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-
-            final JsonPrimitive lf15_11Augment = childPrimitive(cont1, "complexjson-augmentation:lf15_11");
-            assertNotNull(lf15_11Augment);
-            final JsonPrimitive lf15_12Augment = childPrimitive(cont1, "complexjson-augmentation:lf15_12");
-            assertNotNull(lf15_12Augment);
-            final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
-            assertNotNull(lf13);
-            final JsonPrimitive lf15_11 = childPrimitive(cont1, "complexjson:lf15_11", "lf15_11");
-            assertNotNull(lf15_11);
-            final JsonPrimitive lf15_12 = childPrimitive(cont1, "complexjson:lf15_12", "lf15_12");
-            assertNotNull(lf15_12);
-
-            assertEquals("lf15_11 value from augmentation", lf15_11Augment.getAsString());
-            assertEquals("lf15_12 value from augmentation", lf15_12Augment.getAsString());
-            assertEquals("lf13 value", lf13.getAsString());
-            assertTrue("one two".equals(lf15_11.getAsString()) || "two one".equals(lf15_11.getAsString()));
-            assertEquals("complexjson:lf11", lf15_12.getAsString());
-
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+
+        final JsonPrimitive lf15_11Augment = childPrimitive(cont1, "complexjson-augmentation:lf15_11");
+        assertNotNull(lf15_11Augment);
+        final JsonPrimitive lf15_12Augment = childPrimitive(cont1, "complexjson-augmentation:lf15_12");
+        assertNotNull(lf15_12Augment);
+        final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
+        assertNotNull(lf13);
+        final JsonPrimitive lf15_11 = childPrimitive(cont1, "complexjson:lf15_11", "lf15_11");
+        assertNotNull(lf15_11);
+        final JsonPrimitive lf15_12 = childPrimitive(cont1, "complexjson:lf15_12", "lf15_12");
+        assertNotNull(lf15_12);
+
+        assertEquals("lf15_11 value from augmentation", lf15_11Augment.getAsString());
+        assertEquals("lf15_12 value from augmentation", lf15_12Augment.getAsString());
+        assertEquals("lf13 value", lf13.getAsString());
+        assertTrue("one two".equals(lf15_11.getAsString()) || "two one".equals(lf15_11.getAsString()));
+        assertEquals("complexjson:lf11", lf15_12.getAsString());
     }
 
     /**
-     * augmentation of choice - adding new case
-     *
-     * after running this test following exception is raised
+     * augmentation of choice - adding new case.
      *
+     * <p>
+     * after running this test following exception is raised:
      * java.lang.IllegalArgumentException: Augmentation allowed only in DataNodeContainer
      * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
-     *
      */
-    // @Ignore
     @Test
     public void choiceNodeAugmentationInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
         final NormalizedNode<?, ?> choiceNodeAugmentationInContainer = TestingNormalizedNodeStructuresCreator
                 .choiceNodeAugmentationInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, choiceNodeAugmentationInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-
-            final JsonPrimitive lf17 = childPrimitive(cont1, "complexjson:lf17", "lf17");
-            assertNotNull(lf17);
-            assertEquals("lf17 value", lf17.getAsString());
-        }).validate(jsonOutput);
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
+
+        final JsonPrimitive lf17 = childPrimitive(cont1, "complexjson:lf17", "lf17");
+        assertNotNull(lf17);
+        assertEquals("lf17 value", lf17.getAsString());
     }
 
     @Test
@@ -308,27 +274,23 @@ public class NormalizedNodeToJsonStreamTest {
         final NormalizedNode<?, ?> unkeyedNodeInContainer = TestingNormalizedNodeStructuresCreator
                 .unkeyedNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, unkeyedNodeInContainer);
-        ((JsonValidator) jsonOutput1 -> {
-            final JsonObject cont1 = resolveCont1(jsonOutput1);
-            assertNotNull(cont1);
-
-            final JsonArray lst12 = childArray(cont1, "complexjson:lst12", "lst12");
-            assertNotNull(lst12);
-
-            final Iterator<JsonElement> iterator = lst12.iterator();
-            assertTrue(iterator.hasNext());
-            final JsonElement lst12Entry1Raw = iterator.next();
-            assertFalse(iterator.hasNext());
+        final JsonObject cont1 = resolveCont1(jsonOutput);
+        assertNotNull(cont1);
 
-            assertTrue(lst12Entry1Raw instanceof JsonObject);
-            final JsonObject lst12Entry1 = (JsonObject) lst12Entry1Raw;
-            final JsonPrimitive lf121 = childPrimitive(lst12Entry1, "complexjson:lf121", "lf121");
-            assertNotNull(lf121);
+        final JsonArray lst12 = childArray(cont1, "complexjson:lst12", "lst12");
+        assertNotNull(lst12);
 
-            assertEquals("lf121 value", lf121.getAsString());
+        final Iterator<JsonElement> iterator = lst12.iterator();
+        assertTrue(iterator.hasNext());
+        final JsonElement lst12Entry1Raw = iterator.next();
+        assertFalse(iterator.hasNext());
 
-        }).validate(jsonOutput);
+        assertTrue(lst12Entry1Raw instanceof JsonObject);
+        final JsonObject lst12Entry1 = (JsonObject) lst12Entry1Raw;
+        final JsonPrimitive lf121 = childPrimitive(lst12Entry1, "complexjson:lf121", "lf121");
+        assertNotNull(lf121);
 
+        assertEquals("lf121 value", lf121.getAsString());
     }
 
     @Test
@@ -349,14 +311,13 @@ public class NormalizedNodeToJsonStreamTest {
     private static String normalizedNodeToJsonStreamTransformation(final Writer writer,
             final NormalizedNode<?, ?> inputStructure) throws IOException {
 
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
-                createExclusiveWriter(JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
-                    JsonWriterFactory.createJsonWriter(writer, 2));
+        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
+            JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
+            JsonWriterFactory.createJsonWriter(writer, 2));
         final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
         nodeWriter.write(inputStructure);
 
         nodeWriter.close();
         return writer.toString();
     }
-
 }
index 3585cf56430d94b7abd980d022442e61635e1628..0cfefdcbd3e88c81a8515b8af7ba1dbe09918a6d 100644 (file)
@@ -47,8 +47,6 @@ public class StreamToNormalizedNodeTest {
 
     /**
      * Demonstrates how to log events produced by a {@link JsonReader}.
-     *
-     * @throws IOException
      */
     @Test
     public void ownStreamWriterImplementationDemonstration() throws IOException {
@@ -59,7 +57,7 @@ public class StreamToNormalizedNodeTest {
         final LoggingNormalizedNodeStreamWriter logWriter = new LoggingNormalizedNodeStreamWriter();
 
         // JSON -> StreamWriter parser
-        try (final JsonParserStream jsonHandler = JsonParserStream.create(logWriter, schemaContext)) {
+        try (JsonParserStream jsonHandler = JsonParserStream.create(logWriter, schemaContext)) {
             // Process multiple readers, flush()/close() as needed
             jsonHandler.parse(reader);
         }
@@ -68,8 +66,6 @@ public class StreamToNormalizedNodeTest {
     /**
      * Demonstrates how to create an immutable NormalizedNode tree from a {@link JsonReader} and
      * then writes the data back into string representation.
-     *
-     * @throws IOException
      */
     @Ignore
     @Test
@@ -96,7 +92,8 @@ public class StreamToNormalizedNodeTest {
          * This is the serialization part.
          */
         // We want to write the first child out
-        final DataContainerChild<? extends PathArgument, ?> firstChild = (DataContainerChild<? extends PathArgument, ?>) parsedData;
+        final DataContainerChild<? extends PathArgument, ?> firstChild =
+                (DataContainerChild<? extends PathArgument, ?>) parsedData;
         LOG.debug("Serializing first child: {}", firstChild);
 
         // String holder
@@ -104,9 +101,9 @@ public class StreamToNormalizedNodeTest {
 
         // StreamWriter which outputs JSON strings
         // StreamWriter which outputs JSON strings
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
-                createExclusiveWriter(JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
-                    JsonWriterFactory.createJsonWriter(writer, 2));
+        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
+            JSONCodecFactory.getShared(schemaContext), SchemaPath.ROOT, null,
+            JsonWriterFactory.createJsonWriter(writer, 2));
 
         // NormalizedNode -> StreamWriter
         final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
@@ -117,5 +114,4 @@ public class StreamToNormalizedNodeTest {
         // Just to put it somewhere
         LOG.debug("Serialized JSON: {}", writer.toString());
     }
-
 }
index db4814c9820364919af8ba334fe5d31d5cb14708..294ac0232dc0d8ff51e095dc987000a694eec2d4 100644 (file)
@@ -25,7 +25,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
@@ -125,13 +124,9 @@ public class TestingNormalizedNodeStructuresCreator {
     }
 
     private static DataContainerChild<? extends PathArgument, ?> augmentC11AWithLf15_21Node() {
-        DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> choc11_c11AugmentBuilder = Builders
-                .augmentationBuilder();
-        choc11_c11AugmentBuilder.withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(QName.create(
-                "ns:complex:json", "2014-08-11", "lf15_21"))));
-
-        choc11_c11AugmentBuilder.withChild(lf15_21Node());
-        return choc11_c11AugmentBuilder.build();
+        return Builders.augmentationBuilder().withNodeIdentifier(
+            new AugmentationIdentifier(Sets.newHashSet(QName.create("ns:complex:json", "2014-08-11", "lf15_21"))))
+                .withChild(lf15_21Node()).build();
     }
 
     private static LeafNode<Object> lf15_21Node() {
@@ -141,14 +136,13 @@ public class TestingNormalizedNodeStructuresCreator {
     }
 
     private static DataContainerChild<? extends PathArgument, ?> augmentC11AWithLf15_11AndLf15_12Node() {
-        DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> choc11_c11AugmentBuilder = Builders
-                .augmentationBuilder();
-        choc11_c11AugmentBuilder.withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(
-                QName.create("ns:complex:json", "2014-08-11", "lf15_11"),
-                QName.create("ns:complex:json", "2014-08-11", "lf15_12"))));
-        choc11_c11AugmentBuilder.withChild(lf15_11Node());
-        choc11_c11AugmentBuilder.withChild(lf15_12Node());
-        return choc11_c11AugmentBuilder.build();
+        return Builders.augmentationBuilder()
+                .withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(
+                    QName.create("ns:complex:json", "2014-08-11", "lf15_11"),
+                    QName.create("ns:complex:json", "2014-08-11", "lf15_12"))))
+                .withChild(lf15_11Node())
+                .withChild(lf15_12Node())
+                .build();
     }
 
     private static LeafNode<Object> lf15_12Node() {
@@ -176,8 +170,6 @@ public class TestingNormalizedNodeStructuresCreator {
     }
 
     private static DataContainerChild<? extends PathArgument, ?> childLst11() {
-        CollectionNodeBuilder<MapEntryNode, MapNode> lst11 = Builders.mapBuilder().withNodeIdentifier(
-                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lst11")));
 
         DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> lst11Entry1Builder = Builders
                 .mapEntryBuilder();
@@ -200,8 +192,8 @@ public class TestingNormalizedNodeStructuresCreator {
         lst11Entry1Builder.withChild(Builders.leafBuilder()
                 .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf111")))
                 .withValue("lf111 value").build());
-        lst11.withChild(lst11Entry1Builder.build());
-        return lst11.build();
+        return Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(
+            QName.create("ns:complex:json", "2014-08-11", "lst11"))).withChild(lst11Entry1Builder.build()).build();
     }
 
     private static Object lf112Value() {
@@ -217,13 +209,13 @@ public class TestingNormalizedNodeStructuresCreator {
                 new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lflst11")));
         lflst11.withChild(Builders
                 .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value1"))
+                .withNodeIdentifier(new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"),
+                        "lflst11 value1"))
                 .withValue("lflst11 value1").build());
         lflst11.withChild(Builders
                 .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value2"))
+                .withNodeIdentifier(new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"),
+                        "lflst11 value2"))
                 .withValue("lflst11 value2").build());
         return lflst11.build();
     }
@@ -233,13 +225,13 @@ public class TestingNormalizedNodeStructuresCreator {
                 new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lflst11")));
         lflst11.withChild(Builders
                 .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value1\nanother line 1"))
+                .withNodeIdentifier(new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"),
+                        "lflst11 value1\nanother line 1"))
                 .withValue("lflst11 value1\nanother line 1").build());
         lflst11.withChild(Builders
                 .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value2\r\nanother line 2"))
+                .withNodeIdentifier(new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"),
+                        "lflst11 value2\r\nanother line 2"))
                 .withValue("lflst11 value2\r\nanother line 2").build());
         return lflst11.build();
     }
@@ -254,6 +246,7 @@ public class TestingNormalizedNodeStructuresCreator {
     public static NormalizedNode<?, ?> leafListNodeInContainer() {
         return cont1Node(childLflst11());
     }
+
     public static NormalizedNode<?, ?> leafListNodeInContainerMultiline() {
         return cont1Node(childLflst11Multiline());
     }
@@ -271,16 +264,15 @@ public class TestingNormalizedNodeStructuresCreator {
     }
 
     /**
-     * choc11 contains lf13, lf15_11 and lf15_12 are added via external augmentation
-     *
-     * @return
+     * choc11 contains lf13, lf15_11 and lf15_12 are added via external augmentation.
      */
     public static NormalizedNode<?, ?> caseNodeAugmentationInChoiceInContainer() {
         return cont1Node(choc11Node(augmentC11AWithLf15_11AndLf15_12Node(), lf13Node(), augmentC11AWithLf15_21Node()));
     }
 
     public static NormalizedNode<?, ?> caseNodeExternalAugmentationInChoiceInContainer() {
-        return cont1Node(choc11Node(lf13Node(), augmentC11AWithLf15_11AndLf15_12Node(), externalAugmentC11AWithLf15_11AndLf15_12Node()));
+        return cont1Node(choc11Node(lf13Node(), augmentC11AWithLf15_11AndLf15_12Node(),
+            externalAugmentC11AWithLf15_11AndLf15_12Node()));
     }
 
     public static NormalizedNode<?, ?> choiceNodeAugmentationInContainer() {