Trivial cleanups and flip the switch.
Change-Id: I24e912f00d7374a894793b4ddf903a3587d85197
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
</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>
}
@Override
- public void leafNode(final NodeIdentifier name, final Object value, final Map<QName, String> attributes) throws IOException {
+ public void leafNode(final NodeIdentifier name, final Object value, final Map<QName, String> attributes)
+ throws IOException {
final LeafSchemaNode schema = tracker.leafNode(name);
writeElement(schema.getQName(), value, attributes, schema);
}
final LeafListSchemaNode schema = tracker.leafSetEntryNode(name);
writeElement(schema.getQName(), value, Collections.emptyMap(), schema);
}
+
@Override
public void startLeafSet(final NodeIdentifier name, final int childSizeHint) {
tracker.startLeafSet(name);
}
@Override
- public void leafNode(final NodeIdentifier name, final Object value, final Map<QName, String> attributes) throws IOException {
+ public void leafNode(final NodeIdentifier name, final Object value, final Map<QName, String> attributes)
+ throws IOException {
writeElement(name.getNodeType(), value, attributes, null);
}
@Override
- public void leafSetEntryNode(final QName name, final Object value, final Map<QName, String> attributes) throws IOException {
- writeElement(name, value, attributes, null);
+ public void leafNode(final NodeIdentifier name, final Object value) throws IOException {
+ writeElement(name.getNodeType(), value, Collections.emptyMap(), null);
}
@Override
- public void leafNode(final NodeIdentifier name, final Object value) throws IOException {
- writeElement(name.getNodeType(), value, Collections.emptyMap(), null);
+ public void leafSetEntryNode(final QName name, final Object value, final Map<QName, String> attributes)
+ throws IOException {
+ writeElement(name, value, attributes, null);
}
@Override
}
@Override
- protected void writeValue(final XMLStreamWriter xmlWriter, final QName qname, @Nonnull final Object value, final Object context)
+ protected void writeValue(final XMLStreamWriter xmlWriter, final QName qname, @Nonnull final Object value,
+ final Object context)
throws XMLStreamException {
xmlWriter.writeCharacters(value.toString());
}
protected void endNode(final XMLStreamWriter xmlWriter) throws IOException, XMLStreamException {
ContainerType type = containerTypeStack.pop();
switch (type) {
- case CONTAINER:
- case LIST_ITEM:
- case ANY_XML:
- xmlWriter.writeEndElement();
- break;
- default:
- break;
+ case CONTAINER:
+ case LIST_ITEM:
+ case ANY_XML:
+ xmlWriter.writeEndElement();
+ break;
+ default:
+ break;
}
}
}
}
@Override
+ @SuppressWarnings("checkstyle:illegalCatch")
public final T parseValue(final NamespaceContext ctx, final String str) {
for (XmlCodec<?> codec : codecs) {
final Object ret;
}
@Override
+ @SuppressWarnings("checkstyle:illegalCatch")
public void writeValue(final XMLStreamWriter ctx, final Object value) throws XMLStreamException {
for (XmlCodec<?> codec : codecs) {
if (!codec.getDataType().isInstance(value)) {
*/
public abstract class XMLStreamNormalizedNodeStreamWriter<T> implements NormalizedNodeStreamAttributeWriter {
private static final Logger LOG = LoggerFactory.getLogger(XMLStreamNormalizedNodeStreamWriter.class);
- private static final String COM_SUN_TRANSFORMER = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
+ private static final String COM_SUN_TRANSFORMER =
+ "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
private static final TransformerFactory TRANSFORMER_FACTORY;
+
static {
- TransformerFactory f = TransformerFactory.newInstance();
- if (!f.getFeature(StAXResult.FEATURE)) {
+ TransformerFactory fa = TransformerFactory.newInstance();
+ if (!fa.getFeature(StAXResult.FEATURE)) {
LOG.warn("Platform-default TransformerFactory {} does not support StAXResult, attempting fallback to {}",
- f, COM_SUN_TRANSFORMER);
- f = TransformerFactory.newInstance(COM_SUN_TRANSFORMER, null);
- if (!f.getFeature(StAXResult.FEATURE)) {
+ fa, COM_SUN_TRANSFORMER);
+ fa = TransformerFactory.newInstance(COM_SUN_TRANSFORMER, null);
+ if (!fa.getFeature(StAXResult.FEATURE)) {
throw new TransformerFactoryConfigurationError("No TransformerFactory supporting StAXResult found.");
}
}
- TRANSFORMER_FACTORY = f;
+ TRANSFORMER_FACTORY = fa;
}
private static final Set<String> BROKEN_NAMESPACES = ConcurrentHashMap.newKeySet();
}
/**
- * Create a new writer with the specified context and rooted in the specified schema path
+ * Create a new writer with the specified context and rooted in the specified schema path.
*
* @param writer Output {@link XMLStreamWriter}
* @param context Associated {@link SchemaContext}.
abstract void startListItem(final PathArgument name) throws IOException;
- abstract void endNode(XMLStreamWriter xmlWriter) throws IOException, XMLStreamException;
-
private void writeAttributes(@Nonnull final Map<QName, String> attributes) throws IOException {
- for (final Entry<QName, String> qNameStringEntry : attributes.entrySet()) {
+ for (final Entry<QName, String> entry : attributes.entrySet()) {
try {
- final QName qname = qNameStringEntry.getKey();
+ final QName qname = entry.getKey();
final String namespace = qname.getNamespace().toString();
if (!Strings.isNullOrEmpty(namespace)) {
final String prefix = getPrefix(qname.getNamespace(), namespace);
- writer.writeAttribute(prefix, namespace, qname.getLocalName(), qNameStringEntry.getValue());
+ writer.writeAttribute(prefix, namespace, qname.getLocalName(), entry.getValue());
} else {
- writer.writeAttribute(qname.getLocalName(), qNameStringEntry.getValue());
+ writer.writeAttribute(qname.getLocalName(), entry.getValue());
}
} catch (final XMLStreamException e) {
- throw new IOException("Unable to emit attribute " + qNameStringEntry, e);
+ throw new IOException("Unable to emit attribute " + entry, e);
}
}
}
// TODO can the transformer be a constant ? is it thread safe ?
final Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
// Writer has to be wrapped in a wrapper that ignores endDocument event
- // EndDocument event forbids any other modification to the writer so a nested anyXml breaks serialization
+ // EndDocument event forbids any other modification to the writer so a nested anyXml breaks
+ // serialization
transformer.transform(domSource, new StAXResult(new DelegateWriterNoEndDoc(writer)));
} catch (final TransformerException e) {
throw new IOException("Unable to transform anyXml(" + qname + ") value: " + value, e);
writeAttributes(attributes);
}
+ @Override
+ public final void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IOException {
+ startListItem(name);
+ }
+
@Override
public final void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint,
final Map<QName, String> attributes) throws IOException {
}
@Override
- public final void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) {
- startList(name);
+ public final void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint)
+ throws IOException {
+ startListItem(identifier);
}
@Override
- public final void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IOException {
- startListItem(name);
+ public final void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) {
+ startList(name);
}
@Override
startList(name);
}
- @Override
- public final void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint)
- throws IOException {
- startListItem(identifier);
- }
-
@Override
public final void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) {
startList(name);
}
}
+ abstract void endNode(XMLStreamWriter xmlWriter) throws IOException, XMLStreamException;
+
@Override
public final void endNode() throws IOException {
try {
private static final class DelegateWriterNoEndDoc implements XMLStreamWriter {
private final XMLStreamWriter writer;
- public DelegateWriterNoEndDoc(final XMLStreamWriter writer) {
+ DelegateWriterNoEndDoc(final XMLStreamWriter writer) {
this.writer = writer;
}
}
Preconditions.checkArgument(schemaNode instanceof TypedSchemaNode,
- "Unable to write value for node %s, only nodes of type: leaf and leaf-list can be written at this point",
- schemaNode.getQName());
+ "Unable to write value for node %s, only nodes of type: leaf and leaf-list can be written at this point",
+ schemaNode.getQName());
TypeDefinition<?> type = ((TypedSchemaNode) schemaNode).getType();
if (type instanceof LeafrefTypeDefinition) {
final QName qname = (QName) value;
//in case parent is present and same as element namespace write value without namespace
- if (qname.getNamespace().equals(parent.getNamespace())){
+ if (qname.getNamespace().equals(parent.getNamespace())) {
writer.writeCharacters(qname.getLocalName());
} else {
final String ns = qname.getNamespace().toString();
import org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec;
interface XmlCodec<T> extends TypeAwareCodec<T, NamespaceContext, XMLStreamWriter> {
- /**
- * {@inheritDoc}
- *
- * @throws XMLStreamException from {@link XMLStreamWriter}
- */
@Override
void writeValue(XMLStreamWriter ctx, T value) throws XMLStreamException;
}
}
/**
+ * Construct a new {@link XmlParserStream}.
+ *
* @deprecated Use {@link #create(NormalizedNodeStreamWriter, SchemaContext, SchemaNode)} instead.
*/
@Deprecated
DataSchemaNode parentSchema = parent.getSchema();
final String parentSchemaName = parentSchema.getQName().getLocalName();
- if (parentSchemaName.equals(xmlElementName) && in.getEventType() == XMLStreamConstants.END_ELEMENT) {
+ if (parentSchemaName.equals(xmlElementName)
+ && in.getEventType() == XMLStreamConstants.END_ELEMENT) {
in.nextTag();
break;
}
case XMLStreamConstants.END_ELEMENT:
in.nextTag();
break;
+ default:
+ break;
}
}
parentSimpleNode.setValue(translateValueByType(value, parentSimpleNode.getSchema(), nsContext));
}
- private Object translateValueByType(final String value, final DataSchemaNode node, final NamespaceContext namespaceCtx)
- throws IOException, SAXException, ParserConfigurationException {
+ private Object translateValueByType(final String value, final DataSchemaNode node,
+ final NamespaceContext namespaceCtx) throws IOException, SAXException, ParserConfigurationException {
if (node instanceof AnyXmlSchemaNode) {
/*
* FIXME: Figure out some YANG extension dispatch, which will
private SchemaContext schemaContext;
@Before
- public void Init() throws Exception {
- fooModuleQName = QNameModule.create(new URI("foo"), SimpleDateFormatUtil.getRevisionFormat().parse("2016-03-22"));
+ public void setUp() throws Exception {
+ fooModuleQName = QNameModule.create(new URI("foo"), SimpleDateFormatUtil.getRevisionFormat().parse(
+ "2016-03-22"));
schemaContext = YangParserTestUtils.parseYangSource("/bug5396/yang/foo.yang");
}
}
private static final String NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:test";
- private static final Date revision;
+ private static final Date REVISION;
+
static {
try {
- revision = SimpleDateFormatUtil.getRevisionFormat().parse("2014-03-13");
+ REVISION = SimpleDateFormatUtil.getRevisionFormat().parse("2014-03-13");
} catch (final ParseException e) {
throw new ExceptionInInitializerError(e);
}
}
static final XMLOutputFactory XML_FACTORY;
+
static {
XML_FACTORY = XMLOutputFactory.newFactory();
XML_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE);
}
private static NodeIdentifier getNodeIdentifier(final String localName) {
- return new NodeIdentifier(QName.create(URI.create(NAMESPACE), revision, localName));
+ return new NodeIdentifier(QName.create(URI.create(NAMESPACE), REVISION, localName));
}
private static AugmentationIdentifier getAugmentIdentifier(final String... childNames) {
final NormalizedNodeStreamWriter xmlNormalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter
.create(xmlStreamWriter, schema);
- final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter
- (xmlNormalizedNodeStreamWriter);
+ final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
+ xmlNormalizedNodeStreamWriter);
normalizedNodeWriter.write(built);
final XMLStreamWriter xmlStreamWriter = factory.createXMLStreamWriter(domResult);
- final NormalizedNodeStreamWriter xmlNormalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create
- (xmlStreamWriter, schemaContext);
+ final NormalizedNodeStreamWriter xmlNormalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(
+ xmlStreamWriter, schemaContext);
- final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter
- (xmlNormalizedNodeStreamWriter);
+ final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
+ xmlNormalizedNodeStreamWriter);
normalizedNodeWriter.write(buildOuterContainerNode());
for (int i = 0; i < MAX_COUNTER; i++) {
final String prefix = RandomPrefix.encode(i);
final URI uri = new URI("localhost:" + prefix);
- final QName qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
- allGenerated.add(a.encodePrefix(qName.getNamespace()));
+ final QName qname = QName.create(QNameModule.create(uri, new Date()), "local-name");
+ allGenerated.add(a.encodePrefix(qname.getNamespace()));
}
assertEquals(MAX_COUNTER, allGenerated.size());
- // We are generating MAX_COUNTER_VALUE + 27 prefixes total, so we should encounter a reset in prefix a start from 0 at some point
- // At the end, there should be only 27 values in RandomPrefix cache
+ // We are generating MAX_COUNTER_VALUE + 27 prefixes total, so we should encounter a reset in prefix a start
+ // from 0 at some point. At the end, there should be only 27 values in RandomPrefix cache
assertEquals(MAX_COUNTER, Iterables.size(a.getPrefixes()));
assertThat(allGenerated, CoreMatchers.not(CoreMatchers.hasItem("xml")));
assertThat(allGenerated, CoreMatchers.not(CoreMatchers.hasItem("xmla")));
final RandomPrefix a = new RandomPrefix(null);
final URI uri = URI.create("localhost");
- final QName qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
- final QName qName2 = QName.create(QNameModule.create(uri, new Date()), "local-name");
+ final QName qname = QName.create(QNameModule.create(uri, new Date()), "local-name");
+ final QName qname2 = QName.create(QNameModule.create(uri, new Date()), "local-name");
- assertEquals(a.encodePrefix(qName.getNamespace()), a.encodePrefix(qName2.getNamespace()));
+ assertEquals(a.encodePrefix(qname.getNamespace()), a.encodePrefix(qname2.getNamespace()));
}
@Test
final RandomPrefix a = new RandomPrefix(null);
final URI uri = URI.create("localhost");
- QName qName = QName.create(uri, new Date(), "local-name");
- assertEquals("a", a.encodePrefix(qName.getNamespace()));
- qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
- assertEquals("a", a.encodePrefix(qName.getNamespace()));
- qName = QName.create(QNameModule.create(URI.create("second"), new Date()), "local-name");
- assertEquals("b", a.encodePrefix(qName.getNamespace()));
+ QName qname = QName.create(uri, new Date(), "local-name");
+ assertEquals("a", a.encodePrefix(qname.getNamespace()));
+ qname = QName.create(QNameModule.create(uri, new Date()), "local-name");
+ assertEquals("a", a.encodePrefix(qname.getNamespace()));
+ qname = QName.create(QNameModule.create(URI.create("second"), new Date()), "local-name");
+ assertEquals("b", a.encodePrefix(qname.getNamespace()));
}
}
@Before
public void setup() throws URISyntaxException, ParseException {
- foobarModule = QNameModule.create(new URI("foobar-namespace"), SimpleDateFormatUtil.getRevisionFormat().parse
- ("2016-09-19"));
+ foobarModule = QNameModule.create(new URI("foobar-namespace"), SimpleDateFormatUtil.getRevisionFormat().parse(
+ "2016-09-19"));
outerContainer = QName.create(foobarModule, "outer-container");
final NormalizedNodeStreamWriter schemalessXmlNormalizedNodeStreamWriter =
XMLStreamNormalizedNodeStreamWriter.createSchemaless(xmlStreamWriter);
- final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter
- (schemalessXmlNormalizedNodeStreamWriter);
+ final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
+ schemalessXmlNormalizedNodeStreamWriter);
normalizedNodeWriter.write(buildOuterContainerNode());
.withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(myLeafInList2))
.withValue("listleafvalue22").build()).build()).build();
- OrderedMapNode myOrderedListNode = Builders.orderedMapBuilder().withNodeIdentifier(new NodeIdentifier(myOrderedList))
- .withChild(Builders.mapEntryBuilder().withNodeIdentifier(
+ OrderedMapNode myOrderedListNode = Builders.orderedMapBuilder().withNodeIdentifier(
+ new NodeIdentifier(myOrderedList)).withChild(Builders.mapEntryBuilder().withNodeIdentifier(
new NodeIdentifierWithPredicates(myOrderedList, myKeyLeafInOrderedList, "olistkeyvalue1"))
.withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(myLeafInOrderedList1))
.withValue("olistleafvalue1").build())
}
private static Document loadDocument(final String xmlPath) throws IOException, SAXException {
- final InputStream resourceAsStream = SchemalessXMLStreamNormalizedNodeStreamWriterTest.class.getResourceAsStream(xmlPath);
+ final InputStream resourceAsStream = SchemalessXMLStreamNormalizedNodeStreamWriterTest.class
+ .getResourceAsStream(xmlPath);
final Document currentConfigElement = readXmlToDocument(resourceAsStream);
Preconditions.checkNotNull(currentConfigElement);
return currentConfigElement;
}
/**
- * One leafref reference to other leafref via relative references
+ * One leafref reference to other leafref via relative references.
*/
@Test
public void testLeafRefRelativeChaining() {
@Before
public void setup() throws URISyntaxException, ParseException {
- bazModule = QNameModule.create(new URI("baz-namespace"), SimpleDateFormatUtil.getRevisionFormat().parse
- ("1970-01-01"));
+ bazModule = QNameModule.create(new URI("baz-namespace"), SimpleDateFormatUtil.getRevisionFormat().parse(
+ "1970-01-01"));
outerContainer = QName.create(bazModule, "outer-container");
xmlParser.parse(reader);
fail("XMLStreamException should have been thrown because of unterminated leaf element.");
} catch (XMLStreamException ex) {
- assertTrue(ex.getMessage().contains("elementGetText() function expects text only elment but " +
- "START_ELEMENT was encountered."));
+ assertTrue(ex.getMessage().contains("elementGetText() function expects text only elment but "
+ + "START_ELEMENT was encountered."));
}
}
xmlParser.parse(reader);
fail("XMLStreamException should have been thrown because of unterminated leaf element.");
} catch (XMLStreamException ex) {
- assertTrue(ex.getMessage().contains("The element type \"my-leaf-1\" must be terminated by the matching " +
- "end-tag \"</my-leaf-1>\"."));
+ assertTrue(ex.getMessage().contains("The element type \"my-leaf-1\" must be terminated by the matching "
+ + "end-tag \"</my-leaf-1>\"."));
}
}
xmlParser.parse(reader);
fail("XMLStreamException should have been thrown because of unterminated container element.");
} catch (XMLStreamException ex) {
- assertTrue(ex.getMessage().contains("The element type \"my-container-1\" must be terminated by the " +
- "matching end-tag \"</my-container-1>\"."));
+ assertTrue(ex.getMessage().contains("The element type \"my-container-1\" must be terminated by the "
+ + "matching end-tag \"</my-container-1>\"."));
}
}
xmlParser.parse(reader);
fail("IllegalStateException should have been thrown because of an unexisting container element.");
} catch (IllegalStateException ex) {
- assertTrue(ex.getMessage().contains("Schema for node with name my-container-1 and namespace baz-namespace" +
- " doesn't exist."));
+ assertTrue(ex.getMessage().contains("Schema for node with name my-container-1 and namespace baz-namespace"
+ + " doesn't exist."));
}
}
private SchemaContext schemaContext;
@Before
- public void Init() throws Exception {
+ public void setUp() throws Exception {
barModuleQName = QNameModule.create(new URI("bar"), SimpleDateFormatUtil.getRevisionFormat()
.parse("1970-01-01"));
myContainer1 = QName.create(barModuleQName, "my-container-1");
final XMLInputFactory factory = XMLInputFactory.newInstance();
final XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
- final ImmutableContainerNodeBuilder result = (ImmutableContainerNodeBuilder) ImmutableContainerNodeSchemaAwareBuilder
- .create(yangModeledAnyXML.getSchemaOfAnyXmlData());
+ final ImmutableContainerNodeBuilder result =
+ (ImmutableContainerNodeBuilder) ImmutableContainerNodeSchemaAwareBuilder.create(
+ yangModeledAnyXML.getSchemaOfAnyXmlData());
final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
Optional<DataContainerChild<? extends PathArgument, ?>> child2 = myContainerNode1.getChild(new NodeIdentifier(
myLeaf1));
assertTrue(child2.orNull() instanceof LeafNode);
- LeafNode<?> LeafNode1 = (LeafNode<?>) child2.get();
+ LeafNode<?> leafNode1 = (LeafNode<?>) child2.get();
- Object leafNode1Value = LeafNode1.getValue();
+ Object leafNode1Value = leafNode1.getValue();
assertEquals("value1", leafNode1Value);
}
final XMLInputFactory factory = XMLInputFactory.newInstance();
final XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
- final ImmutableContainerNodeBuilder result = (ImmutableContainerNodeBuilder) ImmutableContainerNodeSchemaAwareBuilder
- .create(schemaContext);
+ final ImmutableContainerNodeBuilder result =
+ (ImmutableContainerNodeBuilder) ImmutableContainerNodeSchemaAwareBuilder.create(schemaContext);
final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
Optional<DataContainerChild<? extends PathArgument, ?>> child3 = innerContainerNode
.getChild(new NodeIdentifier(myLeaf2));
assertTrue(child3.orNull() instanceof LeafNode);
- LeafNode<?> LeafNode2 = (LeafNode<?>) child3.get();
+ LeafNode<?> leafNode2 = (LeafNode<?>) child3.get();
- Object leafNode2Value = LeafNode2.getValue();
+ Object leafNode2Value = leafNode2.getValue();
assertEquals("any-xml-leaf-2-value", leafNode2Value);
Optional<DataContainerChild<? extends PathArgument, ?>> child4 = yangModeledAnyXmlNode
.getChild(new NodeIdentifier(myLeaf3));
assertTrue(child4.orNull() instanceof LeafNode);
- LeafNode<?> LeafNode3 = (LeafNode<?>) child4.get();
+ LeafNode<?> leafNode3 = (LeafNode<?>) child4.get();
- Object leafNode3Value = LeafNode3.getValue();
+ Object leafNode3Value = leafNode3.getValue();
assertEquals("any-xml-leaf-3-value", leafNode3Value);
}
private static class YangModeledAnyXMLSchemaNodeImplTest implements YangModeledAnyXmlSchemaNode {
- private final QName qName;
+ private final QName qname;
private final ContainerSchemaNode contentSchema;
- private YangModeledAnyXMLSchemaNodeImplTest(final QName qName, final ContainerSchemaNode contentSchema) {
- this.qName = qName;
+ private YangModeledAnyXMLSchemaNodeImplTest(final QName qname, final ContainerSchemaNode contentSchema) {
+ this.qname = qname;
this.contentSchema = contentSchema;
}
@Nonnull
@Override
public QName getQName() {
- return qName;
+ return qname;
}
@Nonnull
@Test
public void testSerializationOfBaz() throws Exception {
- final InputStream resourceAsStream = XmlToNormalizedNodesTest.class.getResourceAsStream("/anyxml-support/serialization/baz.xml");
+ final InputStream resourceAsStream = XmlToNormalizedNodesTest.class.getResourceAsStream(
+ "/anyxml-support/serialization/baz.xml");
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
final XMLStreamReader reader = inputFactory.createXMLStreamReader(resourceAsStream);
final NormalizedNodeStreamWriter xmlNormalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter
.create(xmlStreamWriter, schemaContext);
- final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter
- (xmlNormalizedNodeStreamWriter);
+ final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
+ xmlNormalizedNodeStreamWriter);
normalizedNodeWriter.write(transformedInput);