use of org.apache.nifi.processors.evtx.parser.bxml.BxmlNode in project nifi by apache.
the class BXmlTypeNodeTest method testInit.
@Test
public void testInit() {
RootNode rootNode = bXmlTypeNode.getRootNode();
List<BxmlNode> children = rootNode.getChildren();
assertEquals(1, children.size());
assertTrue(children.get(0) instanceof EndOfStreamNode);
assertEquals(0, rootNode.getSubstitutions().size());
assertEquals(rootNode.toString(), bXmlTypeNode.getValue());
}
use of org.apache.nifi.processors.evtx.parser.bxml.BxmlNode in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitTemplateNode.
@Test
public void testVisitTemplateNode() throws IOException {
TemplateNode templateNode = mock(TemplateNode.class);
BxmlNode child = mock(BxmlNode.class);
when(templateNode.getChildren()).thenReturn(Arrays.asList(child));
xmlBxmlNodeVisitor.visit(templateNode);
verify(child).accept(xmlBxmlNodeVisitor);
}
use of org.apache.nifi.processors.evtx.parser.bxml.BxmlNode in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitAttributeNodeValueType.
@Test
public void testVisitAttributeNodeValueType() throws IOException, XMLStreamException {
String attributeName = "attributeName";
AttributeNode attributeNode = mock(AttributeNode.class);
ValueNode valueNode = mock(ValueNode.class);
BxmlNode child = mock(BxmlNode.class);
when(attributeNode.getAttributeName()).thenReturn(attributeName);
when(attributeNode.getValue()).thenReturn(valueNode);
when(valueNode.getChildren()).thenReturn(Arrays.asList(child));
doAnswer(invocation -> {
((BxmlNodeVisitor) invocation.getArguments()[0]).visit(valueNode);
return null;
}).when(valueNode).accept(any(BxmlNodeVisitor.class));
xmlBxmlNodeVisitor.visit(attributeNode);
verify(xmlStreamWriter).writeAttribute(attributeName, null);
verify(child).accept(any(BxmlNodeVisitor.class));
}
Aggregations