Search in sources :

Example 1 with ValueNode

use of org.apache.nifi.processors.evtx.parser.bxml.ValueNode in project nifi by apache.

the class XmlBxmlNodeVisitorTest method testVisitValueNode.

@Test
public void testVisitValueNode() throws IOException {
    ValueNode valueNode = mock(ValueNode.class);
    BxmlNode child = mock(BxmlNode.class);
    when(valueNode.getChildren()).thenReturn(Arrays.asList(child));
    xmlBxmlNodeVisitor.visit(valueNode);
    verify(child).accept(xmlBxmlNodeVisitor);
}
Also used : BxmlNode(org.apache.nifi.processors.evtx.parser.bxml.BxmlNode) ValueNode(org.apache.nifi.processors.evtx.parser.bxml.ValueNode) Test(org.junit.Test)

Example 2 with ValueNode

use of org.apache.nifi.processors.evtx.parser.bxml.ValueNode 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)2 ValueNode (org.apache.nifi.processors.evtx.parser.bxml.ValueNode)2 Test (org.junit.Test)2 BxmlNodeVisitor (org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor)1 AttributeNode (org.apache.nifi.processors.evtx.parser.bxml.AttributeNode)1