use of org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor 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.BxmlNodeVisitor in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitRootNode.
@Test
public void testVisitRootNode() throws IOException {
RootNode rootNode = mock(RootNode.class);
BxmlNode child = mock(BxmlNode.class);
when(rootNode.getChildren()).thenReturn(Arrays.asList(child));
xmlBxmlNodeVisitor.visit(rootNode);
ArgumentCaptor<BxmlNodeVisitor> captor = ArgumentCaptor.forClass(BxmlNodeVisitor.class);
verify(child).accept(captor.capture());
BxmlNodeVisitor value = captor.getValue();
assertTrue(value instanceof XmlBxmlNodeVisitor);
assertNotEquals(xmlBxmlNodeVisitor, value);
}
use of org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor in project nifi by apache.
the class XmlBxmlNodeVisitorTest method testVisitAttributeNodeVariantType.
@Test
public void testVisitAttributeNodeVariantType() throws IOException, XMLStreamException {
String attributeName = "attributeName";
String attributeValue = "attributeValue";
AttributeNode attributeNode = mock(AttributeNode.class);
VariantTypeNode variantTypeNode = mock(VariantTypeNode.class);
when(attributeNode.getAttributeName()).thenReturn(attributeName);
when(attributeNode.getValue()).thenReturn(variantTypeNode);
doAnswer(invocation -> {
((BxmlNodeVisitor) invocation.getArguments()[0]).visit(variantTypeNode);
return null;
}).when(variantTypeNode).accept(any(BxmlNodeVisitor.class));
when(variantTypeNode.getValue()).thenReturn(attributeValue);
xmlBxmlNodeVisitor.visit(attributeNode);
verify(xmlStreamWriter).writeAttribute(attributeName, attributeValue);
}
use of org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor in project nifi by apache.
the class AttributeNodeTest method testVisit.
@Test
public void testVisit() throws IOException {
BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
attributeNode.accept(mock);
verify(mock).visit(attributeNode);
verifyNoMoreInteractions(mock);
}
use of org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor in project nifi by apache.
the class CDataSectionNodeTest method testVisitor.
@Test
public void testVisitor() throws IOException {
BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
cDataSectionNode.accept(mock);
verify(mock).visit(cDataSectionNode);
verifyNoMoreInteractions(mock);
}
Aggregations