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);
}
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);
}
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);
}
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);
}
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));
}
Aggregations