Search in sources :

Example 1 with NameStringNode

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

the class ChunkHeader method addNameStringNode.

public NameStringNode addNameStringNode(int offset, BinaryReader binaryReader) throws IOException {
    NameStringNode nameStringNode = new NameStringNode(binaryReader, this);
    nameStrings.put(offset, nameStringNode);
    return nameStringNode;
}
Also used : NameStringNode(org.apache.nifi.processors.evtx.parser.bxml.NameStringNode)

Example 2 with NameStringNode

use of org.apache.nifi.processors.evtx.parser.bxml.NameStringNode 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)

Aggregations

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