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());
}
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;
}
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);
}
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);
}
Aggregations