You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2016/06/09 16:13:09 UTC
[2/6] nifi git commit: NIFI-1975 - Processor for parsing evtx files
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java
new file mode 100644
index 0000000..118bdcc
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class CDataSectionNodeTest extends BxmlNodeWithTokenTestBase {
+ private String content;
+ private CDataSectionNode cDataSectionNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ content = "cdata content";
+ testBinaryReaderBuilder.putWord(content.length() + 2);
+ testBinaryReaderBuilder.putWString(content);
+ cDataSectionNode = new CDataSectionNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.C_DATA_SECTION_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(content, cDataSectionNode.getCdata());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ cDataSectionNode.accept(mock);
+ verify(mock).visit(cDataSectionNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java
new file mode 100644
index 0000000..f057ced
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class CloseElementNodeTest extends BxmlNodeWithTokenTestBase {
+ private CloseElementNode closeElementNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ closeElementNode = new CloseElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.CLOSE_ELEMENT_TOKEN;
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ closeElementNode.accept(mock);
+ verify(mock).visit(closeElementNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java
new file mode 100644
index 0000000..c63d9f8
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class CloseEmptyElementNodeTest extends BxmlNodeWithTokenTestBase {
+ private CloseEmptyElementNode closeEmptyElementNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ closeEmptyElementNode = new CloseEmptyElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.CLOSE_EMPTY_ELEMENT_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(BxmlNode.CLOSE_EMPTY_ELEMENT_TOKEN, closeEmptyElementNode.getToken());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ closeEmptyElementNode.accept(mock);
+ verify(mock).visit(closeEmptyElementNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java
new file mode 100644
index 0000000..c4338d7
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class CloseStartElementNodeTest extends BxmlNodeWithTokenTestBase {
+ private CloseStartElementNode closeStartElementNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ closeStartElementNode = new CloseStartElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.CLOSE_START_ELEMENT_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(BxmlNode.CLOSE_START_ELEMENT_TOKEN, closeStartElementNode.getToken());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ closeStartElementNode.accept(mock);
+ verify(mock).visit(closeStartElementNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java
new file mode 100644
index 0000000..048242c
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class ConditionalSubstitutionNodeTest extends BxmlNodeWithTokenTestBase {
+ private ConditionalSubstitutionNode conditionalSubstitutionNode;
+ private int index;
+ private byte type;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ index = 10;
+ type = 5;
+ testBinaryReaderBuilder.putWord(index);
+ testBinaryReaderBuilder.put(type);
+ conditionalSubstitutionNode = new ConditionalSubstitutionNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.CONDITIONAL_SUBSTITUTION_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(BxmlNode.CONDITIONAL_SUBSTITUTION_TOKEN, conditionalSubstitutionNode.getToken());
+ assertEquals(index, conditionalSubstitutionNode.getIndex());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ conditionalSubstitutionNode.accept(mock);
+ verify(mock).visit(conditionalSubstitutionNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java
new file mode 100644
index 0000000..5cd807e
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class EndOfStreamNodeTest extends BxmlNodeWithTokenTestBase {
+ private EndOfStreamNode endOfStreamNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ endOfStreamNode = new EndOfStreamNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.END_OF_STREAM_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(BxmlNode.END_OF_STREAM_TOKEN, endOfStreamNode.getToken());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ endOfStreamNode.accept(mock);
+ verify(mock).visit(endOfStreamNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java
new file mode 100644
index 0000000..aafc4db
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class EntityReferenceNodeTest extends BxmlNodeWithTokenAndStringTestBase {
+ public static final String AMP = "amp";
+ private EntityReferenceNode entityReferenceNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ entityReferenceNode = new EntityReferenceNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected String getString() {
+ return AMP;
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.ENTITY_REFERENCE_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(BxmlNode.ENTITY_REFERENCE_TOKEN, entityReferenceNode.getToken());
+ }
+
+ @Test
+ public void testGetValue() {
+ assertEquals("&" + AMP + ";", entityReferenceNode.getValue());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ entityReferenceNode.accept(mock);
+ verify(mock).visit(entityReferenceNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java
new file mode 100644
index 0000000..233559f
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import com.google.common.primitives.UnsignedInteger;
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class NameStringNodeTest extends BxmlNodeTestBase {
+ private int nextOffset = 300;
+ private int hash = 100;
+ private String string = "test string";
+ private NameStringNode nameStringNode;
+
+ public static int putNode(TestBinaryReaderBuilder testBinaryReaderBuilder, int nextOffset, int hash, String string) throws IOException {
+ testBinaryReaderBuilder.putDWord(nextOffset);
+ testBinaryReaderBuilder.putWord(hash);
+ testBinaryReaderBuilder.putWord(string.length());
+ testBinaryReaderBuilder.putWString(string);
+ return 8 + (2 * string.length());
+ }
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ putNode(testBinaryReaderBuilder, nextOffset, hash, string);
+ nameStringNode = new NameStringNode(testBinaryReaderBuilder.build(), chunkHeader);
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(UnsignedInteger.valueOf(nextOffset), nameStringNode.getNextOffset());
+ assertEquals(hash, nameStringNode.getHash());
+ assertEquals(string, nameStringNode.getString());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ nameStringNode.accept(mock);
+ verify(mock).visit(nameStringNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java
new file mode 100644
index 0000000..3f59485
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class NormalSubstitutionNodeTest extends BxmlNodeWithTokenTestBase {
+ private int index = 30;
+ private byte type = 20;
+ private NormalSubstitutionNode normalSubstitutionNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.putWord(index);
+ testBinaryReaderBuilder.put(type);
+ normalSubstitutionNode = new NormalSubstitutionNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.NORMAL_SUBSTITUTION_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(BxmlNode.NORMAL_SUBSTITUTION_TOKEN, normalSubstitutionNode.getToken());
+ assertEquals(index, normalSubstitutionNode.getIndex());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ normalSubstitutionNode.accept(mock);
+ verify(mock).visit(normalSubstitutionNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java
new file mode 100644
index 0000000..d4079ac
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BinaryReader;
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
+public class OpenStartElementNodeTest extends BxmlNodeWithTokenTestBase {
+ private int unknown = 24;
+ private int size = 2444;
+ private int stringOffset = 0;
+ private String tagName = "tagName";
+ private OpenStartElementNode openStartElementNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.putWord(unknown);
+ testBinaryReaderBuilder.putDWord(size);
+ testBinaryReaderBuilder.putDWord(stringOffset);
+
+ testBinaryReaderBuilder.put((byte) BxmlNode.CLOSE_EMPTY_ELEMENT_TOKEN);
+ when(chunkHeader.getString(stringOffset)).thenReturn(tagName);
+ openStartElementNode = new OpenStartElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(tagName, openStartElementNode.getTagName());
+ List<BxmlNode> children = openStartElementNode.getChildren();
+ assertEquals(1, children.size());
+ assertTrue(children.get(0) instanceof CloseEmptyElementNode);
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ openStartElementNode.accept(mock);
+ verify(mock).visit(openStartElementNode);
+ verifyNoMoreInteractions(mock);
+ }
+
+ @Test
+ public void testWithFlagAndEmbeddedNameStringNode() throws IOException {
+ byte token = (byte) (0x04 << 4 | getToken());
+ stringOffset = 5;
+ tagName = "teststring";
+ testBinaryReaderBuilder = new TestBinaryReaderBuilder();
+ testBinaryReaderBuilder.put(token);
+ testBinaryReaderBuilder.putWord(unknown);
+ testBinaryReaderBuilder.putDWord(size);
+ testBinaryReaderBuilder.putDWord(stringOffset);
+
+ testBinaryReaderBuilder.putDWord(0);
+ testBinaryReaderBuilder.putWord(0);
+ testBinaryReaderBuilder.putWord(tagName.length());
+ testBinaryReaderBuilder.putWString(tagName);
+ testBinaryReaderBuilder.putWord(0);
+ testBinaryReaderBuilder.put(new byte[5]);
+
+ testBinaryReaderBuilder.put((byte) BxmlNode.CLOSE_EMPTY_ELEMENT_TOKEN);
+
+ BinaryReader binaryReader = testBinaryReaderBuilder.build();
+ NameStringNode nameStringNode = mock(NameStringNode.class);
+ when(nameStringNode.getString()).thenReturn(tagName);
+ when(chunkHeader.addNameStringNode(stringOffset, binaryReader)).thenAnswer(invocation -> new NameStringNode(binaryReader, chunkHeader));
+ openStartElementNode = new OpenStartElementNode(binaryReader, chunkHeader, parent);
+
+ assertEquals(getToken(), openStartElementNode.getToken() & 0x0F);
+ assertTrue((openStartElementNode.getFlags() & 0x04) > 0);
+ assertEquals(tagName, openStartElementNode.getTagName());
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.OPEN_START_ELEMENT_TOKEN;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java
new file mode 100644
index 0000000..f84589d
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class ProcessingInstructionDataNodeTest extends BxmlNodeWithTokenTestBase {
+ private String data = "testData";
+ private ProcessingInstructionDataNode processingInstructionDataNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.putWord(data.length());
+ testBinaryReaderBuilder.putWString(data);
+ processingInstructionDataNode = new ProcessingInstructionDataNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(getToken(), processingInstructionDataNode.getToken());
+ assertEquals(data + "?>", processingInstructionDataNode.getValue());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ processingInstructionDataNode.accept(mock);
+ verify(mock).visit(processingInstructionDataNode);
+ verifyNoMoreInteractions(mock);
+ }
+
+ @Test
+ public void testNoData() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.putDWord(0);
+ processingInstructionDataNode = new ProcessingInstructionDataNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+
+ assertEquals(getToken(), processingInstructionDataNode.getToken());
+ assertEquals("?>", processingInstructionDataNode.getValue());
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.PROCESSING_INSTRUCTION_DATA_TOKEN;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java
new file mode 100644
index 0000000..e33ac0e
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class ProcessingInstructionTargetNodeTest extends BxmlNodeWithTokenAndStringTestBase {
+ private String instruction = "testInstruction";
+ private ProcessingInstructionTargetNode processingInstructionTargetNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ processingInstructionTargetNode = new ProcessingInstructionTargetNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected String getString() {
+ return instruction;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(getToken(), processingInstructionTargetNode.getToken());
+ assertEquals("<?" + instruction, processingInstructionTargetNode.getValue());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ processingInstructionTargetNode.accept(mock);
+ verify(mock).visit(processingInstructionTargetNode);
+ verifyNoMoreInteractions(mock);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.PROCESSING_INSTRUCTION_TARGET_TOKEN;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java
new file mode 100644
index 0000000..e14b9e2
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class RootNodeTest extends BxmlNodeTestBase {
+
+ private String testString = "testString";
+ private RootNode rootNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.put((byte) BxmlNode.END_OF_STREAM_TOKEN);
+ testBinaryReaderBuilder.putDWord(1);
+
+ testBinaryReaderBuilder.putWord(testString.length() + 1);
+ testBinaryReaderBuilder.putWord(2);
+ testBinaryReaderBuilder.putString(testString);
+ testBinaryReaderBuilder.put((byte) 0);
+
+ rootNode = new RootNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Test
+ public void testInit() {
+ List<BxmlNode> children = rootNode.getChildren();
+ assertEquals(1, children.size());
+ assertTrue(children.get(0) instanceof EndOfStreamNode);
+
+ List<VariantTypeNode> substitutions = rootNode.getSubstitutions();
+ assertEquals(1, substitutions.size());
+ assertEquals(testString, substitutions.get(0).getValue());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ rootNode.accept(mock);
+ verify(mock).visit(rootNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java
new file mode 100644
index 0000000..a698f4b
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class StreamStartNodeTest extends BxmlNodeWithTokenTestBase {
+
+ private StreamStartNode streamStartNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.put((byte) 1);
+ testBinaryReaderBuilder.putWord(1);
+ streamStartNode = new StreamStartNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(getToken(), streamStartNode.getToken());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ streamStartNode.accept(mock);
+ verify(mock).visit(streamStartNode);
+ verifyNoMoreInteractions(mock);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.START_OF_STREAM_TOKEN;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java
new file mode 100644
index 0000000..28719cc
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import com.google.common.primitives.UnsignedInteger;
+import org.apache.nifi.processors.evtx.parser.BinaryReader;
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
+public class TemplateInstanceNodeTest extends BxmlNodeWithTokenTestBase {
+ private byte unknown = 23;
+ private int templateId = 101;
+ private int templateLength = 25;
+ private TemplateNode templateNode;
+ private TemplateInstanceNode templateInstanceNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.put(unknown);
+ testBinaryReaderBuilder.putDWord(templateId);
+ testBinaryReaderBuilder.putDWord(0);
+ templateNode = mock(TemplateNode.class);
+ when(templateNode.getTemplateId()).thenReturn(UnsignedInteger.valueOf(templateId));
+ when(chunkHeader.getTemplateNode(0)).thenReturn(templateNode);
+ templateInstanceNode = new TemplateInstanceNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(getToken(), templateInstanceNode.getToken());
+ assertEquals(10, templateInstanceNode.getHeaderLength());
+ assertEquals(templateNode, templateInstanceNode.getTemplateNode());
+ }
+
+ @Test
+ public void testHasEndOfStream() {
+ when(templateNode.hasEndOfStream()).thenReturn(true).thenReturn(false);
+ assertTrue(templateInstanceNode.hasEndOfStream());
+ assertFalse(templateInstanceNode.hasEndOfStream());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ templateInstanceNode.accept(mock);
+ verify(mock).visit(templateInstanceNode);
+ verifyNoMoreInteractions(mock);
+ }
+
+ @Test
+ public void testResidentTemplate() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.put(unknown);
+ testBinaryReaderBuilder.putDWord(templateId);
+ testBinaryReaderBuilder.putDWord(5);
+
+ BinaryReader binaryReader = testBinaryReaderBuilder.build();
+ TemplateNode templateNode = mock(TemplateNode.class);
+ when(templateNode.getTemplateId()).thenReturn(UnsignedInteger.valueOf(templateId));
+ when(templateNode.hasEndOfStream()).thenReturn(true).thenReturn(false);
+ when(chunkHeader.addTemplateNode(5, binaryReader)).thenAnswer(invocation -> {
+ binaryReader.skip(templateLength);
+ return templateNode;
+ });
+ templateInstanceNode = new TemplateInstanceNode(binaryReader, chunkHeader, parent);
+ assertEquals(templateLength, templateInstanceNode.getHeaderLength() - 10);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.TEMPLATE_INSTANCE_TOKEN;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java
new file mode 100644
index 0000000..87d5e34
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import com.google.common.primitives.UnsignedInteger;
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class TemplateNodeTest extends BxmlNodeTestBase {
+
+ private int nextOffset = 101;
+ private String guid = "33323130-3534-3736-3839-616263646566";
+ private int dataLength = 102;
+ private TemplateNode templateNode;
+
+ public static int putNode(TestBinaryReaderBuilder testBinaryReaderBuilder, int nextOffset, String guid, int dataLength) {
+ testBinaryReaderBuilder.putDWord(nextOffset);
+ testBinaryReaderBuilder.putGuid(guid);
+ testBinaryReaderBuilder.putDWord(dataLength);
+ return 24;
+ }
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ putNode(testBinaryReaderBuilder, nextOffset, guid, dataLength);
+ testBinaryReaderBuilder.put((byte) BxmlNode.END_OF_STREAM_TOKEN);
+ templateNode = new TemplateNode(testBinaryReaderBuilder.build(), chunkHeader);
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(nextOffset, templateNode.getNextOffset());
+ assertEquals(UnsignedInteger.valueOf(858927408), templateNode.getTemplateId());
+ assertEquals(guid, templateNode.getGuid());
+ assertEquals(dataLength, templateNode.getDataLength());
+ assertTrue(templateNode.hasEndOfStream());
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ templateNode.accept(mock);
+ verify(mock).visit(templateNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java
new file mode 100644
index 0000000..85b71ff
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml;
+
+import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor;
+import org.apache.nifi.processors.evtx.parser.bxml.value.NullTypeNode;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+public class ValueNodeTest extends BxmlNodeWithTokenTestBase {
+ private ValueNode valueNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.put((byte) 0);
+ valueNode = new ValueNode(testBinaryReaderBuilder.build(), chunkHeader, parent);
+ }
+
+ @Override
+ protected byte getToken() {
+ return BxmlNode.VALUE_TOKEN;
+ }
+
+ @Test
+ public void testInit() {
+ assertEquals(getToken(), valueNode.getToken());
+ List<BxmlNode> children = valueNode.getChildren();
+ assertEquals(1, children.size());
+ assertTrue(children.get(0) instanceof NullTypeNode);
+ }
+
+ @Test
+ public void testVisitor() throws IOException {
+ BxmlNodeVisitor mock = mock(BxmlNodeVisitor.class);
+ valueNode.accept(mock);
+ verify(mock).visit(valueNode);
+ verifyNoMoreInteractions(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java
new file mode 100644
index 0000000..cf7e48a
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNode;
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode;
+import org.apache.nifi.processors.evtx.parser.bxml.RootNode;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class BXmlTypeNodeTest extends BxmlNodeTestBase {
+ private BXmlTypeNode bXmlTypeNode;
+
+ @Override
+ public void setup() throws IOException {
+ super.setup();
+ testBinaryReaderBuilder.put((byte) BxmlNode.END_OF_STREAM_TOKEN);
+ testBinaryReaderBuilder.putDWord(0);
+ bXmlTypeNode = new BXmlTypeNode(testBinaryReaderBuilder.build(), chunkHeader, parent, -1);
+ }
+
+ @Test
+ public void testInit() {
+ RootNode rootNode = bXmlTypeNode.getRootNode();
+ List<BxmlNode> children = rootNode.getChildren();
+ assertEquals(1, children.size());
+ assertTrue(children.get(0) instanceof EndOfStreamNode);
+ assertEquals(0, rootNode.getSubstitutions().size());
+ assertEquals(rootNode.toString(), bXmlTypeNode.getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java
new file mode 100644
index 0000000..fd121a7
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import com.google.common.base.Charsets;
+import com.google.common.primitives.UnsignedInteger;
+import org.apache.nifi.processors.evtx.parser.BinaryReader;
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Base64;
+
+import static org.junit.Assert.assertEquals;
+
+public class BinaryTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testLength() throws IOException {
+ String val = "Test String";
+ BinaryReader binaryReader = testBinaryReaderBuilder.putDWord(val.length()).putString(val).build();
+ assertEquals(Base64.getEncoder().encodeToString(val.getBytes(Charsets.US_ASCII)), new BinaryTypeNode(binaryReader, chunkHeader, parent, -1).getValue());
+ }
+
+ @Test(expected = IOException.class)
+ public void testInvalidStringLength() throws IOException {
+ String val = "Test String";
+ BinaryReader binaryReader = testBinaryReaderBuilder.putDWord(UnsignedInteger.fromIntBits(Integer.MAX_VALUE + 1)).putString(val).build();
+ assertEquals(Base64.getEncoder().encodeToString(val.getBytes(Charsets.US_ASCII)), new BinaryTypeNode(binaryReader, chunkHeader, parent, -1).getValue());
+ }
+
+ @Test
+ public void testNoLength() throws IOException {
+ String val = "Test String";
+ BinaryReader binaryReader = testBinaryReaderBuilder.putString(val).build();
+ assertEquals(Base64.getEncoder().encodeToString(val.getBytes(Charsets.US_ASCII)), new BinaryTypeNode(binaryReader, chunkHeader, parent, val.length()).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java
new file mode 100644
index 0000000..13a75aa
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class BooleanTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testTrue() throws IOException {
+ assertTrue(Boolean.parseBoolean(new BooleanTypeNode(testBinaryReaderBuilder.putDWord(1).build(), chunkHeader, parent, -1).getValue()));
+ }
+
+ @Test
+ public void testFalse() throws IOException {
+ assertFalse(Boolean.parseBoolean(new BooleanTypeNode(testBinaryReaderBuilder.putDWord(-1).build(), chunkHeader, parent, -1).getValue()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java
new file mode 100644
index 0000000..4705367
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class DoubleTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testDoubleTypeNode() throws IOException {
+ double value = 1.23456;
+ assertEquals(Double.toString(value), new DoubleTypeNode(testBinaryReaderBuilder.putQWord(Double.doubleToLongBits(value)).build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java
new file mode 100644
index 0000000..d81c1b6
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Date;
+
+import static org.junit.Assert.assertEquals;
+
+public class FiletimeTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testFiletimeTypeNode() throws IOException {
+ Date date = new Date();
+ assertEquals(FiletimeTypeNode.getFormat().format(date),
+ new FiletimeTypeNode(testBinaryReaderBuilder.putFileTime(date).build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java
new file mode 100644
index 0000000..a4fe3db
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class FloatTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testFloatTypeNode() throws IOException {
+ float value = 5.432f;
+ assertEquals(Float.toString(value),
+ new FloatTypeNode(testBinaryReaderBuilder.putDWord(Float.floatToIntBits(value)).build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java
new file mode 100644
index 0000000..f560869
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class GuidTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testGuidTypeNode() throws IOException {
+ String guid = "a1b2c3d4-e5f6-a7b8-c9da-ebf001121314";
+ assertEquals(guid, new GuidTypeNode(testBinaryReaderBuilder.putGuid(guid).build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java
new file mode 100644
index 0000000..b8ed300
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import com.google.common.primitives.UnsignedInteger;
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class Hex32TypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testHex32TypeNode() throws IOException {
+ UnsignedInteger value = UnsignedInteger.valueOf(1234);
+ String hex = value.toString(16);
+ assertEquals(hex, new Hex32TypeNode(testBinaryReaderBuilder.putDWord(value).build(), chunkHeader, parent, -1).getValue().substring(2));
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java
new file mode 100644
index 0000000..ecaa156
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import com.google.common.primitives.UnsignedLong;
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class Hex64TypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testHex64TypeNode() throws IOException {
+ UnsignedLong value = UnsignedLong.fromLongBits(Long.MAX_VALUE + 1234);
+ String hex = value.toString(16);
+ assertEquals(hex, new Hex64TypeNode(testBinaryReaderBuilder.putQWord(value).build(), chunkHeader, parent, -1).getValue().substring(2));
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java
new file mode 100644
index 0000000..99e7fb0
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class NullTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testNullTypeNode() throws IOException {
+ assertEquals("", new NullTypeNode(testBinaryReaderBuilder.build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java
new file mode 100644
index 0000000..a87fd39
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class SIDTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testSIDTypeNode() throws IOException {
+ testBinaryReaderBuilder.put((byte) 4);
+ testBinaryReaderBuilder.put((byte) 1);
+ testBinaryReaderBuilder.putDWordBE(5);
+ testBinaryReaderBuilder.putWordBE(6);
+ testBinaryReaderBuilder.putDWord(7);
+ assertEquals("S-4-327686-7", new SIDTypeNode(testBinaryReaderBuilder.build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java
new file mode 100644
index 0000000..a19c64e
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class SignedByteTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testSignedByteTypeNode() throws IOException {
+ byte value = -25;
+ assertEquals(Byte.toString(value), new SignedByteTypeNode(testBinaryReaderBuilder.put(value).build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java
new file mode 100644
index 0000000..514145b
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class SignedDWordTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testSignedDWordTypeNode() throws IOException {
+ int value = -5;
+ assertEquals(Integer.toString(value),
+ new SignedDWordTypeNode(testBinaryReaderBuilder.putDWord(value).build(), chunkHeader, parent, -1).getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/a5fecda5/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java
new file mode 100644
index 0000000..a76baa6
--- /dev/null
+++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.evtx.parser.bxml.value;
+
+import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class SignedQWordTypeNodeTest extends BxmlNodeTestBase {
+ @Test
+ public void testSignedQWordTypeNode() throws IOException {
+ long value = -5L;
+ assertEquals(Long.toString(value),
+ new SignedQWordTypeNode(testBinaryReaderBuilder.putQWord(value).build(), chunkHeader, parent, -1).getValue());
+ }
+}