Search in sources :

Example 1 with TemplateNode

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

the class ChunkHeaderTest method testInit.

@Test
public void testInit() throws IOException {
    int count = 0;
    for (Map.Entry<Integer, NameStringNode> integerNameStringNodeEntry : new TreeMap<>(chunkHeader.getNameStrings()).entrySet()) {
        assertEquals(Integer.toString(count++), integerNameStringNodeEntry.getValue().getString());
    }
    Iterator<String> iterator = guids.iterator();
    for (Map.Entry<Integer, TemplateNode> integerTemplateNodeEntry : new TreeMap<>(chunkHeader.getTemplateNodes()).entrySet()) {
        assertEquals(iterator.next(), integerTemplateNodeEntry.getValue().getGuid());
    }
    assertTrue(chunkHeader.hasNext());
    Record next = chunkHeader.next();
    assertEquals(fileLastRecordNumber, next.getRecordNum().intValue());
    RootNode rootNode = next.getRootNode();
    List<BxmlNode> children = rootNode.getChildren();
    assertEquals(1, children.size());
    assertTrue(children.get(0) instanceof EndOfStreamNode);
    assertEquals(0, rootNode.getSubstitutions().size());
    assertFalse(chunkHeader.hasNext());
}
Also used : TemplateNode(org.apache.nifi.processors.evtx.parser.bxml.TemplateNode) RootNode(org.apache.nifi.processors.evtx.parser.bxml.RootNode) BxmlNode(org.apache.nifi.processors.evtx.parser.bxml.BxmlNode) UnsignedInteger(com.google.common.primitives.UnsignedInteger) NameStringNode(org.apache.nifi.processors.evtx.parser.bxml.NameStringNode) EndOfStreamNode(org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode) TreeMap(java.util.TreeMap) Map(java.util.Map) Test(org.junit.Test) TemplateNodeTest(org.apache.nifi.processors.evtx.parser.bxml.TemplateNodeTest) NameStringNodeTest(org.apache.nifi.processors.evtx.parser.bxml.NameStringNodeTest)

Example 2 with TemplateNode

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

the class ChunkHeader method addTemplateNode.

public TemplateNode addTemplateNode(int offset, BinaryReader binaryReader) throws IOException {
    TemplateNode templateNode = new TemplateNode(binaryReader, this);
    templateNodes.put(offset, templateNode);
    return templateNode;
}
Also used : TemplateNode(org.apache.nifi.processors.evtx.parser.bxml.TemplateNode)

Example 3 with TemplateNode

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

the class XmlBxmlNodeVisitorTest method testVisitTemplateInstanceNode.

@Test
public void testVisitTemplateInstanceNode() throws IOException {
    TemplateInstanceNode templateInstanceNode = mock(TemplateInstanceNode.class);
    TemplateNode templateNode = mock(TemplateNode.class);
    when(templateInstanceNode.getTemplateNode()).thenReturn(templateNode);
    xmlBxmlNodeVisitor.visit(templateInstanceNode);
    verify(templateNode).accept(xmlBxmlNodeVisitor);
}
Also used : TemplateNode(org.apache.nifi.processors.evtx.parser.bxml.TemplateNode) TemplateInstanceNode(org.apache.nifi.processors.evtx.parser.bxml.TemplateInstanceNode) Test(org.junit.Test)

Example 4 with TemplateNode

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

the class XmlBxmlNodeVisitorTest method testVisitTemplateNode.

@Test
public void testVisitTemplateNode() throws IOException {
    TemplateNode templateNode = mock(TemplateNode.class);
    BxmlNode child = mock(BxmlNode.class);
    when(templateNode.getChildren()).thenReturn(Arrays.asList(child));
    xmlBxmlNodeVisitor.visit(templateNode);
    verify(child).accept(xmlBxmlNodeVisitor);
}
Also used : TemplateNode(org.apache.nifi.processors.evtx.parser.bxml.TemplateNode) BxmlNode(org.apache.nifi.processors.evtx.parser.bxml.BxmlNode) Test(org.junit.Test)

Aggregations

TemplateNode (org.apache.nifi.processors.evtx.parser.bxml.TemplateNode)4 Test (org.junit.Test)3 BxmlNode (org.apache.nifi.processors.evtx.parser.bxml.BxmlNode)2 UnsignedInteger (com.google.common.primitives.UnsignedInteger)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 EndOfStreamNode (org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode)1 NameStringNode (org.apache.nifi.processors.evtx.parser.bxml.NameStringNode)1 NameStringNodeTest (org.apache.nifi.processors.evtx.parser.bxml.NameStringNodeTest)1 RootNode (org.apache.nifi.processors.evtx.parser.bxml.RootNode)1 TemplateInstanceNode (org.apache.nifi.processors.evtx.parser.bxml.TemplateInstanceNode)1 TemplateNodeTest (org.apache.nifi.processors.evtx.parser.bxml.TemplateNodeTest)1