use of org.apache.nifi.processors.evtx.parser.bxml.NormalSubstitutionNode in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitAttributeNormalSubstitutionNode.
@Test
public void testVisitAttributeNormalSubstitutionNode() 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);
NormalSubstitutionNode normalSubstitutionNode = mock(NormalSubstitutionNode.class);
when(attributeNode.getAttributeName()).thenReturn(attributeName);
when(attributeNode.getValue()).thenReturn(normalSubstitutionNode);
doAnswer(invocation -> {
((BxmlNodeVisitor) invocation.getArguments()[0]).visit(normalSubstitutionNode);
return null;
}).when(normalSubstitutionNode).accept(any(BxmlNodeVisitor.class));
when(normalSubstitutionNode.getIndex()).thenReturn(0);
xmlBxmlNodeVisitor.visit(attributeNode);
verify(xmlStreamWriter).writeAttribute(attributeName, attributeValue);
}
use of org.apache.nifi.processors.evtx.parser.bxml.NormalSubstitutionNode in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitNormalSubstitutionNode.
@Test
public void testVisitNormalSubstitutionNode() throws IOException {
NormalSubstitutionNode normalSubstitutionNode = mock(NormalSubstitutionNode.class);
VariantTypeNode sub = mock(VariantTypeNode.class);
substitutions.add(sub);
when(normalSubstitutionNode.getIndex()).thenReturn(0);
xmlBxmlNodeVisitor.visit(normalSubstitutionNode);
verify(sub).accept(xmlBxmlNodeVisitor);
}
Aggregations