You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2022/03/16 21:57:16 UTC
[accumulo] branch main updated: Migrate test and hadoop-mapreduce modules to JUnit5 (#2545)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 88a3560 Migrate test and hadoop-mapreduce modules to JUnit5 (#2545)
88a3560 is described below
commit 88a35606e8c1782f19bd6672e1d4397d0e19e235
Author: Dom G <do...@gmail.com>
AuthorDate: Wed Mar 16 17:57:08 2022 -0400
Migrate test and hadoop-mapreduce modules to JUnit5 (#2545)
* Replace Junit4 dependancy with Junit5
* Create extension for handling the scalable timeouts for the test module
Co-authored-by: AlbertWhitlock <al...@gmail.com>
---
TESTING.md | 8 +-
.../core/clientImpl/ClientContextTest.java | 2 +-
hadoop-mapreduce/pom.xml | 4 +-
.../apache/accumulo/hadoop/its/WithTestNames.java | 29 +++-
.../its/mapred/AccumuloFileOutputFormatIT.java | 26 ++--
.../hadoop/its/mapred/AccumuloInputFormatIT.java | 12 +-
.../hadoop/its/mapred/AccumuloOutputFormatIT.java | 20 +--
.../its/mapred/AccumuloRowInputFormatIT.java | 22 +--
.../hadoop/its/mapred/MultiTableInputFormatIT.java | 6 +-
.../accumulo/hadoop/its/mapred/TokenFileIT.java | 21 ++-
.../its/mapreduce/AccumuloFileOutputFormatIT.java | 30 ++---
.../its/mapreduce/AccumuloInputFormatIT.java | 34 ++---
.../its/mapreduce/AccumuloOutputFormatIT.java | 10 +-
.../its/mapreduce/AccumuloRowInputFormatIT.java | 22 +--
.../its/mapreduce/MultiTableInputFormatIT.java | 6 +-
.../accumulo/hadoop/its/mapreduce/RowHashIT.java | 14 +-
.../accumulo/hadoop/its/mapreduce/TokenFileIT.java | 21 ++-
.../mapred/AccumuloFileOutputFormatTest.java | 6 +-
.../hadoop/mapred/AccumuloInputFormatTest.java | 23 ++--
.../hadoop/mapred/AccumuloOutputFormatTest.java | 17 +--
.../hadoop/mapred/MultiTableInputFormatTest.java | 17 +--
.../mapreduce/AccumuloFileOutputFormatTest.java | 6 +-
.../hadoop/mapreduce/AccumuloInputFormatTest.java | 14 +-
.../hadoop/mapreduce/AccumuloOutputFormatTest.java | 19 +--
.../mapreduce/MultiTableInputFormatTest.java | 17 +--
.../mapreduce/partition/RangePartitionerTest.java | 6 +-
.../hadoopImpl/mapred/RangeInputSplitTest.java | 8 +-
.../hadoopImpl/mapreduce/BatchInputSplitTest.java | 10 +-
.../mapreduce/InputFormatBuilderTest.java | 10 +-
.../hadoopImpl/mapreduce/InputTableConfigTest.java | 8 +-
.../hadoopImpl/mapreduce/RangeInputSplitTest.java | 10 +-
.../mapreduce/lib/ConfiguratorBaseTest.java | 8 +-
pom.xml | 11 +-
server/monitor/pom.xml | 5 +
.../accumulo/monitor/it/TagNameConstants.java | 9 +-
.../org/apache/accumulo/monitor/it/WebViewsIT.java | 6 +-
.../categories/StandaloneCapableClusterTests.java | 25 ----
.../accumulo/test/categories/SunnyDayTests.java | 25 ----
.../categories/ZooKeeperTestingServerTests.java | 25 ----
test/pom.xml | 8 +-
.../accumulo/harness/AccumuloClusterHarness.java | 27 ++--
.../apache/accumulo/harness/AccumuloITBase.java | 55 ++++----
.../accumulo/harness/MiniClusterHarness.java | 5 +-
.../accumulo/harness/SharedMiniClusterBase.java | 21 +--
.../org/apache/accumulo/harness/TestingKdc.java | 9 +-
.../java/org/apache/accumulo/harness/Timeout.java | 100 ++++++++++++++
.../org/apache/accumulo/harness/WithTestNames.java | 29 +++-
.../StandaloneAccumuloClusterConfiguration.java | 6 +-
.../org/apache/accumulo/test/AuditMessageIT.java | 18 +--
.../accumulo/test/BadDeleteMarkersCreatedIT.java | 26 ++--
.../java/org/apache/accumulo/test/BalanceIT.java | 4 +-
.../accumulo/test/BalanceWithOfflineTableIT.java | 6 +-
.../org/apache/accumulo/test/BatchWriterIT.java | 4 +-
.../accumulo/test/BatchWriterInTabletServerIT.java | 6 +-
.../accumulo/test/BulkImportMonitoringIT.java | 6 +-
.../accumulo/test/BulkImportSequentialRowsIT.java | 14 +-
.../apache/accumulo/test/BulkImportVolumeIT.java | 8 +-
.../java/org/apache/accumulo/test/CleanWalIT.java | 10 +-
.../apache/accumulo/test/ClientSideIteratorIT.java | 18 +--
.../java/org/apache/accumulo/test/CloneIT.java | 8 +-
.../org/apache/accumulo/test/CloseScannerIT.java | 4 +-
.../apache/accumulo/test/ConditionalWriterIT.java | 74 +++++-----
.../accumulo/test/CountNameNodeOpsBulkIT.java | 6 +-
.../accumulo/test/DeprecatedPropertyUtilIT.java | 36 ++---
.../accumulo/test/DetectDeadTabletServersIT.java | 4 +-
.../org/apache/accumulo/test/DumpConfigIT.java | 23 ++--
.../org/apache/accumulo/test/ExistingMacIT.java | 18 +--
.../java/org/apache/accumulo/test/FindMaxIT.java | 6 +-
.../apache/accumulo/test/GarbageCollectWALIT.java | 14 +-
.../org/apache/accumulo/test/ImportExportIT.java | 40 +++---
.../org/apache/accumulo/test/InMemoryMapIT.java | 150 +++++++++++----------
.../accumulo/test/InterruptibleScannersIT.java | 10 +-
.../accumulo/test/IsolationAndDeepCopyIT.java | 8 +-
.../org/apache/accumulo/test/IteratorEnvIT.java | 20 +--
.../apache/accumulo/test/KeyValueEqualityIT.java | 12 +-
.../org/apache/accumulo/test/LargeSplitRowIT.java | 31 +++--
.../java/org/apache/accumulo/test/LocatorIT.java | 18 +--
.../test/ManagerRepairsDualAssignmentIT.java | 10 +-
.../accumulo/test/MetaConstraintRetryIT.java | 8 +-
.../apache/accumulo/test/MetaGetsReadersIT.java | 16 +--
.../org/apache/accumulo/test/MetaRecoveryIT.java | 14 +-
.../java/org/apache/accumulo/test/MetaSplitIT.java | 20 +--
.../test/MissingWalHeaderCompletesRecoveryIT.java | 32 +++--
.../accumulo/test/MultiTableBatchWriterIT.java | 48 +++----
.../apache/accumulo/test/MultiTableRecoveryIT.java | 16 +--
.../org/apache/accumulo/test/NamespacesIT.java | 68 +++++-----
.../accumulo/test/NewTableConfigurationIT.java | 14 +-
.../org/apache/accumulo/test/OrIteratorIT.java | 42 +++---
.../test/RecoveryCompactionsAreFlushesIT.java | 12 +-
.../java/org/apache/accumulo/test/SampleIT.java | 17 ++-
.../apache/accumulo/test/ScanFlushWithTimeIT.java | 8 +-
.../org/apache/accumulo/test/SplitRecoveryIT.java | 14 +-
.../accumulo/test/TableConfigurationUpdateIT.java | 10 +-
.../apache/accumulo/test/TableOperationsIT.java | 30 ++---
.../accumulo/test/TabletServerGivesUpIT.java | 12 +-
.../accumulo/test/TabletServerHdfsRestartIT.java | 15 +--
.../ThriftServerBindsBeforeZooKeeperLockIT.java | 9 +-
.../org/apache/accumulo/test/TotalQueuedIT.java | 15 +--
.../apache/accumulo/test/TransportCachingIT.java | 20 +--
.../java/org/apache/accumulo/test/UnusedWALIT.java | 14 +-
.../java/org/apache/accumulo/test/UsersIT.java | 22 +--
.../accumulo/test/VerifySerialRecoveryIT.java | 18 +--
.../org/apache/accumulo/test/VolumeChooserIT.java | 31 ++---
.../java/org/apache/accumulo/test/VolumeIT.java | 19 +--
.../org/apache/accumulo/test/WaitForBalanceIT.java | 10 +-
.../org/apache/accumulo/test/YieldScannersIT.java | 34 ++---
.../accumulo/test/ZooKeeperPropertiesIT.java | 4 +-
.../test/compaction/CompactionExecutorIT.java | 73 +++++-----
.../test/compaction/CompactionRateLimitingIT.java | 10 +-
.../compaction/ConfigurableMajorCompactionIT.java | 8 +-
.../compaction/ExternalCompactionMetricsIT.java | 12 +-
.../compaction/ExternalCompactionProgressIT.java | 14 +-
.../compaction/ExternalCompactionTestUtils.java | 9 +-
.../test/compaction/ExternalCompaction_1_IT.java | 34 ++---
.../test/compaction/ExternalCompaction_2_IT.java | 16 +--
.../test/compaction/ExternalCompaction_3_IT.java | 14 +-
.../test/compaction/SplitCancelsMajCIT.java | 16 +--
.../test/compaction/UserCompactionStrategyIT.java | 18 +--
.../accumulo/test/fate/zookeeper/FateIT.java | 38 +++---
.../test/fate/zookeeper/ServiceLockIT.java | 72 +++++-----
.../accumulo/test/fate/zookeeper/ZooMutatorIT.java | 30 ++---
.../accumulo/test/functional/AccumuloClientIT.java | 14 +-
.../accumulo/test/functional/AddSplitIT.java | 2 +-
.../accumulo/test/functional/BackupManagerIT.java | 4 +-
.../test/functional/BadIteratorMincIT.java | 6 +-
.../test/functional/BadLocalityGroupMincIT.java | 4 +-
.../functional/BalanceAfterCommsFailureIT.java | 23 ++--
.../BalanceInPresenceOfOfflineTableIT.java | 28 ++--
.../accumulo/test/functional/BatchScanSplitIT.java | 10 +-
.../test/functional/BatchWriterFlushIT.java | 10 +-
.../accumulo/test/functional/BigRootTabletIT.java | 14 +-
.../apache/accumulo/test/functional/BinaryIT.java | 2 +-
.../accumulo/test/functional/BinaryStressIT.java | 16 +--
.../accumulo/test/functional/BloomFilterIT.java | 12 +-
.../accumulo/test/functional/BulkFailureIT.java | 8 +-
.../apache/accumulo/test/functional/BulkIT.java | 15 ++-
.../apache/accumulo/test/functional/BulkNewIT.java | 40 +++---
.../apache/accumulo/test/functional/BulkOldIT.java | 10 +-
.../test/functional/BulkSplitOptimizationIT.java | 18 +--
.../test/functional/ChaoticBalancerIT.java | 12 +-
.../accumulo/test/functional/ClassLoaderIT.java | 26 ++--
.../accumulo/test/functional/CleanTmpIT.java | 26 ++--
.../apache/accumulo/test/functional/CleanUpIT.java | 18 +--
.../accumulo/test/functional/CloneTestIT.java | 28 ++--
.../accumulo/test/functional/CombinerIT.java | 8 +-
.../accumulo/test/functional/CompactionIT.java | 44 +++---
.../accumulo/test/functional/ConcurrencyIT.java | 12 +-
.../test/functional/ConcurrentDeleteTableIT.java | 18 +--
.../test/functional/ConfigurableCompactionIT.java | 10 +-
.../test/functional/ConfigurableMacBase.java | 18 +--
.../accumulo/test/functional/ConstraintIT.java | 2 +-
.../accumulo/test/functional/CreateAndUseIT.java | 18 +--
.../test/functional/CreateInitialSplitsIT.java | 26 ++--
.../test/functional/CreateManyScannersIT.java | 2 +-
.../accumulo/test/functional/CredentialsIT.java | 22 +--
.../test/functional/DeleteEverythingIT.java | 24 ++--
.../accumulo/test/functional/DeleteFailIT.java | 8 +-
.../apache/accumulo/test/functional/DeleteIT.java | 6 +-
.../accumulo/test/functional/DeleteRowsIT.java | 36 +++--
.../test/functional/DeleteRowsSplitIT.java | 14 +-
.../test/functional/DeletedTablesDontFlushIT.java | 12 +-
.../accumulo/test/functional/DurabilityIT.java | 28 ++--
.../test/functional/FateConcurrencyIT.java | 59 ++++----
.../accumulo/test/functional/FateStarvationIT.java | 7 +-
.../accumulo/test/functional/FlushNoFileIT.java | 10 +-
.../test/functional/FunctionalTestUtils.java | 12 +-
.../test/functional/GarbageCollectorIT.java | 26 ++--
.../test/functional/HalfDeadTServerIT.java | 26 ++--
.../functional/IteratorMincClassCastBugIT.java | 12 +-
.../accumulo/test/functional/KerberosIT.java | 93 +++++++------
.../test/functional/KerberosRenewalIT.java | 54 ++++----
.../accumulo/test/functional/LargeRowIT.java | 25 ++--
.../test/functional/LateLastContactIT.java | 12 +-
.../accumulo/test/functional/LogicalTimeIT.java | 4 +-
.../accumulo/test/functional/ManagerApiIT.java | 33 +++--
.../test/functional/ManagerAssignmentIT.java | 10 +-
.../test/functional/ManagerFailoverIT.java | 12 +-
.../test/functional/ManyWriteAheadLogsIT.java | 23 ++--
.../apache/accumulo/test/functional/MaxOpenIT.java | 20 +--
.../apache/accumulo/test/functional/MergeIT.java | 16 +--
.../accumulo/test/functional/MetadataIT.java | 16 +--
.../test/functional/MetadataMaxFilesIT.java | 12 +-
.../accumulo/test/functional/MetadataSplitIT.java | 14 +-
.../accumulo/test/functional/MonitorSslIT.java | 21 +--
.../accumulo/test/functional/NativeMapIT.java | 26 ++--
.../accumulo/test/functional/PermissionsIT.java | 32 ++---
.../accumulo/test/functional/ReadWriteIT.java | 32 ++---
.../test/functional/RecoveryWithEmptyRFileIT.java | 8 +-
.../test/functional/RegexGroupBalanceIT.java | 10 +-
.../apache/accumulo/test/functional/RenameIT.java | 4 +-
.../apache/accumulo/test/functional/RestartIT.java | 19 +--
.../accumulo/test/functional/RestartStressIT.java | 17 +--
.../accumulo/test/functional/RowDeleteIT.java | 20 +--
.../apache/accumulo/test/functional/ScanIdIT.java | 18 +--
.../accumulo/test/functional/ScanIteratorIT.java | 28 ++--
.../accumulo/test/functional/ScanRangeIT.java | 12 +-
.../test/functional/ScanSessionTimeOutIT.java | 20 +--
.../accumulo/test/functional/ScannerContextIT.java | 34 ++---
.../apache/accumulo/test/functional/ScannerIT.java | 9 +-
.../test/functional/ServerSideErrorIT.java | 4 +-
.../test/functional/SessionBlockVerifyIT.java | 26 ++--
.../test/functional/SessionDurabilityIT.java | 16 +--
.../accumulo/test/functional/ShutdownIT.java | 8 +-
.../test/functional/SimpleBalancerFairnessIT.java | 20 ++-
.../test/functional/SparseColumnFamilyIT.java | 2 +-
.../apache/accumulo/test/functional/SplitIT.java | 32 ++---
.../accumulo/test/functional/SplitRecoveryIT.java | 6 +-
.../org/apache/accumulo/test/functional/SslIT.java | 11 +-
.../test/functional/SslWithClientAuthIT.java | 13 +-
.../apache/accumulo/test/functional/StartIT.java | 6 +-
.../apache/accumulo/test/functional/SummaryIT.java | 63 ++++-----
.../apache/accumulo/test/functional/TableIT.java | 18 +--
.../apache/accumulo/test/functional/TabletIT.java | 14 +-
.../accumulo/test/functional/TabletMetadataIT.java | 6 +-
.../functional/TabletStateChangeIteratorIT.java | 30 ++---
.../apache/accumulo/test/functional/TimeoutIT.java | 10 +-
.../accumulo/test/functional/TooManyDeletesIT.java | 4 +-
.../accumulo/test/functional/VisibilityIT.java | 16 +--
.../accumulo/test/functional/WALSunnyDayIT.java | 34 ++---
.../test/functional/WatchTheWatchCountIT.java | 11 +-
.../test/functional/WriteAheadLogEncryptedIT.java | 7 +-
.../accumulo/test/functional/WriteAheadLogIT.java | 7 +-
.../accumulo/test/functional/WriteLotsIT.java | 2 +-
.../accumulo/test/functional/ZooCacheIT.java | 18 +--
.../test/functional/ZookeeperRestartIT.java | 18 +--
.../CloseWriteAheadLogReferencesIT.java | 20 +--
.../apache/accumulo/test/manager/MergeStateIT.java | 4 +-
.../accumulo/test/manager/SuspendedTabletsIT.java | 36 ++---
.../test/mapred/AccumuloFileOutputFormatIT.java | 24 ++--
.../test/mapred/AccumuloInputFormatIT.java | 10 +-
.../mapred/AccumuloMultiTableInputFormatIT.java | 6 +-
.../test/mapred/AccumuloOutputFormatIT.java | 19 ++-
.../test/mapred/AccumuloRowInputFormatIT.java | 22 +--
.../apache/accumulo/test/mapred/TokenFileIT.java | 21 ++-
.../test/mapreduce/AccumuloFileOutputFormatIT.java | 34 ++---
.../test/mapreduce/AccumuloInputFormatIT.java | 14 +-
.../mapreduce/AccumuloMultiTableInputFormatIT.java | 6 +-
.../test/mapreduce/AccumuloOutputFormatIT.java | 10 +-
.../test/mapreduce/AccumuloRowInputFormatIT.java | 22 +--
.../accumulo/test/mapreduce/MapReduceIT.java | 14 +-
.../accumulo/test/mapreduce/TokenFileIT.java | 21 ++-
.../apache/accumulo/test/metrics/MetricsIT.java | 30 ++---
.../test/replication/CyclicReplicationIT.java | 53 ++++----
.../test/replication/FinishedWorkUpdaterIT.java | 12 +-
...GarbageCollectorCommunicatesWithTServersIT.java | 84 ++++++------
.../test/replication/KerberosReplicationIT.java | 57 ++++----
.../replication/MultiInstanceReplicationIT.java | 89 ++++++------
.../replication/MultiTserverReplicationIT.java | 16 +--
.../RemoveCompleteReplicationRecordsIT.java | 14 +-
.../accumulo/test/replication/ReplicationIT.java | 122 ++++++++---------
.../replication/ReplicationOperationsImplIT.java | 30 ++---
.../test/replication/SequentialWorkAssignerIT.java | 14 +-
.../test/replication/StatusCombinerMacIT.java | 22 +--
.../accumulo/test/replication/StatusMakerIT.java | 48 +++----
.../test/replication/UnorderedWorkAssignerIT.java | 10 +-
.../UnorderedWorkAssignerReplicationIT.java | 102 +++++++-------
.../UnusedWalDoesntCloseReplicationStatusIT.java | 16 +--
.../accumulo/test/replication/WorkMakerIT.java | 24 ++--
.../apache/accumulo/test/rpc/ThriftBehaviorIT.java | 43 +++---
.../test/server/security/SystemCredentialsIT.java | 4 +-
.../apache/accumulo/test/shell/ShellConfigIT.java | 24 ++--
.../accumulo/test/shell/ShellCreateTableIT.java | 39 +++---
.../org/apache/accumulo/test/shell/ShellIT.java | 47 +++----
.../apache/accumulo/test/shell/ShellServerIT.java | 100 +++++++-------
.../apache/accumulo/test/start/KeywordStartIT.java | 26 ++--
.../upgrade/DeprecatedPropertyUpgrade9to10IT.java | 16 +--
.../test/upgrade/GCUpgrade9to10TestIT.java | 18 +--
.../accumulo/test/ChaoticLoadBalancerTest.java | 4 +-
.../constraints/AlphaNumKeyConstraintTest.java | 6 +-
.../constraints/NumericValueConstraintTest.java | 6 +-
.../accumulo/test/iterator/AgeOffFilterTest.java | 2 +-
.../apache/accumulo/test/iterator/RegExTest.java | 14 +-
.../performance/scan/CollectTabletStatsTest.java | 16 +--
.../security/KerberosTokenEmbeddedKDCTest.java | 32 ++---
.../apache/accumulo/test/util/CertUtilsTest.java | 64 +++++----
275 files changed, 2881 insertions(+), 2868 deletions(-)
diff --git a/TESTING.md b/TESTING.md
index 0162552..805bddf 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -56,7 +56,7 @@ the WriteAheadLogIT:
mvn clean verify -Dit.test=WriteAheadLogIT -Dtest=foo -Dspotbugs.skip
```
-## SunnyDay (`SunnyDayTests`)
+## SunnyDay (`SunnyDay`)
This test category represents a minimal set of tests chosen to verify the basic
functionality of Accumulo. These would typically be run prior to submitting a
@@ -70,7 +70,7 @@ To run all the Sunny day tests, run:
mvn clean verify -Psunny
```
-## MiniAccumuloCluster (`MiniClusterOnlyTests`)
+## MiniAccumuloCluster (`MiniClusterOnly`)
These tests use MiniAccumuloCluster (MAC) which is a multi-process "implementation" of Accumulo, managed
through Java APIs. This MiniAccumuloCluster has the ability to use the local filesystem or Apache Hadoop's
@@ -88,7 +88,7 @@ To run all the Mini tests, run:
mvn clean verify -Dspotbugs.skip
```
-## Standalone Cluster (`StandaloneCapableClusterTests`)
+## Standalone Cluster (`StandaloneCapableCluster`)
A standalone Accumulo cluster can also be configured for use by most tests. Not all the integration tests are good
candidates to run against a standalone cluster, and some of them require classes in the test jar. Copy the
@@ -98,7 +98,7 @@ the tests.
These tests can be run by providing a system property. Specific ITs can be run using "-Dit.test" or run all tests using:
```bash
-mvn clean verify -Dtest=foo -Daccumulo.it.properties=/home/user/my_cluster.properties -Dfailsafe.groups=org.apache.accumulo.test.categories.StandaloneCapableClusterTests -Dspotbugs.skip
+mvn clean verify -Dtest=foo -Daccumulo.it.properties=/home/user/my_cluster.properties -Dfailsafe.groups=StandaloneCapableCluster -Dspotbugs.skip
```
### Configuration for Standalone clusters
diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java
index afc10f4..f6c3ae7 100644
--- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java
@@ -53,7 +53,7 @@ public class ClientContextTest {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
justification = "provided keystoreUrl path isn't user provided")
@BeforeAll
- public static void setUpBeforeClass() {
+ public static void setUpBeforeAll() {
URL keystoreUrl = ClientContextTest.class.getResource(keystoreName);
assertNotNull(keystoreUrl, "Could not find " + keystoreName);
keystore = new File(keystoreUrl.getFile());
diff --git a/hadoop-mapreduce/pom.xml b/hadoop-mapreduce/pom.xml
index 447aa7c..ca8b331 100644
--- a/hadoop-mapreduce/pom.xml
+++ b/hadoop-mapreduce/pom.xml
@@ -76,8 +76,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/start/src/main/java/org/apache/accumulo/test/categories/MonitorTests.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/WithTestNames.java
similarity index 54%
rename from start/src/main/java/org/apache/accumulo/test/categories/MonitorTests.java
rename to hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/WithTestNames.java
index 3257a44..a166b58 100644
--- a/start/src/main/java/org/apache/accumulo/test/categories/MonitorTests.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/WithTestNames.java
@@ -16,10 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.accumulo.test.categories;
+package org.apache.accumulo.hadoop.its;
-/**
- * Interface to be used with JUnit Category annotation to represent the integration test is for
- * testing Accumulo's Monitor
- */
-public interface MonitorTests {}
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInfo;
+
+// This is only for the unit tests and integration tests in this module
+// It must be copied for use in other modules, because tests in one module
+// don't have dependencies on other modules, and we can't put this in a
+// regular, non-test jar, because we don't want to add a dependency on
+// JUnit in a non-test jar
+public class WithTestNames {
+
+ private String testName;
+
+ @BeforeEach
+ public void setTestName(TestInfo info) {
+ testName = info.getTestMethod().get().getName();
+ }
+
+ public String testName() {
+ return testName;
+ }
+
+}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloFileOutputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloFileOutputFormatIT.java
index cc46344..99e38d4 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloFileOutputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloFileOutputFormatIT.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.hadoop.its.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -56,9 +56,8 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.lib.IdentityMapper;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,9 +79,8 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
new SamplerConfiguration(RowSampler.class.getName()).addOption("hasher", "murmur3_32")
.addOption("modulus", "3");
- @Rule
- public TemporaryFolder folder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
@Test
public void testEmptyWrite() throws Exception {
@@ -182,7 +180,8 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
}
private void handleWriteTests(boolean content) throws Exception {
- File f = folder.newFile(testName.getMethodName());
+ File f = new File(tempDir, testName());
+ assertTrue(f.createNewFile(), "Failed to create file: " + f);
if (f.delete()) {
log.debug("Deleted {}", f);
}
@@ -219,7 +218,8 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
m.put("cf1", "cq2", "A&");
bw.addMutation(m);
bw.close();
- File f = folder.newFile(testName.getMethodName());
+ File f = new File(tempDir, testName());
+ assertTrue(f.createNewFile(), "Failed to create file: " + f);
if (f.delete()) {
log.debug("Deleted {}", f);
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloInputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloInputFormatIT.java
index 7798bf4..633558b 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloInputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloInputFormatIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.hadoop.its.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.util.Collection;
@@ -53,12 +53,12 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.lib.NullOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class AccumuloInputFormatIT extends AccumuloClusterHarness {
- @BeforeClass
+ @BeforeAll
public static void setupClass() {
System.setProperty("hadoop.tmp.dir", System.getProperty("user.dir") + "/target/hadoop-tmp");
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloOutputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloOutputFormatIT.java
index 0a14e29..6c16875 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloOutputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloOutputFormatIT.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.hadoop.its.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -58,7 +58,7 @@ import org.apache.hadoop.mapred.RecordWriter;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloOutputFormatIT extends ConfigurableMacBase {
@@ -73,7 +73,8 @@ public class AccumuloOutputFormatIT extends ConfigurableMacBase {
public void testMapred() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
// create a table and put some data in it
- client.tableOperations().create(testName.getMethodName());
+ final String tableName = testName();
+ client.tableOperations().create(tableName);
JobConf job = new JobConf();
BatchWriterConfig batchConfig = new BatchWriterConfig();
@@ -95,7 +96,7 @@ public class AccumuloOutputFormatIT extends ConfigurableMacBase {
for (int j = 0; j < 3; j++) {
m.put("cf1", "cq" + j, i + "_" + j);
}
- writer.write(new Text(testName.getMethodName()), m);
+ writer.write(new Text(tableName), m);
}
} catch (Exception e) {
@@ -103,8 +104,7 @@ public class AccumuloOutputFormatIT extends ConfigurableMacBase {
// we don't want the exception to come from write
}
- client.securityOperations().revokeTablePermission("root", testName.getMethodName(),
- TablePermission.WRITE);
+ client.securityOperations().revokeTablePermission("root", tableName, TablePermission.WRITE);
var ex = assertThrows(IOException.class, () -> writer.close(null));
log.info(ex.getMessage(), ex);
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloRowInputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloRowInputFormatIT.java
index 263db5c..17da216 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloRowInputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/AccumuloRowInputFormatIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.hadoop.its.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -52,8 +52,8 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.lib.NullOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/**
* Tests the new MR API in the hadoop-mapreduce package.
@@ -72,7 +72,7 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
private static AssertionError e1 = null;
private static AssertionError e2 = null;
- @BeforeClass
+ @BeforeAll
public static void prepareRows() {
row1 = new ArrayList<>();
row1.add(new KeyValue(new Key(ROW1, COLF1, "colq1"), "v1".getBytes()));
@@ -89,8 +89,8 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
int entryIndex = 0;
while (second.hasNext()) {
final Entry<Key,Value> entry = second.next();
- assertEquals("Keys should be equal", first.get(entryIndex).getKey(), entry.getKey());
- assertEquals("Values should be equal", first.get(entryIndex).getValue(), entry.getValue());
+ assertEquals(first.get(entryIndex).getKey(), entry.getKey(), "Keys should be equal");
+ assertEquals(first.get(entryIndex).getValue(), entry.getValue(), "Values should be equal");
entryIndex++;
}
}
@@ -118,15 +118,15 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
try {
switch (count) {
case 0:
- assertEquals("Current key should be " + ROW1, new Text(ROW1), k);
+ assertEquals(new Text(ROW1), k, "Current key should be " + ROW1);
checkLists(row1, v);
break;
case 1:
- assertEquals("Current key should be " + ROW2, new Text(ROW2), k);
+ assertEquals(new Text(ROW2), k, "Current key should be " + ROW2);
checkLists(row2, v);
break;
case 2:
- assertEquals("Current key should be " + ROW3, new Text(ROW3), k);
+ assertEquals(new Text(ROW3), k, "Current key should be " + ROW3);
checkLists(row3, v);
break;
default:
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/MultiTableInputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/MultiTableInputFormatIT.java
index e342746..32656f4 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/MultiTableInputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/MultiTableInputFormatIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoop.its.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.File;
import java.io.IOException;
@@ -44,7 +44,7 @@ import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.lib.NullOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MultiTableInputFormatIT extends AccumuloClusterHarness {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/TokenFileIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/TokenFileIT.java
index 261234d..51f5837 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/TokenFileIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapred/TokenFileIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.hadoop.its.mapred;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-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.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -52,9 +52,8 @@ import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -142,9 +141,8 @@ public class TokenFileIT extends AccumuloClusterHarness {
}
}
- @Rule
- public TemporaryFolder folder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
@Test
public void testMR() throws Exception {
@@ -162,7 +160,8 @@ public class TokenFileIT extends AccumuloClusterHarness {
}
bw.close();
- File tf = folder.newFile("client.properties");
+ File tf = new File(tempDir, "client.properties");
+ assertTrue(tf.createNewFile(), "Failed to create file: " + tf);
try (PrintStream out = new PrintStream(tf)) {
getClientInfo().getProperties().store(out, "Credentials for " + getClass().getName());
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloFileOutputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloFileOutputFormatIT.java
index 4d8f740..39594bf 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloFileOutputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloFileOutputFormatIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.hadoop.its.mapreduce;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -50,10 +50,9 @@ import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
@@ -77,13 +76,12 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
return 4 * 60;
}
- @Rule
- public TemporaryFolder folder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
- @Before
+ @BeforeEach
public void setup() throws Exception {
- PREFIX = testName.getMethodName() + "_";
+ PREFIX = testName() + "_";
BAD_TABLE = PREFIX + "_mapreduce_bad_table";
TEST_TABLE = PREFIX + "_mapreduce_test_table";
EMPTY_TABLE = PREFIX + "_mapreduce_empty_table";
@@ -198,7 +196,8 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
}
private void handleWriteTests(boolean content) throws Exception {
- File f = folder.newFile(testName.getMethodName());
+ File f = new File(tempDir, testName());
+ assertTrue(f.createNewFile(), "Failed to create file: " + f);
assertTrue(f.delete());
MRTester.main(new String[] {content ? TEST_TABLE : EMPTY_TABLE, f.getAbsolutePath()});
@@ -230,7 +229,8 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
@Test
public void writeBadVisibility() throws Exception {
- File f = folder.newFile(testName.getMethodName());
+ File f = new File(tempDir, testName());
+ assertTrue(f.createNewFile(), "Failed to create file: " + f);
assertTrue(f.delete());
MRTester.main(new String[] {BAD_TABLE, f.getAbsolutePath()});
assertTrue(f.exists());
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java
index b5789ea..b2ddf5e 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java
@@ -20,9 +20,10 @@ package org.apache.accumulo.hadoop.its.mapreduce;
import static java.lang.System.currentTimeMillis;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
+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;
import java.io.File;
import java.io.IOException;
@@ -65,9 +66,9 @@ import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
@@ -92,13 +93,13 @@ public class AccumuloInputFormatIT extends AccumuloClusterHarness {
cfg.setNumTservers(1);
}
- @Before
+ @BeforeEach
public void before() {
inputFormat = new AccumuloInputFormat();
client = Accumulo.newClient().from(getClientProps()).build();
}
- @After
+ @AfterEach
public void closeClient() {
client.close();
}
@@ -169,8 +170,8 @@ public class AccumuloInputFormatIT extends AccumuloClusterHarness {
AccumuloInputFormat.configure().clientProperties(getClientInfo().getProperties()).table(table)
.auths(Authorizations.EMPTY).batchScan(true).offlineScan(true).store(job);
- assertThrows("IllegalArgumentException should have been thrown trying to batch scan offline",
- IllegalArgumentException.class, () -> inputFormat.getSplits(job));
+ assertThrows(IllegalArgumentException.class, () -> inputFormat.getSplits(job),
+ "IllegalArgumentException should have been thrown trying to batch scan offline");
// table online tests
client.tableOperations().online(table, true);
@@ -184,16 +185,15 @@ public class AccumuloInputFormatIT extends AccumuloClusterHarness {
AccumuloInputFormat.configure().clientProperties(getClientInfo().getProperties()).table(table)
.auths(Authorizations.EMPTY).batchScan(true).scanIsolation(true).store(job);
- assertThrows(
- "IllegalArgumentException should have been thrown trying to batch scan with isolation",
- IllegalArgumentException.class, () -> inputFormat.getSplits(job));
+ assertThrows(IllegalArgumentException.class, () -> inputFormat.getSplits(job),
+ "IllegalArgumentException should have been thrown trying to batch scan with isolation");
// BatchScan not available with local iterators
AccumuloInputFormat.configure().clientProperties(getClientInfo().getProperties()).table(table)
.auths(Authorizations.EMPTY).batchScan(true).localIterators(true).store(job);
- assertThrows("IllegalArgumentException should have been thrown trying to batch scan locally",
- IllegalArgumentException.class, () -> inputFormat.getSplits(job));
+ assertThrows(IllegalArgumentException.class, () -> inputFormat.getSplits(job),
+ "IllegalArgumentException should have been thrown trying to batch scan locally");
AccumuloInputFormat.configure().clientProperties(getClientInfo().getProperties()).table(table)
.auths(Authorizations.EMPTY).batchScan(true).store(job);
@@ -424,8 +424,8 @@ public class AccumuloInputFormatIT extends AccumuloClusterHarness {
RangeInputSplit risplit = (RangeInputSplit) split;
assertEquals(table, risplit.getTableName());
- assertEquals(true, risplit.isIsolatedScan());
- assertEquals(true, risplit.usesLocalIterators());
+ assertTrue(risplit.isIsolatedScan());
+ assertTrue(risplit.usesLocalIterators());
assertEquals(fetchColumnsText, risplit.getFetchedColumns());
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloOutputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloOutputFormatIT.java
index d61ea5a..b2452b9 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloOutputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloOutputFormatIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.hadoop.its.mapreduce;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-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.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -46,7 +46,7 @@ import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloOutputFormatIT extends AccumuloClusterHarness {
private static AssertionError e1 = null;
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloRowInputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloRowInputFormatIT.java
index 1fb89c1..b3f7346 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloRowInputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloRowInputFormatIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.hadoop.its.mapreduce;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -49,8 +49,8 @@ import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/**
* Tests the new MR API in the hadoop-mapreduce package.
@@ -69,7 +69,7 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
private static AssertionError e1 = null;
private static AssertionError e2 = null;
- @BeforeClass
+ @BeforeAll
public static void prepareRows() {
row1 = new ArrayList<>();
row1.add(new KeyValue(new Key(ROW1, COLF1, "colq1"), "v1".getBytes()));
@@ -86,8 +86,8 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
int entryIndex = 0;
while (second.hasNext()) {
final Entry<Key,Value> entry = second.next();
- assertEquals("Keys should be equal", first.get(entryIndex).getKey(), entry.getKey());
- assertEquals("Values should be equal", first.get(entryIndex).getValue(), entry.getValue());
+ assertEquals(first.get(entryIndex).getKey(), entry.getKey(), "Keys should be equal");
+ assertEquals(first.get(entryIndex).getValue(), entry.getValue(), "Values should be equal");
entryIndex++;
}
}
@@ -114,15 +114,15 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
try {
switch (count) {
case 0:
- assertEquals("Current key should be " + ROW1, new Text(ROW1), k);
+ assertEquals(new Text(ROW1), k, "Current key should be " + ROW1);
checkLists(row1, v);
break;
case 1:
- assertEquals("Current key should be " + ROW2, new Text(ROW2), k);
+ assertEquals(new Text(ROW2), k, "Current key should be " + ROW2);
checkLists(row2, v);
break;
case 2:
- assertEquals("Current key should be " + ROW3, new Text(ROW3), k);
+ assertEquals(new Text(ROW3), k, "Current key should be " + ROW3);
checkLists(row3, v);
break;
default:
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/MultiTableInputFormatIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/MultiTableInputFormatIT.java
index 3f5677d..cf158a5 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/MultiTableInputFormatIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/MultiTableInputFormatIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoop.its.mapreduce;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.File;
import java.io.IOException;
@@ -41,7 +41,7 @@ import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MultiTableInputFormatIT extends AccumuloClusterHarness {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/RowHashIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/RowHashIT.java
index ac98888..48b11c3 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/RowHashIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/RowHashIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.hadoop.its.mapreduce;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.security.MessageDigest;
@@ -54,7 +54,7 @@ import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.beust.jcommander.Parameter;
@@ -62,11 +62,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class RowHashIT extends ConfigurableMacBase {
- @Override
- protected int defaultTimeoutSeconds() {
- return 60;
- }
-
public static final String hadoopTmpDirArg =
"-Dhadoop.tmp.dir=" + System.getProperty("user.dir") + "/target/hadoop-tmp";
@@ -76,6 +71,11 @@ public class RowHashIT extends ConfigurableMacBase {
static final String input_cfcq = input_cf + ":" + input_cq;
static final String output_cq = "cq-MD4BASE64";
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Test
public void test() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/TokenFileIT.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/TokenFileIT.java
index 02919e5..43aee53 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/TokenFileIT.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/TokenFileIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.hadoop.its.mapreduce;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-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.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -49,9 +49,8 @@ import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -136,9 +135,8 @@ public class TokenFileIT extends AccumuloClusterHarness {
}
}
- @Rule
- public TemporaryFolder folder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
@Test
public void testMR() throws Exception {
@@ -156,7 +154,8 @@ public class TokenFileIT extends AccumuloClusterHarness {
}
bw.close();
- File tf = folder.newFile("client.properties");
+ File tf = new File(tempDir, "client.properties");
+ assertTrue(tf.createNewFile(), "Failed to create file: " + tf);
try (PrintStream out = new PrintStream(tf)) {
getClientInfo().getProperties().store(out, "Credentials for " + getClass().getName());
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloFileOutputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloFileOutputFormatTest.java
index b610b56..c0fca9d 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloFileOutputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloFileOutputFormatTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoop.mapred;
-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;
import java.util.Collection;
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.FileOutputConfigurator;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloFileOutputFormatTest {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloInputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloInputFormatTest.java
index 4058432..f611fd2 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloInputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloInputFormatTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoop.mapred;
-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;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -39,26 +39,21 @@ import org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder.InputFormatOption
import org.apache.accumulo.hadoopImpl.mapreduce.lib.InputConfigurator;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class AccumuloInputFormatTest {
private JobConf job;
private static Properties clientProperties;
- @Rule
- public TestName test = new TestName();
-
- @Before
+ @BeforeEach
public void createJob() {
job = new JobConf();
}
- @BeforeClass
+ @BeforeAll
public static void setupClientInfo() {
clientProperties =
org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormatTest.setupClientProperties();
@@ -233,7 +228,7 @@ public class AccumuloInputFormatTest {
.auths(Authorizations.EMPTY);
AccumuloInputFormat aif = new AccumuloInputFormat();
- assertThrows("IllegalStateException should have been thrown for not calling store",
- IllegalStateException.class, () -> aif.getSplits(job, 1));
+ assertThrows(IllegalStateException.class, () -> aif.getSplits(job, 1),
+ "IllegalStateException should have been thrown for not calling store");
}
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormatTest.java
index f6e6312..9e0f519 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/AccumuloOutputFormatTest.java
@@ -19,9 +19,10 @@
package org.apache.accumulo.hadoop.mapred;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileWriter;
@@ -34,7 +35,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.OutputConfigurator;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloOutputFormatTest {
@Test
@@ -104,8 +105,8 @@ public class AccumuloOutputFormatTest {
AccumuloOutputFormat.configure().clientProperties(cp).defaultTable(tableName).createTables(true)
.store(job);
- assertEquals("Should have been able to create table", true,
- OutputConfigurator.canCreateTables(AccumuloOutputFormat.class, job));
+ assertTrue(OutputConfigurator.canCreateTables(AccumuloOutputFormat.class, job),
+ "Should have been able to create table");
}
@Test
@@ -127,8 +128,8 @@ public class AccumuloOutputFormatTest {
AccumuloOutputFormat.configure().clientPropertiesPath(file.getAbsolutePath()).store(job);
- assertEquals("Properties from path does not match the expected values ", cp,
- OutputConfigurator.getClientProperties(AccumuloOutputFormat.class, job));
+ assertEquals(cp, OutputConfigurator.getClientProperties(AccumuloOutputFormat.class, job),
+ "Properties from path does not match the expected values ");
} catch (IOException e) {
throw new IllegalStateException(e);
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
index 5c1c400..fb33903 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.hadoop.mapred;
import static java.util.Collections.singleton;
import static java.util.Collections.singletonList;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.List;
@@ -32,28 +32,25 @@ import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.IteratorSetting.Column;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.hadoop.its.WithTestNames;
import org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder;
import org.apache.accumulo.hadoopImpl.mapreduce.InputTableConfig;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.InputConfigurator;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
-public class MultiTableInputFormatTest {
+public class MultiTableInputFormatTest extends WithTestNames {
public static final Class<AccumuloInputFormat> CLASS = AccumuloInputFormat.class;
- @Rule
- public TestName testName = new TestName();
-
/**
* Verify {@link InputTableConfig} objects get correctly serialized in the JobContext.
*/
@Test
public void testStoreTables() throws Exception {
- String table1Name = testName.getMethodName() + "1";
- String table2Name = testName.getMethodName() + "2";
+ String table1Name = testName() + "1";
+ String table2Name = testName() + "2";
+
JobConf job = new JobConf();
Properties clientProps =
org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormatTest.setupClientProperties();
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloFileOutputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloFileOutputFormatTest.java
index 85a249a..fcccef1 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloFileOutputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloFileOutputFormatTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoop.mapreduce;
-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;
import java.io.IOException;
import java.util.Collection;
@@ -36,7 +36,7 @@ import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.FileOutputConfigurator;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloFileOutputFormatTest {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloInputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloInputFormatTest.java
index 0997c94..b1b760d 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloInputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloInputFormatTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoop.mapreduce;
-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;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@@ -41,14 +41,14 @@ import org.apache.accumulo.hadoopImpl.mapreduce.lib.InputConfigurator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class AccumuloInputFormatTest {
static Properties clientProperties;
- @BeforeClass
+ @BeforeAll
public static void setup() {
clientProperties = setupClientProperties();
}
@@ -246,7 +246,7 @@ public class AccumuloInputFormatTest {
.auths(Authorizations.EMPTY);
AccumuloInputFormat aif = new AccumuloInputFormat();
- assertThrows("IllegalStateException should have been thrown for not calling store",
- IllegalStateException.class, () -> aif.getSplits(job));
+ assertThrows(IllegalStateException.class, () -> aif.getSplits(job),
+ "IllegalStateException should have been thrown for not calling store");
}
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormatTest.java
index dce22e1..2da426d 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/AccumuloOutputFormatTest.java
@@ -19,9 +19,10 @@
package org.apache.accumulo.hadoop.mapreduce;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileWriter;
@@ -34,7 +35,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.OutputConfigurator;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobContext;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AccumuloOutputFormatTest {
@@ -106,8 +107,9 @@ public class AccumuloOutputFormatTest {
AccumuloOutputFormat.configure().clientProperties(cp).defaultTable(tableName).createTables(true)
.store(job);
- assertEquals("Should have been able to create table", true,
- OutputConfigurator.canCreateTables(AccumuloOutputFormat.class, job.getConfiguration()));
+ assertTrue(
+ OutputConfigurator.canCreateTables(AccumuloOutputFormat.class, job.getConfiguration()),
+ "Should have been able to create table");
}
@Test
@@ -129,9 +131,8 @@ public class AccumuloOutputFormatTest {
AccumuloOutputFormat.configure().clientPropertiesPath(file.getAbsolutePath()).store(job);
- assertEquals("Properties from path does not match the expected values ", cp,
- OutputConfigurator.getClientProperties(AccumuloOutputFormat.class,
- job.getConfiguration()));
+ assertEquals(cp, OutputConfigurator.getClientProperties(AccumuloOutputFormat.class,
+ job.getConfiguration()), "Properties from path does not match the expected values ");
} catch (IOException e) {
throw new IllegalStateException(e);
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
index e03d254..1c8c185 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.hadoop.mapreduce;
import static java.util.Collections.singleton;
import static java.util.Collections.singletonList;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.List;
@@ -32,28 +32,25 @@ import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.IteratorSetting.Column;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.hadoop.its.WithTestNames;
import org.apache.accumulo.hadoopImpl.mapreduce.InputTableConfig;
import org.apache.accumulo.hadoopImpl.mapreduce.lib.InputConfigurator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
-public class MultiTableInputFormatTest {
+public class MultiTableInputFormatTest extends WithTestNames {
public static final Class<AccumuloInputFormat> CLASS = AccumuloInputFormat.class;
- @Rule
- public TestName testName = new TestName();
-
/**
* Verify {@link InputTableConfig} objects get correctly serialized in the JobContext.
*/
@Test
public void testStoreTables() throws Exception {
- String table1Name = testName.getMethodName() + "1";
- String table2Name = testName.getMethodName() + "2";
+ String table1Name = testName() + "1";
+ String table2Name = testName() + "2";
+
Job job = Job.getInstance();
Properties clientProps =
org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormatTest.setupClientProperties();
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitionerTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitionerTest.java
index eb836e3..0880989 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitionerTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitionerTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.hadoop.mapreduce.partition;
-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;
import java.io.IOException;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RangePartitionerTest {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapred/RangeInputSplitTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapred/RangeInputSplitTest.java
index d5037fa..6e1864e 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapred/RangeInputSplitTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapred/RangeInputSplitTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.hadoopImpl.mapred;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-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.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RangeInputSplitTest {
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/BatchInputSplitTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/BatchInputSplitTest.java
index 06ab977..ed3ca2a 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/BatchInputSplitTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/BatchInputSplitTest.java
@@ -18,9 +18,8 @@
*/
package org.apache.accumulo.hadoopImpl.mapreduce;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -28,7 +27,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -41,7 +39,7 @@ import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BatchInputSplitTest {
@@ -64,7 +62,7 @@ public class BatchInputSplitTest {
assertEquals(split.getTableName(), newSplit.getTableName());
assertEquals(split.getTableId(), newSplit.getTableId());
assertEquals(split.getRanges(), newSplit.getRanges());
- assertTrue(Arrays.equals(split.getLocations(), newSplit.getLocations()));
+ assertArrayEquals(split.getLocations(), newSplit.getLocations());
}
@Test
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputFormatBuilderTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputFormatBuilderTest.java
index 794381a..5e19883 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputFormatBuilderTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputFormatBuilderTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.hadoopImpl.mapreduce;
-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;
import java.util.Map;
import java.util.Optional;
@@ -28,8 +28,8 @@ import java.util.TreeMap;
import org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder;
import org.apache.hadoop.mapred.JobConf;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/*
This unit tests ClassLoaderContext and ExecuteHints functionality
@@ -77,7 +77,7 @@ public class InputFormatBuilderTest {
private InputTableConfig tableQueryConfig;
private InputFormatBuilderImplTest<InputFormatBuilderTest> formatBuilderTest;
- @Before
+ @BeforeEach
public void setUp() {
tableQueryConfig = new InputTableConfig();
formatBuilderTest = new InputFormatBuilderImplTest<>(InputFormatBuilderTest.class);
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputTableConfigTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputTableConfigTest.java
index 8b46b0b..4710659 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputTableConfigTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/InputTableConfigTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.hadoopImpl.mapreduce;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -35,14 +35,14 @@ import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.sample.SamplerConfiguration;
import org.apache.accumulo.core.data.Range;
import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class InputTableConfigTest {
private InputTableConfig tableQueryConfig;
- @Before
+ @BeforeEach
public void setUp() {
tableQueryConfig = new InputTableConfig();
}
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/RangeInputSplitTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/RangeInputSplitTest.java
index 288ce4f..f82e26e 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/RangeInputSplitTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/RangeInputSplitTest.java
@@ -18,9 +18,8 @@
*/
package org.apache.accumulo.hadoopImpl.mapreduce;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -28,7 +27,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -39,7 +37,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.iterators.user.WholeRowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class RangeInputSplitTest {
@@ -61,7 +59,7 @@ public class RangeInputSplitTest {
assertEquals(split.getTableName(), newSplit.getTableName());
assertEquals(split.getTableId(), newSplit.getTableId());
assertEquals(split.getRange(), newSplit.getRange());
- assertTrue(Arrays.equals(split.getLocations(), newSplit.getLocations()));
+ assertArrayEquals(split.getLocations(), newSplit.getLocations());
}
@Test
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBaseTest.java b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBaseTest.java
index 3b6025d..65db798 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBaseTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBaseTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.hadoopImpl.mapreduce.lib;
-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;
import java.util.Properties;
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.clientImpl.ClientInfo;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConfiguratorBaseTest {
diff --git a/pom.xml b/pom.xml
index 594a1d1..56f822e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1013,6 +1013,7 @@
<unusedDeclaredDependency>org.apache.logging.log4j:log4j-web:jar:*</unusedDeclaredDependency>
<!-- This should be removed upon completion of migrating junit 4 to 5 -->
<unusedDeclaredDependency>org.junit.vintage:junit-vintage-engine:jar:*</unusedDeclaredDependency>
+ <unusedDeclaredDependency>org.junit.jupiter:junit-jupiter-engine:jar:*</unusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
</configuration>
</execution>
@@ -1114,7 +1115,7 @@
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="org[.]junit[.]jupiter[.]api[.]Assertions;" />
- <property name="message" value="Use static imports for Assert.* methods for consistency" />
+ <property name="message" value="Use static imports for Assertions.* methods for consistency" />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="import org[.]junit[.]Assume;" />
@@ -1158,7 +1159,7 @@
<module name="JavadocMethod">
<property name="allowMissingParamTags" value="true" />
<property name="allowMissingReturnTag" value="true" />
- <property name="allowedAnnotations" value="Override,Test,BeforeClass,AfterClass,Before,After" />
+ <property name="allowedAnnotations" value="Override,Test,BeforeClass,AfterClass,Before,After,BeforeAll,AfterAll,BeforeEach,AfterEach" />
</module>
<module name="MissingOverrideCheck" />
</module>
@@ -1240,7 +1241,7 @@
<artifactId>warbucks-maven-plugin</artifactId>
<executions>
<execution>
- <id>check-junit-categories-on-its</id>
+ <id>check-junit-tags-on-its</id>
<goals>
<goal>check</goal>
</goals>
@@ -1250,7 +1251,7 @@
<includeMainClasses>true</includeMainClasses>
<includeTestClasses>true</includeTestClasses>
<classPattern>.*IT</classPattern>
- <classAnnotationPattern>org[.]junit[.]experimental[.]categories[.]Category</classAnnotationPattern>
+ <classAnnotationPattern>org[.]junit[.]jupiter[.]api[.]Tag</classAnnotationPattern>
</rule>
</rules>
</configuration>
@@ -1549,7 +1550,7 @@
<!-- Minimal testing profile. (a.k.a. SunnyDay) -->
<id>sunny</id>
<properties>
- <failsafe.groups>org.apache.accumulo.test.categories.SunnyDayTests</failsafe.groups>
+ <failsafe.groups>SunnyDay</failsafe.groups>
</properties>
</profile>
<profile>
diff --git a/server/monitor/pom.xml b/server/monitor/pom.xml
index d9d5b2e..ef1e15e 100644
--- a/server/monitor/pom.xml
+++ b/server/monitor/pom.xml
@@ -181,6 +181,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
diff --git a/start/src/main/java/org/apache/accumulo/test/categories/package-info.java b/server/monitor/src/test/java/org/apache/accumulo/monitor/it/TagNameConstants.java
similarity index 86%
rename from start/src/main/java/org/apache/accumulo/test/categories/package-info.java
rename to server/monitor/src/test/java/org/apache/accumulo/monitor/it/TagNameConstants.java
index fb5b8f3..70f9766 100644
--- a/start/src/main/java/org/apache/accumulo/test/categories/package-info.java
+++ b/server/monitor/src/test/java/org/apache/accumulo/monitor/it/TagNameConstants.java
@@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-/**
- * JUnit categories for the various types of Accumulo integration tests.
- */
-package org.apache.accumulo.test.categories;
+package org.apache.accumulo.monitor.it;
+
+public class TagNameConstants {
+ public static final String MONITOR = "Monitor";
+}
diff --git a/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java b/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java
index ac25480..58a7262 100644
--- a/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java
+++ b/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java
@@ -18,6 +18,7 @@
*/
package org.apache.accumulo.monitor.it;
+import static org.apache.accumulo.monitor.it.TagNameConstants.MONITOR;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
@@ -47,7 +48,6 @@ import org.apache.accumulo.monitor.Monitor;
import org.apache.accumulo.monitor.Monitor.MonitorFactory;
import org.apache.accumulo.monitor.view.WebViews;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.test.categories.MonitorTests;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
@@ -55,12 +55,12 @@ import org.glassfish.jersey.test.TestProperties;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
/**
* Basic tests for parameter validation constraints
*/
-@Category(MonitorTests.class)
+@Tag(MONITOR)
public class WebViewsIT extends JerseyTest {
@Override
diff --git a/start/src/main/java/org/apache/accumulo/test/categories/StandaloneCapableClusterTests.java b/start/src/main/java/org/apache/accumulo/test/categories/StandaloneCapableClusterTests.java
deleted file mode 100644
index 8ae80a5..0000000
--- a/start/src/main/java/org/apache/accumulo/test/categories/StandaloneCapableClusterTests.java
+++ /dev/null
@@ -1,25 +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.accumulo.test.categories;
-
-/**
- * Interface to be used with JUnit Category annotation to denote that the IntegrationTest can be
- * used with any kind of cluster (a MiniAccumuloCluster or a StandaloneAccumuloCluster).
- */
-public interface StandaloneCapableClusterTests {}
diff --git a/start/src/main/java/org/apache/accumulo/test/categories/SunnyDayTests.java b/start/src/main/java/org/apache/accumulo/test/categories/SunnyDayTests.java
deleted file mode 100644
index 7daf9fa..0000000
--- a/start/src/main/java/org/apache/accumulo/test/categories/SunnyDayTests.java
+++ /dev/null
@@ -1,25 +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.accumulo.test.categories;
-
-/**
- * Interface to be used with JUnit Category annotation to represent the integration test is part of
- * a minimal set of tests which should pass for basic functionality of Accumulo.
- */
-public interface SunnyDayTests {}
diff --git a/start/src/main/java/org/apache/accumulo/test/categories/ZooKeeperTestingServerTests.java b/start/src/main/java/org/apache/accumulo/test/categories/ZooKeeperTestingServerTests.java
deleted file mode 100644
index 00c758c..0000000
--- a/start/src/main/java/org/apache/accumulo/test/categories/ZooKeeperTestingServerTests.java
+++ /dev/null
@@ -1,25 +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.accumulo.test.categories;
-
-/**
- * Interface to be used with JUnit Category annotation to denote that the IntegrationTest requires
- * the use of a ZooKeeperTestingServer.
- */
-public interface ZooKeeperTestingServerTests {}
diff --git a/test/pom.xml b/test/pom.xml
index 78fb227..673a3ae 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -195,8 +195,12 @@
<artifactId>jline</artifactId>
</dependency>
<dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
index 4042c9b..273fbaf 100644
--- a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
+++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
@@ -20,7 +20,8 @@ package org.apache.accumulo.harness;
import static com.google.common.base.Preconditions.checkState;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assume.assumeTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.STANDALONE_CAPABLE_CLUSTER;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.IOException;
import java.util.Properties;
@@ -42,15 +43,14 @@ import org.apache.accumulo.harness.conf.AccumuloClusterPropertyConfiguration;
import org.apache.accumulo.harness.conf.StandaloneAccumuloClusterConfiguration;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.test.categories.StandaloneCapableClusterTests;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
* advanced ITs that do crazy things. For more typical, expected behavior of a cluster see
* {@link SharedMiniClusterBase}. This instance can be MAC or a standalone instance.
*/
-@Category(StandaloneCapableClusterTests.class)
+@Tag(STANDALONE_CAPABLE_CLUSTER)
public abstract class AccumuloClusterHarness extends AccumuloITBase
implements MiniClusterConfigurationCallback, ClusterUsers {
private static final Logger log = LoggerFactory.getLogger(AccumuloClusterHarness.class);
@@ -81,7 +81,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase
protected static AccumuloClusterPropertyConfiguration clusterConf;
protected static TestingKdc krb;
- @BeforeClass
+ @BeforeAll
public static void setUpHarness() throws Exception {
clusterConf = AccumuloClusterPropertyConfiguration.get();
type = clusterConf.getClusterType();
@@ -96,7 +96,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase
initialized = true;
}
- @AfterClass
+ @AfterAll
public static void tearDownHarness() {
if (krb != null) {
krb.stop();
@@ -110,7 +110,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase
return krb;
}
- @Before
+ @BeforeEach
public void setupCluster() throws Exception {
// Before we try to instantiate the cluster, check to see if the test even wants to run against
// this type of cluster
@@ -200,7 +200,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase
}
}
- @After
+ @AfterEach
public void teardownCluster() throws Exception {
if (cluster != null) {
if (type.isDynamic()) {
@@ -288,8 +288,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase
return krb.getClientPrincipal(offset);
} else {
// Come up with a mostly unique name
- String principal =
- getClass().getSimpleName() + "_" + testName.getMethodName() + "_" + offset;
+ String principal = getClass().getSimpleName() + "_" + testName() + "_" + offset;
// Username and password are the same
return new ClusterUser(principal, principal);
}
diff --git a/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java b/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java
index 87adffd..e4c9ddd 100644
--- a/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java
+++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java
@@ -18,17 +18,15 @@
*/
package org.apache.accumulo.harness;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
import java.security.SecureRandom;
-import java.util.concurrent.TimeUnit;
+import java.time.Duration;
import org.apache.commons.io.FileUtils;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,17 +35,19 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Methods, setup and/or infrastructure which are common to any Accumulo integration test.
*/
-public class AccumuloITBase {
+public class AccumuloITBase extends WithTestNames {
public static final SecureRandom random = new SecureRandom();
private static final Logger log = LoggerFactory.getLogger(AccumuloITBase.class);
- @Rule
- public TestName testName = new TestName();
+ public static final String STANDALONE_CAPABLE_CLUSTER = "StandaloneCapableCluster";
+ public static final String SUNNY_DAY = "SunnyDay";
+ public static final String MINI_CLUSTER_ONLY = "MiniClusterOnly";
+ public static final String ZOOKEEPER_TESTING_SERVER = "ZooKeeperTestingServer";
public String[] getUniqueNames(int num) {
String[] names = new String[num];
for (int i = 0; i < num; i++)
- names[i] = this.getClass().getSimpleName() + "_" + testName.getMethodName() + i;
+ names[i] = this.getClass().getSimpleName() + "_" + testName() + i;
return names;
}
@@ -83,42 +83,47 @@ public class AccumuloITBase {
/**
* If a given IT test has a method that takes longer than a class-set default timeout, declare it
* failed.
- *
- * Note that this provides a upper bound on test times, even in the presence of Test annotations
+ * <p>
+ * Note that this provides an upper bound on test times, even in the presence of Test annotations
* with a timeout. That is, the Test annotation can make the timing tighter but will not be able
* to allow a timeout that takes longer.
- *
+ * <p>
* Defaults to no timeout and can be changed via two mechanisms
- *
+ * <p>
* 1) A given IT class can override the defaultTimeoutSeconds method if test methods in that class
* should have a timeout. 2) The system property "timeout.factor" is used as a multiplier for the
* class provided default
- *
- * Note that if either of these values is '0' tests will run with no timeout. The default class
- * level timeout is set to 0.
+ * <p>
+ * Note that if either of these values is '0' tests will run with (effectively) no timeout (a
+ * timeout of 5 days will be applied). The default class level timeout is set to 0.
*
*/
- @Rule
- public Timeout testsShouldTimeout() {
- int waitLonger = 0;
+ @RegisterExtension
+ Timeout timeout = Timeout.from(() -> {
+ int timeoutFactor = 0;
try {
String timeoutString = System.getProperty("timeout.factor");
if (timeoutString != null && !timeoutString.isEmpty()) {
- waitLonger = Integer.parseInt(timeoutString);
+ timeoutFactor = Integer.parseInt(timeoutString);
}
} catch (NumberFormatException exception) {
log.warn("Could not parse timeout.factor, defaulting to no timeout.");
}
- return Timeout.builder().withTimeout(waitLonger * defaultTimeoutSeconds(), TimeUnit.SECONDS)
- .withLookingForStuckThread(true).build();
- }
+ // if either value is zero, apply a very long timeout (effectively no timeout)
+ int totalTimeoutSeconds = timeoutFactor * defaultTimeoutSeconds();
+ if (totalTimeoutSeconds == 0) {
+ return Duration.ofDays(5);
+ }
+
+ return Duration.ofSeconds(totalTimeoutSeconds);
+ });
/**
- * time to wait per-method before declaring a timeout, in seconds.
+ * Time to wait per-method before declaring a timeout, in seconds.
*/
protected int defaultTimeoutSeconds() {
- return 600;
+ return 60 * 10;
}
@SuppressFBWarnings(value = "UI_INHERITANCE_UNSAFE_GETRESOURCE", justification = "for testing")
diff --git a/test/src/main/java/org/apache/accumulo/harness/MiniClusterHarness.java b/test/src/main/java/org/apache/accumulo/harness/MiniClusterHarness.java
index 59375ba..344b558 100644
--- a/test/src/main/java/org/apache/accumulo/harness/MiniClusterHarness.java
+++ b/test/src/main/java/org/apache/accumulo/harness/MiniClusterHarness.java
@@ -23,7 +23,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;
import static org.apache.hadoop.minikdc.MiniKdc.JAVA_SECURITY_KRB5_CONF;
import static org.apache.hadoop.minikdc.MiniKdc.SUN_SECURITY_KRB5_DEBUG;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -66,8 +66,7 @@ public class MiniClusterHarness {
public MiniAccumuloClusterImpl create(AccumuloITBase testBase, AuthenticationToken token,
TestingKdc kdc, MiniClusterConfigurationCallback configCallback) throws Exception {
- return create(testBase.getClass().getName(), testBase.testName.getMethodName(), token,
- configCallback, kdc);
+ return create(testBase.getClass().getName(), testBase.testName(), token, configCallback, kdc);
}
public MiniAccumuloClusterImpl create(String testClassName, String testMethodName,
diff --git a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
index ebd5533..b53a5c7 100644
--- a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
+++ b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
@@ -19,7 +19,8 @@
package org.apache.accumulo.harness;
import static java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.lang.StackWalker.StackFrame;
@@ -37,11 +38,12 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.clientImpl.ClientInfo;
import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,17 +53,17 @@ import org.slf4j.LoggerFactory;
* testing see {@link AccumuloClusterHarness}
*
* There isn't a good way to build this off of the {@link AccumuloClusterHarness} (as would be the
- * logical place) because we need to start the MiniAccumuloCluster in a static BeforeClass-annotated
- * method. Because it is static and invoked before any other BeforeClass methods in the
+ * logical place) because we need to start the MiniAccumuloCluster in a static BeforeAll-annotated
+ * method. Because it is static and invoked before any other BeforeAll methods in the
* implementation, the actual test classes can't expose any information to tell the base class that
* it is to perform the one-MAC-per-class semantics.
*
* Implementations of this class must be sure to invoke {@link #startMiniCluster()} or
* {@link #startMiniClusterWithConfig(MiniClusterConfigurationCallback)} in a method annotated with
- * the {@link org.junit.BeforeClass} JUnit annotation and {@link #stopMiniCluster()} in a method
- * annotated with the {@link org.junit.AfterClass} JUnit annotation.
+ * the {@link org.junit.jupiter.api.BeforeAll} JUnit annotation and {@link #stopMiniCluster()} in a
+ * method annotated with the {@link org.junit.jupiter.api.AfterAll} JUnit annotation.
*/
-@Category(MiniClusterOnlyTests.class)
+@Tag(MINI_CLUSTER_ONLY)
public abstract class SharedMiniClusterBase extends AccumuloITBase implements ClusterUsers {
private static final Logger log = LoggerFactory.getLogger(SharedMiniClusterBase.class);
public static final String TRUE = Boolean.toString(true);
@@ -188,8 +190,7 @@ public abstract class SharedMiniClusterBase extends AccumuloITBase implements Cl
@Override
public ClusterUser getUser(int offset) {
if (krb == null) {
- String user =
- SharedMiniClusterBase.class.getName() + "_" + testName.getMethodName() + "_" + offset;
+ String user = SharedMiniClusterBase.class.getName() + "_" + testName() + "_" + offset;
// Password is the username
return new ClusterUser(user, user);
} else {
diff --git a/test/src/main/java/org/apache/accumulo/harness/TestingKdc.java b/test/src/main/java/org/apache/accumulo/harness/TestingKdc.java
index b37795d..49f0f67 100644
--- a/test/src/main/java/org/apache/accumulo/harness/TestingKdc.java
+++ b/test/src/main/java/org/apache/accumulo/harness/TestingKdc.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.harness;
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.net.InetAddress;
@@ -62,8 +62,7 @@ public class TestingKdc {
File targetDir = new File(System.getProperty("user.dir"), "target");
if (!targetDir.exists())
assertTrue(targetDir.mkdirs());
- assertTrue("Could not find Maven target directory: " + targetDir,
- targetDir.exists() && targetDir.isDirectory());
+ assertTrue(targetDir.isDirectory(), "Could not find Maven target directory: " + targetDir);
// Create the directories: target/kerberos/minikdc
File kdcDir = new File(new File(targetDir, "kerberos"), "minikdc");
@@ -75,8 +74,8 @@ public class TestingKdc {
public static File computeKeytabDir() {
File targetDir = new File(System.getProperty("user.dir"), "target");
- assertTrue("Could not find Maven target directory: " + targetDir,
- targetDir.exists() && targetDir.isDirectory());
+ assertTrue(targetDir.exists() && targetDir.isDirectory(),
+ "Could not find Maven target directory: " + targetDir);
// Create the directories: target/kerberos/keytabs
File keytabDir = new File(new File(targetDir, "kerberos"), "keytabs");
diff --git a/test/src/main/java/org/apache/accumulo/harness/Timeout.java b/test/src/main/java/org/apache/accumulo/harness/Timeout.java
new file mode 100644
index 0000000..a984716
--- /dev/null
+++ b/test/src/main/java/org/apache/accumulo/harness/Timeout.java
@@ -0,0 +1,100 @@
+/*
+ * 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.accumulo.harness;
+
+import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.time.Duration;
+import java.util.Objects;
+import java.util.function.Supplier;
+
+import org.junit.jupiter.api.extension.DynamicTestInvocationContext;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.InvocationInterceptor;
+import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
+
+public final class Timeout implements InvocationInterceptor {
+
+ private final Duration timeoutDuration;
+
+ public static Timeout from(Supplier<Duration> timeoutDurationSupplier) {
+ return new Timeout(timeoutDurationSupplier.get());
+ }
+
+ private Timeout(Duration timeoutDuration) {
+ this.timeoutDuration = Objects.requireNonNull(timeoutDuration);
+ }
+
+ @Override
+ public <T> T interceptTestClassConstructor(Invocation<T> invocation,
+ ReflectiveInvocationContext<Constructor<T>> invocationContext,
+ ExtensionContext extensionContext) {
+ return assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptBeforeAllMethod(Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptBeforeEachMethod(Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptTestMethod(Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public <T> T interceptTestFactoryMethod(Invocation<T> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ return assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptTestTemplateMethod(Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptDynamicTest(Invocation<Void> invocation,
+ DynamicTestInvocationContext invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptAfterEachMethod(Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+
+ @Override
+ public void interceptAfterAllMethod(Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) {
+ assertTimeoutPreemptively(timeoutDuration, invocation::proceed);
+ }
+}
diff --git a/start/src/main/java/org/apache/accumulo/test/categories/MiniClusterOnlyTests.java b/test/src/main/java/org/apache/accumulo/harness/WithTestNames.java
similarity index 54%
rename from start/src/main/java/org/apache/accumulo/test/categories/MiniClusterOnlyTests.java
rename to test/src/main/java/org/apache/accumulo/harness/WithTestNames.java
index f3ac31d..d3adde3 100644
--- a/start/src/main/java/org/apache/accumulo/test/categories/MiniClusterOnlyTests.java
+++ b/test/src/main/java/org/apache/accumulo/harness/WithTestNames.java
@@ -16,10 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.accumulo.test.categories;
+package org.apache.accumulo.harness;
-/**
- * Interface to be used with JUnit Category annotation to denote that the IntegrationTest requires
- * the use of a MiniAccumuloCluster.
- */
-public interface MiniClusterOnlyTests {}
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInfo;
+
+// This is only for the unit tests and integration tests in this module
+// It must be copied for use in other modules, because tests in one module
+// don't have dependencies on other modules, and we can't put this in a
+// regular, non-test jar, because we don't want to add a dependency on
+// JUnit in a non-test jar
+public class WithTestNames {
+
+ private String testName;
+
+ @BeforeEach
+ public void setTestName(TestInfo info) {
+ testName = info.getTestMethod().get().getName();
+ }
+
+ public String testName() {
+ return testName;
+ }
+
+}
diff --git a/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java b/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
index b6ca5bb..cdd80ca 100644
--- a/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
+++ b/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.harness.conf;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -123,8 +123,8 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
String keytab = conf.get(ACCUMULO_STANDALONE_USER_KEYTABS_KEY + suffix);
if (keytab != null) {
File keytabFile = new File(keytab);
- assertTrue("Keytab doesn't exist: " + keytabFile,
- keytabFile.exists() && keytabFile.isFile());
+ assertTrue(keytabFile.exists() && keytabFile.isFile(),
+ "Keytab doesn't exist: " + keytabFile);
clusterUsers.add(new ClusterUser(entry.getValue(), keytabFile));
} else {
String password = conf.get(ACCUMULO_STANDALONE_USER_PASSWORDS_KEY + suffix);
diff --git a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
index 2005ecf..f02acc0 100644
--- a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.test;
import static java.nio.charset.StandardCharsets.UTF_8;
-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;
import java.io.File;
import java.io.IOException;
@@ -55,9 +55,9 @@ import org.apache.accumulo.server.security.AuditedSecurityOperation;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -80,7 +80,7 @@ public class AuditMessageIT extends ConfigurableMacBase {
private static final Authorizations auths = new Authorizations("private", "public");
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
@@ -163,7 +163,7 @@ public class AuditMessageIT extends ConfigurableMacBase {
}
}
- @Before
+ @BeforeEach
public void resetInstance() throws Exception {
client = Accumulo.newClient().from(getClientProperties()).build();
@@ -173,7 +173,7 @@ public class AuditMessageIT extends ConfigurableMacBase {
getAuditMessages("setup");
}
- @After
+ @AfterEach
public void cleanUp() throws Exception {
removeUsersAndTables();
client.close();
diff --git a/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java b/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
index 7e07cb6..f817c8a 100644
--- a/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,9 +49,9 @@ import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,8 +60,8 @@ public class BadDeleteMarkersCreatedIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(BadDeleteMarkersCreatedIT.class);
@Override
- public int defaultTimeoutSeconds() {
- return 120;
+ protected int defaultTimeoutSeconds() {
+ return 2 * 60;
}
@Override
@@ -73,7 +73,7 @@ public class BadDeleteMarkersCreatedIT extends AccumuloClusterHarness {
private int timeoutFactor = 1;
- @Before
+ @BeforeEach
public void getTimeoutFactor() {
try {
timeoutFactor = Integer.parseInt(System.getProperty("timeout.factor"));
@@ -81,12 +81,12 @@ public class BadDeleteMarkersCreatedIT extends AccumuloClusterHarness {
log.warn("Could not parse integer from timeout.factor");
}
- assertTrue("timeout.factor must be greater than or equal to 1", timeoutFactor >= 1);
+ assertTrue(timeoutFactor >= 1, "timeout.factor must be greater than or equal to 1");
}
private String gcCycleDelay, gcCycleStart;
- @Before
+ @BeforeEach
public void alterConfig() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
InstanceOperations iops = client.instanceOperations();
@@ -131,7 +131,7 @@ public class BadDeleteMarkersCreatedIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void restoreConfig() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
InstanceOperations iops = c.instanceOperations();
@@ -156,7 +156,7 @@ public class BadDeleteMarkersCreatedIT extends AccumuloClusterHarness {
log.info("Creating table to be deleted");
c.tableOperations().create(tableName);
final String tableId = c.tableOperations().tableIdMap().get(tableName);
- assertNotNull("Expected to find a tableId", tableId);
+ assertNotNull(tableId, "Expected to find a tableId");
// add some splits
SortedSet<Text> splits = new TreeSet<>();
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceIT.java b/test/src/main/java/org/apache/accumulo/test/BalanceIT.java
index 9c439fa..5479281 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceIT.java
@@ -25,7 +25,7 @@ import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@ public class BalanceIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(BalanceIT.class);
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java
index 26cfcc6..cc5e15c 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java
@@ -31,14 +31,14 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
// ACCUMULO-3692
public class BalanceWithOfflineTableIT extends ConfigurableMacBase {
@Override
protected int defaultTimeoutSeconds() {
- return 120;
+ return 60 * 2;
}
@Override
@@ -83,7 +83,7 @@ public class BalanceWithOfflineTableIT extends ConfigurableMacBase {
c.instanceOperations().waitForBalance();
return true;
});
- wait.get((2 * defaultTimeoutSeconds()) / 3, TimeUnit.SECONDS);
+ wait.get((2L * defaultTimeoutSeconds()) / 3, TimeUnit.SECONDS);
log.info("Balance succeeded with an offline table");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java
index dd6f4e6..12d4010 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java
@@ -25,12 +25,12 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BatchWriterIT extends AccumuloClusterHarness {
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 30;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
index f67e1da..bc75bbb 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.Map;
@@ -38,7 +38,7 @@ import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java b/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java
index a2ff8e8..ca7a1e1 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.ArrayList;
import java.util.HashMap;
@@ -51,7 +51,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BulkImportMonitoringIT extends ConfigurableMacBase {
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java b/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java
index ce61e70..4225172 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.TreeSet;
@@ -35,7 +35,7 @@ import org.apache.hadoop.fs.FsShell;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +49,7 @@ public class BulkImportSequentialRowsIT extends AccumuloClusterHarness {
private static final long NV = 42000;
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
@@ -89,11 +89,11 @@ public class BulkImportSequentialRowsIT extends AccumuloClusterHarness {
GenerateSequentialRFile.main(new String[] {"-f", rfile.toUri().toString(), "-nr",
Long.toString(NR), "-nv", Long.toString(NV)});
- assertTrue("Expected that " + rfile + " exists, but it does not", fs.exists(rfile));
+ assertTrue(fs.exists(rfile), "Expected that " + rfile + " exists, but it does not");
FsShell fsShell = new FsShell(fs.getConf());
- assertEquals("Failed to chmod " + rootPath, 0,
- fsShell.run(new String[] {"-chmod", "-R", "777", rootPath.toString()}));
+ assertEquals(0, fsShell.run(new String[] {"-chmod", "-R", "777", rootPath.toString()}),
+ "Failed to chmod " + rootPath);
// Add some splits
to.addSplits(tableName, getSplits());
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java b/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java
index 3bae562..217e40c 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.io.File;
@@ -32,7 +32,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +44,7 @@ public class BulkImportVolumeIT extends AccumuloClusterHarness {
Path v1, v2;
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
index ebe8285..e4fe165 100644
--- a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
@@ -44,7 +44,7 @@ import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,8 +54,8 @@ public class CleanWalIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(CleanWalIT.class);
@Override
- public int defaultTimeoutSeconds() {
- return 4 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
}
@Override
@@ -89,7 +89,7 @@ public class CleanWalIT extends AccumuloClusterHarness {
assertEquals(1, count(tableName, client));
for (String table : new String[] {MetadataTable.NAME, RootTable.NAME}) {
log.debug("Checking logs for {}", table);
- assertEquals("Found logs for " + table, 0, countLogs(client));
+ assertEquals(0, countLogs(client), "Found logs for " + table);
}
try (BatchWriter bw = client.createBatchWriter(tableName)) {
diff --git a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
index 0c0b6f3..7e2cce6 100644
--- a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.ArrayList;
import java.util.List;
@@ -41,16 +41,16 @@ import org.apache.accumulo.core.iterators.user.VersioningIterator;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ClientSideIteratorIT extends AccumuloClusterHarness {
private List<Key> resultSet1;
private List<Key> resultSet2;
private List<Key> resultSet3;
- @Before
+ @BeforeEach
public void setupData() {
resultSet1 = new ArrayList<>();
resultSet1.add(new Key("row1", "colf", "colq", 4L));
@@ -77,13 +77,13 @@ public class ClientSideIteratorIT extends AccumuloClusterHarness {
private AccumuloClient client;
private String tableName;
- @Before
+ @BeforeEach
public void setupInstance() {
client = Accumulo.newClient().from(getClientProps()).build();
tableName = getUniqueNames(1)[0];
}
- @After
+ @AfterEach
public void closeClient() {
client.close();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/CloneIT.java b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
index d761702..d414c62 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloneIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-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;
import java.util.HashSet;
import java.util.Map.Entry;
@@ -43,7 +43,7 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.server.util.MetadataTableUtil;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CloneIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java b/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java
index 1eee14f..054f881 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
@@ -30,7 +30,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.functional.ReadWriteIT;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
diff --git a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 86a2b08..8b8535a 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -19,12 +19,12 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Arrays;
@@ -92,10 +92,10 @@ import org.apache.accumulo.test.functional.BadIterator;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,15 +107,15 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
@Override
protected int defaultTimeoutSeconds() {
- return 120;
+ return 60 * 2;
}
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniClusterWithConfig(new Callback());
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
@@ -136,7 +136,7 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
return l;
}
- @Before
+ @BeforeEach
public void deleteUsers() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
Set<String> users = client.securityOperations().listLocalUsers();
@@ -228,7 +228,7 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
cm7.putDelete("tx", "seq");
assertEquals(Status.ACCEPTED, cw.write(cm7).getStatus());
- assertFalse("Did not expect to find any results", scanner.iterator().hasNext());
+ assertFalse(scanner.iterator().hasNext(), "Did not expect to find any results");
// add the row back
assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
@@ -474,15 +474,15 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
cm0.put("tx", "seq", "1");
assertEquals(Status.VIOLATED, cw.write(cm0).getStatus());
- assertFalse("Should find no results in the table is mutation result was violated",
- scanner.iterator().hasNext());
+ assertFalse(scanner.iterator().hasNext(),
+ "Should find no results in the table is mutation result was violated");
ConditionalMutation cm1 = new ConditionalMutation("99006", new Condition("tx", "seq"));
cm1.put("tx", "seq", "1");
assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
- assertTrue("Accepted result should be returned when reading table",
- scanner.iterator().hasNext());
+ assertTrue(scanner.iterator().hasNext(),
+ "Accepted result should be returned when reading table");
}
}
}
@@ -580,8 +580,8 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
while (results.hasNext()) {
Result result = results.next();
String k = new String(result.getMutation().getRow());
- assertFalse("Did not expect to see multiple results for the row: " + k,
- actual.containsKey(k));
+ assertFalse(actual.containsKey(k),
+ "Did not expect to see multiple results for the row: " + k);
actual.put(k, result.getStatus());
}
@@ -716,8 +716,8 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
while (results.hasNext()) {
Result result = results.next();
String k = new String(result.getMutation().getRow());
- assertFalse("Did not expect to see multiple results for the row: " + k,
- actual.containsKey(k));
+ assertFalse(actual.containsKey(k),
+ "Did not expect to see multiple results for the row: " + k);
actual.put(k, result.getStatus());
}
@@ -827,8 +827,8 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
}
}
- assertEquals("Expected only one accepted conditional mutation", 1, accepted);
- assertEquals("Expected two rejected conditional mutations", 2, rejected);
+ assertEquals(1, accepted, "Expected only one accepted conditional mutation");
+ assertEquals(2, rejected, "Expected two rejected conditional mutations");
for (String row : new String[] {"59056", "19059"}) {
scanner.setRange(new Range(row));
@@ -891,7 +891,7 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
count++;
}
- assertEquals("Did not receive the expected number of results", num, count);
+ assertEquals(num, count, "Did not receive the expected number of results");
ArrayList<ConditionalMutation> cml2 = new ArrayList<>(num);
@@ -915,7 +915,7 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
count++;
}
- assertEquals("Did not receive the expected number of results", num, count);
+ assertEquals(num, count, "Did not receive the expected number of results");
}
}
}
@@ -1058,9 +1058,9 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
total++;
}
- assertEquals("Expected one accepted result", 1, accepted);
- assertEquals("Expected two rejected results", 2, rejected);
- assertEquals("Expected three total results", 3, total);
+ assertEquals(1, accepted, "Expected one accepted result");
+ assertEquals(2, rejected, "Expected two rejected results");
+ assertEquals(3, total, "Expected three total results");
}
}
}
@@ -1256,7 +1256,7 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
tp.awaitTermination(1, TimeUnit.MINUTES);
}
- assertFalse("A MutatorTask failed with an exception", failed.get());
+ assertFalse(failed.get(), "A MutatorTask failed with an exception");
}
try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
@@ -1373,9 +1373,9 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
String val = entry.getValue().toString();
if (cf.equals("tx") && cq.equals("seq"))
- assertEquals("Unexpected value in tx:seq", "1", val);
+ assertEquals("1", val, "Unexpected value in tx:seq");
else if (cf.equals("data") && cq.equals("x"))
- assertEquals("Unexpected value in data:x", "a", val);
+ assertEquals("a", val, "Unexpected value in data:x");
else
fail("Saw unexpected column family and qualifier: " + entry);
}
@@ -1395,8 +1395,8 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
String table = getUniqueNames(1)[0];
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
- assertThrows("Creating conditional writer for table that doesn't exist should fail",
- TableNotFoundException.class, () -> client.createConditionalWriter(table));
+ assertThrows(TableNotFoundException.class, () -> client.createConditionalWriter(table),
+ "Creating conditional writer for table that doesn't exist should fail");
client.tableOperations().create(table);
@@ -1445,8 +1445,8 @@ public class ConditionalWriterIT extends SharedMiniClusterBase {
});
assertSame(TableOfflineException.class, ae.getCause().getClass());
- assertThrows("Expected exception creating conditional writer to offline table",
- TableOfflineException.class, () -> client.createConditionalWriter(table));
+ assertThrows(TableOfflineException.class, () -> client.createConditionalWriter(table),
+ "Expected exception creating conditional writer to offline table");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java b/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java
index 4612737..36d1f04 100644
--- a/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.net.URL;
import java.util.ArrayList;
@@ -53,7 +53,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.gson.Gson;
@@ -181,7 +181,7 @@ public class CountNameNodeOpsBulkIT extends ConfigurableMacBase {
// counts for old bulk import:
// Expected number of FileInfoOps was between 1000 and 2100
// new bulk import is way better :)
- assertEquals("unexpected number of FileInfoOps", 20, getFileInfoOpts);
+ assertEquals(20, getFileInfoOpts, "unexpected number of FileInfoOps");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/DeprecatedPropertyUtilIT.java b/test/src/main/java/org/apache/accumulo/test/DeprecatedPropertyUtilIT.java
index c168812..350a1b1 100644
--- a/test/src/main/java/org/apache/accumulo/test/DeprecatedPropertyUtilIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/DeprecatedPropertyUtilIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.Map;
@@ -31,9 +31,9 @@ import org.apache.accumulo.core.conf.DeprecatedPropertyUtil.PropertyRenamer;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.server.util.SystemPropUtil;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class DeprecatedPropertyUtilIT extends ConfigurableMacBase {
private static final String OLD_SYSTEM_PREFIX = "old.system.custom.";
@@ -51,13 +51,13 @@ public class DeprecatedPropertyUtilIT extends ConfigurableMacBase {
}
}
- @Before
+ @BeforeEach
public void setUpRenamers() throws Exception {
super.setUp();
TestPropertyUtil.registerTestRenamer();
}
- @After
+ @AfterEach
public void tearDownRenamers() {
super.tearDown();
TestPropertyUtil.removeTestRenamer();
@@ -70,34 +70,34 @@ public class DeprecatedPropertyUtilIT extends ConfigurableMacBase {
String newProp = Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + "test.prop";
String propValue = "dummy prop value";
Map<String,String> config = client.instanceOperations().getSystemConfiguration();
- assertFalse(oldProp + " was in the config!", config.containsKey(newProp));
- assertFalse(newProp + " was in the config!", config.containsKey(newProp));
+ assertFalse(config.containsKey(newProp), oldProp + " was in the config!");
+ assertFalse(config.containsKey(newProp), newProp + " was in the config!");
// create using old prop and verify new prop was created
SystemPropUtil.setSystemProperty(getServerContext(), oldProp, propValue);
config = client.instanceOperations().getSystemConfiguration();
- assertFalse(oldProp + " was in the config after set call!", config.containsKey(oldProp));
- assertTrue(newProp + " was not in the config after set call!", config.containsKey(newProp));
+ assertFalse(config.containsKey(oldProp), oldProp + " was in the config after set call!");
+ assertTrue(config.containsKey(newProp), newProp + " was not in the config after set call!");
assertEquals(propValue, config.get(newProp));
// remove using new prop and verify both are gone
SystemPropUtil.removeSystemProperty(getServerContext(), newProp);
config = client.instanceOperations().getSystemConfiguration();
- assertFalse(oldProp + " was in the config after remove call!", config.containsKey(oldProp));
- assertFalse(newProp + " was in the config after remove call!", config.containsKey(newProp));
+ assertFalse(config.containsKey(oldProp), oldProp + " was in the config after remove call!");
+ assertFalse(config.containsKey(newProp), newProp + " was in the config after remove call!");
// re-create using new prop and verify new prop was created
SystemPropUtil.setSystemProperty(getServerContext(), newProp, propValue);
config = client.instanceOperations().getSystemConfiguration();
- assertFalse(oldProp + " was in the config after set call!", config.containsKey(oldProp));
- assertTrue(newProp + " was not in the config after set call!", config.containsKey(newProp));
+ assertFalse(config.containsKey(oldProp), oldProp + " was in the config after set call!");
+ assertTrue(config.containsKey(newProp), newProp + " was not in the config after set call!");
assertEquals(propValue, config.get(newProp));
// remove using old prop and verify both are gone
SystemPropUtil.removeSystemProperty(getServerContext(), oldProp);
config = client.instanceOperations().getSystemConfiguration();
- assertFalse(oldProp + " was in the config after remove call!", config.containsKey(oldProp));
- assertFalse(newProp + " was in the config after remove call!", config.containsKey(newProp));
+ assertFalse(config.containsKey(oldProp), oldProp + " was in the config after remove call!");
+ assertFalse(config.containsKey(newProp), newProp + " was in the config after remove call!");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
index 8801529..4ad7f80 100644
--- a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.test;
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
import static org.apache.accumulo.minicluster.ServerType.TABLET_SERVER;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.concurrent.TimeUnit;
@@ -40,7 +40,7 @@ import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
diff --git a/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java b/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java
index 2073ddc..b686d1f 100644
--- a/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-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;
import java.io.File;
import java.io.FileInputStream;
@@ -33,21 +33,19 @@ import org.apache.accumulo.server.util.Admin;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class DumpConfigIT extends ConfigurableMacBase {
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir"), "target"));
+ @TempDir
+ private static File tempDir;
@Override
- public int defaultTimeoutSeconds() {
- return 2 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Override
@@ -59,7 +57,8 @@ public class DumpConfigIT extends ConfigurableMacBase {
justification = "user.dir is suitable test input")
@Test
public void test() throws Exception {
- File folder = tempFolder.newFolder();
+ File folder = new File(tempDir, testName() + "/");
+ assertTrue(folder.isDirectory() || folder.mkdir(), "failed to create dir: " + folder);
File siteFileBackup = new File(folder, "accumulo.properties.bak");
assertFalse(siteFileBackup.exists());
assertEquals(0, exec(Admin.class, "dumpConfig", "-a", "-d", folder.getPath()).waitFor());
diff --git a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
index a0e0aa0..0c09dfb 100644
--- a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-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;
import java.io.File;
import java.io.FileOutputStream;
@@ -54,12 +54,13 @@ import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ExistingMacIT extends ConfigurableMacBase {
+
@Override
- public int defaultTimeoutSeconds() {
- return 4 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
}
@Override
@@ -179,9 +180,8 @@ public class ExistingMacIT extends ConfigurableMacBase {
MiniAccumuloClusterImpl accumulo2 = new MiniAccumuloClusterImpl(macConfig2);
- RuntimeException e = assertThrows(
- "A 2nd MAC instance should not be able to start over an existing MAC instance",
- RuntimeException.class, accumulo2::start);
+ RuntimeException e = assertThrows(RuntimeException.class, accumulo2::start,
+ "A 2nd MAC instance should not be able to start over an existing MAC instance");
assertEquals("The Accumulo instance being used is already running. Aborting.",
e.getMessage());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
index ce02d1c..a0ba238 100644
--- a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.ArrayList;
import java.util.Map.Entry;
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class FindMaxIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java b/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java
index 52ce736..2b0459d 100644
--- a/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
@@ -36,13 +36,18 @@ import org.apache.hadoop.fs.LocatedFileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.fs.RemoteIterator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
public class GarbageCollectWALIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 3;
+ }
+
+ @Override
protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_HOST, "5s");
cfg.setProperty(Property.GC_CYCLE_START, "1s");
@@ -51,11 +56,6 @@ public class GarbageCollectWALIT extends ConfigurableMacBase {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 3 * 60;
- }
-
@Test
public void test() throws Exception {
// not yet, please
diff --git a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
index 92471b9..750a3f6 100644
--- a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
@@ -18,11 +18,11 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+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;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -50,7 +50,7 @@ import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -100,10 +100,10 @@ public class ImportExportIT extends AccumuloClusterHarness {
fs.deleteOnExit(baseDir);
if (fs.exists(baseDir)) {
log.info("{} exists on filesystem, deleting", baseDir);
- assertTrue("Failed to deleted " + baseDir, fs.delete(baseDir, true));
+ assertTrue(fs.delete(baseDir, true), "Failed to deleted " + baseDir);
}
log.info("Creating {}", baseDir);
- assertTrue("Failed to create " + baseDir, fs.mkdirs(baseDir));
+ assertTrue(fs.mkdirs(baseDir), "Failed to create " + baseDir);
Path exportDir = new Path(baseDir, "export");
fs.deleteOnExit(exportDir);
Path importDirA = new Path(baseDir, "import-a");
@@ -111,7 +111,7 @@ public class ImportExportIT extends AccumuloClusterHarness {
fs.deleteOnExit(importDirA);
fs.deleteOnExit(importDirB);
for (Path p : new Path[] {exportDir, importDirA, importDirB}) {
- assertTrue("Failed to create " + baseDir, fs.mkdirs(p));
+ assertTrue(fs.mkdirs(p), "Failed to create " + baseDir);
}
Set<String> importDirs = Set.of(importDirA.toString(), importDirB.toString());
@@ -129,7 +129,7 @@ public class ImportExportIT extends AccumuloClusterHarness {
// Make sure the distcp.txt file that exporttable creates is available
Path distcp = new Path(exportDir, "distcp.txt");
fs.deleteOnExit(distcp);
- assertTrue("Distcp file doesn't exist", fs.exists(distcp));
+ assertTrue(fs.exists(distcp), "Distcp file doesn't exist");
FSDataInputStream is = fs.open(distcp);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
@@ -138,10 +138,10 @@ public class ImportExportIT extends AccumuloClusterHarness {
while ((line = reader.readLine()) != null) {
Path p = new Path(line.substring(5));
- assertTrue("File doesn't exist: " + p, fs.exists(p));
+ assertTrue(fs.exists(p), "File doesn't exist: " + p);
Path importDir = importDirAry[random.nextInt(importDirAry.length)];
Path dest = new Path(importDir, p.getName());
- assertFalse("Did not expect " + dest + " to exist", fs.exists(dest));
+ assertFalse(fs.exists(dest), "Did not expect " + dest + " to exist");
FileUtil.copy(fs, p, fs, dest, false, fs.getConf());
}
@@ -173,11 +173,11 @@ public class ImportExportIT extends AccumuloClusterHarness {
// The file should be an absolute URI (file:///...), not a relative path
// (/b-000.../I000001.rf)
String fileUri = k.getColumnQualifier().toString();
- assertFalse("Imported files should have absolute URIs, not relative: " + fileUri,
- looksLikeRelativePath(fileUri));
+ assertFalse(looksLikeRelativePath(fileUri),
+ "Imported files should have absolute URIs, not relative: " + fileUri);
} else if (k.getColumnFamily().equals(ServerColumnFamily.NAME)) {
- assertFalse("Server directory should have absolute URI, not relative: " + value,
- looksLikeRelativePath(value));
+ assertFalse(looksLikeRelativePath(value),
+ "Server directory should have absolute URI, not relative: " + value);
} else {
fail("Got expected pair: " + k + "=" + fileEntry.getValue());
}
@@ -196,15 +196,15 @@ public class ImportExportIT extends AccumuloClusterHarness {
Iterator<Entry<Key,Value>> src =
client.createScanner(srcTable, Authorizations.EMPTY).iterator(),
dest = client.createScanner(destTable, Authorizations.EMPTY).iterator();
- assertTrue("Could not read any data from source table", src.hasNext());
- assertTrue("Could not read any data from destination table", dest.hasNext());
+ assertTrue(src.hasNext(), "Could not read any data from source table");
+ assertTrue(dest.hasNext(), "Could not read any data from destination table");
while (src.hasNext() && dest.hasNext()) {
Entry<Key,Value> orig = src.next(), copy = dest.next();
assertEquals(orig.getKey(), copy.getKey());
assertEquals(orig.getValue(), copy.getValue());
}
- assertFalse("Source table had more data to read", src.hasNext());
- assertFalse("Dest table had more data to read", dest.hasNext());
+ assertFalse(src.hasNext(), "Source table had more data to read");
+ assertFalse(dest.hasNext(), "Dest table had more data to read");
}
private boolean looksLikeRelativePath(String uri) {
diff --git a/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java b/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
index 5a3ca3d..e1969eb 100644
--- a/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/InMemoryMapIT.java
@@ -18,8 +18,10 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.apache.accumulo.harness.AccumuloITBase.SUNNY_DAY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
@@ -45,18 +47,17 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.harness.WithTestNames;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.test.categories.SunnyDayTests;
import org.apache.accumulo.test.functional.NativeMapIT;
import org.apache.accumulo.tserver.InMemoryMap;
import org.apache.accumulo.tserver.MemKey;
import org.apache.accumulo.tserver.memory.NativeMapLoader;
import org.easymock.EasyMock;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,16 +82,15 @@ import org.slf4j.LoggerFactory;
* DefaultMap could move to a unit test in tserver, but they are here for convenience of viewing
* both at the same time.
*/
-@Category(SunnyDayTests.class)
-public class InMemoryMapIT {
+@Tag(SUNNY_DAY)
+public class InMemoryMapIT extends WithTestNames {
private static final Logger log = LoggerFactory.getLogger(InMemoryMapIT.class);
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
- @BeforeClass
+ @BeforeAll
public static void ensureNativeLibrary() {
File nativeMapLocation = NativeMapIT.nativeMapLocation();
NativeMapLoader.loadForTest(List.of(nativeMapLocation), () -> fail("Can't load native maps"));
@@ -213,70 +213,72 @@ public class InMemoryMapIT {
}
private void assertEquivalentMutate(List<Mutation> mutations) {
- InMemoryMap defaultMap = null;
- InMemoryMap nativeMapWrapper = null;
- InMemoryMap localityGroupMap = null;
- InMemoryMap localityGroupMapWithNative = null;
+
+ String[] tempFolders = new String[4];
+ for (int i = 0; i < tempFolders.length; i++) {
+ File dir = new File(tempDir, testName() + "_" + i);
+ assertTrue(dir.isDirectory() || dir.mkdir());
+ tempFolders[i] = dir.getAbsolutePath();
+ }
+
+ Map<String,String> defaultMapConfig = new HashMap<>();
+ defaultMapConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "false");
+ defaultMapConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(), tempFolders[0]);
+ defaultMapConfig.put(Property.TABLE_LOCALITY_GROUPS.getKey(), "");
+
+ Map<String,String> nativeMapConfig = new HashMap<>();
+ nativeMapConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "true");
+ nativeMapConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(), tempFolders[1]);
+ nativeMapConfig.put(Property.TABLE_LOCALITY_GROUPS.getKey(), "");
+
+ Map<String,String> localityGroupConfig = new HashMap<>();
+ localityGroupConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "false");
+ localityGroupConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(), tempFolders[2]);
+
+ Map<String,String> localityGroupNativeConfig = new HashMap<>();
+ localityGroupNativeConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "true");
+ localityGroupNativeConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(), tempFolders[3]);
+
+ TableId testId = TableId.of("TEST");
try {
- Map<String,String> defaultMapConfig = new HashMap<>();
- defaultMapConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "false");
- defaultMapConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(),
- tempFolder.newFolder().getAbsolutePath());
- defaultMapConfig.put(Property.TABLE_LOCALITY_GROUPS.getKey(), "");
- Map<String,String> nativeMapConfig = new HashMap<>();
- nativeMapConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "true");
- nativeMapConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(),
- tempFolder.newFolder().getAbsolutePath());
- nativeMapConfig.put(Property.TABLE_LOCALITY_GROUPS.getKey(), "");
- Map<String,String> localityGroupConfig = new HashMap<>();
- localityGroupConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "false");
- localityGroupConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(),
- tempFolder.newFolder().getAbsolutePath());
- Map<String,String> localityGroupNativeConfig = new HashMap<>();
- localityGroupNativeConfig.put(Property.TSERV_NATIVEMAP_ENABLED.getKey(), "true");
- localityGroupNativeConfig.put(Property.TSERV_MEMDUMP_DIR.getKey(),
- tempFolder.newFolder().getAbsolutePath());
-
- TableId testId = TableId.of("TEST");
-
- defaultMap =
+ InMemoryMap defaultMap =
new InMemoryMap(new ConfigurationCopy(defaultMapConfig), getServerContext(), testId);
- nativeMapWrapper =
+ InMemoryMap nativeMapWrapper =
new InMemoryMap(new ConfigurationCopy(nativeMapConfig), getServerContext(), testId);
- localityGroupMap = new InMemoryMap(
+ InMemoryMap localityGroupMap = new InMemoryMap(
updateConfigurationForLocalityGroups(new ConfigurationCopy(localityGroupConfig)),
getServerContext(), testId);
- localityGroupMapWithNative = new InMemoryMap(
+ InMemoryMap localityGroupMapWithNative = new InMemoryMap(
updateConfigurationForLocalityGroups(new ConfigurationCopy(localityGroupNativeConfig)),
getServerContext(), testId);
+
+ // ensure the maps are correct type
+ assertEquals(InMemoryMap.TYPE_DEFAULT_MAP, defaultMap.getMapType(), "Not a DefaultMap");
+ assertEquals(InMemoryMap.TYPE_NATIVE_MAP_WRAPPER, nativeMapWrapper.getMapType(),
+ "Not a NativeMapWrapper");
+ assertEquals(InMemoryMap.TYPE_LOCALITY_GROUP_MAP, localityGroupMap.getMapType(),
+ "Not a LocalityGroupMap");
+ assertEquals(InMemoryMap.TYPE_LOCALITY_GROUP_MAP_NATIVE,
+ localityGroupMapWithNative.getMapType(), "Not a LocalityGroupMap with native");
+
+ int count = 0;
+ for (Mutation m : mutations) {
+ count += m.size();
+ }
+ defaultMap.mutate(mutations, count);
+ nativeMapWrapper.mutate(mutations, count);
+ localityGroupMap.mutate(mutations, count);
+ localityGroupMapWithNative.mutate(mutations, count);
+
+ // let's use the transitive property to assert all four are equivalent
+ assertMutatesEquivalent(mutations, defaultMap, nativeMapWrapper);
+ assertMutatesEquivalent(mutations, defaultMap, localityGroupMap);
+ assertMutatesEquivalent(mutations, defaultMap, localityGroupMapWithNative);
} catch (Exception e) {
log.error("Error getting new InMemoryMap ", e);
fail(e.getMessage());
}
-
- // ensure the maps are correct type
- assertEquals("Not a DefaultMap", InMemoryMap.TYPE_DEFAULT_MAP, defaultMap.getMapType());
- assertEquals("Not a NativeMapWrapper", InMemoryMap.TYPE_NATIVE_MAP_WRAPPER,
- nativeMapWrapper.getMapType());
- assertEquals("Not a LocalityGroupMap", InMemoryMap.TYPE_LOCALITY_GROUP_MAP,
- localityGroupMap.getMapType());
- assertEquals("Not a LocalityGroupMap with native", InMemoryMap.TYPE_LOCALITY_GROUP_MAP_NATIVE,
- localityGroupMapWithNative.getMapType());
-
- int count = 0;
- for (Mutation m : mutations) {
- count += m.size();
- }
- defaultMap.mutate(mutations, count);
- nativeMapWrapper.mutate(mutations, count);
- localityGroupMap.mutate(mutations, count);
- localityGroupMapWithNative.mutate(mutations, count);
-
- // let's use the transitive property to assert all four are equivalent
- assertMutatesEquivalent(mutations, defaultMap, nativeMapWrapper);
- assertMutatesEquivalent(mutations, defaultMap, localityGroupMap);
- assertMutatesEquivalent(mutations, defaultMap, localityGroupMapWithNative);
}
/**
@@ -305,14 +307,14 @@ public class InMemoryMapIT {
List<MemKey> memKeys1 = getArrayOfMemKeys(imm1);
List<MemKey> memKeys2 = getArrayOfMemKeys(imm2);
- assertEquals("Not all key value pairs included: " + dumpInMemoryMap(imm1, memKeys1),
- mutationKVPairs, memKeys1.size());
- assertEquals("InMemoryMaps differ in size: " + dumpInMemoryMap(imm1, memKeys1) + "\n"
- + dumpInMemoryMap(imm2, memKeys2), memKeys1.size(), memKeys2.size());
- assertEquals("InMemoryMap did not have distinct kvCounts " + dumpInMemoryMap(imm1, memKeys1),
- mutationKVPairs, getUniqKVCount(memKeys1));
- assertEquals("InMemoryMap did not have distinct kvCounts " + dumpInMemoryMap(imm2, memKeys2),
- mutationKVPairs, getUniqKVCount(memKeys2));
+ assertEquals(mutationKVPairs, memKeys1.size(),
+ "Not all key value pairs included: " + dumpInMemoryMap(imm1, memKeys1));
+ assertEquals(memKeys1.size(), memKeys2.size(), "InMemoryMaps differ in size: "
+ + dumpInMemoryMap(imm1, memKeys1) + "\n" + dumpInMemoryMap(imm2, memKeys2));
+ assertEquals(mutationKVPairs, getUniqKVCount(memKeys1),
+ "InMemoryMap did not have distinct kvCounts " + dumpInMemoryMap(imm1, memKeys1));
+ assertEquals(mutationKVPairs, getUniqKVCount(memKeys2),
+ "InMemoryMap did not have distinct kvCounts " + dumpInMemoryMap(imm2, memKeys2));
}
diff --git a/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java b/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
index c5c1cc3..5661406 100644
--- a/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
@@ -33,7 +33,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -41,7 +41,7 @@ import com.google.common.collect.Iterators;
public class InterruptibleScannersIT extends AccumuloClusterHarness {
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
@@ -90,8 +90,8 @@ public class InterruptibleScannersIT extends AccumuloClusterHarness {
thread.start();
try {
// Use the scanner, expect problems
- assertThrows("Scan should not succeed", RuntimeException.class,
- () -> Iterators.size(scanner.iterator()));
+ assertThrows(RuntimeException.class, () -> Iterators.size(scanner.iterator()),
+ "Scan should not succeed");
} finally {
thread.join();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java b/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
index ef92b1e..43e9cd9 100644
--- a/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -38,7 +38,7 @@ import org.apache.accumulo.core.iterators.user.IntersectingIterator;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class IsolationAndDeepCopyIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/IteratorEnvIT.java b/test/src/main/java/org/apache/accumulo/test/IteratorEnvIT.java
index b5e7e54..516b3ab 100644
--- a/test/src/main/java/org/apache/accumulo/test/IteratorEnvIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/IteratorEnvIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.Collections;
@@ -46,9 +46,9 @@ import org.apache.accumulo.core.spi.common.ServiceEnvironment;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Test that objects in IteratorEnvironment returned from the server are as expected.
@@ -56,13 +56,13 @@ import org.junit.Test;
public class IteratorEnvIT extends AccumuloClusterHarness {
@Override
- public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setNumTservers(1);
+ protected int defaultTimeoutSeconds() {
+ return 60;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 60;
+ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setNumTservers(1);
}
private AccumuloClient client;
@@ -180,12 +180,12 @@ public class IteratorEnvIT extends AccumuloClusterHarness {
throw new RuntimeException("Test failed - Error getting Table ID");
}
- @Before
+ @BeforeEach
public void setup() {
client = Accumulo.newClient().from(getClientProps()).build();
}
- @After
+ @AfterEach
public void finish() {
if (client != null)
client.close();
diff --git a/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java b/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
index 07c6599..ed88de8 100644
--- a/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -33,12 +33,12 @@ import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class KeyValueEqualityIT extends AccumuloClusterHarness {
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
@@ -74,8 +74,8 @@ public class KeyValueEqualityIT extends AccumuloClusterHarness {
assertEquals(e1, e2);
assertEquals(e1.hashCode(), e2.hashCode());
}
- assertFalse("table1 had more data to read", t1.hasNext());
- assertFalse("table2 had more data to read", t2.hasNext());
+ assertFalse(t1.hasNext(), "table1 had more data to read");
+ assertFalse(t2.hasNext(), "table2 had more data to read");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
index 6cf9ac8..8043d31 100644
--- a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.test;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-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;
import java.util.HashMap;
import java.util.Map;
@@ -45,7 +45,8 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,6 +54,11 @@ public class LargeSplitRowIT extends ConfigurableMacBase {
private static final Logger log = LoggerFactory.getLogger(LargeSplitRowIT.class);
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
@@ -61,11 +67,6 @@ public class LargeSplitRowIT extends ConfigurableMacBase {
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 60;
- }
-
// User added split
@Test
public void userAddedSplit() throws Exception {
@@ -120,7 +121,8 @@ public class LargeSplitRowIT extends ConfigurableMacBase {
}
// Test tablet server split with 250 entries with all the same prefix
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60)
public void automaticSplitWith250Same() throws Exception {
log.info("Automatic with 250 with same prefix");
@@ -182,7 +184,8 @@ public class LargeSplitRowIT extends ConfigurableMacBase {
}
// 10 0's; 10 2's; 10 4's... 10 30's etc
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60)
public void automaticSplitWithGaps() throws Exception {
log.info("Automatic Split With Gaps");
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
@@ -191,7 +194,8 @@ public class LargeSplitRowIT extends ConfigurableMacBase {
}
// 10 0's; 10 1's; 10 2's... 10 15's etc
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60)
public void automaticSplitWithoutGaps() throws Exception {
log.info("Automatic Split Without Gaps");
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
@@ -199,7 +203,8 @@ public class LargeSplitRowIT extends ConfigurableMacBase {
}
}
- @Test(timeout = 60_000)
+ @Test
+ @Timeout(60)
public void automaticSplitLater() throws Exception {
log.info("Split later");
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
index 44fb748..6939519 100644
--- a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.HashMap;
@@ -45,13 +45,13 @@ import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.dataImpl.TabletIdImpl;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LocatorIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 120;
+ return 60 * 2;
}
private void assertContains(Locations locations, HashSet<String> tservers,
@@ -70,9 +70,9 @@ public class LocatorIT extends AccumuloClusterHarness {
TabletId tid = entry.getKey();
String location = locations.getTabletLocation(tid);
- assertNotNull("Location for " + tid + " was null", location);
- assertTrue("Unknown location " + location, tservers.contains(location));
- assertEquals("Expected <host>:<port> " + location, 2, location.split(":").length);
+ assertNotNull(location, "Location for " + tid + " was null");
+ assertTrue(tservers.contains(location), "Unknown location " + location);
+ assertEquals(2, location.split(":").length, "Expected <host>:<port> " + location);
}
diff --git a/test/src/main/java/org/apache/accumulo/test/ManagerRepairsDualAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/ManagerRepairsDualAssignmentIT.java
index a48fae0..a951c92 100644
--- a/test/src/main/java/org/apache/accumulo/test/ManagerRepairsDualAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ManagerRepairsDualAssignmentIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.util.HashSet;
import java.util.Set;
@@ -51,15 +51,15 @@ import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
public class ManagerRepairsDualAssignmentIT extends ConfigurableMacBase {
@Override
- public int defaultTimeoutSeconds() {
- return 5 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
}
@Override
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
index 6a90b91..5158408 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
@@ -33,12 +33,12 @@ import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.util.MetadataTableUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MetaConstraintRetryIT extends AccumuloClusterHarness {
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 30;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java b/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
index d2ec934..b5f30fa 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-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;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -48,17 +48,17 @@ import com.google.common.collect.Iterators;
public class MetaGetsReadersIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
cfg.setProperty(Property.TSERV_SCAN_MAX_OPENFILES, "2");
cfg.setProperty(Property.TABLE_BLOCKCACHE_ENABLED, "false");
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
- }
-
private static Thread slowScan(final AccumuloClient c, final String tableName,
final AtomicBoolean stop) {
return new Thread(() -> {
@@ -109,7 +109,7 @@ public class MetaGetsReadersIT extends ConfigurableMacBase {
long delay = System.currentTimeMillis() - now;
System.out.println("Delay = " + delay);
- assertTrue("metadata table scan was slow", delay < 1000);
+ assertTrue(delay < 1000, "metadata table scan was slow");
assertFalse(stop.get());
stop.set(true);
t1.interrupt();
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
index 25e1225..6a609f4 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import java.util.SortedSet;
@@ -39,7 +39,7 @@ import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -47,6 +47,11 @@ import com.google.common.collect.Iterators;
public class MetaRecoveryIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
cfg.setProperty(Property.GC_CYCLE_DELAY, "1s");
@@ -55,11 +60,6 @@ public class MetaRecoveryIT extends ConfigurableMacBase {
cfg.setProperty(Property.TSERV_WAL_MAX_SIZE, "1048576");
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void test() throws Exception {
String[] tables = getUniqueNames(10);
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java b/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java
index 1c798e7..6107d4d 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.Arrays;
import java.util.Collection;
@@ -37,9 +37,9 @@ import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,11 +49,11 @@ public class MetaSplitIT extends AccumuloClusterHarness {
private Collection<Text> metadataSplits = null;
@Override
- public int defaultTimeoutSeconds() {
- return 3 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 3;
}
- @Before
+ @BeforeEach
public void saveMetadataSplits() throws Exception {
if (getClusterType() == ClusterType.STANDALONE) {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
@@ -71,7 +71,7 @@ public class MetaSplitIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void restoreMetadataSplits() throws Exception {
if (metadataSplits != null) {
log.info("Restoring split on metadata table");
@@ -145,7 +145,7 @@ public class MetaSplitIT extends AccumuloClusterHarness {
Thread.sleep(2000);
}
Collection<Text> splits = opts.listSplits(MetadataTable.NAME);
- assertEquals("Actual metadata table splits: " + splits, numSplits, splits.size());
+ assertEquals(numSplits, splits.size(), "Actual metadata table splits: " + splits);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
index cd74f62..1ff40ff 100644
--- a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.test;
import static java.nio.charset.StandardCharsets.UTF_8;
-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;
import java.io.File;
import java.util.UUID;
@@ -50,9 +50,9 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,7 +66,7 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase {
@Override
protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ return 60 * 2;
}
@Override
@@ -78,7 +78,7 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase {
conf.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Before
+ @BeforeEach
public void setupMetadataPermission() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
rootHasWritePermission = client.securityOperations().hasTablePermission("root",
@@ -92,7 +92,7 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase {
}
}
- @After
+ @AfterEach
public void resetMetadataPermission() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
// Final state doesn't match the original
@@ -128,15 +128,14 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase {
fs.create(new Path(emptyWalog.toURI())).close();
- assertTrue("root user did not have write permission to metadata table",
- client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
- TablePermission.WRITE));
+ assertTrue(client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
+ TablePermission.WRITE), "root user did not have write permission to metadata table");
String tableName = getUniqueNames(1)[0];
client.tableOperations().create(tableName);
TableId tableId = TableId.of(client.tableOperations().tableIdMap().get(tableName));
- assertNotNull("Table ID was null", tableId);
+ assertNotNull(tableId, "Table ID was null");
LogEntry logEntry =
new LogEntry(new KeyExtent(tableId, null, null), 0, emptyWalog.toURI().toString());
@@ -188,15 +187,14 @@ public class MissingWalHeaderCompletesRecoveryIT extends ConfigurableMacBase {
DfsLogger.LOG_FILE_HEADER_V4.length() / 2);
wal.close();
- assertTrue("root user did not have write permission to metadata table",
- client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
- TablePermission.WRITE));
+ assertTrue(client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
+ TablePermission.WRITE), "root user did not have write permission to metadata table");
String tableName = getUniqueNames(1)[0];
client.tableOperations().create(tableName);
TableId tableId = TableId.of(client.tableOperations().tableIdMap().get(tableName));
- assertNotNull("Table ID was null", tableId);
+ assertNotNull(tableId, "Table ID was null");
LogEntry logEntry = new LogEntry(null, 0, partialHeaderWalog.toURI().toString());
diff --git a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index 30233b4..a160d10 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-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;
import java.util.Arrays;
import java.util.HashMap;
@@ -41,9 +41,9 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Maps;
@@ -53,17 +53,17 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
private MultiTableBatchWriter mtbw;
@Override
- public int defaultTimeoutSeconds() {
- return 5 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
}
- @Before
+ @BeforeEach
public void setUpArgs() {
accumuloClient = Accumulo.newClient().from(getClientProps()).build();
mtbw = getMultiTableBatchWriter();
}
- @After
+ @AfterEach
public void closeClient() {
accumuloClient.close();
}
@@ -117,7 +117,7 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(),
entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
}
- assertEquals("Differing results for " + table1, table1Expectations, actual);
+ assertEquals(table1Expectations, actual, "Differing results for " + table1);
}
try (Scanner s = accumuloClient.createScanner(table2, new Authorizations())) {
@@ -127,7 +127,7 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(),
entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
}
- assertEquals("Differing results for " + table2, table2Expectations, actual);
+ assertEquals(table2Expectations, actual, "Differing results for " + table2);
}
} finally {
@@ -184,7 +184,7 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(),
entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
}
- assertEquals("Differing results for " + table, expectations, actual);
+ assertEquals(expectations, actual, "Differing results for " + table);
}
}
} finally {
@@ -219,13 +219,13 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
// MTBW is still caching this name to the correct table, but we should invalidate its cache
// after seeing the rename
- assertThrows("Should not be able to find this table", TableNotFoundException.class,
- () -> mtbw.getBatchWriter(table1));
+ assertThrows(TableNotFoundException.class, () -> mtbw.getBatchWriter(table1),
+ "Should not be able to find this table");
tops.rename(table2, newTable2);
- assertThrows("Should not be able to find this table", TableNotFoundException.class,
- () -> mtbw.getBatchWriter(table2));
+ assertThrows(TableNotFoundException.class, () -> mtbw.getBatchWriter(table2),
+ "Should not be able to find this table");
bw1 = mtbw.getBatchWriter(newTable1);
bw2 = mtbw.getBatchWriter(newTable2);
@@ -253,7 +253,7 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(),
entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
}
- assertEquals("Differing results for " + table, expectations, actual);
+ assertEquals(expectations, actual, "Differing results for " + table);
}
}
} finally {
@@ -288,11 +288,11 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
tops.rename(table1, newTable1);
tops.rename(table2, newTable2);
- assertThrows("Should not have gotten batchwriter for " + table1, TableNotFoundException.class,
- () -> mtbw.getBatchWriter(table1));
+ assertThrows(TableNotFoundException.class, () -> mtbw.getBatchWriter(table1),
+ "Should not have gotten batchwriter for " + table1);
- assertThrows("Should not have gotten batchwriter for " + table2, TableNotFoundException.class,
- () -> mtbw.getBatchWriter(table2));
+ assertThrows(TableNotFoundException.class, () -> mtbw.getBatchWriter(table2),
+ "Should not have gotten batchwriter for " + table2);
} finally {
if (mtbw != null) {
mtbw.close();
@@ -348,7 +348,7 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
}
}
- assertTrue("Expected mutations to be rejected.", mutationsRejected);
+ assertTrue(mutationsRejected, "Expected mutations to be rejected.");
}
@Test
@@ -397,6 +397,6 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
}
}
- assertTrue("Expected mutations to be rejected.", mutationsRejected);
+ assertTrue(mutationsRejected, "Expected mutations to be rejected.");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
index 8873272..890cd68 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-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;
import java.io.IOException;
import java.util.Map.Entry;
@@ -43,13 +43,18 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
public class MultiTableRecoveryIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
+ }
+
+ @Override
protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
@@ -59,11 +64,6 @@ public class MultiTableRecoveryIT extends ConfigurableMacBase {
cfg.setProperty(Property.TSERV_WAL_SORT_FILE_PREFIX + "compress.type", "none");
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 5 * 60;
- }
-
@Test
public void testRecoveryOverMultipleTables() throws Exception {
final int N = 3;
diff --git a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
index dc13418..daed3a1 100644
--- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
@@ -19,13 +19,14 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+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.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.Arrays;
@@ -79,51 +80,50 @@ import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.util.tables.TableNameUtil;
import org.apache.accumulo.harness.SharedMiniClusterBase;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.accumulo.test.constraints.NumericValueConstraint;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.function.ThrowingRunnable;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
/**
* Test different namespace permissions
*/
-@Category(MiniClusterOnlyTests.class)
+@Tag(MINI_CLUSTER_ONLY)
public class NamespacesIT extends SharedMiniClusterBase {
private AccumuloClient c;
private String namespace;
private static final int MAX_NAMESPACE_LEN = 1024;
- @BeforeClass
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
- @Override
- public int defaultTimeoutSeconds() {
- return 60;
- }
-
- @Before
+ @BeforeEach
public void setupConnectorAndNamespace() {
// prepare a unique namespace and get a new root client for each test
c = Accumulo.newClient().from(getClientProps()).build();
namespace = "ns_" + getUniqueNames(1)[0];
}
- @After
+ @AfterEach
public void swingMjölnir() throws Exception {
if (c == null) {
return;
@@ -165,14 +165,14 @@ public class NamespacesIT extends SharedMiniClusterBase {
}
@Test
- public void createTableInAccumuloNamespace() throws Exception {
+ public void createTableInAccumuloNamespace() {
String tableName = Namespace.ACCUMULO.name() + ".1";
assertFalse(c.tableOperations().exists(tableName));
assertThrows(AccumuloException.class, () -> c.tableOperations().create(tableName));
}
@Test
- public void deleteBuiltinNamespaces() throws Exception {
+ public void deleteBuiltinNamespaces() {
assertThrows(AccumuloSecurityException.class,
() -> c.namespaceOperations().delete(Namespace.DEFAULT.name()));
assertThrows(AccumuloSecurityException.class,
@@ -548,7 +548,7 @@ public class NamespacesIT extends SharedMiniClusterBase {
}
}
- assertNotNull("Namespace constraint ID should not be null", namespaceNum);
+ assertNotNull(namespaceNum, "Namespace constraint ID should not be null");
c.namespaceOperations().removeConstraint(namespace, namespaceNum);
// loop until constraint is removed from config (or until test timeout)
@@ -1121,31 +1121,31 @@ public class NamespacesIT extends SharedMiniClusterBase {
}
}
- private void assertNamespaceExists(ThrowingRunnable runnable) {
+ private void assertNamespaceExists(Executable runnable) {
assertThrows(NamespaceExistsException.class, runnable);
}
- private void assertNoNamespace(ThrowingRunnable runnable) {
+ private void assertNoNamespace(Executable runnable) {
assertThrows(NamespaceNotFoundException.class, runnable);
}
- private void assertNoTableNoNamespace(ThrowingRunnable runnable) {
+ private void assertNoTableNoNamespace(Executable runnable) {
var e = assertThrows(TableNotFoundException.class, runnable);
assertEquals(NamespaceNotFoundException.class, e.getCause().getClass());
}
- private void assertAccumuloExceptionNoNamespace(ThrowingRunnable runnable) {
+ private void assertAccumuloExceptionNoNamespace(Executable runnable) {
var e = assertThrows(AccumuloException.class, runnable);
assertEquals(NamespaceNotFoundException.class, e.getCause().getClass());
}
- private void assertAccumuloExceptionNoTableNoNamespace(ThrowingRunnable runnable) {
+ private void assertAccumuloExceptionNoTableNoNamespace(Executable runnable) {
var e = assertThrows(AccumuloException.class, runnable);
assertEquals(TableNotFoundException.class, e.getCause().getClass());
assertEquals(NamespaceNotFoundException.class, e.getCause().getCause().getClass());
}
- private void assertSecurityException(SecurityErrorCode code, ThrowingRunnable runnable) {
+ private void assertSecurityException(SecurityErrorCode code, Executable runnable) {
var e = assertThrows(AccumuloSecurityException.class, runnable);
assertSame(code, e.getSecurityErrorCode());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java b/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
index f0dd6d1..1b91ef0 100644
--- a/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.Collections;
import java.util.EnumSet;
@@ -41,9 +41,9 @@ import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.harness.SharedMiniClusterBase;
import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class NewTableConfigurationIT extends SharedMiniClusterBase {
@@ -52,12 +52,12 @@ public class NewTableConfigurationIT extends SharedMiniClusterBase {
return 30;
}
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java
index dcaf741..956306a 100644
--- a/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.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;
import java.util.Arrays;
import java.util.Collections;
@@ -47,13 +47,13 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.OrIterator;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class OrIteratorIT extends AccumuloClusterHarness {
private static final String EMPTY = "";
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
@@ -91,10 +91,10 @@ public class OrIteratorIT extends AccumuloClusterHarness {
for (Entry<Key,Value> entry : bs) {
String term = entry.getKey().getColumnFamily().toString();
String expectedDocId = expectedData.remove(term);
- assertNotNull("Found unexpected term: " + term, expectedDocId);
+ assertNotNull(expectedDocId, "Found unexpected term: " + term);
assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
}
- assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
+ assertTrue(expectedData.isEmpty(), "Expected no leftover entries but saw " + expectedData);
}
}
}
@@ -143,10 +143,10 @@ public class OrIteratorIT extends AccumuloClusterHarness {
for (Entry<Key,Value> entry : bs) {
String term = entry.getKey().getColumnFamily().toString();
String expectedDocId = expectedData.remove(term);
- assertNotNull("Found unexpected term: " + term, expectedDocId);
+ assertNotNull(expectedDocId, "Found unexpected term: " + term);
assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
}
- assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
+ assertTrue(expectedData.isEmpty(), "Expected no leftover entries but saw " + expectedData);
}
}
}
@@ -190,11 +190,11 @@ public class OrIteratorIT extends AccumuloClusterHarness {
for (Entry<Key,Value> entry : bs) {
String term = entry.getKey().getColumnFamily().toString();
String expectedDocId = expectedData.remove(term);
- assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
- expectedDocId);
+ assertNotNull(expectedDocId,
+ "Found unexpected term: " + term + " or the docId was unexpectedly null");
assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
}
- assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
+ assertTrue(expectedData.isEmpty(), "Expected no leftover entries but saw " + expectedData);
}
}
}
@@ -227,7 +227,7 @@ public class OrIteratorIT extends AccumuloClusterHarness {
try (BatchScanner bs = client.createBatchScanner(tableName)) {
bs.setRanges(Collections.singleton(new Range()));
bs.addScanIterator(is);
- assertFalse("Found matches when none expected", bs.iterator().hasNext());
+ assertFalse(bs.iterator().hasNext(), "Found matches when none expected");
}
}
}
@@ -278,11 +278,11 @@ public class OrIteratorIT extends AccumuloClusterHarness {
for (Entry<Key,Value> entry : bs) {
String term = entry.getKey().getColumnFamily().toString();
String expectedDocId = expectedData.remove(term);
- assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
- expectedDocId);
+ assertNotNull(expectedDocId,
+ "Found unexpected term: " + term + " or the docId was unexpectedly null");
assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
}
- assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
+ assertTrue(expectedData.isEmpty(), "Expected no leftover entries but saw " + expectedData);
}
}
}
@@ -309,12 +309,12 @@ public class OrIteratorIT extends AccumuloClusterHarness {
Iterator<Entry<Key,Value>> iter = s.iterator();
assertTrue(iter.hasNext());
Key k = iter.next().getKey();
- assertEquals("Actual key was " + k, 0,
- k.compareTo(new Key("row1", "steve", "1"), PartialKey.ROW_COLFAM_COLQUAL));
+ assertEquals(0, k.compareTo(new Key("row1", "steve", "1"), PartialKey.ROW_COLFAM_COLQUAL),
+ "Actual key was " + k);
assertTrue(iter.hasNext());
k = iter.next().getKey();
- assertEquals("Actual key was " + k, 0,
- k.compareTo(new Key("row1", "bob", "2"), PartialKey.ROW_COLFAM_COLQUAL));
+ assertEquals(0, k.compareTo(new Key("row1", "bob", "2"), PartialKey.ROW_COLFAM_COLQUAL),
+ "Actual key was " + k);
assertFalse(iter.hasNext());
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java b/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
index f89bf7a..adabdcb 100644
--- a/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.Map.Entry;
@@ -39,7 +39,7 @@ import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -47,13 +47,13 @@ import com.google.common.collect.Iterators;
public class RecoveryCompactionsAreFlushesIT extends AccumuloClusterHarness {
@Override
- public boolean canRunTest(ClusterType type) {
- return type == ClusterType.MINI;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 3;
}
@Override
- public int defaultTimeoutSeconds() {
- return 180;
+ public boolean canRunTest(ClusterType type) {
+ return type == ClusterType.MINI;
}
@Override
diff --git a/test/src/main/java/org/apache/accumulo/test/SampleIT.java b/test/src/main/java/org/apache/accumulo/test/SampleIT.java
index 919eb24..6890a70 100644
--- a/test/src/main/java/org/apache/accumulo/test/SampleIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SampleIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.io.IOException;
import java.util.ArrayList;
@@ -63,7 +63,7 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.WrappingIterator;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
@@ -369,10 +369,9 @@ public class SampleIT extends AccumuloClusterHarness {
scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
for (ScannerBase s : scanners) {
- assertThrows(
+ assertThrows(SampleNotPresentException.class, () -> countEntries(s),
"Expected SampleNotPresentException, but it did not happen : "
- + s.getClass().getSimpleName(),
- SampleNotPresentException.class, () -> countEntries(s));
+ + s.getClass().getSimpleName());
}
} finally {
if (scanner != null) {
@@ -486,7 +485,7 @@ public class SampleIT extends AccumuloClusterHarness {
final String message = "Expected SampleNotPresentException, but it did not happen : "
+ scanner.getClass().getSimpleName();
- assertThrows(message, SampleNotPresentException.class, () -> scanner.iterator().next());
+ assertThrows(SampleNotPresentException.class, () -> scanner.iterator().next(), message);
scanner.clearSamplerConfiguration();
for (Entry<Key,Value> entry : scanner) {
@@ -508,8 +507,8 @@ public class SampleIT extends AccumuloClusterHarness {
for (Entry<Key,Value> entry : s) {
actual.put(entry.getKey(), entry.getValue());
}
- assertEquals(String.format("Saw %d instead of %d entries using %s", actual.size(),
- expected.size(), s.getClass().getSimpleName()), expected, actual);
+ assertEquals(expected, actual, String.format("Saw %d instead of %d entries using %s",
+ actual.size(), expected.size(), s.getClass().getSimpleName()));
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
index 847e3f0..8f2faab 100644
--- a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collections;
import java.util.SortedSet;
@@ -40,7 +40,7 @@ import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@ public class ScanFlushWithTimeIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 120;
+ return 60 * 2;
}
@Test
@@ -105,6 +105,6 @@ public class ScanFlushWithTimeIT extends AccumuloClusterHarness {
s.iterator().next();
long diff = System.currentTimeMillis() - now;
log.info("Diff = {}", diff);
- assertTrue("Scanner taking too long to return intermediate results: " + diff, diff < expected);
+ assertTrue(diff < expected, "Scanner taking too long to return intermediate results: " + diff);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
index 2241389..e5c3790 100644
--- a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.test;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Map.Entry;
@@ -44,12 +44,17 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
public class SplitRecoveryIT extends AccumuloClusterHarness {
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
private Mutation m(String row) {
Mutation result = new Mutation(row);
result.put("cf", "cq", new Value("value"));
@@ -65,11 +70,6 @@ public class SplitRecoveryIT extends AccumuloClusterHarness {
}
}
- @Override
- public int defaultTimeoutSeconds() {
- return 60;
- }
-
@Test
public void test() throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
index 74eea38..f467644 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.concurrent.Callable;
@@ -40,7 +40,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.conf.NamespaceConfiguration;
import org.apache.accumulo.server.conf.TableConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,8 +48,8 @@ public class TableConfigurationUpdateIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(TableConfigurationUpdateIT.class);
@Override
- public int defaultTimeoutSeconds() {
- return 120;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
index 30d5087..25782a6 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -19,10 +19,10 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
@@ -63,9 +63,9 @@ import org.apache.accumulo.test.functional.BadIterator;
import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Sets;
@@ -75,16 +75,16 @@ public class TableOperationsIT extends AccumuloClusterHarness {
private static final int MAX_TABLE_NAME_LEN = 1024;
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 90;
}
- @Before
+ @BeforeEach
public void setup() {
accumuloClient = Accumulo.newClient().from(getClientProps()).build();
}
- @After
+ @AfterEach
public void checkForDanglingFateLocks() {
if (getClusterType() == ClusterType.MINI) {
FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
@@ -251,11 +251,11 @@ public class TableOperationsIT extends AccumuloClusterHarness {
Collection<Text> clonedSplits = tops.listSplits(clonedTable);
Set<Text> expectedSplits = Sets.newHashSet(new Text("b"), new Text("c"), new Text("d"));
for (Text clonedSplit : clonedSplits) {
- assertTrue("Encountered unexpected split on the cloned table: " + clonedSplit,
- expectedSplits.remove(clonedSplit));
+ assertTrue(expectedSplits.remove(clonedSplit),
+ "Encountered unexpected split on the cloned table: " + clonedSplit);
}
- assertTrue("Did not find all expected splits on the cloned table: " + expectedSplits,
- expectedSplits.isEmpty());
+ assertTrue(expectedSplits.isEmpty(),
+ "Did not find all expected splits on the cloned table: " + expectedSplits);
}
/** Compare only the row, column family and column qualifier. */
@@ -286,7 +286,7 @@ public class TableOperationsIT extends AccumuloClusterHarness {
Map<Key,Value> actual = new TreeMap<>();
for (Map.Entry<Key,Value> entry : scanner)
actual.put(entry.getKey(), entry.getValue());
- assertTrue("Should be empty. Actual is " + actual, actual.isEmpty());
+ assertTrue(actual.isEmpty(), "Should be empty. Actual is " + actual);
accumuloClient.tableOperations().delete(tableName);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java b/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java
index 98df1ac..7113ff2 100644
--- a/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java
@@ -31,12 +31,17 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
// ACCUMULO-2480
public class TabletServerGivesUpIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.useMiniDFS(true);
cfg.setNumTservers(1);
@@ -46,11 +51,6 @@ public class TabletServerGivesUpIT extends ConfigurableMacBase {
cfg.setProperty(Property.TSERV_WAL_TOLERATED_MAXIMUM_WAIT_DURATION, "0s");
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 120;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
index df41ba5..4c9e59c 100644
--- a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
@@ -29,27 +29,26 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
-// ACCUMULO-3914
public class TabletServerHdfsRestartIT extends ConfigurableMacBase {
private static final int N = 1000;
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.useMiniDFS(true);
cfg.setNumTservers(1);
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
index a2d3e72..bc890fd 100644
--- a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
@@ -18,6 +18,8 @@
*/
package org.apache.accumulo.test;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.Socket;
@@ -40,10 +42,9 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
import org.apache.accumulo.miniclusterImpl.ProcessReference;
import org.apache.accumulo.monitor.Monitor;
import org.apache.accumulo.server.util.PortUtils;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.accumulo.test.functional.FunctionalTestUtils;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,7 +54,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* Test class that verifies "HA-capable" servers put up their thrift servers before acquiring their
* ZK lock.
*/
-@Category({MiniClusterOnlyTests.class})
+@Tag(MINI_CLUSTER_ONLY)
public class ThriftServerBindsBeforeZooKeeperLockIT extends AccumuloClusterHarness {
private static final Logger LOG =
LoggerFactory.getLogger(ThriftServerBindsBeforeZooKeeperLockIT.class);
diff --git a/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java b/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java
index ccc67eb..f968c41 100644
--- a/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.concurrent.TimeUnit;
@@ -37,20 +37,19 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-// see ACCUMULO-1950
public class TotalQueuedIT extends ConfigurableMacBase {
@Override
- public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setNumTservers(1);
- cfg.useMiniDFS();
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
+ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setNumTservers(1);
+ cfg.useMiniDFS();
}
private int SMALL_QUEUE_SIZE = 100000;
diff --git a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
index d8efbe0..5ed1342 100644
--- a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.List;
import java.util.stream.Collectors;
@@ -36,7 +36,7 @@ import org.apache.accumulo.core.util.HostAndPort;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,28 +78,28 @@ public class TransportCachingIT extends AccumuloClusterHarness {
TTransport second = getAnyTransport(servers, pool, true);
// We should get the same transport
- assertSame("Expected the first and second to be the same instance", first, second);
+ assertSame(first, second, "Expected the first and second to be the same instance");
pool.returnTransport(second);
// Ensure does not get cached connection just returned
TTransport third = getAnyTransport(servers, pool, false);
- assertNotSame("Expected second and third transport to be different instances", second, third);
+ assertNotSame(second, third, "Expected second and third transport to be different instances");
TTransport fourth = getAnyTransport(servers, pool, false);
- assertNotSame("Expected third and fourth transport to be different instances", third, fourth);
+ assertNotSame(third, fourth, "Expected third and fourth transport to be different instances");
pool.returnTransport(third);
pool.returnTransport(fourth);
// The following three asserts ensure the per server queue is LIFO
TTransport fifth = getAnyTransport(servers, pool, true);
- assertSame("Expected fourth and fifth transport to be the same instance", fourth, fifth);
+ assertSame(fourth, fifth, "Expected fourth and fifth transport to be the same instance");
TTransport sixth = getAnyTransport(servers, pool, true);
- assertSame("Expected third and sixth transport to be the same instance", third, sixth);
+ assertSame(third, sixth, "Expected third and sixth transport to be the same instance");
TTransport seventh = getAnyTransport(servers, pool, true);
- assertSame("Expected second and seventh transport to be the same instance", second, seventh);
+ assertSame(second, seventh, "Expected second and seventh transport to be the same instance");
pool.returnTransport(fifth);
pool.returnTransport(sixth);
diff --git a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
index b319523..193db58 100644
--- a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import java.util.Map.Entry;
@@ -44,7 +44,7 @@ import org.apache.accumulo.server.log.WalStateManager;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -55,6 +55,11 @@ import com.google.common.collect.Iterators;
public class UnusedWALIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
final long logSize = 1024 * 1024 * 10;
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
@@ -65,11 +70,6 @@ public class UnusedWALIT extends ConfigurableMacBase {
hadoopCoreSite.set("fs.namenode.fs-limits.min-block-size", Long.toString(logSize));
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void test() throws Exception {
// don't want this bad boy cleaning up walog entries
diff --git a/test/src/main/java/org/apache/accumulo/test/UsersIT.java b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
index d18537c..d360e45 100644
--- a/test/src/main/java/org/apache/accumulo/test/UsersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Set;
@@ -32,7 +32,7 @@ import org.apache.accumulo.core.client.admin.SecurityOperations;
import org.apache.accumulo.core.client.security.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class UsersIT extends AccumuloClusterHarness {
@@ -54,14 +54,14 @@ public class UsersIT extends AccumuloClusterHarness {
}
final PasswordToken badToken = new PasswordToken("better_fail");
- var ase = assertThrows("Creating a user that already exists should throw an exception",
- AccumuloSecurityException.class,
- () -> securityOperations.createLocalUser(user0Principal, badToken));
- assertSame("Expected USER_EXISTS error", SecurityErrorCode.USER_EXISTS,
- ase.getSecurityErrorCode());
+ var ase = assertThrows(AccumuloSecurityException.class,
+ () -> securityOperations.createLocalUser(user0Principal, badToken),
+ "Creating a user that already exists should throw an exception");
+ assertSame(SecurityErrorCode.USER_EXISTS, ase.getSecurityErrorCode(),
+ "Expected USER_EXISTS error");
String msg = ase.getMessage();
- assertTrue("Error message didn't contain principal: '" + msg + "'",
- msg.contains(user0Principal));
+ assertTrue(msg.contains(user0Principal),
+ "Error message didn't contain principal: '" + msg + "'");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
index 6873c72..ade4ad1 100644
--- a/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -43,7 +43,7 @@ import org.apache.accumulo.tserver.TabletServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -65,6 +65,11 @@ public class VerifySerialRecoveryIT extends ConfigurableMacBase {
}
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
@@ -72,11 +77,6 @@ public class VerifySerialRecoveryIT extends ConfigurableMacBase {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void testSerializedRecovery() throws Exception {
// make a table with many splits
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
index 6419c6c..019bd37 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -59,7 +59,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class VolumeChooserIT extends ConfigurableMacBase {
@@ -89,7 +89,7 @@ public class VolumeChooserIT extends ConfigurableMacBase {
@Override
protected int defaultTimeoutSeconds() {
- return 120;
+ return 60 * 2;
}
@Override
@@ -156,8 +156,8 @@ public class VolumeChooserIT extends ConfigurableMacBase {
try (Scanner scanner = accumuloClient.createScanner(tableName, Authorizations.EMPTY)) {
int i = 0;
for (Entry<Key,Value> entry : scanner) {
- assertEquals("Data read is not data written", alpha_rows[i++],
- entry.getKey().getRow().toString());
+ assertEquals(alpha_rows[i++], entry.getKey().getRow().toString(),
+ "Data read is not data written");
}
}
}
@@ -193,16 +193,14 @@ public class VolumeChooserIT extends ConfigurableMacBase {
inVolume = true;
}
}
- assertTrue(
- "Data not written to the correct volumes. " + entry.getKey().getColumnQualifier(),
- inVolume);
+ assertTrue(inVolume,
+ "Data not written to the correct volumes. " + entry.getKey().getColumnQualifier());
fileCount++;
}
}
- assertEquals(
- "Did not see all the volumes. volumes: " + volumes + " volumes seen: " + volumesSeen,
- volumes.size(), volumesSeen.size());
- assertEquals("Wrong number of files", 26, fileCount);
+ assertEquals(volumes.size(), volumesSeen.size(),
+ "Did not see all the volumes. volumes: " + volumes + " volumes seen: " + volumesSeen);
+ assertEquals(26, fileCount, "Wrong number of files");
}
public static void verifyNoVolumes(AccumuloClient accumuloClient, Range tableRange)
@@ -258,9 +256,8 @@ public class VolumeChooserIT extends ConfigurableMacBase {
volumesSeen.add(volume);
inVolume = true;
}
- assertTrue(
- "Data not written to the correct volumes. " + entry.getKey().getColumnQualifier(),
- inVolume);
+ assertTrue(inVolume,
+ "Data not written to the correct volumes. " + entry.getKey().getColumnQualifier());
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index a5c9768..5730f2a 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -19,10 +19,10 @@
package org.apache.accumulo.test;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.FileReader;
@@ -81,7 +81,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -92,11 +92,6 @@ public class VolumeIT extends ConfigurableMacBase {
private List<String> expected = new ArrayList<>();
@Override
- protected int defaultTimeoutSeconds() {
- return 10 * 60;
- }
-
- @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
File baseDir = cfg.getDir();
volDirBase = new File(baseDir, "volumes");
@@ -412,12 +407,12 @@ public class VolumeIT extends ConfigurableMacBase {
File v1f = new File(v1.toUri());
File v8f = new File(new File(v1.getParent().toUri()), "v8");
- assertTrue("Failed to rename " + v1f + " to " + v8f, v1f.renameTo(v8f));
+ assertTrue(v1f.renameTo(v8f), "Failed to rename " + v1f + " to " + v8f);
Path v8 = new Path(v8f.toURI());
File v2f = new File(v2.toUri());
File v9f = new File(new File(v2.getParent().toUri()), "v9");
- assertTrue("Failed to rename " + v2f + " to " + v9f, v2f.renameTo(v9f));
+ assertTrue(v2f.renameTo(v9f), "Failed to rename " + v2f + " to " + v9f);
Path v9 = new Path(v9f.toURI());
updateConfig(config -> {
diff --git a/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java b/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
index 2355b6b..6c54525 100644
--- a/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test;
-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;
import java.util.HashMap;
import java.util.Map;
@@ -40,7 +40,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Ta
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -49,8 +49,8 @@ public class WaitForBalanceIT extends ConfigurableMacBase {
private static final int NUM_SPLITS = 50;
@Override
- public int defaultTimeoutSeconds() {
- return 120;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java b/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
index 857af30..e604561 100644
--- a/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import java.util.Iterator;
@@ -40,7 +40,7 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.YieldingIterator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@ public class YieldScannersIT extends AccumuloClusterHarness {
private static final char START_ROW = 'a';
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
@@ -92,8 +92,8 @@ public class YieldScannersIT extends AccumuloClusterHarness {
// verify we got the expected key
char expected = (char) (START_ROW + keyCount);
- assertEquals("Unexpected row", Character.toString(expected),
- next.getKey().getRow().toString());
+ assertEquals(Character.toString(expected), next.getKey().getRow().toString(),
+ "Unexpected row");
// determine whether we yielded on a next and seek
if ((keyCount & 1) != 0) {
@@ -101,14 +101,14 @@ public class YieldScannersIT extends AccumuloClusterHarness {
yieldSeekCount++;
}
String[] value = next.getValue().toString().split(",");
- assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
- assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
- assertEquals("Unexpected rebuild count",
- Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
+ assertEquals(Integer.toString(yieldNextCount), value[0], "Unexpected yield next count");
+ assertEquals(Integer.toString(yieldSeekCount), value[1], "Unexpected yield seek count");
+ assertEquals(Integer.toString(yieldNextCount + yieldSeekCount), value[2],
+ "Unexpected rebuild count");
keyCount++;
}
- assertEquals("Did not get the expected number of results", 10, keyCount);
+ assertEquals(10, keyCount, "Did not get the expected number of results");
}
}
}
@@ -147,8 +147,8 @@ public class YieldScannersIT extends AccumuloClusterHarness {
// verify we got the expected key
char expected = (char) (START_ROW + keyCount);
- assertEquals("Unexpected row", Character.toString(expected),
- next.getKey().getRow().toString());
+ assertEquals(Character.toString(expected), next.getKey().getRow().toString(),
+ "Unexpected row");
// determine whether we yielded on a next and seek
if ((keyCount & 1) != 0) {
@@ -156,14 +156,14 @@ public class YieldScannersIT extends AccumuloClusterHarness {
yieldSeekCount++;
}
String[] value = next.getValue().toString().split(",");
- assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
- assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
- assertEquals("Unexpected rebuild count",
- Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
+ assertEquals(Integer.toString(yieldNextCount), value[0], "Unexpected yield next count");
+ assertEquals(Integer.toString(yieldSeekCount), value[1], "Unexpected yield seek count");
+ assertEquals(Integer.toString(yieldNextCount + yieldSeekCount), value[2],
+ "Unexpected rebuild count");
keyCount++;
}
- assertEquals("Did not get the expected number of results", 10, keyCount);
+ assertEquals(10, keyCount, "Did not get the expected number of results");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java b/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java
index 3d95e6a..5805341 100644
--- a/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ZooKeeperPropertiesIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/CompactionExecutorIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/CompactionExecutorIT.java
index 59a218e..aa8eede 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/CompactionExecutorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/CompactionExecutorIT.java
@@ -19,9 +19,10 @@
package org.apache.accumulo.test.compaction;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.io.UncheckedIOException;
@@ -69,10 +70,10 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
import org.bouncycastle.util.Arrays;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class CompactionExecutorIT extends SharedMiniClusterBase {
@@ -132,7 +133,7 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
}
}
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniClusterWithConfig((miniCfg, coreSite) -> {
Map<String,String> siteCfg = new HashMap<>();
@@ -168,12 +169,12 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
});
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
- @After
+ @AfterEach
public void cleanup() {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
client.tableOperations().list().stream()
@@ -429,8 +430,8 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
.setIterators(List.of(iterSetting)).setWait(true).setFlush(true));
for (String row : List.of("a", "h")) {
- assertTrue(expected.remove(row + ":f:004") != null);
- assertTrue(expected.remove(row + ":f:007") != null);
+ assertNotNull(expected.remove(row + ":f:004"));
+ assertNotNull(expected.remove(row + ":f:007"));
}
Map<String,String> actual = scanTable(client, tableName);
@@ -443,9 +444,9 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
.setEndRow(new Text("u")).setIterators(List.of(iterSetting)).setWait(true));
for (String row : List.of("o", "s", "x")) {
- assertTrue(expected.remove(row + ":f:002") != null);
- assertTrue(expected.remove(row + ":f:005") != null);
- assertTrue(expected.remove(row + ":f:009") != null);
+ assertNotNull(expected.remove(row + ":f:002"));
+ assertNotNull(expected.remove(row + ":f:005"));
+ assertNotNull(expected.remove(row + ":f:009"));
}
actual = scanTable(client, tableName);
@@ -458,8 +459,8 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
new CompactionConfig().setIterators(List.of(iterSetting)).setWait(true));
for (String row : List.of("a", "h", "o", "s", "x")) {
- assertTrue(expected.remove(row + ":f:001") != null);
- assertTrue(expected.remove(row + ":f:008") != null);
+ assertNotNull(expected.remove(row + ":f:001"));
+ assertNotNull(expected.remove(row + ":f:008"));
}
actual = scanTable(client, tableName);
@@ -513,8 +514,8 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
// without compression, expect file to be large
long sizes = getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes,
- sizes > data.length * 10 && sizes < data.length * 11);
+ assertTrue(sizes > data.length * 10 && sizes < data.length * 11,
+ "Unexpected files sizes : " + sizes);
client.tableOperations().compact(tableName,
new CompactionConfig().setWait(true)
@@ -524,14 +525,14 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
// after compacting with compression, expect small file
sizes = getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes, sizes < data.length);
+ assertTrue(sizes < data.length, "Unexpected files sizes : " + sizes);
client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
// after compacting without compression, expect big files again
sizes = getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes,
- sizes > data.length * 10 && sizes < data.length * 11);
+ assertTrue(sizes > data.length * 10 && sizes < data.length * 11,
+ "Unexpected files sizes : " + sizes);
}
}
@@ -561,13 +562,12 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
client.tableOperations().create(tableName);
addFiles(client, tableName, 5);
- var msg = assertThrows(AccumuloException.class, () -> {
- client.tableOperations().compact(tableName, new CompactionConfig()
- .setSelector(new PluginConfig(CompressionConfigurer.class.getName())).setWait(true));
- }).getMessage();
-
- assertTrue("Unexpected message : " + msg,
- msg.contains("TabletServer could not load CompactionSelector"));
+ var e = assertThrows(AccumuloException.class,
+ () -> client.tableOperations().compact(tableName, new CompactionConfig()
+ .setSelector(new PluginConfig(CompressionConfigurer.class.getName())).setWait(true)));
+ final String msg = e.getMessage();
+ assertTrue(msg.contains("TabletServer could not load CompactionSelector"),
+ "Unexpected message : " + msg);
}
}
@@ -580,13 +580,14 @@ public class CompactionExecutorIT extends SharedMiniClusterBase {
client.tableOperations().create(tableName);
addFiles(client, tableName, 5);
- var msg = assertThrows(AccumuloException.class, () -> {
- client.tableOperations().compact(tableName, new CompactionConfig()
- .setConfigurer(new PluginConfig(TooManyDeletesSelector.class.getName())).setWait(true));
- }).getMessage();
-
- assertTrue("Unexpected message : " + msg,
- msg.contains("TabletServer could not load CompactionConfigurer"));
+ var e = assertThrows(AccumuloException.class,
+ () -> client.tableOperations().compact(tableName,
+ new CompactionConfig()
+ .setConfigurer(new PluginConfig(TooManyDeletesSelector.class.getName()))
+ .setWait(true)));
+ final String msg = e.getMessage();
+ assertTrue(msg.contains("TabletServer could not load CompactionConfigurer"),
+ "Unexpected message : " + msg);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/CompactionRateLimitingIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/CompactionRateLimitingIT.java
index c15bcf6..0f379d3 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/CompactionRateLimitingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/CompactionRateLimitingIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.compaction;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
@@ -32,7 +32,7 @@ import org.apache.accumulo.core.spi.compaction.DefaultCompactionPlanner;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CompactionRateLimitingIT extends ConfigurableMacBase {
public static final long BYTES_TO_WRITE = 10 * 1024 * 1024;
@@ -99,10 +99,10 @@ public class CompactionRateLimitingIT extends ConfigurableMacBase {
long duration = System.currentTimeMillis() - compactionStart;
// The rate will be "bursty", try to account for that by taking 80% of the expected rate
// (allow for 20% under the maximum expected duration)
- assertTrue(String.format(
+ String message = String.format(
"Expected a compaction rate of no more than %,d bytes/sec, but saw a rate of %,f bytes/sec",
- (int) (0.8d * RATE), 1000.0 * bytesWritten / duration),
- duration > 1000L * 0.8 * BYTES_TO_WRITE / RATE);
+ (int) (0.8d * RATE), 1000.0 * bytesWritten / duration);
+ assertTrue(duration > 1000L * 0.8 * BYTES_TO_WRITE / RATE, message);
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ConfigurableMajorCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ConfigurableMajorCompactionIT.java
index 4541441..c27e746 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ConfigurableMajorCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ConfigurableMajorCompactionIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test.compaction;
-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;
import java.util.HashMap;
import java.util.Map;
@@ -42,7 +42,7 @@ import org.apache.accumulo.tserver.compaction.CompactionStrategy;
import org.apache.accumulo.tserver.compaction.MajorCompactionRequest;
import org.apache.accumulo.tserver.compaction.WriteParameters;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -50,7 +50,7 @@ import com.google.common.collect.Iterators;
public class ConfigurableMajorCompactionIT extends ConfigurableMacBase {
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 30;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionMetricsIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionMetricsIT.java
index c90660d..7d3d219 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionMetricsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionMetricsIT.java
@@ -25,7 +25,7 @@ import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.co
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.createTable;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.verify;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collection;
import java.util.List;
@@ -54,21 +54,21 @@ import org.apache.accumulo.test.metrics.TestStatsDRegistryFactory;
import org.apache.accumulo.test.metrics.TestStatsDSink;
import org.apache.accumulo.test.metrics.TestStatsDSink.Metric;
import org.apache.hadoop.conf.Configuration;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class ExternalCompactionMetricsIT extends AccumuloClusterHarness
implements MiniClusterConfigurationCallback {
private static TestStatsDSink sink;
- @BeforeClass
+ @BeforeAll
public static void before() throws Exception {
sink = new TestStatsDSink();
}
- @AfterClass
+ @AfterAll
public static void after() throws Exception {
if (sink != null) {
sink.close();
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java
index f1ad600..a68f24b 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java
@@ -25,7 +25,7 @@ import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.cr
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.getRunningCompactions;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.verify;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.EnumSet;
@@ -49,7 +49,7 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.conf.Configuration;
import org.apache.thrift.TException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -159,10 +159,10 @@ public class ExternalCompactionProgressIT extends AccumuloClusterHarness {
private void verifyProgress() {
log.info("Verify Progress.");
- assertTrue("Missing start of progress", progressList.contains(EC_PROGRESS.STARTED));
- assertTrue("Missing quarter progress", progressList.contains(EC_PROGRESS.QUARTER));
- assertTrue("Missing half progress", progressList.contains(EC_PROGRESS.HALF));
- assertTrue("Missing three quarters progress",
- progressList.contains(EC_PROGRESS.THREE_QUARTERS));
+ assertTrue(progressList.contains(EC_PROGRESS.STARTED), "Missing start of progress");
+ assertTrue(progressList.contains(EC_PROGRESS.QUARTER), "Missing quarter progress");
+ assertTrue(progressList.contains(EC_PROGRESS.HALF), "Missing half progress");
+ assertTrue(progressList.contains(EC_PROGRESS.THREE_QUARTERS),
+ "Missing three quarters progress");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionTestUtils.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionTestUtils.java
index 5225733..71476d9 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionTestUtils.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionTestUtils.java
@@ -18,9 +18,8 @@
*/
package org.apache.accumulo.test.compaction;
-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 java.util.ArrayList;
import java.util.Collections;
@@ -173,8 +172,8 @@ public class ExternalCompactionTestUtils {
try (Scanner scanner = client.createScanner(table1)) {
int count = 0;
for (Entry<Key,Value> entry : scanner) {
- assertTrue(String.format("%s %s %d != 0", entry.getValue(), "%", modulus),
- Integer.parseInt(entry.getValue().toString()) % modulus == 0);
+ assertEquals(0, Integer.parseInt(entry.getValue().toString()) % modulus,
+ String.format("%s %s %d != 0", entry.getValue(), "%", modulus));
count++;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_1_IT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_1_IT.java
index 1c309dc..7a3db44 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_1_IT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_1_IT.java
@@ -34,10 +34,10 @@ import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.ge
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.row;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.verify;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
@@ -92,9 +92,9 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl.ProcessInfo;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -112,12 +112,12 @@ public class ExternalCompaction_1_IT extends SharedMiniClusterBase {
private static final Logger LOG = LoggerFactory.getLogger(ExternalCompaction_1_IT.class);
- @BeforeClass
+ @BeforeAll
public static void beforeTests() throws Exception {
startMiniClusterWithConfig(new ExternalCompaction1Config());
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
// The ExternalDoNothingCompactor needs to be restarted between tests
getCluster().getClusterControl().stop(ServerType.COMPACTOR);
@@ -298,8 +298,8 @@ public class ExternalCompaction_1_IT extends SharedMiniClusterBase {
// without compression, expect file to be large
long sizes = CompactionExecutorIT.getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes,
- sizes > data.length * 10 && sizes < data.length * 11);
+ assertTrue(sizes > data.length * 10 && sizes < data.length * 11,
+ "Unexpected files sizes : " + sizes);
client.tableOperations().compact(tableName,
new CompactionConfig().setWait(true)
@@ -309,15 +309,15 @@ public class ExternalCompaction_1_IT extends SharedMiniClusterBase {
// after compacting with compression, expect small file
sizes = CompactionExecutorIT.getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes: data: " + data.length + ", file:" + sizes,
- sizes < data.length);
+ assertTrue(sizes < data.length,
+ "Unexpected files sizes: data: " + data.length + ", file:" + sizes);
client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
// after compacting without compression, expect big files again
sizes = CompactionExecutorIT.getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes,
- sizes > data.length * 10 && sizes < data.length * 11);
+ assertTrue(sizes > data.length * 10 && sizes < data.length * 11,
+ "Unexpected files sizes : " + sizes);
// We need to cancel the compaction or delete the table here because we initiate a user
// compaction above in the test. Even though the external compaction was cancelled
@@ -507,8 +507,8 @@ public class ExternalCompaction_1_IT extends SharedMiniClusterBase {
int v = Integer.parseInt(entry.getValue().toString());
int modulus = v < MAX_DATA ? 17 : 19;
- assertTrue(String.format("%s %s %d != 0", entry.getValue(), "%", modulus),
- Integer.parseInt(entry.getValue().toString()) % modulus == 0);
+ assertEquals(0, Integer.parseInt(entry.getValue().toString()) % modulus,
+ String.format("%s %s %d != 0", entry.getValue(), "%", modulus));
count++;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
index 262488d..c59c78c 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
@@ -33,9 +33,9 @@ import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.ge
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.row;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.waitForCompactionStartAndReturnEcids;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Collections;
import java.util.Set;
@@ -62,9 +62,9 @@ import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,12 +79,12 @@ public class ExternalCompaction_2_IT extends SharedMiniClusterBase {
private static final Logger LOG = LoggerFactory.getLogger(ExternalCompaction_2_IT.class);
- @BeforeClass
+ @BeforeAll
public static void beforeTests() throws Exception {
startMiniClusterWithConfig(new ExternalCompaction2Config());
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
// The ExternalDoNothingCompactor needs to be restarted between tests
getCluster().getClusterControl().stop(ServerType.COMPACTOR);
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
index a9126d0..480074b 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
@@ -27,8 +27,8 @@ import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.ge
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.getRunningCompactions;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.waitForCompactionStartAndReturnEcids;
import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
-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;
import java.util.ArrayList;
import java.util.Collections;
@@ -54,9 +54,9 @@ import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class ExternalCompaction_3_IT extends SharedMiniClusterBase {
@@ -67,12 +67,12 @@ public class ExternalCompaction_3_IT extends SharedMiniClusterBase {
}
}
- @BeforeClass
+ @BeforeAll
public static void beforeTests() throws Exception {
startMiniClusterWithConfig(new ExternalCompaction3Config());
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
// The ExternalDoNothingCompactor needs to be restarted between tests
getCluster().getClusterControl().stop(ServerType.COMPACTOR);
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/SplitCancelsMajCIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/SplitCancelsMajCIT.java
index 40a48f3..ab0e1ac 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/SplitCancelsMajCIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/SplitCancelsMajCIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test.compaction;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.EnumSet;
import java.util.SortedSet;
@@ -37,24 +37,24 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.harness.SharedMiniClusterBase;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
// ACCUMULO-2862
public class SplitCancelsMajCIT extends SharedMiniClusterBase {
@Override
- public int defaultTimeoutSeconds() {
- return 2 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java
index cd85e4f..1bd95ce 100644
--- a/test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.test.compaction;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.File;
import java.util.Arrays;
@@ -53,18 +53,18 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.functional.FunctionalTestUtils;
import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("removal")
public class UserCompactionStrategyIT extends AccumuloClusterHarness {
@Override
- public int defaultTimeoutSeconds() {
- return 3 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 3;
}
- @After
+ @AfterEach
public void checkForDanglingFateLocks() {
if (getClusterType() == ClusterType.MINI) {
FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
diff --git a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java
index 1762acb..e1f6453 100644
--- a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java
@@ -25,13 +25,14 @@ import static org.apache.accumulo.fate.ReadOnlyTStore.TStatus.IN_PROGRESS;
import static org.apache.accumulo.fate.ReadOnlyTStore.TStatus.NEW;
import static org.apache.accumulo.fate.ReadOnlyTStore.TStatus.SUBMITTED;
import static org.apache.accumulo.fate.ReadOnlyTStore.TStatus.SUCCESSFUL;
+import static org.apache.accumulo.harness.AccumuloITBase.ZOOKEEPER_TESTING_SERVER;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.UUID;
@@ -55,19 +56,18 @@ import org.apache.accumulo.manager.tableOps.ManagerRepo;
import org.apache.accumulo.manager.tableOps.TraceRepo;
import org.apache.accumulo.manager.tableOps.Utils;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.test.categories.ZooKeeperTestingServerTests;
import org.apache.accumulo.test.zookeeper.ZooKeeperTestingServer;
import org.apache.zookeeper.KeeperException;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Category({ZooKeeperTestingServerTests.class})
+@Tag(ZOOKEEPER_TESTING_SERVER)
public class FateIT {
public static class TestOperation extends ManagerRepo {
@@ -114,9 +114,8 @@ public class FateIT {
private static final Logger LOG = LoggerFactory.getLogger(FateIT.class);
- @ClassRule
- public static final TemporaryFolder TEMP =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
private static ZooKeeperTestingServer szk = null;
private static ZooReaderWriter zk = null;
@@ -127,9 +126,9 @@ public class FateIT {
private static CountDownLatch callStarted;
private static CountDownLatch finishCall;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
- szk = new ZooKeeperTestingServer(TEMP.newFolder());
+ szk = new ZooKeeperTestingServer(tempDir);
zk = szk.getZooReaderWriter();
zk.mkdirs(ZK_ROOT + Constants.ZFATE);
zk.mkdirs(ZK_ROOT + Constants.ZTABLE_LOCKS);
@@ -138,12 +137,13 @@ public class FateIT {
zk.mkdirs(ZK_ROOT + Constants.ZTABLES + "/" + TID.canonical());
}
- @AfterClass
+ @AfterAll
public static void teardown() throws Exception {
szk.close();
}
- @Test(timeout = 30000)
+ @Test
+ @Timeout(30)
public void testTransactionStatus() throws Exception {
final ZooStore<Manager> zooStore = new ZooStore<Manager>(ZK_ROOT + Constants.ZFATE, zk);
diff --git a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ServiceLockIT.java b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ServiceLockIT.java
index b69b9ee..30a491f 100644
--- a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ServiceLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ServiceLockIT.java
@@ -19,11 +19,12 @@
package org.apache.accumulo.test.fate.zookeeper;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.ZOOKEEPER_TESTING_SERVER;
+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.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -43,7 +44,6 @@ import org.apache.accumulo.fate.zookeeper.ServiceLock.ServiceLockPath;
import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooSession;
import org.apache.accumulo.fate.zookeeper.ZooUtil;
-import org.apache.accumulo.test.categories.ZooKeeperTestingServerTests;
import org.apache.accumulo.test.zookeeper.ZooKeeperTestingServer;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
@@ -53,33 +53,32 @@ import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.ACL;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.util.concurrent.Uninterruptibles;
-@Category({ZooKeeperTestingServerTests.class})
+@Tag(ZOOKEEPER_TESTING_SERVER)
public class ServiceLockIT {
- @ClassRule
- public static final TemporaryFolder TEMP =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
private static ZooKeeperTestingServer szk = null;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
- szk = new ZooKeeperTestingServer(TEMP.newFolder());
+ szk = new ZooKeeperTestingServer(tempDir);
szk.initPaths("/accumulo/" + InstanceId.of(UUID.randomUUID()));
}
- @AfterClass
+ @AfterAll
public static void teardown() throws Exception {
szk.close();
}
@@ -208,7 +207,8 @@ public class ServiceLockIT {
return new ServiceLockWrapper(zkw, parent, uuid);
}
- @Test(timeout = 10000)
+ @Test
+ @Timeout(10)
public void testDeleteParent() throws Exception {
var parent = ServiceLock
.path("/zltestDeleteParent-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
@@ -240,7 +240,8 @@ public class ServiceLockIT {
zl.unlock();
}
- @Test(timeout = 10000)
+ @Test
+ @Timeout(10)
public void testNoParent() throws Exception {
var parent =
ServiceLock.path("/zltestNoParent-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
@@ -261,7 +262,8 @@ public class ServiceLockIT {
assertNull(lw.reason);
}
- @Test(timeout = 10000)
+ @Test
+ @Timeout(10)
public void testDeleteLock() throws Exception {
var parent =
ServiceLock.path("/zltestDeleteLock-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
@@ -293,7 +295,8 @@ public class ServiceLockIT {
}
- @Test(timeout = 15000)
+ @Test
+ @Timeout(15)
public void testDeleteWaiting() throws Exception {
var parent = ServiceLock
.path("/zltestDeleteWaiting-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
@@ -359,7 +362,8 @@ public class ServiceLockIT {
}
- @Test(timeout = 10000)
+ @Test
+ @Timeout(10)
public void testUnexpectedEvent() throws Exception {
var parent = ServiceLock
.path("/zltestUnexpectedEvent-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
@@ -405,7 +409,8 @@ public class ServiceLockIT {
}
- @Test(timeout = 60000)
+ @Test
+ @Timeout(60)
public void testLockSerial() throws Exception {
var parent = ServiceLock.path("/zlretryLockSerial");
@@ -467,11 +472,11 @@ public class ServiceLockIT {
List<String> children = zk1.getChildren(parent.toString(), false);
assertTrue(children.contains("zlock#00000000-0000-0000-0000-aaaaaaaaaaaa#0000000000"));
- assertFalse("this node should have been deleted",
- children.contains("zlock#00000000-0000-0000-0000-aaaaaaaaaaaa#0000000001"));
+ assertFalse(children.contains("zlock#00000000-0000-0000-0000-aaaaaaaaaaaa#0000000001"),
+ "this node should have been deleted");
assertTrue(children.contains("zlock#00000000-0000-0000-0000-bbbbbbbbbbbb#0000000002"));
- assertFalse("this node should have been deleted",
- children.contains("zlock#00000000-0000-0000-0000-bbbbbbbbbbbb#0000000003"));
+ assertFalse(children.contains("zlock#00000000-0000-0000-0000-bbbbbbbbbbbb#0000000003"),
+ "this node should have been deleted");
assertNull(zl1.getWatching());
assertEquals("/zlretryLockSerial/zlock#00000000-0000-0000-0000-aaaaaaaaaaaa#0000000000",
@@ -570,7 +575,8 @@ public class ServiceLockIT {
}
}
- @Test(timeout = 60000)
+ @Test
+ @Timeout(60)
public void testLockParallel() throws Exception {
var parent = ServiceLock.path("/zlParallel");
@@ -636,7 +642,8 @@ public class ServiceLockIT {
}
- @Test(timeout = 10000)
+ @Test
+ @Timeout(10)
public void testTryLock() throws Exception {
var parent =
ServiceLock.path("/zltestTryLock-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
@@ -676,7 +683,8 @@ public class ServiceLockIT {
}
}
- @Test(timeout = 10000)
+ @Test
+ @Timeout(10)
public void testChangeData() throws Exception {
var parent =
ServiceLock.path("/zltestChangeData-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
diff --git a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ZooMutatorIT.java b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ZooMutatorIT.java
index a70807c..31a1d30 100644
--- a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ZooMutatorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/ZooMutatorIT.java
@@ -19,8 +19,9 @@
package org.apache.accumulo.test.fate.zookeeper;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.ZOOKEEPER_TESTING_SERVER;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.util.ArrayList;
@@ -32,21 +33,19 @@ import java.util.concurrent.Future;
import org.apache.accumulo.core.data.InstanceId;
import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
-import org.apache.accumulo.test.categories.ZooKeeperTestingServerTests;
+import org.apache.accumulo.harness.WithTestNames;
import org.apache.accumulo.test.zookeeper.ZooKeeperTestingServer;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import com.google.common.hash.Hashing;
-@Category({ZooKeeperTestingServerTests.class})
-public class ZooMutatorIT {
+@Tag(ZOOKEEPER_TESTING_SERVER)
+public class ZooMutatorIT extends WithTestNames {
- @Rule
- public TemporaryFolder tempFolder =
- new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+ @TempDir
+ private static File tempDir;
/**
* This test uses multiple threads to update the data in a single zookeeper node using
@@ -82,8 +81,9 @@ public class ZooMutatorIT {
*/
@Test
public void concurrentMutatorTest() throws Exception {
-
- try (ZooKeeperTestingServer szk = new ZooKeeperTestingServer(tempFolder.newFolder())) {
+ File newFolder = new File(tempDir, testName() + "/");
+ assertTrue(newFolder.isDirectory() || newFolder.mkdir(), "failed to create dir: " + newFolder);
+ try (ZooKeeperTestingServer szk = new ZooKeeperTestingServer(newFolder)) {
szk.initPaths("/accumulo/" + InstanceId.of(UUID.randomUUID()));
ZooReaderWriter zk = szk.getZooReaderWriter();
@@ -106,7 +106,7 @@ public class ZooMutatorIT {
byte[] val =
zk.mutateOrCreate("/test-zm", initialData.getBytes(UTF_8), this::nextValue);
int nextCount = getCount(val);
- assertTrue("nextCount <= count " + nextCount + " " + count, nextCount > count);
+ assertTrue(nextCount > count, "nextCount <= count " + nextCount + " " + count);
count = nextCount;
countCounts.merge(count, 1, Integer::sum);
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java b/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
index 5fc90bc..ba5670d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map.Entry;
import java.util.Properties;
@@ -43,14 +43,14 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.singletons.SingletonManager;
import org.apache.accumulo.core.singletons.SingletonManager.Mode;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
public class AccumuloClientIT extends AccumuloClusterHarness {
- @After
+ @AfterEach
public void deleteUsers() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
Set<String> users = client.securityOperations().listLocalUsers();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
index e45dffe..3b9016f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
@@ -36,7 +36,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AddSplitIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BackupManagerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BackupManagerIT.java
index d510ca0..7fa0d7a 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BackupManagerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BackupManagerIT.java
@@ -28,13 +28,13 @@ import org.apache.accumulo.fate.zookeeper.ServiceLock;
import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
import org.apache.accumulo.manager.Manager;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BackupManagerIT extends ConfigurableMacBase {
@Override
protected int defaultTimeoutSeconds() {
- return 120;
+ return 60 * 2;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
index 803d982..3f1982e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -68,7 +68,7 @@ public class BadIteratorMincIT extends AccumuloClusterHarness {
// try to scan table
try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
int count = Iterators.size(scanner.iterator());
- assertEquals("Did not see expected # entries " + count, 1, count);
+ assertEquals(1, count, "Did not see expected # entries " + count);
// remove the bad iterator
c.tableOperations().removeIterator(tableName, BadIterator.class.getSimpleName(),
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java
index d78cb0a..f5cd440 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Map.Entry;
@@ -33,7 +33,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
index cd24967..582cbcf 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.test.functional;
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
-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;
import java.lang.reflect.Field;
import java.util.ArrayList;
@@ -48,20 +48,20 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.miniclusterImpl.ProcessReference;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
public class BalanceAfterCommsFailureIT extends ConfigurableMacBase {
@Override
- public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setProperty(Property.GENERAL_RPC_TIMEOUT, "2s");
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setProperty(Property.GENERAL_RPC_TIMEOUT, "2s");
}
@Test
@@ -133,7 +133,7 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacBase {
}
}
- assertEquals("Unassigned tablets were not assigned within 30 seconds", 0, unassignedTablets);
+ assertEquals(0, unassignedTablets, "Unassigned tablets were not assigned within 30 seconds");
List<Integer> counts = new ArrayList<>();
for (TabletServerStatus server : stats.tServerInfo) {
@@ -143,11 +143,12 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacBase {
}
counts.add(count);
}
- assertTrue("Expected to have at least two TabletServers", counts.size() > 1);
+ assertTrue(counts.size() > 1, "Expected to have at least two TabletServers");
for (int i = 1; i < counts.size(); i++) {
int diff = Math.abs(counts.get(0) - counts.get(i));
- assertTrue("Expected difference in tablets to be less than or equal to " + counts.size()
- + " but was " + diff + ". Counts " + counts, diff <= counts.size());
+ assertTrue(diff <= counts.size(),
+ "Expected difference in tablets to be less than or equal to " + counts.size()
+ + " but was " + diff + ". Counts " + counts);
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java
index d06e93f..3dbf2de 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.test.functional;
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.util.Arrays;
import java.util.Map;
@@ -54,9 +54,9 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,7 +66,8 @@ import org.slf4j.LoggerFactory;
*/
public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
- private static Logger log = LoggerFactory.getLogger(BalanceInPresenceOfOfflineTableIT.class);
+ private static final Logger log =
+ LoggerFactory.getLogger(BalanceInPresenceOfOfflineTableIT.class);
@Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
@@ -80,18 +81,13 @@ public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
}
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 10 * 60;
- }
-
private static final int NUM_SPLITS = 200;
private String UNUSED_TABLE, TEST_TABLE;
private AccumuloClient accumuloClient;
- @Before
+ @BeforeEach
public void setupTables() throws AccumuloException, AccumuloSecurityException,
TableExistsException, TableNotFoundException {
accumuloClient = Accumulo.newClient().from(getClientProps()).build();
@@ -101,8 +97,8 @@ public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
break;
UtilWaitThread.sleep(TimeUnit.SECONDS.toMillis(2));
}
- assumeTrue("Not enough tservers to run test",
- accumuloClient.instanceOperations().getTabletServers().size() >= 2);
+ assumeTrue(accumuloClient.instanceOperations().getTabletServers().size() >= 2,
+ "Not enough tservers to run test");
// set up splits
final SortedSet<Text> splits = new TreeSet<>();
@@ -127,7 +123,7 @@ public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
}
- @After
+ @AfterEach
public void closeClient() {
accumuloClient.close();
}
@@ -211,7 +207,7 @@ public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
balancingWorked = true;
}
- assertTrue("did not properly balance", balancingWorked);
+ assertTrue(balancingWorked, "did not properly balance");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
index f8999ab..cdbfe93 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
@@ -39,7 +39,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,13 +47,13 @@ public class BatchScanSplitIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(BatchScanSplitIT.class);
@Override
- public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setProperty(Property.TSERV_MAJC_DELAY, "50ms");
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setProperty(Property.TSERV_MAJC_DELAY, "50ms");
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
index 97022c5..1bac9df 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
@@ -19,9 +19,9 @@
package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.Collections;
@@ -49,7 +49,7 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.threads.ThreadPools;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -247,7 +247,7 @@ public class BatchWriterFlushIT extends AccumuloClusterHarness {
break;
}
}
- assertTrue("Mutation not found: " + m, found);
+ assertTrue(found, "Mutation not found: " + m);
}
for (int m = 0; m < NUM_THREADS; m++) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
index b456adb..6ce435e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -40,6 +40,11 @@ public class BigRootTabletIT extends AccumuloClusterHarness {
// buffers
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> siteConfig = cfg.getSiteConfig();
siteConfig.put(Property.TABLE_SCAN_MAXMEM.getKey(), "1024");
@@ -47,11 +52,6 @@ public class BigRootTabletIT extends AccumuloClusterHarness {
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java
index 86c4cd7..ee78764 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java
@@ -27,7 +27,7 @@ import org.apache.accumulo.core.client.admin.NewTableConfiguration;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.TestBinaryRows;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BinaryIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java
index 3e55044..4871774 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet;
import java.util.Map;
@@ -40,15 +40,15 @@ import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class BinaryStressIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 4 * 60;
+ return 60 * 4;
}
@Override
@@ -60,7 +60,7 @@ public class BinaryStressIT extends AccumuloClusterHarness {
private String majcDelay, maxMem;
- @Before
+ @BeforeEach
public void alterConfig() throws Exception {
if (getClusterType() == ClusterType.MINI) {
return;
@@ -79,7 +79,7 @@ public class BinaryStressIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void resetConfig() throws Exception {
if (majcDelay != null) {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
@@ -107,7 +107,7 @@ public class BinaryStressIT extends AccumuloClusterHarness {
tablets.add(entry.getKey().getRow());
}
}
- assertTrue("Expected at least 8 tablets, saw " + tablets.size(), tablets.size() > 7);
+ assertTrue(tablets.size() > 7, "Expected at least 8 tablets, saw " + tablets.size());
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
index e852eb4..1a15aeb 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
@@ -47,7 +47,7 @@ import org.apache.accumulo.minicluster.MemoryUnit;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,6 +55,11 @@ public class BloomFilterIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(BloomFilterIT.class);
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 6;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setDefaultMemory(1, MemoryUnit.GIGABYTE);
cfg.setNumTservers(1);
@@ -63,11 +68,6 @@ public class BloomFilterIT extends AccumuloClusterHarness {
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 6 * 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkFailureIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkFailureIT.java
index c055906..72cb183 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkFailureIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkFailureIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -75,7 +75,7 @@ import org.apache.thrift.TApplicationException;
import org.apache.thrift.TServiceClient;
import org.apache.thrift.transport.TTransportException;
import org.apache.zookeeper.KeeperException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BulkFailureIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
index 8914b5d..3fb5d29 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
@@ -18,6 +18,8 @@
*/
package org.apache.accumulo.test.functional;
+import static org.apache.accumulo.harness.AccumuloITBase.SUNNY_DAY;
+
import java.io.IOException;
import org.apache.accumulo.core.client.Accumulo;
@@ -31,16 +33,15 @@ import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.TestIngest.IngestParams;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.accumulo.test.VerifyIngest.VerifyParams;
-import org.apache.accumulo.test.categories.SunnyDayTests;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
/**
* Tests Old and New Bulk import
*/
-@Category(SunnyDayTests.class)
+@Tag(SUNNY_DAY)
public class BulkIT extends AccumuloClusterHarness {
private static final int N = 100000;
@@ -48,7 +49,7 @@ public class BulkIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 4 * 60;
+ return 60 * 4;
}
@Test
@@ -56,7 +57,7 @@ public class BulkIT extends AccumuloClusterHarness {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
runTest(client, getClientInfo(), getCluster().getFileSystem(),
getCluster().getTemporaryPath(), getUniqueNames(1)[0], this.getClass().getName(),
- testName.getMethodName(), false);
+ testName(), false);
}
}
@@ -65,7 +66,7 @@ public class BulkIT extends AccumuloClusterHarness {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
runTest(client, getClientInfo(), getCluster().getFileSystem(),
getCluster().getTemporaryPath(), getUniqueNames(1)[0], this.getClass().getName(),
- testName.getMethodName(), true);
+ testName(), true);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java
index 9488d08..1925377 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java
@@ -21,9 +21,9 @@ package org.apache.accumulo.test.functional;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FILES;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOADED;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-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;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -76,10 +76,10 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -90,12 +90,17 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
*/
public class BulkNewIT extends SharedMiniClusterBase {
- @BeforeClass
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniClusterWithConfig(new Callback());
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
@@ -110,17 +115,12 @@ public class BulkNewIT extends SharedMiniClusterBase {
}
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
private String tableName;
private AccumuloConfiguration aconf;
private FileSystem fs;
private String rootPath;
- @Before
+ @BeforeEach
public void setupBulkTest() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
tableName = getUniqueNames(1)[0];
@@ -215,16 +215,16 @@ public class BulkNewIT extends SharedMiniClusterBase {
// test max tablets hit while inspecting bulk files
var thrown = assertThrows(RuntimeException.class, () -> testBulkFileMax(false));
var c = thrown.getCause();
- assertTrue("Wrong exception: " + c, c instanceof ExecutionException);
- assertTrue("Wrong exception: " + c.getCause(),
- c.getCause() instanceof IllegalArgumentException);
+ assertTrue(c instanceof ExecutionException, "Wrong exception: " + c);
+ assertTrue(c.getCause() instanceof IllegalArgumentException,
+ "Wrong exception: " + c.getCause());
var msg = c.getCause().getMessage();
- assertTrue("Bad File not in exception: " + msg, msg.contains("bad-file.rf"));
+ assertTrue(msg.contains("bad-file.rf"), "Bad File not in exception: " + msg);
// test max tablets hit using load plan on the server side
c = assertThrows(AccumuloException.class, () -> testBulkFileMax(true));
msg = c.getMessage();
- assertTrue("Bad File not in exception: " + msg, msg.contains("bad-file.rf"));
+ assertTrue(msg.contains("bad-file.rf"), "Bad File not in exception: " + msg);
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkOldIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkOldIT.java
index 4aca716..dec9696 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkOldIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkOldIT.java
@@ -44,7 +44,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests old bulk import technique. For new bulk import see {@link BulkNewIT}
@@ -52,13 +52,13 @@ import org.junit.Test;
public class BulkOldIT extends AccumuloClusterHarness {
@Override
- public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) {
- cfg.setMemory(ServerType.TABLET_SERVER, 512, MemoryUnit.MEGABYTE);
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
+ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) {
+ cfg.setMemory(ServerType.TABLET_SERVER, 512, MemoryUnit.MEGABYTE);
}
// suppress importDirectory deprecated since this is the only test for legacy technique
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
index 4d28b43..05b40a1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
@@ -34,9 +34,9 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* This test verifies that when a lot of files are bulk imported into a table with one tablet and
@@ -45,18 +45,18 @@ import org.junit.Test;
public class BulkSplitOptimizationIT extends AccumuloClusterHarness {
@Override
- public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setProperty(Property.TSERV_MAJC_DELAY, "1s");
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setProperty(Property.TSERV_MAJC_DELAY, "1s");
}
private String majcDelay;
- @Before
+ @BeforeEach
public void alterConfig() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
majcDelay = client.instanceOperations().getSystemConfiguration()
@@ -69,7 +69,7 @@ public class BulkSplitOptimizationIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void resetConfig() throws Exception {
if (majcDelay != null) {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
index 216404b..bb46c10 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
@@ -34,11 +34,16 @@ import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.accumulo.test.VerifyIngest.VerifyParams;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ChaoticBalancerIT extends AccumuloClusterHarness {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> siteConfig = cfg.getSiteConfig();
siteConfig.put(Property.TSERV_MAXMEM.getKey(), "10K");
@@ -48,11 +53,6 @@ public class ChaoticBalancerIT extends AccumuloClusterHarness {
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
index 63c8228..aca10de 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
@@ -19,10 +19,11 @@
package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.IOException;
import java.io.InputStream;
@@ -45,27 +46,26 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
-@Category(MiniClusterOnlyTests.class)
+@Tag(MINI_CLUSTER_ONLY)
public class ClassLoaderIT extends AccumuloClusterHarness {
private static final long ZOOKEEPER_PROPAGATION_TIME = 10_000;
+ private String rootPath;
+
@Override
protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ return 60 * 2;
}
- private String rootPath;
-
- @Before
+ @BeforeEach
public void checkCluster() {
assumeTrue(getClusterType() == ClusterType.MINI);
MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) getCluster();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
index e2d82e8..86b1a1c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.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;
import java.util.Map.Entry;
@@ -42,7 +42,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,6 +53,11 @@ public class CleanTmpIT extends ConfigurableMacBase {
private static final Logger log = LoggerFactory.getLogger(CleanTmpIT.class);
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
cfg.setNumTservers(1);
@@ -60,11 +65,6 @@ public class CleanTmpIT extends ConfigurableMacBase {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProperties()).build()) {
@@ -96,9 +96,9 @@ public class CleanTmpIT extends ConfigurableMacBase {
}
FileSystem fs = getCluster().getFileSystem();
- assertTrue("Could not find file: " + file, fs.exists(file));
+ assertTrue(fs.exists(file), "Could not find file: " + file);
Path tabletDir = file.getParent();
- assertNotNull("Tablet dir should not be null", tabletDir);
+ assertNotNull(tabletDir, "Tablet dir should not be null");
Path tmp = new Path(tabletDir, "junk.rf_tmp");
// Make the file
fs.create(tmp).close();
@@ -109,7 +109,7 @@ public class CleanTmpIT extends ConfigurableMacBase {
try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
assertEquals(2, Iterators.size(scanner.iterator()));
// If we performed log recovery, we should have cleaned up any stray files
- assertFalse("File still exists: " + tmp, fs.exists(tmp));
+ assertFalse(fs.exists(tmp), "File still exists: " + tmp);
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java
index 1b4860f..0f462c1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Map.Entry;
import java.util.Set;
@@ -35,9 +35,9 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.singletons.SingletonManager;
import org.apache.accumulo.harness.SharedMiniClusterBase;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,12 +59,12 @@ public class CleanUpIT extends SharedMiniClusterBase {
return 30;
}
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
@@ -104,7 +104,7 @@ public class CleanUpIT extends SharedMiniClusterBase {
}
}
- assertEquals("Unexpected count", 1, count);
+ assertEquals(1, count, "Unexpected count");
int threadCount = countThreads();
if (threadCount < 2) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
index 540c410..2efcdda 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
+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;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.util.ArrayList;
import java.util.Arrays;
@@ -66,13 +66,13 @@ import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CloneTestIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ return 60 * 2;
}
@Test
@@ -141,7 +141,7 @@ public class CloneTestIT extends AccumuloClusterHarness {
ServerColumnFamily.DIRECTORY_COLUMN.fetch(s);
String tableId = client.tableOperations().tableIdMap().get(table);
- assertNotNull("Could not get table id for " + table, tableId);
+ assertNotNull(tableId, "Could not get table id for " + table);
s.setRange(Range.prefix(tableId));
@@ -158,20 +158,20 @@ public class CloneTestIT extends AccumuloClusterHarness {
if (cf.equals(DataFileColumnFamily.NAME)) {
Path p = new Path(cq.toString());
FileSystem fs = cluster.getFileSystem();
- assertTrue("File does not exist: " + p, fs.exists(p));
+ assertTrue(fs.exists(p), "File does not exist: " + p);
} else if (cf.equals(ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily())) {
- assertEquals("Saw unexpected cq",
- ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), cq);
+ assertEquals(ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), cq,
+ "Saw unexpected cq");
String dirName = entry.getValue().toString();
- assertTrue("Bad dir name " + dirName, pattern.matcher(dirName).matches());
+ assertTrue(pattern.matcher(dirName).matches(), "Bad dir name " + dirName);
} else {
fail("Got unexpected key-value: " + entry);
throw new RuntimeException();
}
}
- assertTrue("Expected to find metadata entries", itemsInspected > 0);
+ assertTrue(itemsInspected > 0, "Expected to find metadata entries");
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
index f42f0a4..767cd35 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test.functional;
-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;
import java.util.Collections;
import java.util.Iterator;
@@ -38,7 +38,7 @@ import org.apache.accumulo.core.iterators.LongCombiner.Type;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CombinerIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
index b0c6e50..6df595c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
@@ -18,10 +18,11 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static java.util.concurrent.TimeUnit.SECONDS;
+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;
import java.io.IOException;
import java.util.ArrayList;
@@ -32,7 +33,6 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@@ -76,7 +76,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
import org.bouncycastle.util.Arrays;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -154,6 +154,11 @@ public class CompactionIT extends AccumuloClusterHarness {
private static final int MAX_DATA = 1000;
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
cfg.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN, "4");
@@ -163,11 +168,6 @@ public class CompactionIT extends AccumuloClusterHarness {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
@Test
public void testBadSelector() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
@@ -368,8 +368,8 @@ public class CompactionIT extends AccumuloClusterHarness {
int v = Integer.parseInt(entry.getValue().toString());
int modulus = v < MAX_DATA ? 17 : 19;
- assertTrue(String.format("%s %s %d != 0", entry.getValue(), "%", modulus),
- Integer.parseInt(entry.getValue().toString()) % modulus == 0);
+ assertEquals(0, Integer.parseInt(entry.getValue().toString()) % modulus,
+ String.format("%s %s %d != 0", entry.getValue(), "%", modulus));
count++;
}
@@ -410,8 +410,8 @@ public class CompactionIT extends AccumuloClusterHarness {
// without compression, expect file to be large
long sizes = CompactionExecutorIT.getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes,
- sizes > data.length * 10 && sizes < data.length * 11);
+ assertTrue(sizes > data.length * 10 && sizes < data.length * 11,
+ "Unexpected files sizes : " + sizes);
client.tableOperations().compact(tableName,
new CompactionConfig().setWait(true)
@@ -421,15 +421,15 @@ public class CompactionIT extends AccumuloClusterHarness {
// after compacting with compression, expect small file
sizes = CompactionExecutorIT.getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes: data: " + data.length + ", file:" + sizes,
- sizes < data.length);
+ assertTrue(sizes < data.length,
+ "Unexpected files sizes: data: " + data.length + ", file:" + sizes);
client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
// after compacting without compression, expect big files again
sizes = CompactionExecutorIT.getFileSizes(client, tableName);
- assertTrue("Unexpected files sizes : " + sizes,
- sizes > data.length * 10 && sizes < data.length * 11);
+ assertTrue(sizes > data.length * 10 && sizes < data.length * 11,
+ "Unexpected files sizes : " + sizes);
}
}
@@ -473,9 +473,9 @@ public class CompactionIT extends AccumuloClusterHarness {
executor.execute(r);
}
executor.shutdown();
- executor.awaitTermination(defaultTimeoutSeconds(), TimeUnit.SECONDS);
- assertFalse("Failed to successfully run all threads, Check the test output for error",
- fail.get());
+ executor.awaitTermination(defaultTimeoutSeconds(), SECONDS);
+ assertFalse(fail.get(),
+ "Failed to successfully run all threads, Check the test output for error");
}
int finalCount = countFiles(c);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
index 29c826a..34edde5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
@@ -38,7 +38,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -71,17 +71,17 @@ public class ConcurrencyIT extends AccumuloClusterHarness {
}
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> siteConfig = cfg.getSiteConfig();
siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
- }
-
// @formatter:off
// Below is a diagram of the operations in this test over time.
//
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
index 41e6f41..95d490d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test.functional;
-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;
import java.util.ArrayList;
import java.util.Collections;
@@ -48,7 +48,7 @@ import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
@@ -57,7 +57,7 @@ public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 7 * 60;
+ return 60 * 7;
}
@Test
@@ -104,8 +104,9 @@ public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
future.get();
}
- assertThrows("Expected table " + table + " to be gone.", TableNotFoundException.class,
- () -> c.createScanner(table, Authorizations.EMPTY));
+ assertThrows(TableNotFoundException.class,
+ () -> c.createScanner(table, Authorizations.EMPTY),
+ "Expected table " + table + " to be gone.");
FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
}
@@ -208,8 +209,9 @@ public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
future.get();
}
- assertThrows("Expected table " + table + " to be gone.", TableNotFoundException.class,
- () -> c.createScanner(table, Authorizations.EMPTY));
+ assertThrows(TableNotFoundException.class,
+ () -> c.createScanner(table, Authorizations.EMPTY),
+ "Expected table " + table + " to be gone.");
FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
index dc07484..c43dcfc 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
@@ -19,8 +19,8 @@
package org.apache.accumulo.test.functional;
import static java.util.Collections.singletonMap;
-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;
import java.util.Arrays;
import java.util.HashMap;
@@ -41,15 +41,15 @@ import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
public class ConfigurableCompactionIT extends ConfigurableMacBase {
@Override
- public int defaultTimeoutSeconds() {
- return 2 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Override
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java
index 6a55161..1b7a1db 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java
@@ -18,7 +18,8 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -39,15 +40,14 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.miniclusterImpl.ZooKeeperBindException;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.accumulo.test.util.CertUtils;
import org.apache.accumulo.tserver.memory.NativeMapLoader;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +59,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* specific configuration. Most tests don't need this level of control and should extend
* {@link AccumuloClusterHarness} instead.
*/
-@Category(MiniClusterOnlyTests.class)
+@Tag(MINI_CLUSTER_ONLY)
public class ConfigurableMacBase extends AccumuloITBase {
public static final Logger log = LoggerFactory.getLogger(ConfigurableMacBase.class);
@@ -127,7 +127,7 @@ public class ConfigurableMacBase extends AccumuloITBase {
cfg.setClientProps(clientProps);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
createMiniAccumulo();
Exception lastException = null;
@@ -150,7 +150,7 @@ public class ConfigurableMacBase extends AccumuloITBase {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
private void createMiniAccumulo() throws Exception {
// createTestDir will give us a empty directory, we don't need to clean it up ourselves
- File baseDir = createTestDir(this.getClass().getName() + "_" + this.testName.getMethodName());
+ File baseDir = createTestDir(this.getClass().getName() + "_" + this.testName());
MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(baseDir, ROOT_PASSWORD);
File nativePathInDevTree = NativeMapIT.nativeMapLocation();
File nativePathInMapReduce = new File(System.getProperty("user.dir"));
@@ -179,7 +179,7 @@ public class ConfigurableMacBase extends AccumuloITBase {
beforeClusterStart(cfg);
}
- @After
+ @AfterEach
public void tearDown() {
if (cluster != null) {
try {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java
index a3ee804..4f6fc43 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java
@@ -43,7 +43,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.constraints.AlphaNumKeyConstraint;
import org.apache.accumulo.test.constraints.NumericValueConstraint;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
index d918e29..11b6569 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Iterator;
@@ -39,21 +39,21 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
public class CreateAndUseIT extends AccumuloClusterHarness {
+ private static NewTableConfiguration ntc;
+
@Override
protected int defaultTimeoutSeconds() {
- return 4 * 60;
+ return 60 * 4;
}
- private static NewTableConfiguration ntc;
-
- @BeforeClass
+ @BeforeAll
public static void createData() {
SortedSet<Text> splits = new TreeSet<>();
@@ -93,7 +93,7 @@ public class CreateAndUseIT extends AccumuloClusterHarness {
ei++;
}
- assertEquals("Did not see expected number of rows", 257, ei);
+ assertEquals(257, ei, "Did not see expected number of rows");
}
}
}
@@ -134,7 +134,7 @@ public class CreateAndUseIT extends AccumuloClusterHarness {
bs.setRanges(ranges);
Iterator<Entry<Key,Value>> iter = bs.iterator();
int count = Iterators.size(iter);
- assertEquals("Did not expect to find any entries", 0, count);
+ assertEquals(0, count, "Did not expect to find any entries");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java
index 391f396..8953591 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test.functional;
-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;
import java.util.Base64;
import java.util.Collection;
@@ -43,9 +43,9 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class CreateInitialSplitsIT extends AccumuloClusterHarness {
@@ -53,6 +53,11 @@ public class CreateInitialSplitsIT extends AccumuloClusterHarness {
private String tableName;
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration conf) {
cfg.setMemory(ServerType.TABLET_SERVER, 512, MemoryUnit.MEGABYTE);
@@ -60,17 +65,12 @@ public class CreateInitialSplitsIT extends AccumuloClusterHarness {
conf.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 2 * 60;
- }
-
- @Before
+ @BeforeEach
public void setupInitialSplits() {
client = Accumulo.newClient().from(getClientProps()).build();
}
- @After
+ @AfterEach
public void closeClient() {
client.close();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java
index 8e26a6b..81737e9 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java
@@ -22,7 +22,7 @@ import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CreateManyScannersIT extends AccumuloClusterHarness {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
index 3c794b2..8d95a12 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
@@ -18,10 +18,10 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -43,9 +43,9 @@ import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class CredentialsIT extends AccumuloClusterHarness {
@@ -54,11 +54,11 @@ public class CredentialsIT extends AccumuloClusterHarness {
private String password;
@Override
- public int defaultTimeoutSeconds() {
- return 2 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
- @Before
+ @BeforeEach
public void createLocalUser() throws AccumuloException, AccumuloSecurityException {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
ClusterUser user = getUser(0);
@@ -77,7 +77,7 @@ public class CredentialsIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void deleteLocalUser() throws Exception {
if (saslEnabled) {
ClusterUser root = getAdminUser();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
index 550f938..33976dd 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
@@ -19,7 +19,7 @@
package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -37,9 +37,9 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
@@ -47,20 +47,20 @@ import com.google.common.collect.Iterators;
public class DeleteEverythingIT extends AccumuloClusterHarness {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> siteConfig = cfg.getSiteConfig();
siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1s");
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 60;
- }
-
private String majcDelay;
- @Before
+ @BeforeEach
public void updateMajcDelay() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
majcDelay =
@@ -73,7 +73,7 @@ public class DeleteEverythingIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void resetMajcDelay() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
@@ -103,7 +103,7 @@ public class DeleteEverythingIT extends AccumuloClusterHarness {
try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
scanner.setRange(new Range());
int count = Iterators.size(scanner.iterator());
- assertEquals("count == " + count, 0, count);
+ assertEquals(0, count, "count == " + count);
c.tableOperations().flush(tableName, null, null, true);
c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java
index 18d56ec..b1cd18b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Collections;
@@ -32,7 +32,7 @@ import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.iteratorsImpl.system.DeletingIterator.Behavior;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DeleteFailIT extends AccumuloClusterHarness {
@@ -52,8 +52,8 @@ public class DeleteFailIT extends AccumuloClusterHarness {
}
try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
- assertThrows("Expected scan to fail because deletes are present.", RuntimeException.class,
- () -> scanner.forEach(e -> {}));
+ assertThrows(RuntimeException.class, () -> scanner.forEach(e -> {}),
+ "Expected scan to fail because deletes are present.");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
index 1643d5b..1a18d0f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.accumulo.cluster.AccumuloCluster;
import org.apache.accumulo.core.client.Accumulo;
@@ -28,13 +28,13 @@ import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.TestRandomDeletes;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.accumulo.test.VerifyIngest.VerifyParams;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DeleteIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ return 60 * 2;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
index cd25612..3ca2007 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
@@ -18,16 +18,15 @@
*/
package org.apache.accumulo.test.functional;
-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;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map.Entry;
-import java.util.SortedSet;
import java.util.TreeSet;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
@@ -39,7 +38,7 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,29 +46,26 @@ import com.google.common.collect.Iterators;
public class DeleteRowsIT extends AccumuloClusterHarness {
- @Override
- protected int defaultTimeoutSeconds() {
- return 5 * 60;
- }
-
private static final Logger log = LoggerFactory.getLogger(DeleteRowsIT.class);
private static final int ROWS_PER_TABLET = 10;
- private static final String[] LETTERS = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
- "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
- static final SortedSet<Text> SPLITS = new TreeSet<>();
- static {
- for (String alpha : LETTERS) {
- SPLITS.add(new Text(alpha));
- }
- }
- static final List<String> ROWS = new ArrayList<>(Arrays.asList(LETTERS));
+ private static final List<String> LETTERS = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
+ "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
+ static final TreeSet<Text> SPLITS =
+ LETTERS.stream().map(Text::new).collect(Collectors.toCollection(TreeSet::new));
+
+ static final List<String> ROWS = new ArrayList<>(LETTERS);
+ // put data on first and last tablet
static {
- // put data on first and last tablet
ROWS.add("A");
ROWS.add("{");
}
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
+ }
+
@Test
public void testDeleteAllRows() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
index 6cc386d..10c3958 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.test.functional;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Collections;
@@ -40,18 +40,13 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// attempt to reproduce ACCUMULO-315
public class DeleteRowsSplitIT extends AccumuloClusterHarness {
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
private static final Logger log = LoggerFactory.getLogger(DeleteRowsSplitIT.class);
private static final String LETTERS = "abcdefghijklmnopqrstuvwxyz";
@@ -64,6 +59,11 @@ public class DeleteRowsSplitIT extends AccumuloClusterHarness {
}
}
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
@Test
public void run() throws Exception {
// Delete ranges of rows, and verify the are removed
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
index 11c7558..a0fb2d2 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
@@ -29,24 +29,24 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.harness.SharedMiniClusterBase;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
// ACCUMULO-2880
public class DeletedTablesDontFlushIT extends SharedMiniClusterBase {
@Override
- public int defaultTimeoutSeconds() {
+ protected int defaultTimeoutSeconds() {
return 60;
}
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void teardown() {
SharedMiniClusterBase.stopMiniCluster();
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
index 33a9b5c..a42e0ec 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
@@ -18,8 +18,9 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
@@ -34,29 +35,28 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.miniclusterImpl.ProcessReference;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
-@Category({MiniClusterOnlyTests.class})
+@Tag(MINI_CLUSTER_ONLY)
public class DurabilityIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
cfg.setNumTservers(1);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
static final long N = 100000;
private String[] init(AccumuloClient c) throws Exception {
@@ -115,7 +115,7 @@ public class DurabilityIT extends ConfigurableMacBase {
writeSome(client, tableNames[2], N);
restartTServer();
long numResults = readSome(client, tableNames[2]);
- assertTrue("Expected " + N + " >= " + numResults, numResults <= N);
+ assertTrue(numResults <= N, "Expected " + N + " >= " + numResults);
cleanup(client, tableNames);
}
}
@@ -128,7 +128,7 @@ public class DurabilityIT extends ConfigurableMacBase {
writeSome(client, tableNames[3], N);
restartTServer();
long numResults = readSome(client, tableNames[3]);
- assertTrue("Expected " + N + " >= " + numResults, numResults <= N);
+ assertTrue(numResults <= N, "Expected " + N + " >= " + numResults);
cleanup(client, tableNames);
}
}
@@ -142,7 +142,7 @@ public class DurabilityIT extends ConfigurableMacBase {
writeSome(c, tableName, N);
restartTServer();
long numResults = readSome(c, tableName);
- assertTrue("Expected " + N + " >= " + numResults, numResults <= N);
+ assertTrue(numResults <= N, "Expected " + N + " >= " + numResults);
c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), "sync");
writeSome(c, tableName, N);
restartTServer();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
index b88849b..388096e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
@@ -21,10 +21,11 @@ package org.apache.accumulo.test.functional;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Arrays;
import java.util.List;
@@ -53,10 +54,10 @@ import org.apache.accumulo.fate.zookeeper.ZooUtil;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.util.SlowOps;
import org.apache.zookeeper.KeeperException;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,29 +90,29 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
private SlowOps slowOps;
- @Before
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @BeforeEach
public void setup() {
client = Accumulo.newClient().from(getClientProps()).build();
context = (ClientContext) client;
secret = cluster.getSiteConfiguration().get(Property.INSTANCE_SECRET);
- maxWaitMillis = Math.max(MINUTES.toMillis(1), defaultTimeoutSeconds() * 1000 / 2);
+ maxWaitMillis = Math.max(MINUTES.toMillis(1), SECONDS.toMillis(defaultTimeoutSeconds()) / 2);
}
- @After
+ @AfterEach
public void closeClient() {
client.close();
}
- @AfterClass
+ @AfterAll
public static void cleanup() {
pool.shutdownNow();
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
/**
* Validate that {@code TableOperations} online operation does not block when table is already
* online and fate transaction lock is held by other operations. The test creates, populates a
@@ -128,7 +129,7 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
SlowOps.setExpectedCompactions(client, 1);
slowOps = new SlowOps(client, tableName, maxWaitMillis);
- assertEquals("verify table online after created", TableState.ONLINE, getTableState(tableName));
+ assertEquals(TableState.ONLINE, getTableState(tableName), "verify table online after created");
OnLineCallable onlineOp = new OnLineCallable(tableName);
@@ -138,12 +139,12 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
log.trace("Online 1 in {} ms", NANOSECONDS.toMillis(timing1.runningTime()));
- assertEquals("verify table is still online", TableState.ONLINE, getTableState(tableName));
+ assertEquals(TableState.ONLINE, getTableState(tableName), "verify table is still online");
// verify that offline then online functions as expected.
client.tableOperations().offline(tableName, true);
- assertEquals("verify table is offline", TableState.OFFLINE, getTableState(tableName));
+ assertEquals(TableState.OFFLINE, getTableState(tableName), "verify table is offline");
onlineOp = new OnLineCallable(tableName);
@@ -153,7 +154,7 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
log.trace("Online 2 in {} ms", NANOSECONDS.toMillis(timing2.runningTime()));
- assertEquals("verify table is back online", TableState.ONLINE, getTableState(tableName));
+ assertEquals(TableState.ONLINE, getTableState(tableName), "verify table is back online");
// launch a full table compaction with the slow iterator to ensure table lock is acquired and
// held by the compaction
@@ -168,12 +169,12 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
OnlineOpTiming timing3 = task.get();
- assertTrue("online should take less time than expected compaction time",
- timing3.runningTime() < MILLISECONDS.toNanos(NUM_ROWS * SLOW_SCAN_SLEEP_MS));
+ assertTrue(timing3.runningTime() < MILLISECONDS.toNanos(NUM_ROWS * SLOW_SCAN_SLEEP_MS),
+ "online should take less time than expected compaction time");
- assertEquals("verify table is still online", TableState.ONLINE, getTableState(tableName));
+ assertEquals(TableState.ONLINE, getTableState(tableName), "verify table is still online");
- assertTrue("Find FATE operation for table", findFate(tableName));
+ assertTrue(findFate(tableName), "Find FATE operation for table");
// test complete, cancel compaction and move on.
client.tableOperations().cancelCompaction(tableName);
@@ -211,7 +212,7 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
}
/**
- * Validate the the AdminUtil.getStatus works correctly after refactor and validate that
+ * Validate the AdminUtil.getStatus works correctly after refactor and validate that
* getTransactionStatus can be called without lock map(s). The test starts a long running fate
* transaction (slow compaction) and the calls AdminUtil functions to get the FATE.
*/
@@ -225,8 +226,8 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
try {
- assertEquals("verify table online after created", TableState.ONLINE,
- getTableState(tableName));
+ assertEquals(TableState.ONLINE, getTableState(tableName),
+ "verify table online after created");
tableId = context.getTableId(tableName);
@@ -301,7 +302,7 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
}
}
- assertTrue("Number of fates matches should be > 0", matchCount > 0);
+ assertTrue(matchCount > 0, "Number of fates matches should be > 0");
try {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java
index 350af80..8b96184 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java
@@ -28,16 +28,13 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.TestIngest.IngestParams;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-/**
- * See ACCUMULO-779
- */
public class FateStarvationIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ return 60 * 2;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java
index 855a2a5..a8727ec 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test.functional;
-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;
import java.io.IOException;
import java.util.Collection;
@@ -46,7 +46,7 @@ import org.apache.accumulo.core.iterators.IteratorUtil;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
@@ -99,10 +99,10 @@ public class FlushNoFileIT extends AccumuloClusterHarness {
FunctionalTestUtils.checkRFiles(c, tableName, 3, 3, 0, 0);
long secondFlushId = FunctionalTestUtils.checkFlushId((ClientContext) c, tableId, flushId);
- assertTrue("Flush ID did not change", secondFlushId > flushId);
+ assertTrue(secondFlushId > flushId, "Flush ID did not change");
try (Scanner scanner = c.createScanner(tableName)) {
- assertEquals("Expected 0 Entries in table", 0, Iterables.size(scanner));
+ assertEquals(0, Iterables.size(scanner), "Expected 0 Entries in table");
}
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
index 67e5c0b..3eb1f1f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
@@ -20,8 +20,8 @@ package org.apache.accumulo.test.functional;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FLUSH_ID;
-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;
import java.io.IOException;
import java.io.InputStream;
@@ -204,10 +204,10 @@ public class FunctionalTestUtils {
public static void assertNoDanglingFateLocks(AccumuloCluster cluster) {
FateStatus fateStatus = getFateStatus(cluster);
- assertEquals("Dangling FATE locks : " + fateStatus.getDanglingHeldLocks(), 0,
- fateStatus.getDanglingHeldLocks().size());
- assertEquals("Dangling FATE locks : " + fateStatus.getDanglingWaitingLocks(), 0,
- fateStatus.getDanglingWaitingLocks().size());
+ assertEquals(0, fateStatus.getDanglingHeldLocks().size(),
+ "Dangling FATE locks : " + fateStatus.getDanglingHeldLocks());
+ assertEquals(0, fateStatus.getDanglingWaitingLocks().size(),
+ "Dangling FATE locks : " + fateStatus.getDanglingWaitingLocks());
}
private static FateStatus getFateStatus(AccumuloCluster cluster) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index a2ea64a..0fc9932 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -19,12 +19,12 @@
package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.UncheckedIOException;
import java.util.Arrays;
@@ -69,7 +69,7 @@ import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterators;
@@ -77,8 +77,8 @@ public class GarbageCollectorIT extends ConfigurableMacBase {
private static final String OUR_SECRET = "itsreallysecret";
@Override
- public int defaultTimeoutSeconds() {
- return 5 * 60;
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
}
@Override
@@ -275,14 +275,14 @@ public class GarbageCollectorIT extends ConfigurableMacBase {
String gcLoc = new String(zk.getData(lockPath));
- assertTrue("Found unexpected data in zookeeper for GC location: " + gcLoc,
- gcLoc.startsWith(Service.GC_CLIENT.name()));
+ assertTrue(gcLoc.startsWith(Service.GC_CLIENT.name()),
+ "Found unexpected data in zookeeper for GC location: " + gcLoc);
int loc = gcLoc.indexOf(ServerServices.SEPARATOR_CHAR);
- assertNotEquals("Could not find split point of GC location for: " + gcLoc, -1, loc);
+ assertNotEquals(-1, loc, "Could not find split point of GC location for: " + gcLoc);
String addr = gcLoc.substring(loc + 1);
int addrSplit = addr.indexOf(':');
- assertNotEquals("Could not find split of GC host:port for: " + addr, -1, addrSplit);
+ assertNotEquals(-1, addrSplit, "Could not find split of GC host:port for: " + addr);
String host = addr.substring(0, addrSplit), port = addr.substring(addrSplit + 1);
// We shouldn't have the "bindall" address in zk
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
index e0c57da..9155111 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
@@ -19,10 +19,10 @@
package org.apache.accumulo.test.functional;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.File;
import java.io.IOException;
@@ -45,8 +45,8 @@ import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.accumulo.tserver.TabletServer;
import org.apache.hadoop.conf.Configuration;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -68,6 +68,11 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class HalfDeadTServerIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
// configure only one tserver from mini; mini won't less us configure 0, so instead, we will
// start only 1, and kill it to start our own in the desired simulation environment
@@ -77,16 +82,11 @@ public class HalfDeadTServerIT extends ConfigurableMacBase {
cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.FALSE.toString());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
private static final AtomicBoolean sharedLibBuilt = new AtomicBoolean(false);
@SuppressFBWarnings(value = "COMMAND_INJECTION",
justification = "command executed is not from user input")
- @BeforeClass
+ @BeforeAll
public static void buildSharedLib() throws IOException, InterruptedException {
String root = System.getProperty("user.dir");
String source = root + "/src/test/c/fake_disk_failure.c";
@@ -156,7 +156,7 @@ public class HalfDeadTServerIT extends ConfigurableMacBase {
@SuppressFBWarnings(value = {"PATH_TRAVERSAL_IN", "COMMAND_INJECTION"},
justification = "path provided by test; command args provided by test")
public String test(int seconds, boolean expectTserverDied) throws Exception {
- assumeTrue("Shared library did not build", sharedLibBuilt.get());
+ assumeTrue(sharedLibBuilt.get(), "Shared library did not build");
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
while (client.instanceOperations().getTabletServers().isEmpty()) {
// wait until the tserver that we need to kill is running
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/IteratorMincClassCastBugIT.java b/test/src/main/java/org/apache/accumulo/test/functional/IteratorMincClassCastBugIT.java
index aa90844..01d7f11 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/IteratorMincClassCastBugIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/IteratorMincClassCastBugIT.java
@@ -44,7 +44,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests iterator class hierarchy bug. The failure condition of this test is to hang on the flush
@@ -53,17 +53,17 @@ import org.junit.Test;
public class IteratorMincClassCastBugIT extends AccumuloClusterHarness {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
// this bug only shows up when not using native maps
cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, "false");
cfg.setNumTservers(1);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
index c81f21e..2b2c065 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
@@ -19,11 +19,12 @@
package org.apache.accumulo.test.functional;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.lang.reflect.UndeclaredThrowableException;
@@ -70,17 +71,16 @@ import org.apache.accumulo.harness.TestingKdc;
import org.apache.accumulo.minicluster.ServerType;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,7 +93,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* MAC test which uses {@link MiniKdc} to simulate ta secure environment. Can be used as a sanity
* check for Kerberos/SASL testing.
*/
-@Category(MiniClusterOnlyTests.class)
+@Tag(MINI_CLUSTER_ONLY)
public class KerberosIT extends AccumuloITBase {
private static final Logger log = LoggerFactory.getLogger(KerberosIT.class);
@@ -101,7 +101,12 @@ public class KerberosIT extends AccumuloITBase {
private static String krbEnabledForITs = null;
private static ClusterUser rootUser;
- @BeforeClass
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
+ }
+
+ @BeforeAll
public static void startKdc() throws Exception {
kdc = new TestingKdc();
kdc.start();
@@ -112,7 +117,7 @@ public class KerberosIT extends AccumuloITBase {
rootUser = kdc.getRootUser();
}
- @AfterClass
+ @AfterAll
public static void stopKdc() {
if (kdc != null) {
kdc.stop();
@@ -123,14 +128,9 @@ public class KerberosIT extends AccumuloITBase {
UserGroupInformation.setConfiguration(new Configuration(false));
}
- @Override
- public int defaultTimeoutSeconds() {
- return 60 * 5;
- }
-
private MiniAccumuloClusterImpl mac;
- @Before
+ @BeforeEach
public void startMac() throws Exception {
MiniClusterHarness harness = new MiniClusterHarness();
mac = harness.create(this, new PasswordToken("unused"), kdc,
@@ -153,7 +153,7 @@ public class KerberosIT extends AccumuloITBase {
UserGroupInformation.setConfiguration(conf);
}
- @After
+ @AfterEach
public void stopMac() throws Exception {
if (mac != null) {
mac.stop();
@@ -171,8 +171,8 @@ public class KerberosIT extends AccumuloITBase {
// The "root" user should have all system permissions
for (SystemPermission perm : SystemPermission.values()) {
- assertTrue("Expected user to have permission: " + perm,
- client.securityOperations().hasSystemPermission(client.whoami(), perm));
+ assertTrue(client.securityOperations().hasSystemPermission(client.whoami(), perm),
+ "Expected user to have permission: " + perm);
}
// and the ability to modify the root and metadata tables
@@ -187,7 +187,7 @@ public class KerberosIT extends AccumuloITBase {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
@Test
public void testNewUser() throws Exception {
- String newUser = testName.getMethodName();
+ String newUser = testName();
final File newUserKeytab = new File(kdc.getKeytabDir(), newUser + ".keytab");
if (newUserKeytab.exists() && !newUserKeytab.delete()) {
log.warn("Unable to delete {}", newUserKeytab);
@@ -242,7 +242,7 @@ public class KerberosIT extends AccumuloITBase {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
@Test
public void testUserPrivilegesThroughGrant() throws Exception {
- String user1 = testName.getMethodName();
+ String user1 = testName();
final File user1Keytab = new File(kdc.getKeytabDir(), user1 + ".keytab");
if (user1Keytab.exists() && !user1Keytab.delete()) {
log.warn("Unable to delete {}", user1Keytab);
@@ -287,7 +287,7 @@ public class KerberosIT extends AccumuloITBase {
AccumuloClient client = mac.createAccumuloClient(qualifiedUser1, new KerberosToken());
// Shouldn't throw an exception since we granted the create table permission
- final String table = testName.getMethodName() + "_user_table";
+ final String table = testName() + "_user_table";
client.tableOperations().create(table);
// Make sure we can actually use the table we made
@@ -305,7 +305,7 @@ public class KerberosIT extends AccumuloITBase {
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
@Test
public void testUserPrivilegesForTable() throws Exception {
- String user1 = testName.getMethodName();
+ String user1 = testName();
final File user1Keytab = new File(kdc.getKeytabDir(), user1 + ".keytab");
if (user1Keytab.exists() && !user1Keytab.delete()) {
log.warn("Unable to delete {}", user1Keytab);
@@ -332,7 +332,7 @@ public class KerberosIT extends AccumuloITBase {
return null;
});
- final String table = testName.getMethodName() + "_user_table";
+ final String table = testName() + "_user_table";
final String viz = "viz";
ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(rootUser.getPrincipal(),
@@ -379,11 +379,11 @@ public class KerberosIT extends AccumuloITBase {
// Read (and proper authorizations)
try (Scanner s = client.createScanner(table, new Authorizations(viz))) {
Iterator<Entry<Key,Value>> iter = s.iterator();
- assertTrue("No results from iterator", iter.hasNext());
+ assertTrue(iter.hasNext(), "No results from iterator");
Entry<Key,Value> entry = iter.next();
assertEquals(new Key("a", "b", "c", viz, ts), entry.getKey());
assertEquals(new Value("d"), entry.getValue());
- assertFalse("Had more results from iterator", iter.hasNext());
+ assertFalse(iter.hasNext(), "Had more results from iterator");
return null;
}
});
@@ -464,26 +464,25 @@ public class KerberosIT extends AccumuloITBase {
UserGroupInformation userWithoutPrivs =
UserGroupInformation.createUserForTesting("fake_user", new String[0]);
// Use the delegation token to try to log in as a different user
- var e = assertThrows("Using a delegation token as a different user should throw an exception",
- UndeclaredThrowableException.class,
+ var e = assertThrows(UndeclaredThrowableException.class,
() -> userWithoutPrivs.doAs((PrivilegedExceptionAction<Void>) () -> {
AccumuloClient client = mac.createAccumuloClient("some_other_user", delegationToken);
client.securityOperations().authenticateUser("some_other_user", delegationToken);
return null;
- }));
+ }), "Using a delegation token as a different user should throw an exception");
Throwable cause = e.getCause();
assertNotNull(cause);
// We should get an AccumuloSecurityException from trying to use a delegation token for the
// wrong user
- assertTrue("Expected cause to be AccumuloSecurityException, but was " + cause.getClass(),
- cause instanceof AccumuloSecurityException);
+ assertTrue(cause instanceof AccumuloSecurityException,
+ "Expected cause to be AccumuloSecurityException, but was " + cause.getClass());
}
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
@Test
public void testGetDelegationTokenDenied() throws Exception {
- String newUser = testName.getMethodName();
+ String newUser = testName();
final File newUserKeytab = new File(kdc.getKeytabDir(), newUser + ".keytab");
if (newUserKeytab.exists() && !newUserKeytab.delete()) {
log.warn("Unable to delete {}", newUserKeytab);
@@ -530,9 +529,8 @@ public class KerberosIT extends AccumuloITBase {
AuthenticationToken token =
client.securityOperations().getDelegationToken(new DelegationTokenConfig());
- assertTrue("Could not get tables with delegation token",
- !mac.createAccumuloClient(rootUser.getPrincipal(), token).tableOperations().list()
- .isEmpty());
+ assertTrue(!mac.createAccumuloClient(rootUser.getPrincipal(), token).tableOperations()
+ .list().isEmpty(), "Could not get tables with delegation token");
return token;
});
@@ -547,8 +545,8 @@ public class KerberosIT extends AccumuloITBase {
root.doAs((PrivilegedExceptionAction<Void>) () -> {
AccumuloClient client = mac.createAccumuloClient(rootUser.getPrincipal(), delegationToken1);
- assertTrue("Could not get tables with delegation token",
- !client.tableOperations().list().isEmpty());
+ assertTrue(!client.tableOperations().list().isEmpty(),
+ "Could not get tables with delegation token");
return null;
});
@@ -564,9 +562,8 @@ public class KerberosIT extends AccumuloITBase {
AuthenticationToken token =
client.securityOperations().getDelegationToken(new DelegationTokenConfig());
- assertTrue("Could not get tables with delegation token",
- !mac.createAccumuloClient(rootUser.getPrincipal(), token).tableOperations().list()
- .isEmpty());
+ assertTrue(!mac.createAccumuloClient(rootUser.getPrincipal(), token).tableOperations()
+ .list().isEmpty(), "Could not get tables with delegation token");
return token;
});
@@ -622,8 +619,8 @@ public class KerberosIT extends AccumuloITBase {
});
AuthenticationTokenIdentifier identifier = ((DelegationTokenImpl) dt).getIdentifier();
- assertTrue("Expected identifier to expire in no more than 5 minutes: " + identifier,
- identifier.getExpirationDate() - identifier.getIssueDate() <= MINUTES.toMillis(5));
+ assertTrue(identifier.getExpirationDate() - identifier.getIssueDate() <= (MINUTES.toMillis(5)),
+ "Expected identifier to expire in no more than 5 minutes: " + identifier);
}
@Test
@@ -649,7 +646,7 @@ public class KerberosIT extends AccumuloITBase {
*/
private void createTableWithDataAndCompact(AccumuloClient client) throws TableNotFoundException,
AccumuloSecurityException, AccumuloException, TableExistsException {
- final String table = testName.getMethodName() + "_table";
+ final String table = testName() + "_table";
client.tableOperations().create(table);
try (BatchWriter bw = client.createBatchWriter(table)) {
Mutation m = new Mutation("a");
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java
index bbea019..ce30e69 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java
@@ -19,7 +19,9 @@
package org.apache.accumulo.test.functional;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.junit.Assert.assertEquals;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+import static org.apache.accumulo.test.functional.KerberosRenewalIT.TEST_DURATION_MINUTES;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Map;
import java.util.Map.Entry;
@@ -48,17 +50,17 @@ import org.apache.accumulo.harness.MiniClusterHarness;
import org.apache.accumulo.harness.TestingKdc;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloClusterImpl;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.test.categories.MiniClusterOnlyTests;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,7 +70,7 @@ import com.google.common.collect.Iterables;
* MAC test which uses {@link MiniKdc} to simulate ta secure environment. Can be used as a sanity
* check for Kerberos/SASL testing.
*/
-@Category(MiniClusterOnlyTests.class)
+@Tag(MINI_CLUSTER_ONLY)
public class KerberosRenewalIT extends AccumuloITBase {
private static final Logger log = LoggerFactory.getLogger(KerberosRenewalIT.class);
@@ -77,12 +79,17 @@ public class KerberosRenewalIT extends AccumuloITBase {
private static ClusterUser rootUser;
private static final long TICKET_LIFETIME = MINUTES.toMillis(6); // Anything less seems to fail
- // when
- // generating the ticket
+ // when generating the ticket
private static final long TICKET_TEST_LIFETIME = MINUTES.toMillis(8); // Run a test for 8 mins
- private static final long TEST_DURATION = 9 * 60_000; // The test should finish within 9 mins
- @BeforeClass
+ public static final int TEST_DURATION_MINUTES = 9; // The test should finish within 9 mins
+
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * TEST_DURATION_MINUTES;
+ }
+
+ @BeforeAll
public static void startKdc() throws Exception {
// 30s renewal time window
kdc =
@@ -95,7 +102,7 @@ public class KerberosRenewalIT extends AccumuloITBase {
rootUser = kdc.getRootUser();
}
- @AfterClass
+ @AfterAll
public static void stopKdc() {
if (kdc != null) {
kdc.stop();
@@ -105,14 +112,9 @@ public class KerberosRenewalIT extends AccumuloITBase {
}
}
- @Override
- public int defaultTimeoutSeconds() {
- return (int) TEST_DURATION / 1000;
- }
-
private MiniAccumuloClusterImpl mac;
- @Before
+ @BeforeEach
public void startMac() throws Exception {
MiniClusterHarness harness = new MiniClusterHarness();
mac = harness.create(this, new PasswordToken("unused"), kdc,
@@ -137,7 +139,7 @@ public class KerberosRenewalIT extends AccumuloITBase {
UserGroupInformation.setConfiguration(conf);
}
- @After
+ @AfterEach
public void stopMac() throws Exception {
if (mac != null) {
mac.stop();
@@ -145,7 +147,8 @@ public class KerberosRenewalIT extends AccumuloITBase {
}
// Intentionally setting the Test annotation timeout. We do not want to scale the timeout.
- @Test(timeout = TEST_DURATION)
+ @Test
+ @Timeout(value = TEST_DURATION_MINUTES, unit = MINUTES)
public void testReadAndWriteThroughTicketLifetime() throws Exception {
// Attempt to use Accumulo for a duration of time that exceeds the Kerberos ticket lifetime.
// This is a functional test to verify that Accumulo services renew their ticket.
@@ -185,7 +188,7 @@ public class KerberosRenewalIT extends AccumuloITBase {
*/
private void createReadWriteDrop(AccumuloClient client) throws TableNotFoundException,
AccumuloSecurityException, AccumuloException, TableExistsException {
- final String table = testName.getMethodName() + "_table";
+ final String table = testName() + "_table";
client.tableOperations().create(table);
try (BatchWriter bw = client.createBatchWriter(table)) {
Mutation m = new Mutation("a");
@@ -195,8 +198,9 @@ public class KerberosRenewalIT extends AccumuloITBase {
client.tableOperations().compact(table, new CompactionConfig().setFlush(true).setWait(true));
try (Scanner s = client.createScanner(table, Authorizations.EMPTY)) {
Entry<Key,Value> entry = Iterables.getOnlyElement(s);
- assertEquals("Did not find the expected key", 0,
- new Key("a", "b", "c").compareTo(entry.getKey(), PartialKey.ROW_COLFAM_COLQUAL));
+ assertEquals(0,
+ new Key("a", "b", "c").compareTo(entry.getKey(), PartialKey.ROW_COLFAM_COLQUAL),
+ "Did not find the expected key");
assertEquals("d", entry.getValue().toString());
client.tableOperations().delete(table);
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java b/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java
index 1a8a8a5..630bb4c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java
@@ -20,7 +20,7 @@ package org.apache.accumulo.test.functional;
import static java.util.Collections.singletonMap;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
import java.util.Map.Entry;
@@ -46,9 +46,9 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.TestIngest;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +58,11 @@ public class LargeRowIT extends AccumuloClusterHarness {
private static final Logger log = LoggerFactory.getLogger(LargeRowIT.class);
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 4;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setMemory(ServerType.TABLET_SERVER, cfg.getMemory(ServerType.TABLET_SERVER) * 2,
MemoryUnit.BYTE);
@@ -66,11 +71,6 @@ public class LargeRowIT extends AccumuloClusterHarness {
cfg.setSiteConfig(siteConfig);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 4 * 60;
- }
-
private static final int SEED = 42;
private static final int NUM_ROWS = 100;
private static final int ROW_SIZE = 1 << 17;
@@ -82,7 +82,7 @@ public class LargeRowIT extends AccumuloClusterHarness {
private int timeoutFactor = 1;
private String tservMajcDelay;
- @Before
+ @BeforeEach
public void getTimeoutFactor() throws Exception {
try {
timeoutFactor = Integer.parseInt(System.getProperty("timeout.factor"));
@@ -91,7 +91,8 @@ public class LargeRowIT extends AccumuloClusterHarness {
System.getProperty("timeout.factor"));
}
- assertTrue("Timeout factor must be greater than or equal to 1", timeoutFactor >= 1);
+ assertTrue(timeoutFactor >= 1,
+ "org.apache.accumulo.Timeout factor must be greater than or equal to 1");
String[] names = getUniqueNames(2);
REG_TABLE_NAME = names[0];
@@ -104,7 +105,7 @@ public class LargeRowIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void resetMajcDelay() throws Exception {
if (tservMajcDelay != null) {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/LateLastContactIT.java b/test/src/main/java/org/apache/accumulo/test/functional/LateLastContactIT.java
index 54860c3..e8294c5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/LateLastContactIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/LateLastContactIT.java
@@ -18,14 +18,14 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collections;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Fake the "tablet stops talking but holds its lock" problem we see when hard drives and NFS fail.
@@ -34,13 +34,13 @@ import org.junit.Test;
public class LateLastContactIT extends ConfigurableMacBase {
@Override
- public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setSiteConfig(Collections.singletonMap(Property.GENERAL_RPC_TIMEOUT.getKey(), "2s"));
+ protected int defaultTimeoutSeconds() {
+ return 90;
}
@Override
- protected int defaultTimeoutSeconds() {
- return 90;
+ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setSiteConfig(Collections.singletonMap(Property.GENERAL_RPC_TIMEOUT.getKey(), "2s"));
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java b/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
index 7031c62..6462704 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@ public class LogicalTimeIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 4 * 60;
+ return 60 * 4;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java
index 1b39b4c..db4cf3d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicLong;
@@ -46,26 +46,26 @@ import org.apache.accumulo.core.singletons.SingletonManager.Mode;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.accumulo.harness.SharedMiniClusterBase;
import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
// the shutdown test should sort last, so other tests don't break
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@TestMethodOrder(MethodOrderer.MethodName.class)
public class ManagerApiIT extends SharedMiniClusterBase {
- @Override
- public int defaultTimeoutSeconds() {
- return 60;
- }
-
private static Credentials rootUser;
private static Credentials regularUser;
private static Credentials privilegedUser;
- @BeforeClass
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @BeforeAll
public static void setup() throws Exception {
// need to pretend to be a server, so we can bypass all of
// the singleton resource management in this test
@@ -82,7 +82,7 @@ public class ManagerApiIT extends SharedMiniClusterBase {
}
}
- @AfterClass
+ @AfterAll
public static void teardown() throws Exception {
SharedMiniClusterBase.stopMiniCluster();
}
@@ -242,8 +242,7 @@ public class ManagerApiIT extends SharedMiniClusterBase {
}
private static void expectPermissionDenied(
- Function<TCredentials,ClientExec<ManagerClientService.Client>> op, Credentials user)
- throws Exception {
+ Function<TCredentials,ClientExec<ManagerClientService.Client>> op, Credentials user) {
AccumuloSecurityException e =
assertThrows(AccumuloSecurityException.class, () -> expectPermissionSuccess(op, user));
assertSame(SecurityErrorCode.PERMISSION_DENIED, e.getSecurityErrorCode());
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
index e676391..d6fbf2f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java
@@ -18,9 +18,9 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
@@ -35,13 +35,13 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.server.manager.state.MetaDataTableScanner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ManagerAssignmentIT extends AccumuloClusterHarness {
@Override
protected int defaultTimeoutSeconds() {
- return 2 * 60;
+ return 60 * 2;
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManagerFailoverIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManagerFailoverIT.java
index 04f0129..a386cbb 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ManagerFailoverIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ManagerFailoverIT.java
@@ -32,11 +32,16 @@ import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.accumulo.test.VerifyIngest.VerifyParams;
import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ManagerFailoverIT extends AccumuloClusterHarness {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 90;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> siteConfig = cfg.getSiteConfig();
siteConfig.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "15s");
@@ -44,11 +49,6 @@ public class ManagerFailoverIT extends AccumuloClusterHarness {
cfg.setClientProperty(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT, "15s");
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 90;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
index 073a092..799b628 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ManyWriteAheadLogsIT.java
@@ -18,7 +18,7 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Base64;
import java.util.HashSet;
@@ -43,9 +43,9 @@ import org.apache.accumulo.server.log.WalStateManager.WalState;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,12 +72,7 @@ public class ManyWriteAheadLogsIT extends AccumuloClusterHarness {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 10 * 60;
- }
-
- @Before
+ @BeforeEach
public void alterConfig() throws Exception {
if (getClusterType() == ClusterType.MINI) {
return;
@@ -95,7 +90,7 @@ public class ManyWriteAheadLogsIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void resetConfig() throws Exception {
if (majcDelay != null) {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
@@ -181,8 +176,8 @@ public class ManyWriteAheadLogsIT extends AccumuloClusterHarness {
}
}
- assertTrue("Number of WALs seen was less than expected " + allWalsSeen.size(),
- allWalsSeen.size() >= 50);
+ assertTrue(allWalsSeen.size() >= 50,
+ "Number of WALs seen was less than expected " + allWalsSeen.size());
// the total number of closed write ahead logs should get small
int closedLogs = countClosedWals(context);
@@ -223,7 +218,7 @@ public class ManyWriteAheadLogsIT extends AccumuloClusterHarness {
}
log.debug("It took {} attempt(s) to find {} open WALs", attempts, open);
- assertTrue("Open WALs not in expected range " + open, open > 0 && open < 4);
+ assertTrue(open > 0 && open < 4, "Open WALs not in expected range " + open);
}
private int countClosedWals(ServerContext c) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java
index 12bc710..4352a17 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java
@@ -39,9 +39,9 @@ import org.apache.accumulo.test.TestIngest;
import org.apache.accumulo.test.TestIngest.IngestParams;
import org.apache.accumulo.test.VerifyIngest;
import org.apache.hadoop.conf.Configuration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* A functional test that exercises hitting the max open file limit on a tablet server. This test
@@ -51,6 +51,11 @@ import org.junit.Test;
public class MaxOpenIT extends AccumuloClusterHarness {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 3;
+ }
+
+ @Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> conf = cfg.getSiteConfig();
conf.put(Property.TSERV_SCAN_MAX_OPENFILES.getKey(), "4");
@@ -59,14 +64,9 @@ public class MaxOpenIT extends AccumuloClusterHarness {
cfg.setSiteConfig(conf);
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 3 * 60;
- }
-
private String scanMaxOpenFiles, majcConcurrent, majcThreadMaxOpen;
- @Before
+ @BeforeEach
public void alterConfig() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
InstanceOperations iops = client.instanceOperations();
@@ -77,7 +77,7 @@ public class MaxOpenIT extends AccumuloClusterHarness {
}
}
- @After
+ @AfterEach
public void restoreConfig() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
InstanceOperations iops = client.instanceOperations();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java
index d64a52e..5fe025e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java
@@ -18,8 +18,8 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.Collection;
@@ -41,15 +41,10 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.Merge;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MergeIT extends AccumuloClusterHarness {
- @Override
- public int defaultTimeoutSeconds() {
- return 8 * 60;
- }
-
SortedSet<Text> splits(String[] points) {
SortedSet<Text> result = new TreeSet<>();
for (String point : points)
@@ -57,6 +52,11 @@ public class MergeIT extends AccumuloClusterHarness {
return result;
}
+ @Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 8;
+ }
+
@Test
public void merge() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java
index 8bc277c..a7450c2 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java
@@ -23,9 +23,9 @@ import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOCATION;
import static org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW;
import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collections;
import java.util.HashSet;
@@ -57,7 +57,7 @@ import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
@@ -65,13 +65,13 @@ import com.google.common.collect.Iterators;
public class MetadataIT extends AccumuloClusterHarness {
@Override
- public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setNumTservers(1);
+ protected int defaultTimeoutSeconds() {
+ return 60 * 2;
}
@Override
- public int defaultTimeoutSeconds() {
- return 2 * 60;
+ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setNumTservers(1);
}
@Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
index 325c976..fed1331 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
@@ -43,11 +43,16 @@ import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.RawLocalFileSystem;
import org.apache.hadoop.io.Text;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MetadataMaxFilesIT extends ConfigurableMacBase {
@Override
+ protected int defaultTimeoutSeconds() {
+ return 60 * 5;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.TSERV_MAJC_DELAY, "1");
cfg.setProperty(Property.TSERV_SCAN_MAX_OPENFILES, "10");
@@ -55,11 +60,6 @@ public class MetadataMaxFilesIT extends ConfigurableMacBase {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Override
- protected int defaultTimeoutSeconds() {
- return 5 * 60;
- }
-
@Test
public void test() throws Exception {
try (AccumuloClient c = Accumulo.newClient().from(getClientProperties()).build()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
index 897d51d..d65f58b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
... 6115 lines suppressed ...