Search in sources :

Example 1 with VariantTypeNode

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

the class XmlBxmlNodeVisitorTest method testVisitConditionalSubstitutionNode.

@Test
public void testVisitConditionalSubstitutionNode() throws IOException {
    ConditionalSubstitutionNode conditionalSubstitutionNode = mock(ConditionalSubstitutionNode.class);
    VariantTypeNode sub = mock(VariantTypeNode.class);
    substitutions.add(sub);
    when(conditionalSubstitutionNode.getIndex()).thenReturn(0);
    xmlBxmlNodeVisitor.visit(conditionalSubstitutionNode);
    verify(sub).accept(xmlBxmlNodeVisitor);
}
Also used : VariantTypeNode(org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode) ConditionalSubstitutionNode(org.apache.nifi.processors.evtx.parser.bxml.ConditionalSubstitutionNode) Test(org.junit.Test)

Example 2 with VariantTypeNode

use of org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode 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);
}
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) NormalSubstitutionNode(org.apache.nifi.processors.evtx.parser.bxml.NormalSubstitutionNode) Test(org.junit.Test)

Example 3 with VariantTypeNode

use of org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode 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);
}
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) Test(org.junit.Test)

Example 4 with VariantTypeNode

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

the class XmlBxmlNodeVisitorTest method testVisitVariantTypeNode.

@Test
public void testVisitVariantTypeNode() throws IOException, XMLStreamException {
    String variantValue = "variantValue";
    VariantTypeNode variantTypeNode = mock(VariantTypeNode.class);
    when(variantTypeNode.getValue()).thenReturn(variantValue);
    xmlBxmlNodeVisitor.visit(variantTypeNode);
    verify(xmlStreamWriter).writeCharacters(variantValue);
}
Also used : VariantTypeNode(org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode) Test(org.junit.Test)

Example 5 with VariantTypeNode

use of org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode 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);
}
Also used : NormalSubstitutionNode(org.apache.nifi.processors.evtx.parser.bxml.NormalSubstitutionNode) VariantTypeNode(org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode) Test(org.junit.Test)

Aggregations

VariantTypeNode (org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode)6 Test (org.junit.Test)6 BxmlNodeVisitor (org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor)3 AttributeNode (org.apache.nifi.processors.evtx.parser.bxml.AttributeNode)3 ConditionalSubstitutionNode (org.apache.nifi.processors.evtx.parser.bxml.ConditionalSubstitutionNode)2 NormalSubstitutionNode (org.apache.nifi.processors.evtx.parser.bxml.NormalSubstitutionNode)2