Search in sources :

Example 11 with BxmlNodeVisitor

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

the class RootNodeTest method testVisitor.

@Test
public void testVisitor() throws IOException {
    BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
    rootNode.accept(mock);
    verify(mock).visit(rootNode);
    verifyNoMoreInteractions(mock);
}
Also used : BxmlNodeVisitor(org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor) Test(org.junit.Test)

Example 12 with BxmlNodeVisitor

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

the class StreamStartNodeTest method testVisitor.

@Test
public void testVisitor() throws IOException {
    BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
    streamStartNode.accept(mock);
    verify(mock).visit(streamStartNode);
    verifyNoMoreInteractions(mock);
}
Also used : BxmlNodeVisitor(org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor) Test(org.junit.Test)

Example 13 with BxmlNodeVisitor

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

the class TemplateInstanceNodeTest method testVisitor.

@Test
public void testVisitor() throws IOException {
    BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
    templateInstanceNode.accept(mock);
    verify(mock).visit(templateInstanceNode);
    verifyNoMoreInteractions(mock);
}
Also used : BxmlNodeVisitor(org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor) Test(org.junit.Test)

Example 14 with BxmlNodeVisitor

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

the class XmlBxmlNodeVisitorTest method testVisitAttributeConditionalSubstitutionNode.

@Test
public void testVisitAttributeConditionalSubstitutionNode() throws IOException, XMLStreamException {
    String attributeName = "attributeName";
    String attributeValue = "attributeValue";
    VariantTypeNode sub = mock(VariantTypeNode.class);
    when(sub.getValue()).thenReturn(attributeValue);
    substitutions.add(sub);
    AttributeNode attributeNode = mock(AttributeNode.class);
    ConditionalSubstitutionNode conditionalSubstitutionNode = mock(ConditionalSubstitutionNode.class);
    when(attributeNode.getAttributeName()).thenReturn(attributeName);
    when(attributeNode.getValue()).thenReturn(conditionalSubstitutionNode);
    doAnswer(invocation -> {
        ((BxmlNodeVisitor) invocation.getArguments()[0]).visit(conditionalSubstitutionNode);
        return null;
    }).when(conditionalSubstitutionNode).accept(any(BxmlNodeVisitor.class));
    when(conditionalSubstitutionNode.getIndex()).thenReturn(0);
    xmlBxmlNodeVisitor.visit(attributeNode);
    verify(xmlStreamWriter).writeAttribute(attributeName, attributeValue);
}
Also used : BxmlNodeVisitor(org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor) AttributeNode(org.apache.nifi.processors.evtx.parser.bxml.AttributeNode) VariantTypeNode(org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode) ConditionalSubstitutionNode(org.apache.nifi.processors.evtx.parser.bxml.ConditionalSubstitutionNode) Test(org.junit.Test)

Example 15 with BxmlNodeVisitor

use of org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor 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

BxmlNodeVisitor (org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor)23 Test (org.junit.Test)23 AttributeNode (org.apache.nifi.processors.evtx.parser.bxml.AttributeNode)4 VariantTypeNode (org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode)3 BxmlNode (org.apache.nifi.processors.evtx.parser.bxml.BxmlNode)2 ConditionalSubstitutionNode (org.apache.nifi.processors.evtx.parser.bxml.ConditionalSubstitutionNode)1 NormalSubstitutionNode (org.apache.nifi.processors.evtx.parser.bxml.NormalSubstitutionNode)1 RootNode (org.apache.nifi.processors.evtx.parser.bxml.RootNode)1 ValueNode (org.apache.nifi.processors.evtx.parser.bxml.ValueNode)1