This is an automated email from the ASF dual-hosted git repository. exceptionfactory pushed a commit to branch support/nifi-1.x in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 5cebd32e96a314d9e76664d8207ec59db8b67ec0 Author: Zoltan Kornel Torok <[email protected]> AuthorDate: Mon Aug 21 00:49:56 2023 +0200 NIFI-11965 Removed failing Integration Tests for Ignite Processors This closes #7630 Signed-off-by: David Handermann <[email protected]> --- .../processors/ignite/cache/ITGetIgniteCache.java | 184 ------------------- .../processors/ignite/cache/ITPutIgniteCache.java | 195 --------------------- 2 files changed, 379 deletions(-) diff --git a/nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/test/java/org/apache/nifi/processors/ignite/cache/ITGetIgniteCache.java b/nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/test/java/org/apache/nifi/processors/ignite/cache/ITGetIgniteCache.java deleted file mode 100644 index 1fc8635e9d..0000000000 --- a/nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/test/java/org/apache/nifi/processors/ignite/cache/ITGetIgniteCache.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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.ignite.cache; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.ignite.IgniteCache; -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -public class ITGetIgniteCache { - - private static final String CACHE_NAME = "testCache"; - private static TestRunner runner; - private static GetIgniteCache getIgniteCache; - private static Map<String,String> properties1; - private static HashMap<String, String> properties2; - - @BeforeAll - public static void setUp() { - getIgniteCache = new GetIgniteCache(); - properties1 = new HashMap<String,String>(); - properties2 = new HashMap<String,String>(); - } - - @AfterAll - public static void teardown() { - runner = null; - IgniteCache<String, byte[]> cache = getIgniteCache.getIgniteCache(); - if (cache != null ) - cache.destroy(); - getIgniteCache = null; - } - - @Test - public void testgetIgniteCacheOnTriggerFileConfigurationOneFlowFile() throws IOException, InterruptedException { - runner = TestRunners.newTestRunner(getIgniteCache); - runner.setProperty(GetIgniteCache.CACHE_NAME, CACHE_NAME); - runner.setProperty(GetIgniteCache.IGNITE_CONFIGURATION_FILE, - "file:///" + new File(".").getAbsolutePath() + "/src/test/resources/test-ignite.xml"); - runner.setProperty(GetIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}"); - - runner.assertValid(); - properties1.put("igniteKey", "key5"); - runner.enqueue("test5".getBytes(),properties1); - - getIgniteCache.initialize(runner.getProcessContext()); - - getIgniteCache.getIgniteCache().put("key5", "test5".getBytes()); - runner.run(1, false, true); - - runner.assertAllFlowFilesTransferred(GetIgniteCache.REL_SUCCESS, 1); - List<MockFlowFile> sucessfulFlowFiles = runner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS); - assertEquals(1, sucessfulFlowFiles.size()); - List<MockFlowFile> failureFlowFiles = runner.getFlowFilesForRelationship(GetIgniteCache.REL_FAILURE); - assertEquals(0, failureFlowFiles.size()); - - final MockFlowFile out = runner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS).get(0); - - out.assertContentEquals("test5".getBytes()); - assertArrayEquals("test5".getBytes(),(byte[])getIgniteCache.getIgniteCache().get("key5")); - runner.shutdown(); - } - - @Test - public void testgetIgniteCacheOnTriggerNoConfigurationTwoFlowFile() throws IOException, InterruptedException { - runner = TestRunners.newTestRunner(getIgniteCache); - runner.setProperty(GetIgniteCache.CACHE_NAME, CACHE_NAME); - runner.setProperty(GetIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}"); - - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - getIgniteCache.initialize(runner.getProcessContext()); - - getIgniteCache.getIgniteCache().put("key51", "test51".getBytes()); - getIgniteCache.getIgniteCache().put("key52", "test52".getBytes()); - runner.run(2, false, true); - - runner.assertAllFlowFilesTransferred(GetIgniteCache.REL_SUCCESS, 2); - List<MockFlowFile> sucessfulFlowFiles = runner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS); - assertEquals(2, sucessfulFlowFiles.size()); - List<MockFlowFile> failureFlowFiles = runner.getFlowFilesForRelationship(GetIgniteCache.REL_FAILURE); - assertEquals(0, failureFlowFiles.size()); - - final MockFlowFile out = runner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS).get(0); - - out.assertContentEquals("test51".getBytes()); - assertArrayEquals("test51".getBytes(), - (byte[])getIgniteCache.getIgniteCache().get("key51")); - - final MockFlowFile out2 = runner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS).get(1); - - out2.assertContentEquals("test52".getBytes()); - assertArrayEquals("test52".getBytes(), - (byte[])getIgniteCache.getIgniteCache().get("key52")); - - runner.shutdown(); - } - - @Test - public void testgetIgniteCacheOnTriggerNoConfigurationTwoFlowFileStopStart2Times() throws IOException, InterruptedException { - runner = TestRunners.newTestRunner(getIgniteCache); - runner.setProperty(GetIgniteCache.CACHE_NAME, CACHE_NAME); - runner.setProperty(GetIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}"); - - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - getIgniteCache.initialize(runner.getProcessContext()); - - getIgniteCache.getIgniteCache().put("key51", "test51".getBytes()); - getIgniteCache.getIgniteCache().put("key52", "test52".getBytes()); - runner.run(2, false, true); - - runner.assertAllFlowFilesTransferred(GetIgniteCache.REL_SUCCESS, 2); - - getIgniteCache.closeIgniteCache(); - - runner.clearTransferState(); - - // reinit and check first time - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - getIgniteCache.initialize(runner.getProcessContext()); - - runner.run(2, false, true); - - runner.assertAllFlowFilesTransferred(GetIgniteCache.REL_SUCCESS, 2); - - getIgniteCache.closeIgniteCache(); - - runner.clearTransferState(); - - // reinit and check second time - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - getIgniteCache.initialize(runner.getProcessContext()); - - runner.run(2, false, true); - - runner.assertAllFlowFilesTransferred(GetIgniteCache.REL_SUCCESS, 2); - - getIgniteCache.closeIgniteCache(); - - runner.clearTransferState(); - - } -} diff --git a/nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/test/java/org/apache/nifi/processors/ignite/cache/ITPutIgniteCache.java b/nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/test/java/org/apache/nifi/processors/ignite/cache/ITPutIgniteCache.java deleted file mode 100644 index 768f206f43..0000000000 --- a/nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/test/java/org/apache/nifi/processors/ignite/cache/ITPutIgniteCache.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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.ignite.cache; - -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class ITPutIgniteCache { - - private static final String CACHE_NAME = "testCache"; - private static TestRunner runner; - private static PutIgniteCache putIgniteCache; - private static Map<String,String> properties1; - private static HashMap<String, String> properties2; - - @BeforeAll - public static void setUp() { - putIgniteCache = new PutIgniteCache(); - properties1 = new HashMap<String,String>(); - properties2 = new HashMap<String,String>(); - } - - @AfterAll - public static void teardown() { - runner = null; - putIgniteCache.getIgniteCache().destroy(); - putIgniteCache = null; - } - - @Test - public void testPutIgniteCacheOnTriggerFileConfigurationOneFlowFile() throws IOException, InterruptedException { - runner = TestRunners.newTestRunner(putIgniteCache); - runner.setProperty(PutIgniteCache.BATCH_SIZE, "5"); - runner.setProperty(PutIgniteCache.CACHE_NAME, CACHE_NAME); - runner.setProperty(PutIgniteCache.IGNITE_CONFIGURATION_FILE, - "file:///" + new File(".").getAbsolutePath() + "/src/test/resources/test-ignite.xml"); - runner.setProperty(PutIgniteCache.DATA_STREAMER_PER_NODE_BUFFER_SIZE, "1"); - runner.setProperty(PutIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}"); - - runner.assertValid(); - properties1.put("igniteKey", "key5"); - runner.enqueue("test".getBytes(),properties1); - runner.run(1, false, true); - - runner.assertAllFlowFilesTransferred(PutIgniteCache.REL_SUCCESS, 1); - List<MockFlowFile> sucessfulFlowFiles = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS); - assertEquals(1, sucessfulFlowFiles.size()); - List<MockFlowFile> failureFlowFiles = runner.getFlowFilesForRelationship(PutIgniteCache.REL_FAILURE); - assertEquals(0, failureFlowFiles.size()); - - final MockFlowFile out = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS).get(0); - - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_ITEM_NUMBER, "0"); - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_TOTAL_COUNT, "1"); - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_COUNT, "1"); - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_ITEM_NUMBER, "0"); - - out.assertContentEquals("test".getBytes()); - System.out.println("Value was: " + new String((byte[])putIgniteCache.getIgniteCache().get("key5"))); - assertArrayEquals("test".getBytes(),(byte[])putIgniteCache.getIgniteCache().get("key5")); - putIgniteCache.getIgniteCache().remove("key5"); - } - - @Test - public void testPutIgniteCacheOnTriggerNoConfigurationTwoFlowFile() throws IOException, InterruptedException { - runner = TestRunners.newTestRunner(putIgniteCache); - runner.setProperty(PutIgniteCache.BATCH_SIZE, "5"); - runner.setProperty(PutIgniteCache.CACHE_NAME, CACHE_NAME); - runner.setProperty(PutIgniteCache.DATA_STREAMER_PER_NODE_BUFFER_SIZE, "1"); - runner.setProperty(PutIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}"); - - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - runner.run(1, false, true); - - runner.assertAllFlowFilesTransferred(PutIgniteCache.REL_SUCCESS, 2); - List<MockFlowFile> sucessfulFlowFiles = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS); - assertEquals(2, sucessfulFlowFiles.size()); - List<MockFlowFile> failureFlowFiles = runner.getFlowFilesForRelationship(PutIgniteCache.REL_FAILURE); - assertEquals(0, failureFlowFiles.size()); - - final MockFlowFile out = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS).get(0); - - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_ITEM_NUMBER, "0"); - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_TOTAL_COUNT, "2"); - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_COUNT, "2"); - out.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_ITEM_NUMBER, "0"); - - out.assertContentEquals("test1".getBytes()); - System.out.println("value was " + new String(putIgniteCache.getIgniteCache().get("key51"))); - assertArrayEquals("test1".getBytes(),(byte[])putIgniteCache.getIgniteCache().get("key51")); - - final MockFlowFile out2 = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS).get(1); - - out2.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_ITEM_NUMBER, "1"); - out2.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_TOTAL_COUNT, "2"); - out2.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_COUNT, "2"); - out2.assertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_ITEM_NUMBER, "1"); - - out2.assertContentEquals("test2".getBytes()); - assertArrayEquals("test2".getBytes(),(byte[])putIgniteCache.getIgniteCache().get("key52")); - putIgniteCache.getIgniteCache().remove("key52"); - putIgniteCache.getIgniteCache().remove("key51"); - - } - - @Test - public void testPutIgniteCacheOnTriggerNoConfigurationTwoFlowFileStopAndStart2Times() throws IOException, InterruptedException { - runner = TestRunners.newTestRunner(putIgniteCache); - runner.setProperty(PutIgniteCache.BATCH_SIZE, "5"); - runner.setProperty(PutIgniteCache.CACHE_NAME, CACHE_NAME); - runner.setProperty(PutIgniteCache.DATA_STREAMER_PER_NODE_BUFFER_SIZE, "1"); - runner.setProperty(PutIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}"); - - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - runner.run(1, false, true); - putIgniteCache.getIgniteCache().remove("key51"); - putIgniteCache.getIgniteCache().remove("key52"); - - runner.assertAllFlowFilesTransferred(PutIgniteCache.REL_SUCCESS, 2); - putIgniteCache.getIgniteCache().remove("key52"); - putIgniteCache.getIgniteCache().remove("key52"); - - // Close and restart first time - putIgniteCache.closeIgniteDataStreamer(); - - runner.clearTransferState(); - - putIgniteCache.initializeIgniteDataStreamer(runner.getProcessContext()); - - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - runner.run(1, false, true); - - runner.assertAllFlowFilesTransferred(PutIgniteCache.REL_SUCCESS, 2); - putIgniteCache.getIgniteCache().remove("key51"); - putIgniteCache.getIgniteCache().remove("key52"); - - // Close and restart second time - putIgniteCache.closeIgniteDataStreamer(); - - runner.clearTransferState(); - - putIgniteCache.initializeIgniteDataStreamer(runner.getProcessContext()); - - runner.assertValid(); - properties1.put("igniteKey", "key51"); - runner.enqueue("test1".getBytes(),properties1); - properties2.put("igniteKey", "key52"); - runner.enqueue("test2".getBytes(),properties2); - runner.run(1, false, true); - - runner.assertAllFlowFilesTransferred(PutIgniteCache.REL_SUCCESS, 2); - putIgniteCache.getIgniteCache().remove("key52"); - putIgniteCache.getIgniteCache().remove("key51"); - - } -}
