mirror of https://github.com/apache/nifi.git
NIFI-9773 Refactored nifi-system-tests using JUnit 5
- Enabled system-tests workflow on push and pull requests This closes #5901 Signed-off-by: Mike Thomsen <mthomsen@apache.org>
This commit is contained in:
parent
16c9bd535b
commit
105890ef37
|
@ -19,6 +19,12 @@ on:
|
|||
# Run every day at 00:00
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
push:
|
||||
paths:
|
||||
- 'nifi-system-tests/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'nifi-system-tests/**'
|
||||
|
||||
env:
|
||||
DEFAULT_MAVEN_OPTS: >-
|
||||
|
@ -52,19 +58,12 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Maven Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Set up Java 11
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: 11
|
||||
cache: 'maven'
|
||||
- name: Build Dependencies
|
||||
env:
|
||||
MAVEN_OPTS: >-
|
||||
|
@ -99,19 +98,12 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Maven Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Set up Java 8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: 8
|
||||
cache: 'maven'
|
||||
- name: Build Dependencies
|
||||
env:
|
||||
MAVEN_OPTS: >-
|
||||
|
|
|
@ -34,11 +34,9 @@ import org.apache.nifi.stateless.engine.StatelessEngineConfiguration;
|
|||
import org.apache.nifi.stateless.flow.DataflowDefinition;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TransactionThresholds;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TestName;
|
||||
import org.junit.rules.Timeout;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -53,6 +51,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Timeout(value = 5, unit = TimeUnit.MINUTES)
|
||||
public class StatelessSystemIT {
|
||||
private final List<StatelessDataflow> createdFlows = new ArrayList<>();
|
||||
|
||||
|
@ -60,19 +59,12 @@ public class StatelessSystemIT {
|
|||
// up finding a "compatible bundle" and using that, regardless of the specified version.
|
||||
protected static final Bundle SYSTEM_TEST_EXTENSIONS_BUNDLE = new Bundle("org.apache.nifi", "nifi-system-test-extensions-nar", "1.13.0-SNAPSHOT");
|
||||
|
||||
@Rule
|
||||
public TestName name = new TestName();
|
||||
|
||||
@Rule
|
||||
public Timeout defaultTimeout = new Timeout(5, TimeUnit.MINUTES);
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void clearFlows() {
|
||||
createdFlows.clear();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void shutdownFlows() {
|
||||
createdFlows.forEach(StatelessDataflow::shutdown);
|
||||
}
|
||||
|
@ -236,8 +228,4 @@ public class StatelessSystemIT {
|
|||
createdFlows.add(dataflow);
|
||||
return dataflow;
|
||||
}
|
||||
|
||||
protected String getTestName() {
|
||||
return name.getMethodName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
public class VersionedFlowBuilder {
|
||||
private VersionedFlowSnapshot flowSnapshot;
|
||||
private VersionedProcessGroup rootGroup;
|
||||
private final VersionedFlowSnapshot flowSnapshot;
|
||||
private final VersionedProcessGroup rootGroup;
|
||||
|
||||
public VersionedFlowBuilder() {
|
||||
rootGroup = new VersionedProcessGroup();
|
||||
|
@ -146,7 +146,7 @@ public class VersionedFlowBuilder {
|
|||
processor.setSchedulingStrategy("TIMER_DRIVEN");
|
||||
processor.setRetryCount(0);
|
||||
processor.setBackoffMechanism("PENALIZE_FLOWFILE");
|
||||
processor.setRetriedRelationships(Collections.EMPTY_SET);
|
||||
processor.setRetriedRelationships(Collections.emptySet());
|
||||
processor.setMaxBackoffPeriod("0 sec");
|
||||
|
||||
group.getProcessors().add(processor);
|
||||
|
|
|
@ -27,8 +27,9 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -40,15 +41,15 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class AsyncCommitCallbackIT extends StatelessSystemIT {
|
||||
private final File inputFile = new File("target/input.txt");
|
||||
private final File replacementFile = new File("target/replacement.txt");
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
Files.write(inputFile.toPath(), "Hello World".getBytes(), StandardOpenOption.CREATE);
|
||||
Files.deleteIfExists(replacementFile.toPath());
|
||||
|
@ -98,13 +99,15 @@ public class AsyncCommitCallbackIT extends StatelessSystemIT {
|
|||
assertTrue(failureOutputFile.exists());
|
||||
}
|
||||
|
||||
@Test(timeout = 10_000)
|
||||
@Timeout(10)
|
||||
@Test
|
||||
public void testCleanupAfterFlowFilesTerminated() throws IOException, StatelessConfigurationException, InterruptedException {
|
||||
testCleanupAfterFlowFilesTerminated("asynchronous");
|
||||
}
|
||||
|
||||
@Test(timeout = 10_000)
|
||||
public void testSynchronousCommitCleanupAFterFlowFilesTerminated() throws IOException, StatelessConfigurationException, InterruptedException {
|
||||
@Timeout(10)
|
||||
@Test
|
||||
public void testSynchronousCommitCleanupAfterFlowFilesTerminated() throws IOException, StatelessConfigurationException, InterruptedException {
|
||||
testCleanupAfterFlowFilesTerminated("synchronous");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,15 +27,15 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class BatchOutputIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class CancelFlowExecutionIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -27,16 +27,16 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class CloneFlowFileIT extends StatelessSystemIT {
|
||||
|
||||
|
@ -94,9 +94,7 @@ public class CloneFlowFileIT extends StatelessSystemIT {
|
|||
try {
|
||||
return new String(result.readContentAsByteArray(flowFile), StandardCharsets.UTF_8);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
Assert.fail("Could not read content");
|
||||
return null;
|
||||
throw new UncheckedIOException("Read Content Failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -34,8 +34,8 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class CreatesFlowFileIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class InputOutputIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -34,8 +34,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class LoopingIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -34,8 +34,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class MergingIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -36,8 +36,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class PartitioningContentIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.apache.nifi.stateless.flow.DataflowTrigger;
|
|||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TransactionThresholds;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
@ -44,9 +43,9 @@ import java.util.Optional;
|
|||
import java.util.OptionalLong;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class RequiresAdditionalInputIT extends StatelessSystemIT {
|
||||
|
||||
|
@ -75,11 +74,11 @@ public class RequiresAdditionalInputIT extends StatelessSystemIT {
|
|||
assertTrue(result.isSuccessful());
|
||||
|
||||
final List<FlowFile> flowFiles = result.getOutputFlowFiles("Out");
|
||||
Assert.assertEquals(1, flowFiles.size());
|
||||
assertEquals(1, flowFiles.size());
|
||||
|
||||
final FlowFile first = flowFiles.get(0);
|
||||
final String outputContent = new String(result.readContentAsByteArray(first));
|
||||
Assert.assertEquals("123", outputContent);
|
||||
assertEquals("123", outputContent);
|
||||
|
||||
result.acknowledge();
|
||||
}
|
||||
|
|
|
@ -27,18 +27,20 @@ import org.apache.nifi.stateless.flow.DataflowTrigger;
|
|||
import org.apache.nifi.stateless.flow.FailurePortEncounteredException;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class RollbackOnExceptionIT extends StatelessSystemIT {
|
||||
private static final String EXCEPTION_TEXT = "Intentional Exception to verify behavior in RollbackOnExceptionIT";
|
||||
|
||||
@Test(timeout = 30_000)
|
||||
@Timeout(30)
|
||||
@Test
|
||||
public void testFlowFileCompletelyRemovedWhenExceptionThrown() throws IOException, StatelessConfigurationException, InterruptedException {
|
||||
final VersionedFlowBuilder builder = new VersionedFlowBuilder();
|
||||
final VersionedProcessor generate = builder.createSimpleProcessor("GenerateFlowFile");
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -34,8 +34,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class SplittingIT extends StatelessSystemIT {
|
||||
@Test
|
||||
|
|
|
@ -27,16 +27,16 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class StateStorageIT extends StatelessSystemIT {
|
||||
@Test
|
||||
|
|
|
@ -26,14 +26,14 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class StatelessRetryIT extends StatelessSystemIT {
|
||||
private static final int RETRY_COUNT = 2;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.nifi.stateless.StatelessSystemIT;
|
|||
import org.apache.nifi.stateless.VersionedFlowBuilder;
|
||||
import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
@ -33,7 +33,7 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class InstanceClassLoaderIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ import org.apache.nifi.stateless.config.StatelessConfigurationException;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class StatelessControllerServiceSystemIT extends StatelessSystemIT {
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ import org.apache.nifi.stateless.flow.DataflowTrigger;
|
|||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TransactionThresholds;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -45,8 +44,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class ParameterContextIT extends StatelessSystemIT {
|
||||
|
||||
|
@ -105,14 +105,12 @@ public class ParameterContextIT extends StatelessSystemIT {
|
|||
parameterContext.getParameters().add(createVersionedParameter("three", "-1")); // Set value to -1. This should be overridden by the Numeric Parameter Context.
|
||||
flowBuilder.getRootGroup().setParameterContextName("Context 1");
|
||||
|
||||
Assert.assertThrows(IllegalStateException.class, () -> {
|
||||
loadDataflow(flowSnapshot, Collections.emptyList(), parameterValueProviders, Collections.emptySet(), TransactionThresholds.SINGLE_FLOWFILE);
|
||||
});
|
||||
assertThrows(IllegalStateException.class, () -> loadDataflow(flowSnapshot, Collections.emptyList(), parameterValueProviders, Collections.emptySet(), TransactionThresholds.SINGLE_FLOWFILE));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParameterValueProviderWithRequiredPropertyNotSet() throws IOException, StatelessConfigurationException {
|
||||
public void testParameterValueProviderWithRequiredPropertyNotSet() {
|
||||
final VersionedFlowBuilder flowBuilder = new VersionedFlowBuilder();
|
||||
final VersionedPort outPort = flowBuilder.createOutputPort("Out");
|
||||
final VersionedProcessor generate = flowBuilder.createSimpleProcessor("GenerateFlowFile");
|
||||
|
@ -133,9 +131,7 @@ public class ParameterContextIT extends StatelessSystemIT {
|
|||
parameterContext.getParameters().add(createVersionedParameter("three", "1")); // Set value to -1. This should be overridden by the Numeric Parameter Context.
|
||||
flowBuilder.getRootGroup().setParameterContextName("Context 1");
|
||||
|
||||
Assert.assertThrows(IllegalStateException.class, () -> {
|
||||
loadDataflow(flowSnapshot, Collections.emptyList(), parameterValueProviders, Collections.emptySet(), TransactionThresholds.SINGLE_FLOWFILE);
|
||||
});
|
||||
assertThrows(IllegalStateException.class, () -> loadDataflow(flowSnapshot, Collections.emptyList(), parameterValueProviders, Collections.emptySet(), TransactionThresholds.SINGLE_FLOWFILE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -23,15 +23,15 @@ import org.apache.nifi.stateless.VersionedFlowBuilder;
|
|||
import org.apache.nifi.stateless.flow.DataflowTrigger;
|
||||
import org.apache.nifi.stateless.flow.StatelessDataflow;
|
||||
import org.apache.nifi.stateless.flow.TriggerResult;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class StatelessPerformanceIT extends StatelessSystemIT {
|
||||
@Test
|
||||
@Ignore("For manual testing purposes only")
|
||||
@EnabledIfSystemProperty(named = "nifi.test.performance", matches = "true")
|
||||
public void testCreateDestroyPerf() throws InterruptedException {
|
||||
System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi", "WARN");
|
||||
final VersionedFlowBuilder builder = new VersionedFlowBuilder();
|
||||
|
|
|
@ -87,7 +87,6 @@ import org.apache.nifi.web.api.entity.VariableEntity;
|
|||
import org.apache.nifi.web.api.entity.VariableRegistryEntity;
|
||||
import org.apache.nifi.web.api.entity.VariableRegistryUpdateRequestEntity;
|
||||
import org.apache.nifi.web.api.entity.VerifyConfigRequestEntity;
|
||||
import org.junit.Assert;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -105,6 +104,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
public class NiFiClientUtil {
|
||||
private static final Logger logger = LoggerFactory.getLogger(NiFiClientUtil.class);
|
||||
|
||||
|
@ -734,7 +735,7 @@ public class NiFiClientUtil {
|
|||
try {
|
||||
Thread.sleep(500L);
|
||||
} catch (final Exception e) {
|
||||
Assert.fail(e.toString());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -762,8 +763,7 @@ public class NiFiClientUtil {
|
|||
try {
|
||||
Thread.sleep(500L);
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
Assert.fail(e.toString());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1039,8 +1039,7 @@ public class NiFiClientUtil {
|
|||
getConnectionClient().deleteListingRequest(connectionId, listingRequestEntity.getListingRequest().getId());
|
||||
return listingRequestEntity;
|
||||
} catch (final InterruptedException e) {
|
||||
Assert.fail("Failed to obtain connection status");
|
||||
return null;
|
||||
throw new RuntimeException("Failed to obtain connection status");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1117,16 +1116,13 @@ public class NiFiClientUtil {
|
|||
try {
|
||||
Thread.sleep(100L);
|
||||
} catch (final InterruptedException ie) {
|
||||
Assert.fail("Interrupted while waiting for variable registry to update");
|
||||
return null;
|
||||
throw new RuntimeException("Interrupted while waiting for variable registry to update");
|
||||
}
|
||||
|
||||
updateRequestEntity = nifiClient.getProcessGroupClient().getVariableRegistryUpdateRequest(processGroup.getId(), updateRequestEntity.getRequest().getRequestId());
|
||||
}
|
||||
|
||||
if (updateRequestEntity.getRequest().getFailureReason() != null) {
|
||||
Assert.fail("Failed to update Variable Registry due to: " + updateRequestEntity.getRequest().getFailureReason());
|
||||
}
|
||||
assertNull(updateRequestEntity.getRequest().getFailureReason());
|
||||
|
||||
nifiClient.getProcessGroupClient().deleteVariableRegistryUpdateRequest(processGroup.getId(), updateRequestEntity.getRequest().getRequestId());
|
||||
return updateRequestEntity;
|
||||
|
@ -1192,7 +1188,7 @@ public class NiFiClientUtil {
|
|||
try {
|
||||
responseEntity = waitForComplete(responseEntity);
|
||||
} catch (final InterruptedException ie) {
|
||||
Assert.fail("Interrupted while waiting for Provenance Query to complete");
|
||||
throw new RuntimeException("Interrupted while waiting for Provenance Query to complete");
|
||||
}
|
||||
|
||||
nifiClient.getProvenanceClient().deleteProvenanceQuery(responseEntity.getProvenance().getId());
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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.tests.system;
|
||||
|
||||
/**
|
||||
* Provider for configured NiFi instances
|
||||
*/
|
||||
public interface NiFiInstanceProvider {
|
||||
/**
|
||||
* Get configured NiFi instance or null when not configured
|
||||
*
|
||||
* @return NiFi instance or null when not configured
|
||||
*/
|
||||
NiFiInstance getNiFiInstance();
|
||||
|
||||
/**
|
||||
* Get NiFi instance factory
|
||||
*
|
||||
* @return NiFi Instance Factory
|
||||
*/
|
||||
NiFiInstanceFactory getInstanceFactory();
|
||||
}
|
|
@ -24,15 +24,12 @@ import org.apache.nifi.web.api.dto.NodeDTO;
|
|||
import org.apache.nifi.web.api.entity.ClusteSummaryEntity;
|
||||
import org.apache.nifi.web.api.entity.ClusterEntity;
|
||||
import org.apache.nifi.web.api.entity.ConnectionStatusEntity;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TestName;
|
||||
import org.junit.rules.TestWatcher;
|
||||
import org.junit.rules.Timeout;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -49,7 +46,9 @@ import java.util.function.Predicate;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public abstract class NiFiSystemIT {
|
||||
@ExtendWith(TroubleshootingTestWatcher.class)
|
||||
@Timeout(value = 5, unit = TimeUnit.MINUTES)
|
||||
public abstract class NiFiSystemIT implements NiFiInstanceProvider {
|
||||
private static final Logger logger = LoggerFactory.getLogger(NiFiSystemIT.class);
|
||||
private final ConcurrentMap<String, Long> lastLogTimestamps = new ConcurrentHashMap<>();
|
||||
|
||||
|
@ -65,31 +64,16 @@ public abstract class NiFiSystemIT {
|
|||
private static final File LIB_DIR = new File("target/nifi-lib-assembly/lib");
|
||||
private static volatile String nifiFrameworkVersion = null;
|
||||
|
||||
@Rule
|
||||
public TestName name = new TestName();
|
||||
@Rule
|
||||
public Timeout defaultTimeout = new Timeout(5, TimeUnit.MINUTES);
|
||||
|
||||
@Rule(order = Integer.MIN_VALUE)
|
||||
public TestWatcher quarantineRule = new TestWatcher() {
|
||||
@Override
|
||||
protected void failed(final Throwable t, final Description description) {
|
||||
final String testName = description.getMethodName();
|
||||
try {
|
||||
final File dir = quarantineTroubleshootingInfo(testName, t);
|
||||
logger.info("Test failure for <{}>. Successfully wrote troubleshooting info to {}", testName, dir.getAbsolutePath());
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to quarantine troubleshooting info for test " + testName, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private NiFiClient nifiClient;
|
||||
private NiFiClientUtil clientUtil;
|
||||
private static final AtomicReference<NiFiInstance> nifiRef = new AtomicReference<>();
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException {
|
||||
private TestInfo testInfo;
|
||||
|
||||
@BeforeEach
|
||||
public void setup(final TestInfo testInfo) throws IOException {
|
||||
this.testInfo = testInfo;
|
||||
|
||||
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
|
||||
setupClient();
|
||||
|
||||
|
@ -107,7 +91,7 @@ public abstract class NiFiSystemIT {
|
|||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
public static void cleanup() {
|
||||
final NiFiInstance nifi = nifiRef.get();
|
||||
nifiRef.set(null);
|
||||
|
@ -116,7 +100,7 @@ public abstract class NiFiSystemIT {
|
|||
}
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void teardown() throws Exception {
|
||||
try {
|
||||
Exception destroyFlowFailure = null;
|
||||
|
@ -147,21 +131,23 @@ public abstract class NiFiSystemIT {
|
|||
}
|
||||
}
|
||||
|
||||
protected File quarantineTroubleshootingInfo(final String methodName, final Throwable failureCause) throws IOException {
|
||||
NiFiInstance instance = getNiFiInstance();
|
||||
@Override
|
||||
public NiFiInstance getNiFiInstance() {
|
||||
return nifiRef.get();
|
||||
}
|
||||
|
||||
// The @AfterClass may or may not have already run at this point. If it has, the instance will be null.
|
||||
// In that case, just create a new instance and use it - it will map to the same directories.
|
||||
if (instance == null) {
|
||||
instance = getInstanceFactory().createInstance();
|
||||
}
|
||||
@Override
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedStandaloneNiFiInstanceFactory(
|
||||
new InstanceConfiguration.Builder()
|
||||
.bootstrapConfig("src/test/resources/conf/default/bootstrap.conf")
|
||||
.instanceDirectory("target/standalone-instance")
|
||||
.overrideNifiProperties(getNifiPropertiesOverrides())
|
||||
.build());
|
||||
}
|
||||
|
||||
final File troubleshooting = new File("target/troubleshooting");
|
||||
final File quarantineDir = new File(troubleshooting, methodName);
|
||||
quarantineDir.mkdirs();
|
||||
|
||||
instance.quarantineTroubleshootingInfo(quarantineDir, failureCause);
|
||||
return quarantineDir;
|
||||
protected String getTestName() {
|
||||
return testInfo.getDisplayName();
|
||||
}
|
||||
|
||||
protected boolean isDestroyEnvironmentAfterEachTest() {
|
||||
|
@ -253,11 +239,6 @@ public abstract class NiFiSystemIT {
|
|||
return CLIENT_API_PORT;
|
||||
}
|
||||
|
||||
|
||||
protected String getTestName() {
|
||||
return name.getMethodName();
|
||||
}
|
||||
|
||||
protected NiFiClient getNifiClient() {
|
||||
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
|
||||
return nifiClient;
|
||||
|
@ -283,10 +264,6 @@ public abstract class NiFiSystemIT {
|
|||
throw new IllegalStateException("Could not determine version of NiFi");
|
||||
}
|
||||
|
||||
protected NiFiInstance getNiFiInstance() {
|
||||
return nifiRef.get();
|
||||
}
|
||||
|
||||
protected int getNumberOfNodes() {
|
||||
return getNumberOfNodes(true);
|
||||
}
|
||||
|
@ -300,15 +277,6 @@ public abstract class NiFiSystemIT {
|
|||
return instance.getNumberOfNodes(includeOnlyAutoStartInstances);
|
||||
}
|
||||
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedStandaloneNiFiInstanceFactory(
|
||||
new InstanceConfiguration.Builder()
|
||||
.bootstrapConfig("src/test/resources/conf/default/bootstrap.conf")
|
||||
.instanceDirectory("target/standalone-instance")
|
||||
.overrideNifiProperties(getNifiPropertiesOverrides())
|
||||
.build());
|
||||
}
|
||||
|
||||
protected Map<String, String> getNifiPropertiesOverrides() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
@ -398,9 +366,7 @@ public abstract class NiFiSystemIT {
|
|||
try {
|
||||
return getNifiClient().getFlowClient().getConnectionStatus(connectionId, true);
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
Assert.fail("Failed to obtain connection status");
|
||||
return null;
|
||||
throw new RuntimeException("Failed to obtain connection status");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.util.Collections;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class SpawnedStandaloneNiFiInstanceFactory implements NiFiInstanceFactory {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SpawnedStandaloneNiFiInstanceFactory.class);
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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.tests.system;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.TestWatcher;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Test Watcher responsible for writing troubleshooting logs
|
||||
*/
|
||||
public class TroubleshootingTestWatcher implements TestWatcher {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TroubleshootingTestWatcher.class);
|
||||
|
||||
@Override
|
||||
public void testFailed(final ExtensionContext context, final Throwable cause) {
|
||||
final Optional<Object> optionalTestInstance = context.getTestInstance();
|
||||
if (optionalTestInstance.isPresent()) {
|
||||
final Object testInstance = optionalTestInstance.get();
|
||||
if (testInstance instanceof NiFiInstanceProvider) {
|
||||
final NiFiInstanceProvider provider = (NiFiInstanceProvider) testInstance;
|
||||
final String displayName = context.getDisplayName();
|
||||
try {
|
||||
final File dir = quarantineTroubleshootingInfo(provider, displayName, cause);
|
||||
logger.info("Test Failed [{}]: Troubleshooting information stored [{}]", displayName, dir.getAbsolutePath());
|
||||
} catch (final Exception e) {
|
||||
logger.error("Test Failed [{}]: Troubleshooting information not stored", displayName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private File quarantineTroubleshootingInfo(final NiFiInstanceProvider provider, final String methodName, final Throwable failureCause) throws IOException {
|
||||
NiFiInstance instance = provider.getNiFiInstance();
|
||||
|
||||
// The teardown method may or may not have already run at this point. If it has, the instance will be null.
|
||||
// In that case, just create a new instance and use it - it will map to the same directories.
|
||||
if (instance == null) {
|
||||
instance = provider.getInstanceFactory().createInstance();
|
||||
}
|
||||
|
||||
final File troubleshooting = new File("target/troubleshooting");
|
||||
final File quarantineDir = new File(troubleshooting, methodName);
|
||||
quarantineDir.mkdirs();
|
||||
|
||||
instance.quarantineTroubleshootingInfo(quarantineDir, failureCause);
|
||||
return quarantineDir;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.nio.file.Files;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ClassloaderIsolationKeyIT extends NiFiSystemIT {
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ import org.apache.nifi.web.api.entity.ProcessGroupEntity;
|
|||
import org.apache.nifi.web.api.entity.ProcessGroupFlowEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.apache.nifi.web.api.entity.ReportingTaskEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -70,9 +70,9 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class FlowSynchronizationIT extends NiFiSystemIT {
|
||||
private static final Logger logger = LoggerFactory.getLogger(FlowSynchronizationIT.class);
|
||||
|
@ -84,7 +84,7 @@ public class FlowSynchronizationIT extends NiFiSystemIT {
|
|||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
new InstanceConfiguration.Builder()
|
||||
.bootstrapConfig("src/test/resources/conf/clustered/node1/bootstrap.conf")
|
||||
|
|
|
@ -23,18 +23,18 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
||||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class JoinClusterAdjustStateIT extends NiFiSystemIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
new InstanceConfiguration.Builder()
|
||||
.bootstrapConfig("src/test/resources/conf/clustered/node1/bootstrap.conf")
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.nifi.web.api.entity.ControllerServicesEntity;
|
|||
import org.apache.nifi.web.api.entity.NodeEntity;
|
||||
import org.apache.nifi.web.api.entity.ParameterEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.InputSource;
|
||||
|
@ -69,12 +69,12 @@ import java.util.Properties;
|
|||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
public class JoinClusterWithDifferentFlow extends NiFiSystemIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
final Map<String, String> propertyOverrides = Collections.singletonMap("nifi.cluster.flow.serialization.format", "XML");
|
||||
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
|
|
|
@ -20,11 +20,11 @@ import org.apache.nifi.tests.system.InstanceConfiguration;
|
|||
import org.apache.nifi.tests.system.NiFiInstanceFactory;
|
||||
import org.apache.nifi.tests.system.NiFiSystemIT;
|
||||
import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JoinClusterWithMissingConnectionNoData extends NiFiSystemIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
new InstanceConfiguration.Builder()
|
||||
.bootstrapConfig("src/test/resources/conf/clustered/node1/bootstrap.conf")
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.nifi.web.api.dto.flow.FlowDTO;
|
|||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.NodeEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class JoinClusterWithMissingConnectionWithData extends NiFiSystemIT {
|
|||
private static final String CONNECTION_UUID = "6be9a991-016e-1000-ffff-fffffebf0217";
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
new InstanceConfiguration.Builder()
|
||||
.bootstrapConfig("src/test/resources/conf/clustered/node1/bootstrap.conf")
|
||||
|
|
|
@ -23,20 +23,20 @@ import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.dto.NodeDTO;
|
||||
import org.apache.nifi.web.api.entity.ClusteSummaryEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
public class NodeRestartWithNewNodeIdIT extends NiFiSystemIT {
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
|
|||
import org.apache.nifi.web.api.entity.ClusterEntity;
|
||||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class OffloadIT extends NiFiSystemIT {
|
|||
private static final Logger logger = LoggerFactory.getLogger(OffloadIT.class);
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -24,19 +24,19 @@ import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
|||
import org.apache.nifi.web.api.dto.NodeDTO;
|
||||
import org.apache.nifi.web.api.entity.ClusteSummaryEntity;
|
||||
import org.apache.nifi.web.api.entity.ClusterEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class RestartWithDifferentPort extends NiFiSystemIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -22,16 +22,16 @@ import org.apache.nifi.tests.system.NiFiInstanceFactory;
|
|||
import org.apache.nifi.tests.system.NiFiSystemIT;
|
||||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ClusteSummaryEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class SimpleNodeRestartIT extends NiFiSystemIT {
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -21,12 +21,12 @@ import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
|||
import org.apache.nifi.web.api.entity.ControllerServiceEntity;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceRunStatusEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ControllerServiceApiValidationIT extends NiFiSystemIT {
|
||||
@Test
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentEntit
|
|||
import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentsEntity;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceRunStatusEntity;
|
||||
import org.apache.nifi.web.api.entity.UpdateControllerServiceReferenceRequestEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -34,8 +34,7 @@ import org.apache.nifi.web.api.entity.ConnectionEntity;
|
|||
import org.apache.nifi.web.api.entity.ConnectionStatusEntity;
|
||||
import org.apache.nifi.web.api.entity.FlowFileEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -47,14 +46,14 @@ import java.util.LongSummaryStatistics;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class LoadBalanceIT extends NiFiSystemIT {
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
@ -219,7 +218,7 @@ public class LoadBalanceIT extends NiFiSystemIT {
|
|||
assertEquals(10, nodesByAttribute.size());
|
||||
for (final Map.Entry<String, Set<String>> entry : nodesByAttribute.entrySet()) {
|
||||
final Set<String> nodes = entry.getValue();
|
||||
assertEquals("FlowFile with attribute number=" + entry.getKey() + " went to nodes " + nodes, 1, nodes.size());
|
||||
assertEquals(1, nodes.size(), "FlowFile with attribute number=" + entry.getKey() + " went to nodes " + nodes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,8 +302,7 @@ public class LoadBalanceIT extends NiFiSystemIT {
|
|||
try {
|
||||
return getNifiClient().getFlowClient().getConnectionStatus(connectionId, true);
|
||||
} catch (final Exception e) {
|
||||
Assert.fail("Failed to obtain connection status");
|
||||
return null;
|
||||
throw new RuntimeException("Failed to obtain connection status");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.nifi.tests.system.NiFiInstanceFactory;
|
|||
*/
|
||||
public class ClusteredParameterContextIT extends ParameterContextIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -31,7 +31,8 @@ import org.apache.nifi.web.api.entity.ParameterContextUpdateRequestEntity;
|
|||
import org.apache.nifi.web.api.entity.ParameterEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessGroupEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -46,11 +47,11 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class ParameterContextIT extends NiFiSystemIT {
|
||||
@Test
|
||||
|
@ -181,7 +182,8 @@ public class ParameterContextIT extends NiFiSystemIT {
|
|||
waitForValidProcessor(processorId);
|
||||
}
|
||||
|
||||
@Test(timeout=30000)
|
||||
@Timeout(30)
|
||||
@Test
|
||||
public void testValidationWithRequiredPropertiesAndNoDefault() throws NiFiClientException, IOException, InterruptedException {
|
||||
final ProcessorEntity generate = getClientUtil().createProcessor("DependOnProperties");
|
||||
final Map<String, String> properties = new HashMap<>();
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.nifi.web.api.entity.ConnectionEntity;
|
|||
import org.apache.nifi.web.api.entity.PortEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessGroupEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -26,15 +26,15 @@ import org.apache.nifi.web.api.entity.FlowFileEntity;
|
|||
import org.apache.nifi.web.api.entity.PortEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessGroupEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class SingleFlowFileConcurrencyIT extends NiFiSystemIT {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
|||
import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
|
||||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
@ -32,7 +32,7 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class RetryIT extends NiFiSystemIT {
|
||||
private static final int RETRY_COUNT = 2;
|
||||
|
|
|
@ -20,15 +20,17 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class RunOnceIT extends NiFiSystemIT {
|
||||
|
||||
@Test(timeout = 10000L)
|
||||
@Timeout(10)
|
||||
@Test
|
||||
public void testRunOnce() throws NiFiClientException, IOException, InterruptedException {
|
||||
ProcessorEntity generate = getClientUtil().createProcessor("GenerateFlowFile");
|
||||
getClientUtil().updateProcessorSchedulingPeriod(generate, "1 sec");
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO;
|
|||
import org.apache.nifi.web.api.dto.provenance.ProvenanceSearchValueDTO;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.apache.nifi.web.api.entity.ProvenanceEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ProvenanceRepositoryIT extends NiFiSystemIT {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceEntity;
|
||||
import org.apache.nifi.web.api.entity.ReportingTaskEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -30,7 +30,7 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* This test is intended to verify that Processors are able to access the content that their FlowFiles represent in several different situations.
|
||||
|
|
|
@ -23,8 +23,7 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ConnectionEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -34,10 +33,11 @@ import java.nio.file.Files;
|
|||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class FlowFileRestorationIT extends NiFiSystemIT {
|
||||
|
||||
|
@ -72,12 +72,7 @@ public class FlowFileRestorationIT extends NiFiSystemIT {
|
|||
|
||||
nifiInstance.start();
|
||||
|
||||
try {
|
||||
getNifiClient().getConnectionClient().getConnection(connection.getId());
|
||||
Assert.fail("Didn't expect to retrieve a connection");
|
||||
} catch (final NiFiClientException nfce) {
|
||||
// Expected because the connection no longer exists.
|
||||
}
|
||||
assertThrows(NiFiClientException.class, () -> getNifiClient().getConnectionClient().getConnection(connection.getId()));
|
||||
|
||||
// Stop the instance, restore the flow.xml.gz, and restart
|
||||
nifiInstance.stop();
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
|||
|
||||
public class ClusteredRemoteProcessGroupIT extends RemoteProcessGroupIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.apache.nifi.web.api.entity.ConnectionEntity;
|
|||
import org.apache.nifi.web.api.entity.PortEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.apache.nifi.web.api.entity.RemoteProcessGroupEntity;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -82,9 +81,7 @@ public class RemoteProcessGroupIT extends NiFiSystemIT {
|
|||
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Assert.fail("Could not retrieve RPG with ID " + rpgId);
|
||||
return false;
|
||||
throw new RuntimeException("Could not retrieve RPG with ID " + rpgId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ package org.apache.nifi.tests.system.validation;
|
|||
import org.apache.nifi.tests.system.NiFiSystemIT;
|
||||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -29,7 +30,8 @@ import java.util.Map;
|
|||
|
||||
public class DependentPropertyValidationIT extends NiFiSystemIT {
|
||||
|
||||
@Test(timeout = 20_000)
|
||||
@Timeout(20)
|
||||
@Test
|
||||
public void testPropertyDependenciesAreValidatedProperly() throws NiFiClientException, IOException, InterruptedException {
|
||||
final ProcessorEntity processor = getClientUtil().createProcessor("DependOnProperties");
|
||||
getClientUtil().updateProcessorProperties(processor, Collections.singletonMap("Always Required", "foo"));
|
||||
|
|
|
@ -22,12 +22,12 @@ import org.apache.nifi.web.api.entity.ConnectionEntity;
|
|||
import org.apache.nifi.web.api.entity.FlowFileEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessGroupEntity;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ProcessGroupVariablesIT extends NiFiSystemIT {
|
||||
|
||||
|
|
|
@ -23,18 +23,18 @@ import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.dto.ConfigVerificationResultDTO;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ClusteredVerifiableControllerServiceSystemIT extends VerifiableControllerServiceSystemIT {
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -23,19 +23,19 @@ import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.dto.ConfigVerificationResultDTO;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ClusteredVerifiableProcessorSystemIT extends VerifiableProcessorSystemIT {
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -23,19 +23,19 @@ import org.apache.nifi.tests.system.SpawnedClusterNiFiInstanceFactory;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.dto.ConfigVerificationResultDTO;
|
||||
import org.apache.nifi.web.api.entity.ReportingTaskEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ClusteredVerifiableReportingTaskSystemIT extends VerifiableReportingTaskSystemIT {
|
||||
|
||||
@Override
|
||||
protected NiFiInstanceFactory getInstanceFactory() {
|
||||
public NiFiInstanceFactory getInstanceFactory() {
|
||||
return new SpawnedClusterNiFiInstanceFactory(
|
||||
"src/test/resources/conf/clustered/node1/bootstrap.conf",
|
||||
"src/test/resources/conf/clustered/node2/bootstrap.conf");
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.dto.ConfigVerificationResultDTO;
|
||||
import org.apache.nifi.web.api.entity.ControllerServiceEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -30,8 +30,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class VerifiableControllerServiceSystemIT extends NiFiSystemIT {
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class VerifiableControllerServiceSystemIT extends NiFiSystemIT {
|
|||
|
||||
// Verify using attributes that should give us a successful verification
|
||||
List<ConfigVerificationResultDTO> resultList = getClientUtil().verifyControllerServiceConfig(service.getId(), properties, goodAttributes);
|
||||
assertEquals("Got unexpected results: " + resultList, 7, resultList.size());
|
||||
assertEquals(7, resultList.size());
|
||||
|
||||
// Should have SUCCESS for validation, then 5 successes for the steps. Then 1 skipped for the Fail on Primary Node
|
||||
for (int i=0; i < resultList.size() - 1; i++) {
|
||||
|
@ -139,7 +139,7 @@ public class VerifiableControllerServiceSystemIT extends NiFiSystemIT {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testVerificationWithValidConfigWhenComponentRunning() throws InterruptedException, IOException, NiFiClientException {
|
||||
public void testVerificationWithValidConfigWhenComponentRunning() throws IOException, NiFiClientException {
|
||||
final ControllerServiceEntity service = getClientUtil().createControllerService("EnsureControllerServiceConfigurationCorrect");
|
||||
|
||||
final Map<String, String> properties = Collections.singletonMap("Successful Verification", "true");
|
||||
|
@ -147,9 +147,7 @@ public class VerifiableControllerServiceSystemIT extends NiFiSystemIT {
|
|||
|
||||
getClientUtil().enableControllerService(service);
|
||||
|
||||
assertThrows(NiFiClientException.class, () -> {
|
||||
getClientUtil().verifyControllerServiceConfig(service.getId(), properties);
|
||||
});
|
||||
assertThrows(NiFiClientException.class, () -> getClientUtil().verifyControllerServiceConfig(service.getId(), properties));
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +177,7 @@ public class VerifiableControllerServiceSystemIT extends NiFiSystemIT {
|
|||
assertEquals(1, resultList.size());
|
||||
|
||||
// Even though GenerateFlowFile is not connected, it should be valid because connections are not considered when verifying the processor
|
||||
assertEquals("Unexpected results: " + resultList, Outcome.SUCCESSFUL.name(), resultList.get(0).getOutcome());
|
||||
assertEquals(Outcome.SUCCESSFUL.name(), resultList.get(0).getOutcome());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -189,7 +187,7 @@ public class VerifiableControllerServiceSystemIT extends NiFiSystemIT {
|
|||
final List<ConfigVerificationResultDTO> resultList = getClientUtil().verifyControllerServiceConfig(service.getId(), Collections.singletonMap("Validate Sleep Time", "foo"));
|
||||
assertEquals(1, resultList.size());
|
||||
|
||||
assertEquals("Unexpected results: " + resultList, Outcome.FAILED.name(), resultList.get(0).getOutcome());
|
||||
assertEquals(Outcome.FAILED.name(), resultList.get(0).getOutcome());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.nifi.tests.system.NiFiSystemIT;
|
|||
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
||||
import org.apache.nifi.web.api.dto.ConfigVerificationResultDTO;
|
||||
import org.apache.nifi.web.api.entity.ProcessorEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -30,8 +30,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class VerifiableProcessorSystemIT extends NiFiSystemIT {
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class VerifiableProcessorSystemIT extends NiFiSystemIT {
|
|||
|
||||
// Verify using attributes that should give us a successful verification
|
||||
List<ConfigVerificationResultDTO> resultList = getClientUtil().verifyProcessorConfig(processor.getId(), properties, goodAttributes);
|
||||
assertEquals("Got unexpected results: " + resultList, 7, resultList.size());
|
||||
assertEquals(7, resultList.size());
|
||||
|
||||
// Should have SUCCESS for validation, then 5 successes for the steps. Then 1 skipped for the Fail on Primary Node
|
||||
for (int i=0; i < resultList.size() - 1; i++) {
|
||||
|
@ -155,9 +155,7 @@ public class VerifiableProcessorSystemIT extends NiFiSystemIT {
|
|||
getClientUtil().startProcessGroupComponents("root");
|
||||
getClientUtil().waitForProcessorState(processor.getId(), "RUNNING");
|
||||
|
||||
assertThrows(NiFiClientException.class, () -> {
|
||||
getClientUtil().verifyProcessorConfig(processor.getId(), properties);
|
||||
});
|
||||
assertThrows(NiFiClientException.class, () -> getClientUtil().verifyProcessorConfig(processor.getId(), properties));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -210,7 +208,7 @@ public class VerifiableProcessorSystemIT extends NiFiSystemIT {
|
|||
assertEquals(1, resultList.size());
|
||||
|
||||
// Even though GenerateFlowFile is not connected, it should be valid because connections are not considered when verifying the processor
|
||||
assertEquals("Unexpected results: " + resultList, Outcome.SUCCESSFUL.name(), resultList.get(0).getOutcome());
|
||||
assertEquals(Outcome.SUCCESSFUL.name(), resultList.get(0).getOutcome());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -220,7 +218,7 @@ public class VerifiableProcessorSystemIT extends NiFiSystemIT {
|
|||
final List<ConfigVerificationResultDTO> resultList = getClientUtil().verifyProcessorConfig(processor.getId(), Collections.singletonMap("File Size", "foo"));
|
||||
assertEquals(1, resultList.size());
|
||||
|
||||
assertEquals("Unexpected results: " + resultList, Outcome.FAILED.name(), resultList.get(0).getOutcome());
|
||||
assertEquals(Outcome.FAILED.name(), resultList.get(0).getOutcome());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
|
|||
import org.apache.nifi.web.api.dto.ConfigVerificationResultDTO;
|
||||
import org.apache.nifi.web.api.entity.ReportingTaskEntity;
|
||||
import org.apache.nifi.web.api.entity.ReportingTaskRunStatusEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -31,8 +31,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class VerifiableReportingTaskSystemIT extends NiFiSystemIT {
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class VerifiableReportingTaskSystemIT extends NiFiSystemIT {
|
|||
assertEquals(1, resultList.size());
|
||||
|
||||
// Even though GenerateFlowFile is not connected, it should be valid because connections are not considered when verifying the processor
|
||||
assertEquals("Unexpected results: " + resultList, Outcome.SUCCESSFUL.name(), resultList.get(0).getOutcome());
|
||||
assertEquals(Outcome.SUCCESSFUL.name(), resultList.get(0).getOutcome());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue