Search in sources :

Example 6 with BxmlNode

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());
}
Also used : RootNode(org.apache.nifi.processors.evtx.parser.bxml.RootNode) BxmlNode(org.apache.nifi.processors.evtx.parser.bxml.BxmlNode) EndOfStreamNode(org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode) Test(org.junit.Test)

Example 7 with BxmlNode

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);
}
Also used : TemplateNode(org.apache.nifi.processors.evtx.parser.bxml.TemplateNode) BxmlNode(org.apache.nifi.processors.evtx.parser.bxml.BxmlNode) Test(org.junit.Test)

Example 8 with BxmlNode

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));
}
Also used : BxmlNodeVisitor(org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor) AttributeNode(org.apache.nifi.processors.evtx.parser.bxml.AttributeNode) BxmlNode(org.apache.nifi.processors.evtx.parser.bxml.BxmlNode) ValueNode(org.apache.nifi.processors.evtx.parser.bxml.ValueNode) Test(org.junit.Test)

Aggregations

BxmlNode (org.apache.nifi.processors.evtx.parser.bxml.BxmlNode)8 Test (org.junit.Test)8 RootNode (org.apache.nifi.processors.evtx.parser.bxml.RootNode)4 EndOfStreamNode (org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode)3 BxmlNodeVisitor (org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor)2 AttributeNode (org.apache.nifi.processors.evtx.parser.bxml.AttributeNode)2 TemplateNode (org.apache.nifi.processors.evtx.parser.bxml.TemplateNode)2 ValueNode (org.apache.nifi.processors.evtx.parser.bxml.ValueNode)2 UnsignedInteger (com.google.common.primitives.UnsignedInteger)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 NameStringNode (org.apache.nifi.processors.evtx.parser.bxml.NameStringNode)1 NameStringNodeTest (org.apache.nifi.processors.evtx.parser.bxml.NameStringNodeTest)1 OpenStartElementNode (org.apache.nifi.processors.evtx.parser.bxml.OpenStartElementNode)1 TemplateNodeTest (org.apache.nifi.processors.evtx.parser.bxml.TemplateNodeTest)1 InOrder (org.mockito.InOrder)1