From 807ab0252e9d18f390484d030c9b18baf6d8cefe Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 2 Sep 2017 14:25:23 +0200 Subject: [PATCH] Enable checkstyle on yang-data-codec-gson Gneeral cleanup and enable checkstyle. Change-Id: Ib63901ef099b1b457504e2b8e11341ab357a394a Signed-off-by: Robert Varga --- yang/yang-data-codec-gson/pom.xml | 38 ++- .../yang/data/codec/gson/JSONCodec.java | 2 +- .../data/codec/gson/JSONCodecFactory.java | 6 + .../gson/JSONNormalizedNodeStreamWriter.java | 37 ++- .../codec/gson/JSONStreamWriterContext.java | 25 +- .../JSONStreamWriterNamedObjectContext.java | 4 +- .../gson/JSONStreamWriterObjectContext.java | 3 +- .../gson/JSONStreamWriterQNameContext.java | 3 +- .../data/codec/gson/JsonParserStream.java | 173 +++++----- .../data/codec/gson/JsonWriterFactory.java | 2 +- .../yang/data/codec/gson/NumberJSONCodec.java | 2 +- .../yang/data/codec/gson/UnionJSONCodec.java | 2 + .../data/codec/gson/AnyXmlSupportTest.java | 16 +- .../yang/data/codec/gson/Bug4969Test.java | 33 +- .../yang/data/codec/gson/Bug7246Test.java | 6 +- .../gson/JsonStreamToNormalizedNodeTest.java | 32 +- .../gson/NormalizedNodeToJsonStreamTest.java | 311 ++++++++---------- .../gson/StreamToNormalizedNodeTest.java | 16 +- ...estingNormalizedNodeStructuresCreator.java | 56 ++-- 19 files changed, 360 insertions(+), 407 deletions(-) diff --git a/yang/yang-data-codec-gson/pom.xml b/yang/yang-data-codec-gson/pom.xml index 8e9de4c512..a5143b87d6 100644 --- a/yang/yang-data-codec-gson/pom.xml +++ b/yang/yang-data-codec-gson/pom.xml @@ -74,19 +74,31 @@ - - ${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/ + + ${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/ + + + + opendaylight-site + ${nexus.site.url}/${project.artifactId}/ + + diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodec.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodec.java index e32f10846c..e84cff42fe 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodec.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodec.java @@ -13,7 +13,7 @@ import org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec; interface JSONCodec extends TypeAwareCodec { /** - * {@inheritDoc} + * {@inheritDoc}. * * @throws IOException if the write fails */ diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodecFactory.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodecFactory.java index c24db76994..7769eb1ed7 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodecFactory.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONCodecFactory.java @@ -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. * + *

* 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> { * 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. * + *

* 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. * + *

* 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> { * 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. * + *

* 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> { * return distinct objects every time it is invoked. Returned object may not be used from multiple threads * concurrently. * + *

* 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> { * 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. * + *

* 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. diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java index a3ba148e56..70cb77f871 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java @@ -35,8 +35,8 @@ import org.w3c.dom.NodeList; /** * This implementation will create JSON output as output stream. * + *

* 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. * + *

* The codec factory can be reused between multiple writers. * + *

* Returned writer is exclusive user of JsonWriter, which means it will start * top-level JSON element and ends it. * + *

* 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. * + *

* The codec factory can be reused between multiple writers. * + *

* 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) 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) 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()); } } diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterContext.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterContext.java index 5449f4c4c7..11ac84f1d9 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterContext.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterContext.java @@ -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) { diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterNamedObjectContext.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterNamedObjectContext.java index fe08410caf..cac95796c7 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterNamedObjectContext.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterNamedObjectContext.java @@ -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); } diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterObjectContext.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterObjectContext.java index fb4e48ed60..c24be1cc31 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterObjectContext.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterObjectContext.java @@ -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); } diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterQNameContext.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterQNameContext.java index 3cee46f7bb..90c472800a 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterQNameContext.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONStreamWriterQNameContext.java @@ -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); } diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java index bc29d28a65..cf02d07ac2 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonParserStream.java @@ -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 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 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 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 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 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 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 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(); diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonWriterFactory.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonWriterFactory.java index 8d3eb258b8..00f5538da6 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonWriterFactory.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonWriterFactory.java @@ -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 { diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/NumberJSONCodec.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/NumberJSONCodec.java index 1e72352012..9800476b7a 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/NumberJSONCodec.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/NumberJSONCodec.java @@ -16,7 +16,7 @@ import org.opendaylight.yangtools.yang.data.impl.codec.DataStringCodec; * * @param Deserialized value type */ -final class NumberJSONCodec extends AbstractJSONCodec { +final class NumberJSONCodec extends AbstractJSONCodec { NumberJSONCodec(final DataStringCodec codec) { super(codec); } diff --git a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/UnionJSONCodec.java b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/UnionJSONCodec.java index 741db997ee..23af4462eb 100644 --- a/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/UnionJSONCodec.java +++ b/yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/UnionJSONCodec.java @@ -77,6 +77,7 @@ abstract class UnionJSONCodec implements JSONCodec { } @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 implements JSONCodec { } @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)) { diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AnyXmlSupportTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AnyXmlSupportTest.java index f64661b412..0970dde218 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AnyXmlSupportTest.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AnyXmlSupportTest.java @@ -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 child = cont1.getChild(new NodeIdentifier(anyxmlName)).get(); - assertNotNull(child); + final DataContainerChild child = cont1.getChild(new NodeIdentifier(anyxmlName)) + .get(); assertTrue(child instanceof AnyXmlNode); final AnyXmlNode anyXmlNode = (AnyXmlNode) child; return anyXmlNode.getValue(); diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java index 32ac33c248..945cd3c55e 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java @@ -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> ref1 = root.getChild(NodeIdentifier.create((QName - .create("foo", "2016-01-22", "ref1")))); - Optional> ref2 = root.getChild(NodeIdentifier.create((QName - .create("foo", "2016-01-22", "ref2")))); - Optional> ref3 = root.getChild(NodeIdentifier.create((QName - .create("foo", "2016-01-22", "ref3")))); - Optional> ref4 = root.getChild(NodeIdentifier.create((QName - .create("foo", "2016-01-22", "ref4")))); + final Optional> ref1 = root.getChild(NodeIdentifier.create( + QName.create("foo", "2016-01-22", "ref1"))); + final Optional> ref2 = root.getChild(NodeIdentifier.create( + QName.create("foo", "2016-01-22", "ref2"))); + final Optional> ref3 = root.getChild(NodeIdentifier.create( + QName.create("foo", "2016-01-22", "ref3"))); + final Optional> 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()); diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug7246Test.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug7246Test.java index 682fcc6765..511ab97bbe 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug7246Test.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug7246Test.java @@ -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); } diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonStreamToNormalizedNodeTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonStreamToNormalizedNodeTest.java index 5ab681dc29..bd852e288b 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonStreamToNormalizedNodeTest.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonStreamToNormalizedNodeTest.java @@ -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. * + *

* 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. * + *

* 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. * + *

* 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. * + *

* 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); } - } diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java index fcba4f921b..7271c929b3 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java @@ -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 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 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 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 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 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 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). * + *

+ * 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). * + *

+ * 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. * + *

+ * 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 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 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(); } - } diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/StreamToNormalizedNodeTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/StreamToNormalizedNodeTest.java index 3585cf5643..0cfefdcbd3 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/StreamToNormalizedNodeTest.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/StreamToNormalizedNodeTest.java @@ -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 firstChild = (DataContainerChild) parsedData; + final DataContainerChild firstChild = + (DataContainerChild) 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()); } - } diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java index db4814c982..294ac0232d 100644 --- a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java +++ b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java @@ -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 augmentC11AWithLf15_21Node() { - DataContainerNodeBuilder 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 lf15_21Node() { @@ -141,14 +136,13 @@ public class TestingNormalizedNodeStructuresCreator { } private static DataContainerChild augmentC11AWithLf15_11AndLf15_12Node() { - DataContainerNodeBuilder 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 lf15_12Node() { @@ -176,8 +170,6 @@ public class TestingNormalizedNodeStructuresCreator { } private static DataContainerChild childLst11() { - CollectionNodeBuilder lst11 = Builders.mapBuilder().withNodeIdentifier( - new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lst11"))); DataContainerNodeAttrBuilder 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() { -- 2.36.6