diff --git a/hadoop-hdds/common/pom.xml b/hadoop-hdds/common/pom.xml
index cf65d8b1d556..0c1273df0aa4 100644
--- a/hadoop-hdds/common/pom.xml
+++ b/hadoop-hdds/common/pom.xml
@@ -169,6 +169,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
junit-jupiter-api
test
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
org.junit.jupiter
junit-jupiter-engine
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/TestComponentVersionInvariants.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/TestComponentVersionInvariants.java
index 4ba9943c3987..d5524688a64f 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/TestComponentVersionInvariants.java
+++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/TestComponentVersionInvariants.java
@@ -19,75 +19,73 @@
import org.apache.hadoop.ozone.ClientVersion;
import org.apache.hadoop.ozone.OzoneManagerVersion;
-import org.assertj.core.util.Arrays;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
-import static org.junit.Assert.assertEquals;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Test to ensure Component version instances conform with invariants relied
* upon in other parts of the codebase.
*/
-@RunWith(Parameterized.class)
public class TestComponentVersionInvariants {
- @Parameterized.Parameters
- public static Object[][] values() {
- Object[][] values = new Object[3][];
- values[0] =
- Arrays.array(
+ public static Stream values() {
+ return Stream.of(
+ arguments(
DatanodeVersion.values(),
DatanodeVersion.DEFAULT_VERSION,
- DatanodeVersion.FUTURE_VERSION);
- values[1] =
- Arrays.array(
+ DatanodeVersion.FUTURE_VERSION),
+ arguments(
ClientVersion.values(),
ClientVersion.DEFAULT_VERSION,
- ClientVersion.FUTURE_VERSION);
- values[2] =
- Arrays.array(
+ ClientVersion.FUTURE_VERSION),
+ arguments(
OzoneManagerVersion.values(),
OzoneManagerVersion.DEFAULT_VERSION,
- OzoneManagerVersion.FUTURE_VERSION);
- return values;
- }
-
- private final ComponentVersion[] values;
- private final ComponentVersion defaultValue;
- private final ComponentVersion futureValue;
-
- public TestComponentVersionInvariants(ComponentVersion[] values,
- ComponentVersion defaultValue, ComponentVersion futureValue) {
- this.values = new ComponentVersion[values.length];
- System.arraycopy(values, 0, this.values, 0, values.length);
- this.defaultValue = defaultValue;
- this.futureValue = futureValue;
+ OzoneManagerVersion.FUTURE_VERSION)
+ );
}
// FUTURE_VERSION is the latest
- @Test
- public void testFutureVersionHasTheHighestOrdinal() {
+ @ParameterizedTest
+ @MethodSource("values")
+ public void testFutureVersionHasTheHighestOrdinal(
+ ComponentVersion[] values, ComponentVersion defaultValue,
+ ComponentVersion futureValue) {
+
assertEquals(values[values.length - 1], futureValue);
}
// FUTURE_VERSION's internal version id is -1
- @Test
- public void testFuturVersionHasMinusOneAsProtoRepresentation() {
+ @ParameterizedTest
+ @MethodSource("values")
+ public void testFuturVersionHasMinusOneAsProtoRepresentation(
+ ComponentVersion[] values, ComponentVersion defaultValue,
+ ComponentVersion futureValue) {
assertEquals(-1, futureValue.toProtoValue());
}
// DEFAULT_VERSION's internal version id is 0
- @Test
- public void testDefaultVersionHasZeroAsProtoRepresentation() {
+ @ParameterizedTest
+ @MethodSource("values")
+ public void testDefaultVersionHasZeroAsProtoRepresentation(
+ ComponentVersion[] values, ComponentVersion defaultValue,
+ ComponentVersion futureValue) {
assertEquals(0, defaultValue.toProtoValue());
}
// versions are increasing monotonically by one
- @Test
- public void testAssignedProtoRepresentations() {
+ @ParameterizedTest
+ @MethodSource("values")
+ public void testAssignedProtoRepresentations(
+ ComponentVersion[] values, ComponentVersion defaultValue,
+ ComponentVersion futureValue) {
int startValue = defaultValue.toProtoValue();
// we skip the future version at the last position
for (int i = 0; i < values.length - 1; i++) {
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
index ed8c8f764e2b..9f939904ca68 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
+++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfig.java
@@ -23,72 +23,48 @@
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.stream.Stream;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION_TYPE;
-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.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Test replicationConfig.
*/
-@RunWith(Parameterized.class)
public class TestReplicationConfig {
private static final int MB = 1024 * 1024;
private static final int KB = 1024;
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter
- public String type;
-
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter(1)
- public String factor;
-
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter(2)
- public String codec;
-
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter(3)
- public int data;
-
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter(4)
- public int parity;
-
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter(5)
- public int chunkSize;
-
- @SuppressWarnings("checkstyle:VisibilityModifier")
- @Parameterized.Parameter(6)
- public Class> replicationConfigClass;
-
- //NOTE: if a new cunckSize is used/added in the parameters other than KB or MB
+ //NOTE: if a new chunkSize is used/added in the parameters other than KB or MB
// please revisit the method createECDescriptor, to handle the new chunkSize.
- @Parameterized.Parameters(name = "{0}/{1}")
- public static Object[][] parameters() {
- return new Object[][] {
- {"RATIS", "ONE", null, 0, 0, 0, RatisReplicationConfig.class },
- {"RATIS", "THREE", null, 0, 0, 0, RatisReplicationConfig.class},
- {"STAND_ALONE", "ONE", null, 0, 0, 0,
- StandaloneReplicationConfig.class},
- {"STAND_ALONE", "THREE", null, 0, 0, 0,
- StandaloneReplicationConfig.class},
- {"EC", "RS-3-2-1024K", "RS", 3, 2, MB, ECReplicationConfig.class},
- {"EC", "RS-3-2-1024", "RS", 3, 2, KB, ECReplicationConfig.class},
- {"EC", "RS-6-3-1024K", "RS", 6, 3, MB, ECReplicationConfig.class},
- {"EC", "RS-6-3-1024", "RS", 6, 3, KB, ECReplicationConfig.class},
- {"EC", "RS-10-4-1024K", "RS", 10, 4, MB, ECReplicationConfig.class},
- {"EC", "RS-10-4-1024", "RS", 10, 4, KB, ECReplicationConfig.class},
- };
+ public static Stream replicaType() {
+ return Stream.of(
+ arguments("RATIS", "ONE", RatisReplicationConfig.class),
+ arguments("RATIS", "THREE", RatisReplicationConfig.class),
+ arguments("STAND_ALONE", "ONE", StandaloneReplicationConfig.class),
+ arguments("STAND_ALONE", "THREE", StandaloneReplicationConfig.class)
+ );
+ }
+
+ public static Stream ecType() {
+ return Stream.of(
+ arguments("RS", 3, 2, MB),
+ arguments("RS", 3, 2, KB),
+ arguments("RS", 6, 3, MB),
+ arguments("RS", 6, 3, KB),
+ arguments("RS", 10, 4, MB),
+ arguments("RS", 10, 4, KB)
+ );
}
@Test
@@ -102,9 +78,10 @@ public void testGetDefaultShouldReturnRatisThreeIfNotSetClientSide() {
RatisReplicationConfig.class);
}
- @Test
- public void testGetDefaultShouldCreateReplicationConfFromConfValues() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void testGetDefaultShouldCreateReplicationConfFromConfValues(
+ String type, String factor, Class> replicationConfigClass) {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set(OZONE_REPLICATION_TYPE, type);
conf.set(OZONE_REPLICATION, factor);
@@ -113,16 +90,17 @@ public void testGetDefaultShouldCreateReplicationConfFromConfValues() {
validate(replicationConfig,
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor));
+ org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor),
+ replicationConfigClass);
}
- @Test
- public void testGetDefaultShouldCreateECReplicationConfFromConfValues() {
- assumeECType();
-
+ @ParameterizedTest
+ @MethodSource("ecType")
+ public void testGetDefaultShouldCreateECReplicationConfFromConfValues(
+ String codec, int data, int parity, int chunkSize) {
OzoneConfiguration conf = new OzoneConfiguration();
- conf.set(OZONE_REPLICATION_TYPE, type);
- conf.set(OZONE_REPLICATION, ecDescriptor());
+ conf.set(OZONE_REPLICATION_TYPE, "EC");
+ conf.set(OZONE_REPLICATION, ecDescriptor(codec, data, parity, chunkSize));
ReplicationConfig replicationConfig = ReplicationConfig.getDefault(conf);
@@ -130,9 +108,10 @@ public void testGetDefaultShouldCreateECReplicationConfFromConfValues() {
EcCodec.valueOf(codec), data, parity, chunkSize);
}
- @Test
- public void deserialize() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void deserialize(String type, String factor,
+ Class> replicationConfigClass) {
final ReplicationConfig replicationConfig =
ReplicationConfig.fromProtoTypeAndFactor(
ReplicationType.valueOf(type),
@@ -140,12 +119,13 @@ public void deserialize() {
validate(replicationConfig,
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor));
+ org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor),
+ replicationConfigClass);
}
- @Test
- public void deserializeEC() {
- assumeECType();
+ @ParameterizedTest
+ @MethodSource("ecType")
+ public void deserializeEC(String codec, int data, int parity, int chunkSize) {
HddsProtos.ECReplicationConfig proto =
HddsProtos.ECReplicationConfig.newBuilder()
.setCodec(codec)
@@ -160,9 +140,10 @@ public void deserializeEC() {
validate(config, EcCodec.valueOf(codec), data, parity, chunkSize);
}
- @Test
- public void testECReplicationConfigGetReplication() {
- assumeECType();
+ @ParameterizedTest
+ @MethodSource("ecType")
+ public void testECReplicationConfigGetReplication(
+ String codec, int data, int parity, int chunkSize) {
HddsProtos.ECReplicationConfig proto =
HddsProtos.ECReplicationConfig.newBuilder().setCodec(codec)
.setData(data).setParity(parity).setEcChunkSize(chunkSize).build();
@@ -170,27 +151,29 @@ public void testECReplicationConfigGetReplication() {
ReplicationConfig config =
ReplicationConfig.fromProto(ReplicationType.EC, null, proto);
- Assert.assertEquals(EcCodec.valueOf(
+ assertEquals(EcCodec.valueOf(
codec) + ECReplicationConfig.EC_REPLICATION_PARAMS_DELIMITER
+ data + ECReplicationConfig.EC_REPLICATION_PARAMS_DELIMITER
+ parity + ECReplicationConfig.EC_REPLICATION_PARAMS_DELIMITER
+ chunkSize, config.getReplication());
}
- @Test
- public void testReplicationConfigGetReplication() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void testReplicationConfigGetReplication(String type, String factor,
+ Class> replicationConfigClass) {
final ReplicationConfig replicationConfig = ReplicationConfig
.fromTypeAndFactor(
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor));
- Assert.assertEquals(factor, replicationConfig.getReplication());
+ assertEquals(factor, replicationConfig.getReplication());
}
- @Test
- public void fromJavaObjects() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void fromJavaObjects(String type, String factor,
+ Class> replicationConfigClass) {
final ReplicationConfig replicationConfig =
ReplicationConfig.fromTypeAndFactor(
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
@@ -198,12 +181,14 @@ public void fromJavaObjects() {
validate(replicationConfig,
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor));
+ org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor),
+ replicationConfigClass);
}
- @Test
- public void testParseFromTypeAndFactorAsString() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void testParseFromTypeAndFactorAsString(String type, String factor,
+ Class> replicationConfigClass) {
ConfigurationSource conf = new OzoneConfiguration();
ReplicationConfig replicationConfig = ReplicationConfig.parse(
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
@@ -211,12 +196,14 @@ public void testParseFromTypeAndFactorAsString() {
validate(replicationConfig,
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor));
+ org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor),
+ replicationConfigClass);
}
- @Test
- public void testParseFromTypeAndFactorAsStringifiedInteger() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void testParseFromTypeAndFactorAsStringifiedInteger(
+ String type, String factor, Class> replicationConfigClass) {
ConfigurationSource conf = new OzoneConfiguration();
String f =
factor.equals("ONE") ? "1"
@@ -229,16 +216,19 @@ public void testParseFromTypeAndFactorAsStringifiedInteger() {
validate(replicationConfig,
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(this.factor));
+ org.apache.hadoop.hdds.client.ReplicationFactor.valueOf(factor),
+ replicationConfigClass);
}
- @Test
- public void testParseECReplicationConfigFromString() {
- assumeECType();
+ @ParameterizedTest
+ @MethodSource("ecType")
+ public void testParseECReplicationConfigFromString(
+ String codec, int data, int parity, int chunkSize) {
ConfigurationSource conf = new OzoneConfiguration();
ReplicationConfig repConfig = ReplicationConfig.parse(
- org.apache.hadoop.hdds.client.ReplicationType.EC, ecDescriptor(), conf);
+ org.apache.hadoop.hdds.client.ReplicationType.EC,
+ ecDescriptor(codec, data, parity, chunkSize), conf);
validate(repConfig, EcCodec.valueOf(codec), data, parity, chunkSize);
}
@@ -251,9 +241,10 @@ public void testParseECReplicationConfigFromString() {
* or STAND_ALONE, then replica count can be adjusted with the replication
* factor.
*/
- @Test
- public void testAdjustReplication() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void testAdjustReplication(String type, String factor,
+ Class> replicationConfigClass) {
ConfigurationSource conf = new OzoneConfiguration();
ReplicationConfig replicationConfig = ReplicationConfig.parse(
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
@@ -262,12 +253,14 @@ public void testAdjustReplication() {
validate(
ReplicationConfig.adjustReplication(replicationConfig, (short) 3, conf),
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.THREE);
+ org.apache.hadoop.hdds.client.ReplicationFactor.THREE,
+ replicationConfigClass);
validate(
ReplicationConfig.adjustReplication(replicationConfig, (short) 1, conf),
org.apache.hadoop.hdds.client.ReplicationType.valueOf(type),
- org.apache.hadoop.hdds.client.ReplicationFactor.ONE);
+ org.apache.hadoop.hdds.client.ReplicationFactor.ONE,
+ replicationConfigClass);
}
/**
@@ -278,12 +271,14 @@ public void testAdjustReplication() {
* then the client can not adjust the configuration via the replication
* factor.
*/
- @Test
- public void testAdjustECReplication() {
- assumeECType();
+ @ParameterizedTest
+ @MethodSource("ecType")
+ public void testAdjustECReplication(String codec, int data, int parity,
+ int chunkSize) {
ConfigurationSource conf = new OzoneConfiguration();
ReplicationConfig replicationConfig = ReplicationConfig.parse(
- org.apache.hadoop.hdds.client.ReplicationType.EC, ecDescriptor(), conf);
+ org.apache.hadoop.hdds.client.ReplicationType.EC,
+ ecDescriptor(codec, data, parity, chunkSize), conf);
validate(
ReplicationConfig.adjustReplication(replicationConfig, (short) 3, conf),
@@ -304,9 +299,10 @@ public void testAdjustECReplication() {
* system there might exist some keys that were created with a now disallowed
* ReplicationConfig.
*/
- @Test
- public void testValidationBasedOnConfig() {
- assumeRatisOrStandaloneType();
+ @ParameterizedTest
+ @MethodSource("replicaType")
+ public void testValidationBasedOnConfig(String type, String factor,
+ Class> replicationConfigClass) {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set(OZONE_REPLICATION + ".allowed-configs",
"^STANDALONE/ONE|RATIS/THREE$");
@@ -357,28 +353,18 @@ public void testValidationBasedOnConfig() {
org.apache.hadoop.hdds.client.ReplicationType.CHAINED, "", conf));
}
- private void validate(ReplicationConfig replicationConfig,
- org.apache.hadoop.hdds.client.ReplicationType expectedType,
- org.apache.hadoop.hdds.client.ReplicationFactor expectedFactor) {
-
- validate(replicationConfig, expectedType, expectedFactor,
- replicationConfigClass);
- }
-
-
private void validate(ReplicationConfig replicationConfig,
org.apache.hadoop.hdds.client.ReplicationType expectedType,
org.apache.hadoop.hdds.client.ReplicationFactor expectedFactor,
Class> expectedReplicationConfigClass) {
- assertEquals(expectedReplicationConfigClass, replicationConfig.getClass());
+ assertSame(expectedReplicationConfigClass, replicationConfig.getClass());
- assertEquals(
- expectedType.name(), replicationConfig.getReplicationType().name());
- assertEquals(
- expectedFactor.getValue(), replicationConfig.getRequiredNodes());
- assertEquals(
- expectedFactor.name(),
+ assertEquals(expectedType.name(),
+ replicationConfig.getReplicationType().name());
+ assertEquals(expectedFactor.getValue(),
+ replicationConfig.getRequiredNodes());
+ assertEquals(expectedFactor.name(),
((ReplicatedReplicationConfig) replicationConfig)
.getReplicationFactor().name());
}
@@ -387,7 +373,7 @@ private void validate(ReplicationConfig replicationConfig,
EcCodec expectedCodec,
int expectedData, int expectedParity, int expectedChunkSize) {
- assertEquals(ECReplicationConfig.class, replicationConfig.getClass());
+ assertSame(ECReplicationConfig.class, replicationConfig.getClass());
assertEquals(ReplicationType.EC, replicationConfig.getReplicationType());
ECReplicationConfig ecReplicationConfig =
@@ -402,16 +388,10 @@ private void validate(ReplicationConfig replicationConfig,
replicationConfig.getRequiredNodes());
}
- private String ecDescriptor() {
+ private String ecDescriptor(String codec, int data, int parity,
+ int chunkSize) {
return codec.toUpperCase() + "-" + data + "-" + parity + "-" +
(chunkSize == MB ? "1024K" : "1024");
}
- private void assumeRatisOrStandaloneType() {
- Assume.assumeTrue(type.equals("RATIS") || type.equals("STAND_ALONE"));
- }
-
- private void assumeECType() {
- Assume.assumeTrue(type.equals("EC"));
- }
}
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/scm/net/TestNetworkTopologyImpl.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/scm/net/TestNetworkTopologyImpl.java
index 0a3251dd9b90..53991f338266 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/scm/net/TestNetworkTopologyImpl.java
+++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/scm/net/TestNetworkTopologyImpl.java
@@ -25,6 +25,7 @@
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
@@ -38,26 +39,25 @@
import static org.apache.hadoop.hdds.scm.net.NetConstants.REGION_SCHEMA;
import static org.apache.hadoop.hdds.scm.net.NetConstants.ROOT;
import static org.apache.hadoop.hdds.scm.net.NetConstants.ROOT_SCHEMA;
-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.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
+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 static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Timeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Test the network topology functions. */
-@RunWith(Parameterized.class)
+@Timeout(30)
public class TestNetworkTopologyImpl {
private static final Logger LOG = LoggerFactory.getLogger(
TestNetworkTopologyImpl.class);
@@ -65,7 +65,7 @@ public class TestNetworkTopologyImpl {
private Node[] dataNodes;
private Random random = new Random();
- public TestNetworkTopologyImpl(NodeSchema[] schemas, Node[] nodeArray) {
+ public void initNetworkTopology(NodeSchema[] schemas, Node[] nodeArray) {
NodeSchemaManager.getInstance().init(schemas, true);
cluster = new NetworkTopologyImpl(NodeSchemaManager.getInstance());
dataNodes = nodeArray.clone();
@@ -74,13 +74,9 @@ public TestNetworkTopologyImpl(NodeSchema[] schemas, Node[] nodeArray) {
}
}
- @Rule
- public Timeout testTimeout = Timeout.seconds(300);
-
- @Parameters
- public static Collection