Search in sources :

Example 6 with NormalizedNodeWriter

use of org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter in project controller by opendaylight.

the class NormalizedNodePrunerTest method testNodesPrunedWhenTestSchemaMissing.

@Test
public void testNodesPrunedWhenTestSchemaMissing() throws IOException {
    NormalizedNodePruner pruner = prunerNoTestSchema(TestModel.TEST_PATH);
    NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(pruner);
    NormalizedNode<?, ?> expected = createTestContainer();
    normalizedNodeWriter.write(expected);
    NormalizedNode<?, ?> actual = pruner.normalizedNode();
    // Since top level schema is missing null is returned
    assertNull(actual);
    // Asserting true here instead of checking actual value because I don't want this assertion to be fragile
    assertTrue(countNodes(expected, "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test") > 0);
}
Also used : NormalizedNodeWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter) Test(org.junit.Test)

Aggregations

NormalizedNodeWriter (org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter)6 Test (org.junit.Test)4 NormalizedNodeStreamWriter (org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter)2 IndentingXMLStreamWriter (javanet.staxutils.IndentingXMLStreamWriter)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 XMLStreamNormalizedNodeStreamWriter (org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter)1