This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new ae51f7e104 NIFI-15411 Removed old Disabled unit tests (#10717)
ae51f7e104 is described below
commit ae51f7e104906b8f3254f5862019fee69f78c195
Author: dan-s1 <[email protected]>
AuthorDate: Thu Jan 1 17:56:46 2026 -0500
NIFI-15411 Removed old Disabled unit tests (#10717)
Signed-off-by: David Handermann <[email protected]>
---
.../nifi/processors/standard/TestScanContent.java | 55 ----------------------
.../repository/StandardProcessSessionIT.java | 29 ------------
.../scheduling/TestStandardProcessScheduler.java | 43 +----------------
3 files changed, 1 insertion(+), 126 deletions(-)
diff --git
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
index 541220b7b1..d71bb6c741 100644
---
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
+++
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
@@ -16,21 +16,15 @@
*/
package org.apache.nifi.processors.standard;
-import org.apache.nifi.util.MockFlowFile;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
-import java.util.List;
public class TestScanContent {
@@ -51,53 +45,4 @@ public class TestScanContent {
runner.assertTransferCount(ScanContent.REL_NO_MATCH, 1);
}
-
- @Disabled("This test has a race condition/ordering problem")
- @Test
- public void testBinaryScan() throws IOException {
- // Create dictionary file.
- final String[] terms = new String[]{"hello", "good-bye"};
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- try (final DataOutputStream dictionaryOut = new
DataOutputStream(baos)) {
- for (final String term : terms) {
- final byte[] termBytes = term.getBytes(StandardCharsets.UTF_8);
- dictionaryOut.writeInt(termBytes.length);
- dictionaryOut.write(termBytes);
- }
- final byte[] termBytes = baos.toByteArray();
-
- final Path dictionaryPath = Paths.get("target/dictionary");
- Files.write(dictionaryPath, termBytes, StandardOpenOption.CREATE,
StandardOpenOption.WRITE);
-
- final TestRunner runner = TestRunners.newTestRunner(new
ScanContent());
- runner.setThreadCount(1);
- runner.setProperty(ScanContent.DICTIONARY,
dictionaryPath.toString());
- runner.setProperty(ScanContent.DICTIONARY_ENCODING,
ScanContent.BINARY_ENCODING);
-
-
runner.enqueue(Paths.get("src/test/resources/TestScanContent/helloWorld"));
-
runner.enqueue(Paths.get("src/test/resources/TestScanContent/wellthengood-bye"));
- runner.enqueue(new byte[0]);
-
- while (!runner.isQueueEmpty()) {
- runner.run(3);
- try { //must insert this delay or flowfiles are made so close
together they become out of order in the queue
- Thread.sleep(500);
- } catch (InterruptedException ignored) {
- //moving on
- }
- }
-
- runner.assertTransferCount(ScanContent.REL_MATCH, 2);
- runner.assertTransferCount(ScanContent.REL_NO_MATCH, 1);
- final List<MockFlowFile> matched =
runner.getFlowFilesForRelationship(ScanContent.REL_MATCH);
- final List<MockFlowFile> unmatched =
runner.getFlowFilesForRelationship(ScanContent.REL_NO_MATCH);
-
-
matched.get(0).assertAttributeEquals(ScanContent.MATCH_ATTRIBUTE_KEY, "hello");
-
matched.get(1).assertAttributeEquals(ScanContent.MATCH_ATTRIBUTE_KEY,
"good-bye");
-
-
unmatched.get(0).assertAttributeNotExists(ScanContent.MATCH_ATTRIBUTE_KEY);
- }
- }
-
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
index 978a6ff042..201bacadf6 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
@@ -61,14 +61,11 @@ import org.apache.nifi.stream.io.StreamUtils;
import org.apache.nifi.util.NiFiProperties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -124,7 +121,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class StandardProcessSessionIT {
- private static final Logger logger =
LoggerFactory.getLogger(StandardProcessSessionIT.class);
private static final Relationship FAKE_RELATIONSHIP = new
Relationship.Builder().name("FAKE").build();
private StandardProcessSession session;
@@ -1698,31 +1694,6 @@ public class StandardProcessSessionIT {
assertEquals(1L, contentRepo.getClaimsRemoved());
}
- @Test
- @Disabled
- public void testManyFilesOpened() {
-
- StandardProcessSession[] standardProcessSessions = new
StandardProcessSession[100000];
- for (int i = 0; i < 70000; i++) {
- standardProcessSessions[i] = new StandardProcessSession(context,
() -> false, new NopPerformanceTracker());
-
- FlowFile flowFile = standardProcessSessions[i].create();
- final byte[] buff = new byte["Hello".getBytes().length];
-
- flowFile = standardProcessSessions[i].append(flowFile, out ->
out.write("Hello".getBytes()));
-
- try {
- standardProcessSessions[i].read(flowFile, in ->
StreamUtils.fillBuffer(in, buff));
- } catch (Exception e) {
- logger.error("Failed at file:{}", i);
- throw e;
- }
- if (i % 1000 == 0) {
- logger.info("i:{}", i);
- }
- }
- }
-
@Test
public void
testMissingFlowFileExceptionThrownWhenUnableToReadDataStreamCallback() {
final FlowFileRecord flowFileRecord = new
StandardFlowFileRecord.Builder()
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
index bcbf5b375a..1a33b04629 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/TestStandardProcessScheduler.java
@@ -47,7 +47,6 @@ import
org.apache.nifi.controller.scheduling.processors.FailOnScheduledProcessor
import org.apache.nifi.controller.service.ControllerServiceNode;
import org.apache.nifi.controller.service.ControllerServiceProvider;
import org.apache.nifi.controller.service.ControllerServiceState;
-import org.apache.nifi.controller.service.StandardControllerServiceNode;
import org.apache.nifi.controller.service.StandardControllerServiceProvider;
import org.apache.nifi.controller.service.mock.MockProcessGroup;
import org.apache.nifi.engine.FlowEngine;
@@ -74,7 +73,6 @@ import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.util.SynchronousValidationTrigger;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.mockito.AdditionalMatchers;
@@ -95,7 +93,6 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -329,7 +326,7 @@ public class TestStandardProcessScheduler {
* ControllerServiceNode.
*/
@Test
- public void validateServiceEnablementLogicHappensOnlyOnce() throws
Exception {
+ public void validateServiceEnablementLogicHappensOnlyOnce() {
final StandardProcessScheduler scheduler = createScheduler();
final ControllerServiceNode serviceNode =
flowManager.createControllerService(SimpleTestService.class.getName(),
@@ -456,44 +453,6 @@ public class TestStandardProcessScheduler {
assertSame(ControllerServiceState.ENABLING, serviceNode.getState());
}
- /**
- * Validates that in multithreaded environment enabling service can still
- * be disabled. This test is set up in such way that disabling of the
- * service could be initiated by both disable and enable methods. In other
- * words it tests two conditions in
- * {@link StandardControllerServiceNode#disable(ScheduledExecutorService)}
- * where the disabling of the service can be initiated right there (if
- * ENABLED), or if service is still enabling its disabling will be deferred
- * to the logic in
- * {@link StandardControllerServiceNode#enable(ScheduledExecutorService,
long)}
- * IN any even the resulting state of the service is DISABLED
- */
- @Test
- @Disabled
- @SuppressWarnings("PMD.UnusedLocalVariable")
- public void validateEnabledDisableMultiThread() throws Exception {
- final StandardProcessScheduler scheduler = createScheduler();
- final StandardControllerServiceProvider provider = new
StandardControllerServiceProvider(scheduler, null, flowManager,
extensionManager);
- final ExecutorService executor = Executors.newCachedThreadPool();
- for (int i = 0; i < 200; i++) {
- final ControllerServiceNode serviceNode =
flowManager.createControllerService(RandomShortDelayEnablingService.class.getName(),
"1",
- systemBundle.getBundleDetails().getCoordinate(), null,
false, true, nullable(String.class));
-
- executor.execute(() ->
scheduler.enableControllerService(serviceNode));
- Thread.sleep(10); // ensure that enable gets initiated before
disable
- executor.execute(() ->
scheduler.disableControllerService(serviceNode));
- Thread.sleep(100);
- assertFalse(serviceNode.isActive());
- assertEquals(ControllerServiceState.DISABLED,
serviceNode.getState());
- }
-
- // need to sleep a while since we are emulating async invocations on
- // method that is also internally async
- Thread.sleep(500);
- executor.shutdown();
- executor.awaitTermination(5000, TimeUnit.MILLISECONDS);
- }
-
/**
* Validates that service that is infinitely blocking in @OnEnabled can
* still have DISABLE operation initiated. The service itself will be set
to