From 3921ce0a3c4d18295e7b991d7cda20e57e649956 Mon Sep 17 00:00:00 2001 From: Shreyaa Sharma Date: Sat, 18 Mar 2023 21:32:10 +0530 Subject: [PATCH 1/5] Upgrade JUnit4 to Junit5 --- build.gradle | 5 - mantis-client/build.gradle | 2 +- .../src/test/java/MantisSSEJobTest.java | 2 +- mantis-common/build.gradle | 2 +- .../mantisrx/common/utils/LabelUtilsTest.java | 12 +- .../test/java/io/mantisrx/common/AckTest.java | 4 +- .../io/mantisrx/common/WorkerPortsTest.java | 31 +-- .../compression/CompressionUtilsTest.java | 10 +- .../runtime/MachineDefinitionTest.java | 6 +- .../descriptor/DeploymentStrategyTest.java | 8 +- .../descriptor/SchedulingInfoTest.java | 4 +- .../descriptor/StageScalingPolicyTest.java | 4 +- .../runtime/parameter/TestSerialization.java | 4 +- .../consistenthashing/ConsistentHashTest.java | 8 +- .../ServerSlotManagerTest.java | 8 +- .../mantis/operators/OperatorGroupByTest.java | 36 ++-- .../mantis-connector-kafka/build.gradle | 2 +- .../sink/MantisKafkaProducerConfigTest.java | 4 +- .../source/MantisKafkaConsumerConfigTest.java | 6 +- .../source/MantisKafkaSourceConfigTest.java | 4 +- .../assignor/StaticPartitionAssignorTest.java | 8 +- .../mantis-control-plane-client/build.gradle | 2 +- .../client/MantisMasterClientApiTest.java | 10 +- .../client/MasterClientWrapperTest.java | 6 +- .../mantis-control-plane-core/build.gradle | 2 +- .../server/core/ExecuteStageRequestTest.java | 10 +- .../server/core/JobSchedulingInfoTest.java | 6 +- .../core/TimeBufferedWorkerOutlierTest.java | 4 +- .../server/core/WorkerAssignmentsTest.java | 6 +- .../mantisrx/server/core/WorkerHostTest.java | 14 +- .../server/core/WorkerOutlierTest.java | 4 +- .../server/core/domain/WorkerIdTest.java | 4 +- .../TaskExecutorHeartbeatTest.java | 4 +- .../TaskExecutorRegistrationTest.java | 6 +- .../mantis-control-plane-server/build.gradle | 2 +- .../master/api/akka/route/JacksonTest.java | 4 +- .../route/LeaderRedirectionFilterTest.java | 6 +- .../route/LeaderRedirectionRouteTest.java | 16 +- .../route/pagination/ListObjectTests.java | 75 ++++--- .../akka/route/utils/JobRouteUtilsTest.java | 4 +- .../akka/route/v0/AgentClusterRouteTest.java | 16 +- .../akka/route/v0/JobClusterRouteTest.java | 16 +- .../api/akka/route/v0/JobRouteTest.java | 8 +- .../route/v0/MasterDescriptionRouteTest.java | 6 +- .../akka/route/v1/AdminMasterRouteTest.java | 16 +- .../akka/route/v1/AgentClustersRouteTest.java | 16 +- .../akka/route/v1/JobArtifactSerdeTest.java | 4 +- .../akka/route/v1/JobClustersRouteTest.java | 14 +- .../route/v1/JobDiscoveryStreamRouteTest.java | 10 +- .../api/akka/route/v1/JobsRouteTest.java | 10 +- ...urceClusterNonLeaderRedirectRouteTest.java | 6 +- .../api/akka/route/v1/RouteTestBase.java | 16 +- .../master/events/WorkerRegistryV2Test.java | 18 +- .../master/jobcluster/JobClusterTest.java | 39 ++-- .../jobcluster/JobDefinitionResolverTest.java | 8 +- .../master/jobcluster/JobManagerTest.java | 14 +- .../master/jobcluster/LabelCacheTest.java | 4 +- .../master/jobcluster/LabelManagerTest.java | 4 +- .../master/jobcluster/SLAEnforcerTest.java | 8 +- .../jobcluster/job/JobClusterManagerTest.java | 48 ++--- .../jobcluster/job/JobScaleUpDownTests.java | 18 +- .../master/jobcluster/job/JobTestHelper.java | 8 +- .../jobcluster/job/JobTestLifecycle.java | 16 +- .../jobcluster/job/JobTestMigrationTests.java | 14 +- .../master/jobcluster/job/JobTestTimeout.java | 6 +- .../job/MantisJobMetadataViewTest.java | 6 +- .../job/WorkerResubmitRateLimiterTest.java | 4 +- .../DisableTaskExecutorsRequestTest.java | 6 +- .../ExecutorStateManagerTests.java | 12 +- .../ResourceClusterActorTest.java | 57 ++--- .../ResourceClusterScalerActorTests.java | 20 +- ...ResourceClustersHostManagerActorTests.java | 12 +- .../TaskExecutorStateTest.java | 12 +- ...impleFileResourceStorageProviderTests.java | 24 ++- .../scheduler/AgentsErrorMonitorTest.java | 16 +- .../master/domain/DataFormatAdapterTest.java | 8 +- .../master/domain/JobClusterConfigTest.java | 27 ++- .../server/master/domain/JobIdTest.java | 4 +- .../persistence/FileBasedStoreTest.java | 12 +- mantis-discovery-proto/build.gradle | 2 +- .../proto/AppJobClustersMapTest.java | 8 +- .../DefaultSubscriptionTrackerTest.java | 11 +- .../publish/MantisEventPublisherTest.java | 14 +- .../discovery/MantisJobDiscoveryTest.java | 28 ++- .../mantisapi/DefaultMantisApiClientTest.java | 7 +- mantis-remote-observable/build.gradle | 2 +- .../observable/DynamicConnectionSetTest.java | 89 ++++---- .../observable/DynamicConnectionTest.java | 6 +- .../observable/FixedConnectionSetTest.java | 89 ++++---- .../observable/MergedObservableTest.java | 97 ++++----- .../mantis/remote/observable/MetricsTest.java | 80 +++---- .../RemoteGroupedObservableTest.java | 10 +- .../observable/RemoteObservableTest.java | 134 ++++++------ .../remote/observable/ServeNestedTest.java | 8 +- .../ToDeltaEndpointInjectorTest.java | 56 ++--- mantis-runtime-loader/build.gradle | 2 +- .../SubscriptionStateHandlerImplTest.java | 8 +- mantis-runtime/build.gradle | 2 +- .../runtime/core/MantisStreamImplTest.java | 7 +- .../functions/FunctionCombinatorTest.java | 4 +- .../LocalJobExecutorNetworkedTest.java | 30 +-- .../executor/ParameterDefinitionTest.java | 51 ++--- .../executor/StageExecutorsGroupByTest.java | 50 ++--- .../StageExecutorsSingleStageTest.java | 12 +- .../runtime/executor/StageExecutorsTest.java | 24 +-- .../runtime/parameter/ParametersTest.java | 12 +- .../runtime/parameter/SinkParameterTest.java | 4 +- .../parameter/SourceJobParametersTest.java | 4 +- .../MantisRxSingleThreadSchedulerTest.java | 6 +- .../source/http/ClientResumePoliciesTest.java | 30 +-- .../source/http/ContextualHttpSourceTest.java | 40 ++-- .../runtime/source/http/HttpSourceTest.java | 82 ++++--- .../source/http/LocalServerProvider.java | 2 +- .../source/http/StaticServerPollerTest.java | 18 +- .../impl/DefaultHttpServerProviderTest.java | 10 +- .../source/http/impl/HttpSourceImplTest.java | 203 ++++++++---------- .../impl/OperatorResumeOnCompletedTest.java | 12 +- .../http/impl/OperatorResumeOnErrorTest.java | 16 +- .../mantis-server-agent/build.gradle | 2 +- .../mantisrx/server/agent/BlobStoreTest.java | 2 +- .../agent/ResourceManagerGatewayCxnTest.java | 31 +-- .../agent/RuntimeTaskImplExecutorTest.java | 30 +-- .../agent/TestHadoopFileSystemBlobStore.java | 2 +- .../WorkerConfigurationWritableTest.java | 8 +- .../agent/metrics/cgroups/TestCgroup.java | 4 +- .../cgroups/TestCpuAcctsSubsystemProcess.java | 4 +- .../cgroups/TestMemorySubsystemProcess.java | 4 +- .../cgroups/TestNetworkSubsystemProcess.java | 4 +- .../mantis-server-worker-client/build.gradle | 2 +- .../worker/client/MetricsClientImplTest.java | 4 +- .../SseWorkerConnectionFunctionTest.java | 6 +- .../client/SseWorkerConnectionTest.java | 6 +- .../mantis-server-worker/build.gradle | 2 +- .../worker/DataDroppedPayloadSetterTest.java | 4 +- .../mantisrx/server/worker/HeartbeatTest.java | 10 +- ...erExecutionOperationsNetworkStageTest.java | 6 +- .../config/WorkerConfigurationTest.java | 4 +- .../jobmaster/AutoScaleMetricsConfigTest.java | 4 +- .../worker/jobmaster/JobAutoScalerTest.java | 6 +- ...ourceJobWorkerMetricsSubscriptionTest.java | 4 +- .../jobmaster/WorkerMetricHandlerTest.java | 6 +- .../RpsClutchConfigurationSelectorTest.java | 6 +- .../clutch/rps/RpsMetricComputerTest.java | 4 +- .../clutch/rps/RpsScaleComputerTest.java | 4 +- .../control/AdaptiveAutoScalerTest.java | 2 +- .../actuators/MantisStageActuatorTest.java | 2 +- .../controllers/PIDControllerTest.java | 4 +- .../control/utils/ErrorComputerTest.java | 2 +- .../control/utils/IntegratorTest.java | 2 +- .../mesos/TestMesosMetricsCollector.java | 2 +- 150 files changed, 1201 insertions(+), 1170 deletions(-) diff --git a/build.gradle b/build.gradle index fae485de9..53e425c2f 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,6 @@ ext.versions = [ flink : "1.14.2", hadoop : "2.7.7", jsr305 : "3.0.1", - junit4 : "4.11", junit5 : "5.4.+", mockito : "2.0.+", mockito3 : "3.+", @@ -58,10 +57,6 @@ ext.libraries = [ flinkRpcImpl : [ "org.apache.flink:flink-rpc-akka:${versions.flink}", ], - junit4 : [ - "junit:junit:${versions.junit4}", - "junit:junit-dep:${versions.junit4}", - ], hadoopCommon : "org.apache.hadoop:hadoop-common:${versions.hadoop}", hadoopS3 : "org.apache.hadoop:hadoop-aws:${versions.hadoop}", jsr305 : "com.google.code.findbugs:jsr305:${versions.jsr305}", // For Nonnull annotation diff --git a/mantis-client/build.gradle b/mantis-client/build.gradle index f58e166ba..3652c7eda 100644 --- a/mantis-client/build.gradle +++ b/mantis-client/build.gradle @@ -21,7 +21,7 @@ dependencies { implementation libraries.slf4jApi implementation libraries.spectatorApi - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoCore } diff --git a/mantis-client/src/test/java/MantisSSEJobTest.java b/mantis-client/src/test/java/MantisSSEJobTest.java index 6e66971f7..10999758e 100644 --- a/mantis-client/src/test/java/MantisSSEJobTest.java +++ b/mantis-client/src/test/java/MantisSSEJobTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import io.mantisrx.client.MantisClient; import io.mantisrx.client.MantisSSEJob; diff --git a/mantis-common/build.gradle b/mantis-common/build.gradle index d7e83080b..215fab73e 100644 --- a/mantis-common/build.gradle +++ b/mantis-common/build.gradle @@ -44,6 +44,6 @@ dependencies { testImplementation libraries.spectatorApi testImplementation libraries.commonsLang3 testImplementation "org.hamcrest:hamcrest-core:1.3" - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoCore } diff --git a/mantis-common/src/test/java/com/mantisrx/common/utils/LabelUtilsTest.java b/mantis-common/src/test/java/com/mantisrx/common/utils/LabelUtilsTest.java index c81c0a99c..2e001cb42 100644 --- a/mantis-common/src/test/java/com/mantisrx/common/utils/LabelUtilsTest.java +++ b/mantis-common/src/test/java/com/mantisrx/common/utils/LabelUtilsTest.java @@ -16,17 +16,17 @@ package com.mantisrx.common.utils; -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 io.mantisrx.common.Label; import io.mantisrx.shaded.com.fasterxml.jackson.core.JsonProcessingException; import io.mantisrx.shaded.com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LabelUtilsTest { @@ -189,4 +189,4 @@ public void testSerDe() { } -} \ No newline at end of file +} diff --git a/mantis-common/src/test/java/io/mantisrx/common/AckTest.java b/mantis-common/src/test/java/io/mantisrx/common/AckTest.java index 65a5dd33c..92103c502 100644 --- a/mantis-common/src/test/java/io/mantisrx/common/AckTest.java +++ b/mantis-common/src/test/java/io/mantisrx/common/AckTest.java @@ -16,9 +16,9 @@ package io.mantisrx.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AckTest { private final JsonSerializer serializer = new JsonSerializer(); diff --git a/mantis-common/src/test/java/io/mantisrx/common/WorkerPortsTest.java b/mantis-common/src/test/java/io/mantisrx/common/WorkerPortsTest.java index afa56788c..733611ff0 100644 --- a/mantis-common/src/test/java/io/mantisrx/common/WorkerPortsTest.java +++ b/mantis-common/src/test/java/io/mantisrx/common/WorkerPortsTest.java @@ -15,12 +15,13 @@ */ package io.mantisrx.common; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Arrays; import java.util.List; import org.apache.commons.lang3.SerializationUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerPortsTest { @@ -29,10 +30,12 @@ public class WorkerPortsTest { * Uses legacy constructor {@link WorkerPorts#WorkerPorts(List)} which expects * at least 5 ports: metrics, debug, console, custom. */ - @Test(expected = IllegalArgumentException.class) + @Test public void shouldNotConstructWorkerPorts() { - // Not enough ports. - new WorkerPorts(Arrays.asList(1, 1, 1, 1)); + assertThrows(IllegalArgumentException.class, () -> { + // Not enough ports. + new WorkerPorts(Arrays.asList(1, 1, 1, 1)); + }); } /** @@ -40,20 +43,24 @@ public void shouldNotConstructWorkerPorts() { * a WorkerPorts object, because a worker needs a sink to be useful. * Otherwise, other workers can't connect to it. */ - @Test(expected = IllegalStateException.class) + @Test public void shouldNotConstructWorkerPortsWithDuplicatePorts() { - // Enough ports, but has duplicate ports. - new WorkerPorts(Arrays.asList(1, 1, 1, 1, 1)); + assertThrows(IllegalStateException.class, () -> { + // Enough ports, but has duplicate ports. + new WorkerPorts(Arrays.asList(1, 1, 1, 1, 1)); + }); } /** * Uses legacy constructor {@link WorkerPorts#WorkerPorts(List)} but was given a port * out of range. */ - @Test(expected = IllegalStateException.class) + @Test public void shouldNotConstructWorkerPortsWithInvalidPortRange() { - // Enough ports, but given an invalid port range - new WorkerPorts(Arrays.asList(1, 1, 1, 1, 65536)); + assertThrows(IllegalStateException.class, () -> { + // Enough ports, but given an invalid port range + new WorkerPorts(Arrays.asList(1, 1, 1, 1, 65536)); + }); } /** @@ -82,4 +89,4 @@ public void testWorkerPortsIsSerializableByJava() { byte[] serialized = SerializationUtils.serialize(workerPorts); assertEquals(workerPorts, SerializationUtils.deserialize(serialized)); } -} \ No newline at end of file +} diff --git a/mantis-common/src/test/java/io/mantisrx/common/compression/CompressionUtilsTest.java b/mantis-common/src/test/java/io/mantisrx/common/compression/CompressionUtilsTest.java index a8dcbf877..51af230c9 100644 --- a/mantis-common/src/test/java/io/mantisrx/common/compression/CompressionUtilsTest.java +++ b/mantis-common/src/test/java/io/mantisrx/common/compression/CompressionUtilsTest.java @@ -15,7 +15,7 @@ */ package io.mantisrx.common.compression; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.MantisServerSentEvent; import java.io.BufferedReader; @@ -24,7 +24,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CompressionUtilsTest { @@ -56,7 +56,7 @@ public void shouldTokenizeWithEventsContainingPartialDelimiterMatchesWithCustomD List result = CompressionUtils.tokenize(reader, delimiter); List actual = result.stream().map(e -> e.getEventAsString()).collect(Collectors.toList()); - assertEquals("Delimiter: '" + delimiter + "'", Arrays.asList(event1,event2,event3), actual); + assertEquals(Arrays.asList(event1,event2,event3), actual, "Delimiter: '" + delimiter + "'"); } @Test @@ -76,7 +76,7 @@ public void testDelimiterWiithPrefixMatchingEndOfMEssage() throws Exception { List result = CompressionUtils.tokenize(reader, delimiter); List actual = result.stream().map(e -> e.getEventAsString()).collect(Collectors.toList()); - assertEquals("Delimiter: '" + delimiter + "'", Arrays.asList(event1,event2,event3), actual); + assertEquals(Arrays.asList(event1,event2,event3), actual, "Delimiter: '" + delimiter + "'"); } @Test @@ -102,7 +102,7 @@ public void testMultiline() throws Exception { List result = CompressionUtils.tokenize(reader, delimiter); List actual = result.stream().map(e -> e.getEventAsString()).collect(Collectors.toList()); - assertEquals("Delimiter: '" + delimiter + "'", Arrays.asList(event1,event2,event3), actual); + assertEquals(Arrays.asList(event1,event2,event3), actual, "Delimiter: '" + delimiter + "'"); } @Test diff --git a/mantis-common/src/test/java/io/mantisrx/runtime/MachineDefinitionTest.java b/mantis-common/src/test/java/io/mantisrx/runtime/MachineDefinitionTest.java index 6d6398351..f898f7ef7 100644 --- a/mantis-common/src/test/java/io/mantisrx/runtime/MachineDefinitionTest.java +++ b/mantis-common/src/test/java/io/mantisrx/runtime/MachineDefinitionTest.java @@ -16,10 +16,10 @@ package io.mantisrx.runtime; -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 org.junit.Test; +import org.junit.jupiter.api.Test; public class MachineDefinitionTest { @Test diff --git a/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/DeploymentStrategyTest.java b/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/DeploymentStrategyTest.java index 4dda5c6c0..b24318680 100644 --- a/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/DeploymentStrategyTest.java +++ b/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/DeploymentStrategyTest.java @@ -16,12 +16,12 @@ package io.mantisrx.runtime.descriptor; -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 io.mantisrx.common.JsonSerializer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DeploymentStrategyTest { private final JsonSerializer serializer = new JsonSerializer(); diff --git a/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/SchedulingInfoTest.java b/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/SchedulingInfoTest.java index 50e3b13e3..d4f140a1a 100644 --- a/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/SchedulingInfoTest.java +++ b/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/SchedulingInfoTest.java @@ -18,7 +18,7 @@ import static java.util.Optional.empty; import static java.util.Optional.of; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.JsonSerializer; import io.mantisrx.runtime.MachineDefinition; @@ -26,7 +26,7 @@ import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SchedulingInfoTest { @Test diff --git a/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/StageScalingPolicyTest.java b/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/StageScalingPolicyTest.java index 1833479d2..1f8de6d2d 100644 --- a/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/StageScalingPolicyTest.java +++ b/mantis-common/src/test/java/io/mantisrx/runtime/descriptor/StageScalingPolicyTest.java @@ -16,7 +16,7 @@ package io.mantisrx.runtime.descriptor; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.JsonSerializer; import io.mantisrx.runtime.descriptor.StageScalingPolicy.RollingCount; @@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class StageScalingPolicyTest { private final JsonSerializer serializer = new JsonSerializer(); diff --git a/mantis-common/src/test/java/io/mantisrx/runtime/parameter/TestSerialization.java b/mantis-common/src/test/java/io/mantisrx/runtime/parameter/TestSerialization.java index 960cd6729..7ddcee824 100644 --- a/mantis-common/src/test/java/io/mantisrx/runtime/parameter/TestSerialization.java +++ b/mantis-common/src/test/java/io/mantisrx/runtime/parameter/TestSerialization.java @@ -16,10 +16,10 @@ package io.mantisrx.runtime.parameter; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.JsonSerializer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestSerialization { private final JsonSerializer jsonSerializer = new JsonSerializer(); diff --git a/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ConsistentHashTest.java b/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ConsistentHashTest.java index ee8a4e01c..7ae7e0976 100644 --- a/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ConsistentHashTest.java +++ b/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ConsistentHashTest.java @@ -17,9 +17,9 @@ package io.reactivx.common.consistenthashing; -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 io.mantisrx.common.network.ConsistentHash; import io.mantisrx.common.network.Endpoint; @@ -27,7 +27,7 @@ import io.mantisrx.common.network.HashFunctions; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ConsistentHashTest { diff --git a/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ServerSlotManagerTest.java b/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ServerSlotManagerTest.java index d82327f15..3ac0b73cf 100644 --- a/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ServerSlotManagerTest.java +++ b/mantis-common/src/test/java/io/reactivx/common/consistenthashing/ServerSlotManagerTest.java @@ -16,9 +16,9 @@ package io.reactivx.common.consistenthashing; -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 io.mantisrx.common.network.HashFunctions; import io.mantisrx.common.network.ServerSlotManager; @@ -28,7 +28,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ServerSlotManagerTest { diff --git a/mantis-common/src/test/java/io/reactivx/mantis/operators/OperatorGroupByTest.java b/mantis-common/src/test/java/io/reactivx/mantis/operators/OperatorGroupByTest.java index a6347010f..b0bcb5d1a 100644 --- a/mantis-common/src/test/java/io/reactivx/mantis/operators/OperatorGroupByTest.java +++ b/mantis-common/src/test/java/io/reactivx/mantis/operators/OperatorGroupByTest.java @@ -15,16 +15,18 @@ */ package io.reactivx.mantis.operators; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTimeout; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -35,8 +37,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Matchers; import org.mockito.MockitoAnnotations; import rx.Notification; @@ -552,11 +554,12 @@ public void onNext(Integer s) { assertEquals(100, eventCounter.get()); } - @Test(timeout = 1000) + @Test public void testCompletionIfInnerNotSubscribed() throws InterruptedException { - final CountDownLatch latch = new CountDownLatch(1); - final AtomicInteger eventCounter = new AtomicInteger(); - Observable.range(0, 100) + assertTimeout(Duration.ofMillis(1000), () -> { + final CountDownLatch latch = new CountDownLatch(1); + final AtomicInteger eventCounter = new AtomicInteger(); + Observable.range(0, 100) .groupBy(new Func1() { @Override @@ -583,10 +586,11 @@ public void onNext(GroupedObservable s) { System.out.println("=> " + s); } }); - if (!latch.await(500, TimeUnit.MILLISECONDS)) { - fail("timed out - never got completion"); - } - assertEquals(2, eventCounter.get()); + if (!latch.await(500, TimeUnit.MILLISECONDS)) { + fail("timed out - never got completion"); + } + assertEquals(2, eventCounter.get()); + }); } @Test @@ -1110,7 +1114,7 @@ public R call(T t1) { }; } - @Before + @BeforeEach public void before() { MockitoAnnotations.initMocks(this); } @@ -1351,4 +1355,4 @@ public String toString() { } } -} \ No newline at end of file +} diff --git a/mantis-connectors/mantis-connector-kafka/build.gradle b/mantis-connectors/mantis-connector-kafka/build.gradle index 375bd8be6..fd0e80888 100644 --- a/mantis-connectors/mantis-connector-kafka/build.gradle +++ b/mantis-connectors/mantis-connector-kafka/build.gradle @@ -33,7 +33,7 @@ dependencies { api "com.netflix.archaius:archaius2-api:$archaiusVersion" api "com.netflix.archaius:archaius2-core:$archaiusVersion" - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation project(':mantis-runtime').sourceSets.test.output testImplementation libraries.mockitoAll testImplementation "com.github.tomakehurst:wiremock-jre8:2.21.0" diff --git a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/sink/MantisKafkaProducerConfigTest.java b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/sink/MantisKafkaProducerConfigTest.java index 1ab769895..5e34457c1 100644 --- a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/sink/MantisKafkaProducerConfigTest.java +++ b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/sink/MantisKafkaProducerConfigTest.java @@ -16,7 +16,7 @@ package io.mantisrx.connector.kafka.sink; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -30,7 +30,7 @@ import org.apache.kafka.common.metrics.JmxReporter; import org.apache.kafka.common.serialization.ByteArraySerializer; import org.apache.kafka.common.serialization.StringSerializer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; diff --git a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaConsumerConfigTest.java b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaConsumerConfigTest.java index e5e2a4cad..f447d9f49 100644 --- a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaConsumerConfigTest.java +++ b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaConsumerConfigTest.java @@ -16,8 +16,8 @@ package io.mantisrx.connector.kafka.source; -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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -30,7 +30,7 @@ import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.RangeAssignor; import org.apache.kafka.common.metrics.JmxReporter; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; diff --git a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaSourceConfigTest.java b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaSourceConfigTest.java index 35175895a..3e65e748a 100644 --- a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaSourceConfigTest.java +++ b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/MantisKafkaSourceConfigTest.java @@ -16,7 +16,7 @@ package io.mantisrx.connector.kafka.source; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -30,7 +30,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; diff --git a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/assignor/StaticPartitionAssignorTest.java b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/assignor/StaticPartitionAssignorTest.java index b947971be..e4e2e6e56 100644 --- a/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/assignor/StaticPartitionAssignorTest.java +++ b/mantis-connectors/mantis-connector-kafka/src/test/java/io/mantisrx/connector/kafka/source/assignor/StaticPartitionAssignorTest.java @@ -16,15 +16,15 @@ package io.mantisrx.connector.kafka.source.assignor; -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.HashMap; import java.util.List; import java.util.Map; import org.apache.kafka.common.TopicPartition; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mantis-control-plane/mantis-control-plane-client/build.gradle b/mantis-control-plane/mantis-control-plane-client/build.gradle index bb93e33ff..196a2e973 100644 --- a/mantis-control-plane/mantis-control-plane-client/build.gradle +++ b/mantis-control-plane/mantis-control-plane-client/build.gradle @@ -21,7 +21,7 @@ dependencies { api project(":mantis-remote-observable") - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoAll testImplementation libraries.spectatorApi testImplementation(testFixtures(project(":mantis-common"))) diff --git a/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MantisMasterClientApiTest.java b/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MantisMasterClientApiTest.java index c026efab7..e31ea174d 100644 --- a/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MantisMasterClientApiTest.java +++ b/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MantisMasterClientApiTest.java @@ -21,8 +21,8 @@ //import io.mantisrx.master.core.proto.JobDefinition; //import io.mantisrx.master.core.proto.MachineDefinition; -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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -41,8 +41,8 @@ import mantis.io.reactivex.netty.protocol.http.server.HttpServerRequest; import mantis.io.reactivex.netty.protocol.http.server.HttpServerResponse; import mantis.io.reactivex.netty.protocol.http.server.RequestHandler; -import org.junit.AfterClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observable; @@ -60,7 +60,7 @@ public class MantisMasterClientApiTest { private static AtomicInteger port = new AtomicInteger(8950); private static List> startedServers = new ArrayList<>(); - @AfterClass + @AfterAll public static void cleanup() throws InterruptedException { for (HttpServer startedServer : startedServers) { logger.info("shutting down server on port {}", startedServer.getServerPort()); diff --git a/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MasterClientWrapperTest.java b/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MasterClientWrapperTest.java index 518d4076e..a5bb701f4 100644 --- a/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MasterClientWrapperTest.java +++ b/mantis-control-plane/mantis-control-plane-client/src/test/java/io/mantisrx/server/master/client/MasterClientWrapperTest.java @@ -16,8 +16,8 @@ package io.mantisrx.server.master.client; -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 io.mantisrx.server.core.Configurations; import io.mantisrx.server.core.CoreConfiguration; @@ -30,7 +30,7 @@ import java.util.Properties; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.functions.Func1; import rx.schedulers.Schedulers; diff --git a/mantis-control-plane/mantis-control-plane-core/build.gradle b/mantis-control-plane/mantis-control-plane-core/build.gradle index 55727b39c..3327d017b 100644 --- a/mantis-control-plane/mantis-control-plane-core/build.gradle +++ b/mantis-control-plane/mantis-control-plane-core/build.gradle @@ -45,7 +45,7 @@ dependencies { api "joda-time:joda-time:$jodaTimeVersion" testFixturesImplementation libraries.flinkRpcImpl - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoAll } diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/ExecuteStageRequestTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/ExecuteStageRequestTest.java index 7962af750..b828e1831 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/ExecuteStageRequestTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/ExecuteStageRequestTest.java @@ -16,8 +16,8 @@ package io.mantisrx.server.core; -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 io.mantisrx.common.JsonSerializer; import io.mantisrx.common.WorkerPorts; @@ -30,8 +30,8 @@ import java.net.URL; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ExecuteStageRequestTest { private ExecuteStageRequest example1; @@ -39,7 +39,7 @@ public class ExecuteStageRequestTest { private final JsonSerializer serializer = new JsonSerializer(); - @Before + @BeforeEach public void setup() throws Exception { example1 = new ExecuteStageRequest("jobName", "jobId-0", 0, 1, new URL("http://datamesh/whatever"), diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/JobSchedulingInfoTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/JobSchedulingInfoTest.java index 94e35aeb1..f35033fa8 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/JobSchedulingInfoTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/JobSchedulingInfoTest.java @@ -16,13 +16,13 @@ package io.mantisrx.server.core; -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 io.mantisrx.runtime.MantisJobState; import io.mantisrx.shaded.com.google.common.collect.ImmutableList; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobSchedulingInfoTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/TimeBufferedWorkerOutlierTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/TimeBufferedWorkerOutlierTest.java index 8619eea8d..8cb2d18c5 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/TimeBufferedWorkerOutlierTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/TimeBufferedWorkerOutlierTest.java @@ -16,11 +16,11 @@ package io.mantisrx.server.core; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TimeBufferedWorkerOutlierTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerAssignmentsTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerAssignmentsTest.java index 53a79f6ab..a20f88a94 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerAssignmentsTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerAssignmentsTest.java @@ -16,13 +16,13 @@ package io.mantisrx.server.core; -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 io.mantisrx.runtime.MantisJobState; import io.mantisrx.shaded.com.google.common.collect.ImmutableList; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerAssignmentsTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java index 1a37b610a..c442ccbf8 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java @@ -16,12 +16,13 @@ package io.mantisrx.server.core; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import io.mantisrx.runtime.MantisJobState; import io.mantisrx.shaded.com.google.common.collect.ImmutableList; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerHostTest { @Test @@ -30,7 +31,10 @@ public void testEquals() { WorkerHost w2 = new WorkerHost("localhost", 1, ImmutableList.of(7001, 7002), MantisJobState.Accepted, 2, 7003, 7004); WorkerHost w3 = new WorkerHost("localhost", 1, ImmutableList.of(7001, 7002), MantisJobState.Accepted, 2, 7003, 7005); - assertTrue(w1.equals(w2)); - assertFalse(w1.equals(w3)); + // required? + assertAll( + () -> assertTrue(w1.equals(w2)), + () -> assertFalse(w1.equals(w3)) + ); } } diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerOutlierTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerOutlierTest.java index 703ea0c3f..e5b52fdef 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerOutlierTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerOutlierTest.java @@ -16,11 +16,11 @@ package io.mantisrx.server.core; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerOutlierTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/domain/WorkerIdTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/domain/WorkerIdTest.java index c9441c36d..30c56d1f4 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/domain/WorkerIdTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/domain/WorkerIdTest.java @@ -16,11 +16,11 @@ package io.mantisrx.server.core.domain; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.JsonSerializer; import org.apache.commons.lang3.SerializationUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerIdTest { private final JsonSerializer serializer = new JsonSerializer(); diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorHeartbeatTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorHeartbeatTest.java index c7db69495..70646bdee 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorHeartbeatTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorHeartbeatTest.java @@ -16,10 +16,10 @@ package io.mantisrx.server.master.resourcecluster; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.JsonSerializer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TaskExecutorHeartbeatTest { private final JsonSerializer serializer = new JsonSerializer(); diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorRegistrationTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorRegistrationTest.java index 9337fdd02..a9f8166bb 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorRegistrationTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/master/resourcecluster/TaskExecutorRegistrationTest.java @@ -15,12 +15,12 @@ */ package io.mantisrx.server.master.resourcecluster; -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 io.mantisrx.common.JsonSerializer; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TaskExecutorRegistrationTest { private final JsonSerializer serializer = new JsonSerializer(); diff --git a/mantis-control-plane/mantis-control-plane-server/build.gradle b/mantis-control-plane/mantis-control-plane-server/build.gradle index af01c2a28..ff19d321c 100644 --- a/mantis-control-plane/mantis-control-plane-server/build.gradle +++ b/mantis-control-plane/mantis-control-plane-server/build.gradle @@ -55,7 +55,7 @@ dependencies { testImplementation "com.typesafe.akka:akka-testkit_$scalaBinaryVersion:$akkaVersion" testImplementation "com.typesafe.akka:akka-http-testkit_$scalaBinaryVersion:$akkaHttpVersion" - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoCore3 testImplementation "org.testng:testng:$testngVersion" testImplementation testFixtures(project(":mantis-common")) diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java index 2586fb4ed..8d003f140 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java @@ -16,7 +16,7 @@ package io.mantisrx.master.api.akka.route; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import io.mantisrx.common.Ack; import io.mantisrx.master.jobcluster.job.MantisJobMetadataView; @@ -30,7 +30,7 @@ import java.io.ObjectOutputStream; import java.util.List; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JacksonTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java index 4eb6c27e0..a1e24a40a 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java @@ -16,8 +16,8 @@ package io.mantisrx.master.api.akka.route; -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 akka.http.javadsl.server.AllDirectives; import akka.http.javadsl.server.Route; @@ -27,7 +27,7 @@ import io.mantisrx.server.master.ILeadershipManager; import io.mantisrx.server.master.LeaderRedirectionFilter; import io.mantisrx.server.master.LeadershipManagerLocalImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LeaderRedirectionFilterTest extends AllDirectives { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java index 95bc1bbf0..6986ad36b 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route; -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 akka.NotUsed; import akka.actor.ActorSystem; @@ -46,9 +46,9 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -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; @@ -99,7 +99,7 @@ private String getResponseMessage(final String msg, final Throwable t) { private static final MasterMonitor masterMonitor = new LocalMasterMonitor(fakeMasterDesc); private static final ILeadershipManager leadershipMgr = new LeadershipManagerLocalImpl(fakeMasterDesc); - @BeforeClass + @BeforeAll public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -131,7 +131,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("MasterDescriptionRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java index 0ec49ddc5..028ad4383 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java @@ -16,30 +16,33 @@ package io.mantisrx.master.api.akka.route.pagination; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; import java.util.Random; -import org.junit.Test; +import org.junit.jupiter.api.Test; import scala.Tuple1; public class ListObjectTests { private static final Random rnd = new Random(System.currentTimeMillis()); - @Test(expected = RuntimeException.class) + @Test public void testSortingByInvalidFieldName() { - try { - ListObject listobject = new ListObject.Builder() - .withObjects(generateList(10), TestObject.class) - .withSortField("invalidValue") - .withSortAscending(true) - .build(); - } catch (Exception e) { - assertTrue(e.getMessage().contains("Specified sort field is invalid.")); - throw e; - } + assertThrows(RuntimeException.class, () -> { + try { + ListObject listobject = new ListObject.Builder() + .withObjects(generateList(10), TestObject.class) + .withSortField("invalidValue") + .withSortAscending(true) + .build(); + } catch (Exception e) { + assertTrue(e.getMessage().contains("Specified sort field is invalid.")); + throw e; + } + }); } @Test @@ -110,18 +113,20 @@ public void testSortingByPublicValueFieldNameDescending() { } } - @Test(expected = RuntimeException.class) + @Test public void testSortingByPrivateValueFieldName() { - try { - ListObject listobject = new ListObject.Builder() - .withObjects(generateList(10), TestObject.class) - .withSortField("privateValue") - .withSortAscending(true) - .build(); - } catch (Exception e) { - assertTrue(e.getMessage().contains("Cannot access sort field.")); - throw e; - } + assertThrows(RuntimeException.class, () -> { + try { + ListObject listobject = new ListObject.Builder() + .withObjects(generateList(10), TestObject.class) + .withSortField("privateValue") + .withSortAscending(true) + .build(); + } catch (Exception e) { + assertTrue(e.getMessage().contains("Cannot access sort field.")); + throw e; + } + }); } @Test @@ -174,17 +179,19 @@ public void testPaginationLimit() { .build().list.size() == 5); } - @Test(expected = IllegalStateException.class) + @Test public void testPaginationInvalidLimit() { - try { - int size = new ListObject.Builder() - .withObjects(generateList(10), TestObject.class) - .withLimit(-1) - .build().list.size(); - } catch (Exception e) { - assertTrue(e.getMessage().contains("limit needs to be greater than 0")); - throw e; - } + assertThrows(IllegalStateException.class, () -> { + try { + int size = new ListObject.Builder() + .withObjects(generateList(10), TestObject.class) + .withLimit(-1) + .build().list.size(); + } catch (Exception e) { + assertTrue(e.getMessage().contains("limit needs to be greater than 0")); + throw e; + } + }); } @Test diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java index 3ad88a410..bd16b6fc3 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java @@ -16,7 +16,7 @@ package io.mantisrx.master.api.akka.route.utils; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.master.jobcluster.job.JobState; import io.mantisrx.master.jobcluster.job.worker.WorkerState; @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobRouteUtilsTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java index 518465f0c..f6c22e1aa 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v0; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -68,9 +68,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -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; import rx.Observer; @@ -111,7 +111,7 @@ private String getResponseMessage(final String msg, final Throwable t) { private static CompletionStage binding; private static ActorSystem system = ActorSystem.create("AgentClusterRoutes"); - @BeforeClass + @BeforeAll public static void setup() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); t = new Thread(() -> { @@ -156,7 +156,7 @@ public static void setup() throws InterruptedException { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("V0AgentClusterRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java index c717dd7c4..6f085267f 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v0; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -71,9 +71,9 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; -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; @@ -112,7 +112,7 @@ private String getResponseMessage(final String msg, final Throwable t) { private static CompletionStage binding; private static ActorSystem system = ActorSystem.create("JobClusterRoutes"); - @BeforeClass + @BeforeAll public static void setup() throws Exception { TestHelpers.setupMasterConfig(); final CountDownLatch latch = new CountDownLatch(1); @@ -152,7 +152,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("V0JobClusterRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java index 67cd06ec7..b806f9f5b 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java @@ -16,10 +16,10 @@ package io.mantisrx.master.api.akka.route.v0; -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 static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java index 3cc525a10..67049e6e8 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v0; -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 akka.NotUsed; import akka.actor.ActorSystem; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java index b35e12eff..ad6e84cb8 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v1; -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 akka.NotUsed; import akka.http.javadsl.ConnectHttp; @@ -38,9 +38,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -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; @@ -70,7 +70,7 @@ public AdminMasterRouteTest(){ super("MasterDescriptionRouteTest", 8205); } - @BeforeClass + @BeforeAll public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -98,7 +98,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("MasterDescriptionRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java index 2bee8e84f..d5922e792 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v1; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -67,9 +67,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -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; import rx.Observer; @@ -92,7 +92,7 @@ public AgentClustersRouteTest() { super("AgentClusterRoutes", 8202); } - @BeforeClass + @BeforeAll public static void setup() throws InterruptedException { TestHelpers.setupMasterConfig(); final CountDownLatch latch = new CountDownLatch(1); @@ -150,7 +150,7 @@ public static void setup() throws InterruptedException { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("V1AgentClusterRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java index 5d07ffba9..f8a5ec897 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java @@ -16,7 +16,7 @@ package io.mantisrx.master.api.akka.route.v1; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.master.api.akka.route.Jackson; import io.mantisrx.server.core.domain.ArtifactID; @@ -29,7 +29,7 @@ import io.mantisrx.shaded.com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobArtifactSerdeTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java index 41171342e..08b8b3534 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java @@ -16,8 +16,8 @@ package io.mantisrx.master.api.akka.route.v1; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -60,9 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; import org.apache.commons.io.FileUtils; -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; @@ -80,7 +80,7 @@ public JobClustersRouteTest() { super("JobClustersRouteTest", SERVER_PORT); } - @BeforeClass + @BeforeAll public static void setup() throws Exception { TestHelpers.setupMasterConfig(); final CountDownLatch latch = new CountDownLatch(1); @@ -133,7 +133,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterClass + @AfterAll public static void tearDown() throws Exception { logger.info("V1JobClusterRouteTest teardown"); binding.thenCompose(ServerBinding::unbind) // trigger unbinding from the port diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java index 7a5f14cea..47036b2de 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java @@ -52,9 +52,9 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.CountDownLatch; import java.util.function.Function; -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; import rx.Observable; @@ -72,7 +72,7 @@ public JobDiscoveryStreamRouteTest(){ super("JobDiscoveryRoute", SERVER_PORT); } - @BeforeClass + @BeforeAll public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -117,7 +117,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("JobDiscoveryRouteTest teardown"); if (binding != null) { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java index 3ba5541ef..089201394 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java @@ -79,9 +79,9 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.CountDownLatch; import java.util.function.Function; -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; import org.testng.util.Strings; @@ -100,7 +100,7 @@ public JobsRouteTest() { super("JobsRoute", SERVER_PORT); } - @BeforeClass + @BeforeAll public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -237,7 +237,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterClass + @AfterAll public static void teardown() { logger.info("V1JobsRouteTest teardown"); binding.thenCompose(ServerBinding::unbind) // trigger unbinding from the port diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java index 222bcdc0b..6b5c6be60 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java @@ -77,8 +77,8 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; public class ResourceClusterNonLeaderRedirectRouteTest extends JUnitRouteTest { @@ -114,7 +114,7 @@ resourceProviderAdapter, new InMemoryOnlyResourceClusterStorageProvider()), testRoute(new ResourceClustersNonLeaderRedirectRoute(resourceClusters, resourceClusterRouteHandlerWithTestAdapter, system) .createRoute(route -> route)); - @BeforeClass + @BeforeAll public static void init() { TestHelpers.setupMasterConfig(); } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java index 7684487dc..d901b9def 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v1; -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 akka.actor.ActorSystem; import akka.http.javadsl.Http; @@ -37,8 +37,8 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.util.Strings; @@ -54,7 +54,7 @@ public abstract class RouteTestBase { static ResponseValidatorFunc EMPTY_RESPONSE_VALIDATOR = (msg) -> { - assertTrue(String.format("response [%s] is not empty", msg), Strings.isNullOrEmpty(msg)); + assertTrue(Strings.isNullOrEmpty(msg), String.format("response [%s] is not empty", msg)); }; RouteTestBase(String testName, int port) { @@ -65,14 +65,14 @@ public abstract class RouteTestBase { this.serverPort = port; } - @BeforeClass + @BeforeAll public static void setupActorSystem() { system = ActorSystem.create(); materializer = Materializer.createMaterializer(system); http = Http.get(system); } - @AfterClass + @AfterAll public static void tearDownActorSystem() { try { http.shutdownAllConnectionPools(); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java index dc118a511..9c0ddd703 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java @@ -19,10 +19,10 @@ import static io.mantisrx.master.events.LifecycleEventsProto.StatusEvent.StatusEventType.INFO; import static io.mantisrx.master.jobcluster.job.worker.MantisWorkerMetadataImpl.MANTIS_SYSTEM_ALLOCATED_NUM_PORTS; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -import static junit.framework.TestCase.assertTrue; -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.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; import akka.actor.ActorRef; @@ -53,9 +53,9 @@ import io.mantisrx.shaded.com.google.common.collect.Lists; import java.util.*; import java.util.concurrent.*; -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 WorkerRegistryV2Test { @@ -67,7 +67,7 @@ public class WorkerRegistryV2Test { private static final String user = "mantis"; - @BeforeClass + @BeforeAll public static void setup() { system = ActorSystem.create(); @@ -80,7 +80,7 @@ public static void setup() { } - @AfterClass + @AfterAll public static void tearDown() { //((SimpleCachedFileStorageProvider)storageProvider).deleteAllFiles(); //JobTestHelper.deleteAllFiles(); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java index 0ce1845ec..98f096a23 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java @@ -52,10 +52,10 @@ import static io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyResponse; import static java.util.Optional.empty; import static java.util.Optional.of; -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 static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doAnswer; @@ -133,13 +133,12 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Mockito; import org.mockito.stubbing.Answer; import rx.schedulers.Schedulers; @@ -160,10 +159,12 @@ public class JobClusterTest { private IMantisPersistenceProvider storageProvider; private static LifecycleEventPublisher eventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); private static final String user = "mantis"; - @Rule - public TemporaryFolder rootDir = new TemporaryFolder(); +// @Rule +// public TemporaryFolder rootDir = new TemporaryFolder(); + @TempDir + File rootDir; - @BeforeClass + @BeforeAll public static void setup() { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -178,17 +179,17 @@ public static void setup() { TestHelpers.setupMasterConfig(); } - @AfterClass + @AfterAll public static void tearDown() { JobTestHelper.deleteAllFiles(); TestKit.shutdownActorSystem(system); system = null; } - @Before + @BeforeEach public void setupStorageProvider() { storageProvider = new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir.getRoot()), + new FileBasedStore(rootDir), eventPublisher); jobStore = new MantisJobStore(storageProvider); } @@ -1181,7 +1182,7 @@ public void testJobSubmitWithVersionAndNoSchedInfo() { } - @Ignore + @Disabled @Test public void testJobComplete() { TestKit probe = new TestKit(system); @@ -1442,7 +1443,7 @@ public void testJobSubmitTriggersSLAToKillOldHandlesErrors() { /** * {@see Github issue for more context} */ - @Ignore + @Disabled @Test public void testCronTriggersSLAToKillOld() { TestKit probe = new TestKit(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java index 2b7cf2df1..2f0860a2f 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.jobcluster; -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 io.mantisrx.common.Label; import io.mantisrx.runtime.JobConstraints; @@ -36,7 +36,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobDefinitionResolverTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java index b3dec2156..bced1fb69 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java @@ -17,10 +17,10 @@ package io.mantisrx.master.jobcluster; import static java.util.Optional.empty; -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 static org.mockito.Mockito.*; import akka.actor.AbstractActor; @@ -39,8 +39,8 @@ import java.time.Instant; import java.util.List; import java.util.Optional; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class JobManagerTest { @@ -48,7 +48,7 @@ public class JobManagerTest { private static AbstractActor.ActorContext context; private static MantisSchedulerFactory schedulerFactory; private static LifecycleEventPublisher publisher; - @BeforeClass + @BeforeAll public static void setup() { jobStore = mock(MantisJobStore.class); context = mock(AbstractActor.ActorContext.class); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java index 82de9f1ce..f09b18853 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java @@ -16,14 +16,14 @@ package io.mantisrx.master.jobcluster; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import io.mantisrx.common.Label; import io.mantisrx.server.master.domain.JobId; import java.util.ArrayList; import java.util.List; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LabelCacheTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java index 7f8e9244d..f213448b8 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java @@ -17,7 +17,7 @@ package io.mantisrx.master.jobcluster; import static io.mantisrx.master.jobcluster.LabelManager.SystemLabels.*; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.Label; import io.mantisrx.runtime.JobSla; @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LabelManagerTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java index 152206e84..a4d4c3761 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.jobcluster; -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 io.mantisrx.master.jobcluster.JobClusterActor.JobInfo; import io.mantisrx.master.jobcluster.job.JobState; @@ -28,7 +28,7 @@ import java.util.List; import java.util.Set; import org.joda.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SLAEnforcerTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java index aff29817d..4e6763913 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java @@ -26,11 +26,11 @@ import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS_CREATED; import static java.util.Optional.empty; import static java.util.Optional.of; -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 static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; @@ -101,6 +101,7 @@ import io.mantisrx.server.master.scheduler.WorkerLaunched; import io.mantisrx.server.master.store.FileBasedStore; import io.mantisrx.shaded.com.google.common.collect.Lists; +import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.time.Duration; @@ -109,13 +110,11 @@ import java.util.Optional; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.rules.Timeout; +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.junit.jupiter.api.io.TempDir; import org.mockito.Mockito; import rx.schedulers.Schedulers; import rx.subjects.BehaviorSubject; @@ -132,13 +131,14 @@ public class JobClusterManagerTest { new WorkerEventSubscriberLoggingImpl()); private static final String user = "nj"; - @Rule - public TemporaryFolder rootDir = new TemporaryFolder(); +// @Rule +// public TemporaryFolder rootDir = new TemporaryFolder(); + @TempDir + File rootDir; +// @Rule +// public Timeout globalTimeout = new Timeout(2000); - @Rule - public Timeout globalTimeout = new Timeout(2000); - - @BeforeClass + @BeforeAll public static void setup() { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -153,7 +153,7 @@ public static void setup() { TestHelpers.setupMasterConfig(); } - @Before + @BeforeEach public void setupState() { jobStoreMock = mock(MantisJobStore.class); schedulerMockFactory = mock(MantisSchedulerFactory.class); @@ -167,7 +167,7 @@ public void setupState() { true), ActorRef.noSender()); } - @AfterClass + @AfterAll public static void tearDown() { JobTestHelper.deleteAllFiles(); TestKit.shutdownActorSystem(system); @@ -263,7 +263,7 @@ private void createJobClusterAndAssert( "user"), probe.getRef()); JobClusterManagerProto.CreateJobClusterResponse resp = probe.expectMsgClass( JobClusterManagerProto.CreateJobClusterResponse.class); - assertEquals(resp.toString(), SUCCESS_CREATED, resp.responseCode); + assertEquals(SUCCESS_CREATED, resp.responseCode, resp.toString()); } private void submitJobAndAssert(ActorRef jobClusterManagerActor, String cluster) { @@ -295,7 +295,7 @@ public void testBootStrapJobClustersAndJobs1() { TestKit probe = new TestKit(system); JobTestHelper.deleteAllFiles(); MantisJobStore jobStore = new MantisJobStore(new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir.getRoot()), + new FileBasedStore(rootDir), eventPublisher)); MantisJobStore jobStoreSpied = Mockito.spy(jobStore); // MantisScheduler schedulerMock = mock(MantisScheduler.class); @@ -393,7 +393,7 @@ public void testBootStrapJobClustersAndJobs() { TestKit probe = new TestKit(system); JobTestHelper.deleteAllFiles(); MantisJobStore jobStore = new MantisJobStore(new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir.getRoot()), + new FileBasedStore(rootDir), eventPublisher)); MantisJobStore jobStoreSpied = Mockito.spy(jobStore); ActorRef jobClusterManagerActor = system.actorOf(JobClustersManagerActor.props( @@ -640,7 +640,7 @@ public void testBootstrapJobClusterAndJobsWithCorruptedWorkerPorts() TestKit probe = new TestKit(system); JobTestHelper.deleteAllFiles(); MantisJobStore jobStore = new MantisJobStore(new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir.getRoot()), + new FileBasedStore(rootDir), eventPublisher)); MantisJobStore jobStoreSpied = Mockito.spy(jobStore); // MantisScheduler schedulerMock = mock(MantisScheduler.class); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java index 16c6a48bd..3f4a18198 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java @@ -33,10 +33,10 @@ package io.mantisrx.master.jobcluster.job; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -79,9 +79,9 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -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 rx.schedulers.Schedulers; import rx.subjects.BehaviorSubject; @@ -90,14 +90,14 @@ public class JobScaleUpDownTests { static ActorSystem system; final LifecycleEventPublisher lifecycleEventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); - @BeforeClass + @BeforeAll public static void setup() { system = ActorSystem.create(); TestHelpers.setupMasterConfig(); } - @AfterClass + @AfterAll public static void tearDown() { TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java index a6354a67c..3cbc26630 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java @@ -17,9 +17,9 @@ package io.mantisrx.master.jobcluster.job; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -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 akka.actor.ActorRef; import akka.actor.ActorSystem; @@ -61,7 +61,7 @@ import java.time.Duration; import java.time.Instant; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobTestHelper { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java index 09006c69e..47a9bf7cf 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java @@ -20,9 +20,9 @@ import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SERVER_ERROR; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; import static java.util.Optional.empty; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.timeout; @@ -68,9 +68,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -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.mockito.InOrder; import org.mockito.Mockito; @@ -83,7 +83,7 @@ public class JobTestLifecycle { private static final String user = "mantis"; - @BeforeClass + @BeforeAll public static void setup() { system = ActorSystem.create(); @@ -92,7 +92,7 @@ public static void setup() { jobStore = new MantisJobStore(storageProvider); } - @AfterClass + @AfterAll public static void tearDown() { JobTestHelper.deleteAllFiles(); TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java index 9b1f92be2..5758e87bf 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java @@ -17,8 +17,8 @@ package io.mantisrx.master.jobcluster.job; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; import akka.actor.ActorRef; @@ -53,9 +53,9 @@ import java.util.Optional; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -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; @@ -68,7 +68,7 @@ public class JobTestMigrationTests { final LifecycleEventPublisher eventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); - @BeforeClass + @BeforeAll public static void setup() { system = ActorSystem.create(); @@ -76,7 +76,7 @@ public static void setup() { } - @AfterClass + @AfterAll public static void tearDown() { //((SimpleCachedFileStorageProvider)storageProvider).deleteAllFiles(); TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java index 046cd318a..c5ea0f017 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java @@ -15,9 +15,9 @@ */ //package io.mantisrx.master.jobcluster.job; // -//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.assertFalse; +//import static org.junit.jupiter.api.Assertions.assertTrue; +//import static org.junit.jupiter.api.Assertions.fail; // //import java.time.Instant; // diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java index 2c04cf68a..373979989 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java @@ -16,8 +16,8 @@ package io.mantisrx.master.jobcluster.job; -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 io.mantisrx.master.api.akka.payloads.PayloadUtils; import io.mantisrx.server.master.domain.DataFormatAdapter; @@ -27,7 +27,7 @@ import io.mantisrx.shaded.com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java index 9559f6472..1fa8e7662 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java @@ -16,11 +16,11 @@ package io.mantisrx.master.jobcluster.job; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import io.mantisrx.server.core.domain.WorkerId; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerResubmitRateLimiterTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java index ab276c005..d86ed646b 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java @@ -16,14 +16,14 @@ package io.mantisrx.master.resourcecluster; -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 io.mantisrx.server.master.resourcecluster.ClusterID; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.time.Duration; import java.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DisableTaskExecutorsRequestTest { private static final DisableTaskExecutorsRequest R1 = diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java index 755f045ec..26da803f5 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java @@ -16,9 +16,9 @@ package io.mantisrx.master.resourcecluster; -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 static org.mockito.Mockito.mock; import io.mantisrx.common.WorkerPorts; @@ -43,8 +43,8 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.lang3.tuple.Pair; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ExecutorStateManagerTests { private final AtomicReference actual = @@ -111,7 +111,7 @@ public class ExecutorStateManagerTests { private final ExecutorStateManager stateManager = new ExecutorStateManagerImpl(); - @Before + @BeforeEach public void setup() { rpc.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java index a952edcca..362f909e8 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java @@ -16,8 +16,9 @@ package io.mantisrx.master.resourcecluster; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -67,10 +68,10 @@ import java.util.Optional; import java.util.concurrent.ExecutionException; import org.apache.flink.util.ExceptionUtils; -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.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Matchers; @@ -155,18 +156,18 @@ public class ResourceClusterActorTest { private ResourceCluster resourceCluster; private JobMessageRouter jobMessageRouter; - @BeforeClass + @BeforeAll public static void setup() { actorSystem = ActorSystem.create(); } - @AfterClass + @AfterAll public static void teardown() { TestKit.shutdownActorSystem(actorSystem); actorSystem = null; } - @Before + @BeforeEach public void setupRpcService() { rpcService.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); mantisJobStore = mock(MantisJobStore.class); @@ -174,7 +175,7 @@ public void setupRpcService() { jobMessageRouter = mock(JobMessageRouter.class); } - @Before + @BeforeEach public void setupActor() { final Props props = ResourceClusterActor.props( @@ -581,27 +582,29 @@ public void testIfTaskExecutorsThatWereRunningTasksPreviouslyAndRunningCorrectly assertEquals(WORKER_ID, actualWorkerEvent.getWorkerId()); } - @Test(expected = TaskNotFoundException.class) + @Test public void testGetAssignedTaskExecutorAfterTaskCompletes() throws Throwable { - assertEquals(Ack.getInstance(), resourceCluster.registerTaskExecutor(TASK_EXECUTOR_REGISTRATION).join()); - assertEquals( - Ack.getInstance(), - resourceCluster.heartBeatFromTaskExecutor( - new TaskExecutorHeartbeat(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); + assertThrows(TaskNotFoundException.class, () -> { + assertEquals(Ack.getInstance(), resourceCluster.registerTaskExecutor(TASK_EXECUTOR_REGISTRATION).join()); + assertEquals( + Ack.getInstance(), + resourceCluster.heartBeatFromTaskExecutor( + new TaskExecutorHeartbeat(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); - assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorFor(MACHINE_DEFINITION, WORKER_ID).join()); - assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join()); - assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( - new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.occupied(WORKER_ID))).join()); + assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorFor(MACHINE_DEFINITION, WORKER_ID).join()); + assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join()); + assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( + new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.occupied(WORKER_ID))).join()); - assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( - new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); + assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( + new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); - try { - TaskExecutorID result = resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join(); + try { + TaskExecutorID result = resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join(); - } catch (Exception e) { - throw ExceptionUtils.stripCompletionException(e); - } + } catch (Exception e) { + throw ExceptionUtils.stripCompletionException(e); + } + }); } } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java index e37570262..9dd7d5644 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java @@ -17,9 +17,9 @@ package io.mantisrx.master.resourcecluster; import static io.mantisrx.master.resourcecluster.ResourceClusterActorTest.actorSystem; -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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -55,10 +55,10 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; -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; public class ResourceClusterScalerActorTests { private static final ClusterID CLUSTER_ID = ClusterID.of("clusterId"); @@ -78,18 +78,18 @@ public class ResourceClusterScalerActorTests { private static final MachineDefinition MACHINE_DEFINITION_M = new MachineDefinition(3, 4096, 700, 10240, 5); - @BeforeClass + @BeforeAll public static void setup() { actorSystem = ActorSystem.create(); } - @AfterClass + @AfterAll public static void teardown() { TestKit.shutdownActorSystem(actorSystem); actorSystem = null; } - @Before + @BeforeEach public void setupMocks() { clusterActorProbe = new TestKit(actorSystem); hostActorProbe = new TestKit(actorSystem); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java index 4cfdf15ed..f12ae4fa4 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java @@ -16,7 +16,7 @@ package io.mantisrx.master.resourcecluster; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.any; import static org.mockito.Mockito.argThat; import static org.mockito.Mockito.atMost; @@ -50,14 +50,14 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import lombok.val; -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 ResourceClustersHostManagerActorTests { static ActorSystem system; - @BeforeClass + @BeforeAll public static void setup() { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -68,7 +68,7 @@ public static void setup() { system = ActorSystem.create("ResourceClusterManagerUnitTest", config.withFallback(ConfigFactory.load())); } - @AfterClass + @AfterAll public static void tearDown() { TestKit.shutdownActorSystem(system); system = null; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java index ddb7c399e..c615d71cd 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.resourcecluster; -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 static org.mockito.Mockito.mock; import io.mantisrx.common.WorkerPorts; @@ -42,8 +42,8 @@ import java.time.ZoneId; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TaskExecutorStateTest { private final AtomicReference actual = @@ -68,7 +68,7 @@ public class TaskExecutorStateTest { ImmutableMap.of("attr1", "attr2"); private static final WorkerId WORKER_ID = WorkerId.fromIdUnsafe("late-sine-function-tutorial-1-worker-0-1"); - @Before + @BeforeEach public void setup() { rpc.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java index 2f47f3d44..82513d0ef 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java @@ -16,8 +16,8 @@ package io.mantisrx.master.resourcecluster.resourceprovider; -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 akka.actor.ActorSystem; import com.typesafe.config.Config; @@ -37,19 +37,21 @@ import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +//import org.junit.rules.TemporaryFolder; @Slf4j public class SimpleFileResourceStorageProviderTests { static ActorSystem system; - @Rule - public TemporaryFolder storageDirectory = new TemporaryFolder(); +// @Rule +// public TemporaryFolder storageDirectory = new TemporaryFolder(); + @TempDir + File storageDirectory, testDirectory; - @BeforeClass + @BeforeAll public static void setup() throws IOException { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -64,7 +66,7 @@ public static void setup() throws IOException { public void testResourceClusterRules() throws ExecutionException, InterruptedException, IOException { final ClusterID clusterId = ClusterID.of("mantisRCMTest2"); final ContainerSkuID smallSkuId = ContainerSkuID.of("small"); - SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory.newFolder("test")); + SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory); ResourceClusterScaleSpec rule1 = ResourceClusterScaleSpec.builder() .clusterId(clusterId) @@ -161,7 +163,7 @@ public void testUpdateClusterSpec() throws ExecutionException, InterruptedExcept .id(spec.getId()) .build(); - SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory.newFolder("test")); + SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, testDirectory); CompletionStage updateFut = prov.registerAndUpdateClusterSpec(specWritable); log.info("res: " + updateFut.toCompletableFuture().get()); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java index fa81031c9..ebd9aa980 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java @@ -17,9 +17,9 @@ package io.mantisrx.master.scheduler; import static io.mantisrx.master.scheduler.AgentsErrorMonitorActor.props; -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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -33,9 +33,9 @@ import io.mantisrx.server.master.scheduler.MantisScheduler; import java.util.ArrayList; import java.util.List; -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 rx.functions.Action1; public class AgentsErrorMonitorTest { @@ -44,13 +44,13 @@ public class AgentsErrorMonitorTest { private static TestKit probe; - @BeforeClass + @BeforeAll public static void setup() { system = ActorSystem.create(); probe = new TestKit(system); } - @AfterClass + @AfterAll public static void tearDown() { TestKit.shutdownActorSystem(system); system = null; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java index 683c078b9..98fbda2b3 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java @@ -17,9 +17,9 @@ package io.mantisrx.server.master.domain; import static java.util.Optional.of; -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 io.mantisrx.common.Label; import io.mantisrx.common.WorkerPorts; @@ -68,7 +68,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DataFormatAdapterTest { public static final MachineDefinition DEFAULT_MACHINE_DEFINITION = new MachineDefinition(1, 10, 10, 10, 2); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java index 34ec8d21f..c62e4d8f3 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java @@ -16,15 +16,16 @@ package io.mantisrx.server.master.domain; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +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 io.mantisrx.runtime.JobOwner; import io.mantisrx.runtime.MachineDefinition; import io.mantisrx.runtime.WorkerMigrationConfig; import io.mantisrx.runtime.descriptor.SchedulingInfo; import io.mantisrx.shaded.com.google.common.collect.Lists; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobClusterConfigTest { @@ -55,17 +56,18 @@ public void happyTest() { fail(); } } - @Test(expected = Exception.class) + @Test public void noSchedInfoFails() { - String name = "noSchedInfoFails"; + assertThrows(Exception.class, () -> { + String name = "noSchedInfoFails"; - JobClusterConfig clusterConfig = new JobClusterConfig.Builder() + JobClusterConfig clusterConfig = new JobClusterConfig.Builder() .withArtifactName("myart") .withSchedulingInfo(null) .withVersion("0.0.1") .build(); - final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() + final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() .withJobClusterConfig(clusterConfig) .withName(name) .withParameters(Lists.newArrayList()) @@ -74,19 +76,21 @@ public void noSchedInfoFails() { .withOwner(new JobOwner("Nick", "Mantis", "desc", "nma@netflix.com", "repo")) .withMigrationConfig(WorkerMigrationConfig.DEFAULT) .build(); + }); } - @Test(expected = Exception.class) + @Test public void noArtifactNameFails() { - String name = "noArtifactNameFails"; + assertThrows(Exception.class, () -> { + String name = "noArtifactNameFails"; - JobClusterConfig clusterConfig = new JobClusterConfig.Builder() + JobClusterConfig clusterConfig = new JobClusterConfig.Builder() .withArtifactName(null) .withSchedulingInfo(DEFAULT_SCHED_INFO) .withVersion("0.0.1") .build(); - final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() + final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() .withJobClusterConfig(clusterConfig) .withName(name) .withUser("nj") @@ -95,6 +99,7 @@ public void noArtifactNameFails() { .withOwner(new JobOwner("Nick", "Mantis", "desc", "nma@netflix.com", "repo")) .withMigrationConfig(WorkerMigrationConfig.DEFAULT) .build(); + }); } @Test public void noVersionAutogenerate() { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java index 4daf5b6cf..e8cbbe061 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java @@ -16,10 +16,10 @@ package io.mantisrx.server.master.domain; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JobIdTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java index 631e4ef71..0aebfa8ad 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java @@ -17,9 +17,9 @@ package io.mantisrx.server.master.persistence; import static io.mantisrx.master.jobcluster.job.worker.MantisWorkerMetadataImpl.MANTIS_SYSTEM_ALLOCATED_NUM_PORTS; -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 io.mantisrx.common.Label; import io.mantisrx.common.WorkerPorts; @@ -61,8 +61,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; public class FileBasedStoreTest { private final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -70,7 +70,7 @@ public class FileBasedStoreTest { private final FileBasedStore fileProvider = new FileBasedStore(); - @After + @AfterEach public void tearDown() { fileProvider.reset(); } diff --git a/mantis-discovery-proto/build.gradle b/mantis-discovery-proto/build.gradle index e82298125..3368371cb 100644 --- a/mantis-discovery-proto/build.gradle +++ b/mantis-discovery-proto/build.gradle @@ -17,5 +17,5 @@ dependencies { api libraries.mantisShaded - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter } diff --git a/mantis-discovery-proto/src/test/java/io/mantisrx/discovery/proto/AppJobClustersMapTest.java b/mantis-discovery-proto/src/test/java/io/mantisrx/discovery/proto/AppJobClustersMapTest.java index ba0e624bb..248daac04 100644 --- a/mantis-discovery-proto/src/test/java/io/mantisrx/discovery/proto/AppJobClustersMapTest.java +++ b/mantis-discovery-proto/src/test/java/io/mantisrx/discovery/proto/AppJobClustersMapTest.java @@ -16,16 +16,16 @@ package io.mantisrx.discovery.proto; -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 io.mantisrx.shaded.com.fasterxml.jackson.databind.DeserializationFeature; import io.mantisrx.shaded.com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AppJobClustersMapTest { diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java index d5d916edf..aa6f7e3da 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java @@ -44,7 +44,6 @@ import java.io.IOException; import java.util.*; import java.util.stream.Collectors; -import org.junit.Rule; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -56,12 +55,7 @@ public class DefaultSubscriptionTrackerTest { private static final int subscriptionExpiryIntervalSec = 3; private final Map streamJobClusterMap = new HashMap<>(); - @Rule - public WireMockRule mantisWorker1 = new WireMockRule(options().dynamicPort()); - @Rule - public WireMockRule mantisWorker2 = new WireMockRule(options().dynamicPort()); - @Rule - public WireMockRule mantisWorker3 = new WireMockRule(options().dynamicPort()); + WireMockRule mantisWorker1, mantisWorker2, mantisWorker3; private DefaultSubscriptionTracker subscriptionTracker; private MantisJobDiscovery mockJobDiscovery; private StreamManager mockStreamManager; @@ -103,6 +97,9 @@ public void setup() { Registry registry = new DefaultRegistry(); mockJobDiscovery = mock(MantisJobDiscovery.class); mockStreamManager = spy(new StreamManager(registry, mrePublishConfiguration)); + mantisWorker1 = new WireMockRule(options().dynamicPort()); + mantisWorker2 = new WireMockRule(options().dynamicPort()); + mantisWorker3 = new WireMockRule(options().dynamicPort()); mantisWorker1.start(); mantisWorker2.start(); mantisWorker3.start(); diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/MantisEventPublisherTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/MantisEventPublisherTest.java index 9ccb8f3b6..3803b98d0 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/MantisEventPublisherTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/MantisEventPublisherTest.java @@ -16,9 +16,9 @@ package io.mantisrx.publish; -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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -38,8 +38,8 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MantisEventPublisherTest { @@ -53,7 +53,7 @@ private MrePublishConfiguration testConfig(boolean mantisPublishClientEnabled) { private StreamManager streamManager; - @Before + @BeforeEach public void setup() { streamManager = mock(StreamManager.class); } @@ -70,7 +70,7 @@ private void assertStatusAsync(PublishStatus expected, CompletionStage streamJobClusterMap = new HashMap<>(); - @Rule - public WireMockRule mantisApi = new WireMockRule(options().dynamicPort()); + WireMockRule mantisApi; private MrePublishConfiguration config; private MantisJobDiscovery jobDiscovery; +// public class WireMockExtension implements AfterEachCallback, BeforeEachCallback { +// static WireMockServer mantisAPI = new WireMockServer(); +// @Override +// public void beforeEach(ExtensionContext context) throws Exception { +// mantisAPI.start(); +// } +// +// @Override +// public void afterEach(ExtensionContext context) throws Exception { +// mantisAPI.shutdown(); +// } +// +// public static WireMockServer getMantisAPI() { +// return mantisAPI; +// } +// } + public MantisJobDiscoveryTest() { streamJobClusterMap.put(StreamType.DEFAULT_EVENT_STREAM, "RequestEventSubTrackerTestJobCluster"); streamJobClusterMap.put(StreamType.LOG_EVENT_STREAM, "LogEventSubTrackerTestJobCluster"); @@ -82,6 +97,7 @@ private MrePublishConfiguration testConfig() { @BeforeEach public void setup() { + mantisApi = new WireMockRule(options().dynamicPort()); mantisApi.start(); config = testConfig(); Registry registry = new DefaultRegistry(); @@ -94,8 +110,10 @@ public void teardown() { mantisApi.shutdown(); } +// @ExtendWith(WireMockExtension.class) @Test public void testJobDiscoveryFetch() throws IOException { +// WireMockServer mantisAPI = WireMockExtension.getMantisAPI(); String jobCluster = "MantisJobDiscoveryTestJobCluster"; String jobId = jobCluster + "-1"; @@ -122,7 +140,7 @@ public void testJobDiscoveryFetch() throws IOException { } @Test - @Ignore("another flaky test") + @Disabled("another flaky test") public void testJobDiscoveryFetchFailureHandlingAfterSuccess() throws IOException, InterruptedException { String jobCluster = "MantisJobDiscoveryTestJobCluster"; String jobId = jobCluster + "-1"; diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java index 77d3cda11..4fef2dab2 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java @@ -42,18 +42,17 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import org.apache.commons.io.IOUtils; -import org.junit.Rule; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class DefaultMantisApiClientTest { - @Rule - public WireMockRule mantisAPI = new WireMockRule(options().dynamicPort()); + WireMockRule mantisAPI; @BeforeEach public void setup() { + mantisAPI = new WireMockRule(options().dynamicPort()); mantisAPI.start(); } @@ -64,7 +63,7 @@ public void teardown() { @Test public void simpleTest() throws Exception { - mantisAPI.stubFor(get(urlMatching("/jobClusters/discoveryInfo/TestJob")) + mantisAPI.stubFor(get(urlMatching("/jobClusters/discoveryInfo/TestJob")) .willReturn(aResponse() .withStatus(200) .withBody(readStub("mantisapi/jobclusters_discoveryinfo_stub.json")))); diff --git a/mantis-remote-observable/build.gradle b/mantis-remote-observable/build.gradle index fd54815bd..b063b0a14 100644 --- a/mantis-remote-observable/build.gradle +++ b/mantis-remote-observable/build.gradle @@ -31,5 +31,5 @@ dependencies { } implementation libraries.slf4jApi implementation libraries.slf4jLog4j12 - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionSetTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionSetTest.java index 83d0f8af8..0923ae455 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionSetTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionSetTest.java @@ -20,8 +20,8 @@ import io.mantisrx.common.network.Endpoint; import java.util.LinkedList; import java.util.List; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -67,7 +67,7 @@ public void call(Subscriber subscriber) { int sum = MathObservable.sumInteger(Observable.merge(cm.observables())) .toBlocking() .last(); - Assert.assertEquals(5050, sum); + Assertions.assertEquals(5050, sum); } @@ -99,59 +99,60 @@ public void testMergeInWithDeltaEndpointService() { int sum = MathObservable.sumInteger(Observable.merge(cm.observables())) .toBlocking() .last(); - Assert.assertEquals(5050, sum); + Assertions.assertEquals(5050, sum); } - @Test(expected = RuntimeException.class) + @Test public void testMergeInBadObservable() throws InterruptedException { - - PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); - final int server1Port = portSelector.acquirePort(); - final int server2Port = portSelector.acquirePort(); - - Observable badObservable = Observable.create(new OnSubscribe() { - @Override - public void call(Subscriber subscriber) { - for (int i = 100; i < 200; i++) { - subscriber.onNext(i); - if (i == 150) { - subscriber.onError(new Exception("error")); + Assertions.assertThrows(RuntimeException.class, () -> { + PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); + final int server1Port = portSelector.acquirePort(); + final int server2Port = portSelector.acquirePort(); + + Observable badObservable = Observable.create(new OnSubscribe() { + @Override + public void call(Subscriber subscriber) { + for (int i = 100; i < 200; i++) { + subscriber.onNext(i); + if (i == 150) { + subscriber.onError(new Exception("error")); + } } } - } - }); - - // setup servers - RemoteRxServer server1 = RemoteObservable.serve(server1Port, Observable.range(1, 50), Codecs.integer()); - RemoteRxServer server2 = RemoteObservable.serve(server2Port, badObservable, Codecs.integer()); - - server1.start(); - server2.start(); - - EndpointInjector staticEndpoints = new EndpointInjector() { - @Override - public Observable deltas() { - return Observable.create(new OnSubscribe() { - @Override - public void call(Subscriber subscriber) { - subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server1Port, "1"))); - subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server2Port, "2"))); - subscriber.onCompleted(); - } - }); - } - }; + }); + + // setup servers + RemoteRxServer server1 = RemoteObservable.serve(server1Port, Observable.range(1, 50), Codecs.integer()); + RemoteRxServer server2 = RemoteObservable.serve(server2Port, badObservable, Codecs.integer()); + + server1.start(); + server2.start(); + + EndpointInjector staticEndpoints = new EndpointInjector() { + @Override + public Observable deltas() { + return Observable.create(new OnSubscribe() { + @Override + public void call(Subscriber subscriber) { + subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server1Port, "1"))); + subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server2Port, "2"))); + subscriber.onCompleted(); + } + }); + } + }; - DynamicConnectionSet cm + DynamicConnectionSet cm = DynamicConnectionSet.create(new ConnectToObservable.Builder() .decoder(Codecs.integer())); - cm.setEndpointInjector(staticEndpoints); + cm.setEndpointInjector(staticEndpoints); - int sum = MathObservable.sumInteger(Observable.merge(cm.observables())) + int sum = MathObservable.sumInteger(Observable.merge(cm.observables())) .toBlocking() .last(); - Assert.assertEquals(5050, sum); + Assertions.assertEquals(5050, sum); + }); } } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionTest.java index 46e70db3d..e92895a15 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/DynamicConnectionTest.java @@ -18,8 +18,8 @@ import io.mantisrx.common.codec.Codecs; import io.mantisrx.common.network.Endpoint; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -63,7 +63,7 @@ public void call(Subscriber subscriber) { .subscribe(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(20100, t1.intValue()); + Assertions.assertEquals(20100, t1.intValue()); } }); diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/FixedConnectionSetTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/FixedConnectionSetTest.java index 410053091..bcde8c3c6 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/FixedConnectionSetTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/FixedConnectionSetTest.java @@ -20,8 +20,8 @@ import io.mantisrx.common.network.Endpoint; import java.util.LinkedList; import java.util.List; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -67,7 +67,7 @@ public void call(Subscriber subscriber) { int sum = MathObservable.sumInteger(Observable.merge(cm.getObservables())) .toBlocking() .last(); - Assert.assertEquals(5050, sum); + Assertions.assertEquals(5050, sum); } @@ -98,60 +98,61 @@ public void testMergeInWithDeltaEndpointService() { int sum = MathObservable.sumInteger(Observable.merge(cm.getObservables())) .toBlocking() .last(); - Assert.assertEquals(5050, sum); + Assertions.assertEquals(5050, sum); } - @Test(expected = RuntimeException.class) + @Test public void testMergeInBadObservable() throws InterruptedException { - - PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); - final int server1Port = portSelector.acquirePort(); - final int server2Port = portSelector.acquirePort(); - - Observable badObservable = Observable.create(new OnSubscribe() { - @Override - public void call(Subscriber subscriber) { - for (int i = 100; i < 200; i++) { - subscriber.onNext(i); - if (i == 150) { - subscriber.onError(new Exception("error")); + Assertions.assertThrows(RuntimeException.class, () -> { + PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); + final int server1Port = portSelector.acquirePort(); + final int server2Port = portSelector.acquirePort(); + + Observable badObservable = Observable.create(new OnSubscribe() { + @Override + public void call(Subscriber subscriber) { + for (int i = 100; i < 200; i++) { + subscriber.onNext(i); + if (i == 150) { + subscriber.onError(new Exception("error")); + } } } - } - }); - - // setup servers - RemoteRxServer server1 = RemoteObservable.serve(server1Port, Observable.range(1, 50), Codecs.integer()); - RemoteRxServer server2 = RemoteObservable.serve(server2Port, badObservable, Codecs.integer()); - - server1.start(); - server2.start(); - - EndpointInjector staticEndpoints = new EndpointInjector() { - @Override - public Observable deltas() { - return Observable.create(new OnSubscribe() { - @Override - public void call(Subscriber subscriber) { - subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server1Port, "1"))); - subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server2Port, "2"))); - subscriber.onCompleted(); - } - }); - } - }; + }); + + // setup servers + RemoteRxServer server1 = RemoteObservable.serve(server1Port, Observable.range(1, 50), Codecs.integer()); + RemoteRxServer server2 = RemoteObservable.serve(server2Port, badObservable, Codecs.integer()); + + server1.start(); + server2.start(); + + EndpointInjector staticEndpoints = new EndpointInjector() { + @Override + public Observable deltas() { + return Observable.create(new OnSubscribe() { + @Override + public void call(Subscriber subscriber) { + subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server1Port, "1"))); + subscriber.onNext(new EndpointChange(EndpointChange.Type.add, new Endpoint("localhost", server2Port, "2"))); + subscriber.onCompleted(); + } + }); + } + }; - FixedConnectionSet cm + FixedConnectionSet cm = FixedConnectionSet.create(2, new ConnectToObservable.Builder() - .decoder(Codecs.integer()), + .decoder(Codecs.integer()), staticEndpoints); - int sum = MathObservable.sumInteger(Observable.merge(cm.getObservables())) + int sum = MathObservable.sumInteger(Observable.merge(cm.getObservables())) .toBlocking() .last(); - Assert.assertEquals(5050, sum); + Assertions.assertEquals(5050, sum); + }); } } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MergedObservableTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MergedObservableTest.java index a71464667..a6d4a865f 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MergedObservableTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MergedObservableTest.java @@ -17,8 +17,8 @@ package io.reactivex.mantis.remote.observable; import io.mantisrx.common.codec.Codecs; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -33,9 +33,9 @@ public class MergedObservableTest { public void testMergeCount() { MergeCounts counts = new MergeCounts(3); - Assert.assertEquals(false, counts.incrementTerminalCountAndCheck()); - Assert.assertEquals(false, counts.incrementTerminalCountAndCheck()); - Assert.assertEquals(true, counts.incrementTerminalCountAndCheck()); + Assertions.assertEquals(false, counts.incrementTerminalCountAndCheck()); + Assertions.assertEquals(false, counts.incrementTerminalCountAndCheck()); + Assertions.assertEquals(true, counts.incrementTerminalCountAndCheck()); } @@ -51,64 +51,65 @@ public void testFixedMerge() throws InterruptedException { .forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); + Assertions.assertEquals(5050, t1.intValue()); } }); } - @Test(expected = RuntimeException.class) + @Test public void testMergeInBadObservable() throws InterruptedException { - - MergedObservable merged = MergedObservable.createWithReplay(2); - merged.mergeIn("t1", Observable.range(1, 50)); - - Observable badObservable = Observable.create(new OnSubscribe() { - @Override - public void call(Subscriber subscriber) { - for (int i = 100; i < 200; i++) { - subscriber.onNext(i); - if (i == 150) { - subscriber.onError(new Exception("bad")); + Assertions.assertThrows(RuntimeException.class, () -> { + MergedObservable merged = MergedObservable.createWithReplay(2); + merged.mergeIn("t1", Observable.range(1, 50)); + + Observable badObservable = Observable.create(new OnSubscribe() { + @Override + public void call(Subscriber subscriber) { + for (int i = 100; i < 200; i++) { + subscriber.onNext(i); + if (i == 150) { + subscriber.onError(new Exception("bad")); + } } } - } - }); - merged.mergeIn("t2", badObservable); + }); + merged.mergeIn("t2", badObservable); - MathObservable.sumInteger(Observable.merge(merged.get())) + MathObservable.sumInteger(Observable.merge(merged.get())) .toBlocking() .forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); + Assertions.assertEquals(5050, t1.intValue()); } }); + }); } - @Test - public void testSingleRemoteObservableMerge() { - // setup - Observable os = Observable.range(0, 101); - // serve - PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); - int serverPort = portSelector.acquirePort(); - RemoteRxServer server = RemoteObservable.serve(serverPort, os, Codecs.integer()); - server.start(); - // connect - Observable ro = RemoteObservable.connect("localhost", serverPort, Codecs.integer()); - - MergedObservable merged = MergedObservable.createWithReplay(1); - merged.mergeIn("t1", ro); - - // assert - MathObservable.sumInteger(Observable.merge(merged.get())) + @Test + public void testSingleRemoteObservableMerge() { + // setup + Observable os = Observable.range(0, 101); + // serve + PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); + int serverPort = portSelector.acquirePort(); + RemoteRxServer server = RemoteObservable.serve(serverPort, os, Codecs.integer()); + server.start(); + // connect + Observable ro = RemoteObservable.connect("localhost", serverPort, Codecs.integer()); + + MergedObservable merged = MergedObservable.createWithReplay(1); + merged.mergeIn("t1", ro); + + // assert + MathObservable.sumInteger(Observable.merge(merged.get())) .toBlocking().forEach(new Action1() { - @Override - public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 - } - }); - } + @Override + public void call(Integer t1) { + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 + } + }); + } @Test public void testThreeRemoteObservablesMerge() { @@ -134,7 +135,7 @@ public void testThreeRemoteObservablesMerge() { .toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(15150, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(15150, t1.intValue()); // sum of number 0-100 } }); } @@ -169,7 +170,7 @@ public void testMergeFromMultipleSources() { .toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(20100, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(20100, t1.intValue()); // sum of number 0-100 } }); } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MetricsTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MetricsTest.java index 5fbc1ddad..5caac26f9 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MetricsTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/MetricsTest.java @@ -17,8 +17,8 @@ package io.reactivex.mantis.remote.observable; import io.mantisrx.common.codec.Codecs; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -49,13 +49,13 @@ public void testConnectionMetrics() { MathObservable.sumInteger(rc.getObservable()).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); - Assert.assertEquals(1000, rc.getMetrics().getOnNextCount()); - Assert.assertEquals(0, rc.getMetrics().getOnErrorCount()); - Assert.assertEquals(1, rc.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(1000, rc.getMetrics().getOnNextCount()); + Assertions.assertEquals(0, rc.getMetrics().getOnErrorCount()); + Assertions.assertEquals(1, rc.getMetrics().getOnCompletedCount()); } @Test @@ -79,13 +79,13 @@ public void testServerMetrics() { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); - Assert.assertEquals(1000, server.getMetrics().getOnNextCount()); - Assert.assertEquals(0, server.getMetrics().getOnErrorCount()); - Assert.assertEquals(1, server.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(1000, server.getMetrics().getOnNextCount()); + Assertions.assertEquals(0, server.getMetrics().getOnErrorCount()); + Assertions.assertEquals(1, server.getMetrics().getOnCompletedCount()); } @Test @@ -109,7 +109,7 @@ public void testMutlipleConnectionsSingleServerMetrics() throws InterruptedExcep MathObservable.sumInteger(ro1.getObservable()).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); @@ -118,26 +118,26 @@ public void call(Integer t1) { MathObservable.sumInteger(ro2.getObservable()).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); // client asserts - Assert.assertEquals(1000, ro1.getMetrics().getOnNextCount()); - Assert.assertEquals(0, ro1.getMetrics().getOnErrorCount()); - Assert.assertEquals(1, ro1.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(1000, ro1.getMetrics().getOnNextCount()); + Assertions.assertEquals(0, ro1.getMetrics().getOnErrorCount()); + Assertions.assertEquals(1, ro1.getMetrics().getOnCompletedCount()); - Assert.assertEquals(1000, ro2.getMetrics().getOnNextCount()); - Assert.assertEquals(0, ro2.getMetrics().getOnErrorCount()); - Assert.assertEquals(1, ro2.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(1000, ro2.getMetrics().getOnNextCount()); + Assertions.assertEquals(0, ro2.getMetrics().getOnErrorCount()); + Assertions.assertEquals(1, ro2.getMetrics().getOnCompletedCount()); // server asserts - Assert.assertEquals(2000, server.getMetrics().getOnNextCount()); - Assert.assertEquals(0, server.getMetrics().getOnErrorCount()); - Assert.assertEquals(2, server.getMetrics().getOnCompletedCount()); - Assert.assertEquals(2, server.getMetrics().getSubscribedCount()); + Assertions.assertEquals(2000, server.getMetrics().getOnNextCount()); + Assertions.assertEquals(0, server.getMetrics().getOnErrorCount()); + Assertions.assertEquals(2, server.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(2, server.getMetrics().getSubscribedCount()); Thread.sleep(1000); // allow time for unsub, connections to close - Assert.assertEquals(2, server.getMetrics().getUnsubscribedCount()); + Assertions.assertEquals(2, server.getMetrics().getUnsubscribedCount()); } @Test @@ -172,7 +172,7 @@ public void call(Subscriber subscriber) { MathObservable.sumInteger(ro1.getObservable()).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); } catch (Exception e) { @@ -184,7 +184,7 @@ public void call(Integer t1) { MathObservable.sumInteger(ro2.getObservable()).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); } catch (Exception e) { @@ -192,21 +192,21 @@ public void call(Integer t1) { } // client asserts - Assert.assertEquals(5, ro1.getMetrics().getOnNextCount()); - Assert.assertEquals(1, ro1.getMetrics().getOnErrorCount()); - Assert.assertEquals(0, ro1.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(5, ro1.getMetrics().getOnNextCount()); + Assertions.assertEquals(1, ro1.getMetrics().getOnErrorCount()); + Assertions.assertEquals(0, ro1.getMetrics().getOnCompletedCount()); - Assert.assertEquals(5, ro2.getMetrics().getOnNextCount()); - Assert.assertEquals(1, ro2.getMetrics().getOnErrorCount()); - Assert.assertEquals(0, ro2.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(5, ro2.getMetrics().getOnNextCount()); + Assertions.assertEquals(1, ro2.getMetrics().getOnErrorCount()); + Assertions.assertEquals(0, ro2.getMetrics().getOnCompletedCount()); // server asserts - Assert.assertEquals(10, server.getMetrics().getOnNextCount()); - Assert.assertEquals(2, server.getMetrics().getOnErrorCount()); - Assert.assertEquals(0, server.getMetrics().getOnCompletedCount()); - Assert.assertEquals(2, server.getMetrics().getSubscribedCount()); + Assertions.assertEquals(10, server.getMetrics().getOnNextCount()); + Assertions.assertEquals(2, server.getMetrics().getOnErrorCount()); + Assertions.assertEquals(0, server.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(2, server.getMetrics().getSubscribedCount()); Thread.sleep(1000); // allow time for unsub, connections to close - Assert.assertEquals(2, server.getMetrics().getUnsubscribedCount()); + Assertions.assertEquals(2, server.getMetrics().getUnsubscribedCount()); } @Test @@ -243,16 +243,16 @@ public void call(Subscriber subscriber) { MathObservable.sumInteger(rc.getObservable()).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(500500, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(500500, t1.intValue()); // sum of number 0-100 } }); } catch (Exception e) { // noOp } - Assert.assertEquals(5, rc.getMetrics().getOnNextCount()); - Assert.assertEquals(1, rc.getMetrics().getOnErrorCount()); - Assert.assertEquals(0, rc.getMetrics().getOnCompletedCount()); + Assertions.assertEquals(5, rc.getMetrics().getOnNextCount()); + Assertions.assertEquals(1, rc.getMetrics().getOnErrorCount()); + Assertions.assertEquals(0, rc.getMetrics().getOnCompletedCount()); } } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteGroupedObservableTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteGroupedObservableTest.java index 31762270e..7187201cf 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteGroupedObservableTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteGroupedObservableTest.java @@ -18,8 +18,8 @@ import io.mantisrx.common.codec.Codecs; import io.reactivex.mantis.remote.observable.slotting.ConsistentHashing; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.functions.Action1; import rx.functions.Func1; @@ -108,15 +108,15 @@ public Result call(Integer t1) { @Override public void call(Result result) { if (result.getKey().equals("odd")) { - Assert.assertEquals(25, result.getResults().intValue()); + Assertions.assertEquals(25, result.getResults().intValue()); intRef.setValue(intRef.getValue() + 1); } else { - Assert.assertEquals(30, result.getResults().intValue()); + Assertions.assertEquals(30, result.getResults().intValue()); intRef.setValue(intRef.getValue() + 1); } } }); - Assert.assertEquals(2, intRef.getValue().intValue()); + Assertions.assertEquals(2, intRef.getValue().intValue()); } } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteObservableTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteObservableTest.java index ef6236e83..586fa0790 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteObservableTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/RemoteObservableTest.java @@ -22,9 +22,9 @@ import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; -import org.junit.After; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Notification; import rx.Observable; import rx.Observable.OnSubscribe; @@ -41,7 +41,7 @@ public class RemoteObservableTest { - @After + @AfterEach public void waitForServerToShutdown() { try { Thread.sleep(200); @@ -66,7 +66,7 @@ public void testServeObservable() throws InterruptedException { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } @@ -96,7 +96,7 @@ public void testServeNestedObservable() throws InterruptedException { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(15150, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(15150, t1.intValue()); // sum of number 0-100 } }); } @@ -116,7 +116,7 @@ public void testServeManyObservable() throws InterruptedException { MathObservable.sumInteger(oc1).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); // connect @@ -125,7 +125,7 @@ public void call(Integer t1) { MathObservable.sumInteger(oc2).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); // connect @@ -134,7 +134,7 @@ public void call(Integer t1) { MathObservable.sumInteger(oc3).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } @@ -165,7 +165,7 @@ public void call(Subscriber subscriber) { MathObservable.sumInteger(oc1).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } catch (RuntimeException e) { @@ -176,7 +176,7 @@ public void call(Integer t1) { MathObservable.sumInteger(oc2).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } catch (RuntimeException e) { @@ -187,13 +187,13 @@ public void call(Integer t1) { MathObservable.sumInteger(oc3).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } catch (RuntimeException e) { errorCount++; } - Assert.assertEquals(3, errorCount); + Assertions.assertEquals(3, errorCount); } @@ -219,7 +219,7 @@ public byte[] call(Integer value) { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } @@ -245,30 +245,32 @@ public void testServeObservableByName() throws InterruptedException { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } - @Test(expected = RuntimeException.class) + @Test public void testFailedToConnect() throws InterruptedException { - // setup - Observable os = Observable.range(0, 101); - // serve - PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); - int serverPort = portSelector.acquirePort(); - int wrongPort = portSelector.acquirePort(); - - RemoteRxServer server = RemoteObservable.serve(serverPort, os, Codecs.integer()); - server.start(); - // connect - Observable oc = RemoteObservable.connect("localhost", wrongPort, Codecs.integer()); - // assert - MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { - @Override - public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 - } + Assertions.assertThrows(RuntimeException.class, () -> { + // setup + Observable os = Observable.range(0, 101); + // serve + PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); + int serverPort = portSelector.acquirePort(); + int wrongPort = portSelector.acquirePort(); + + RemoteRxServer server = RemoteObservable.serve(serverPort, os, Codecs.integer()); + server.start(); + // connect + Observable oc = RemoteObservable.connect("localhost", wrongPort, Codecs.integer()); + // assert + MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { + @Override + public void call(Integer t1) { + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 + } + }); }); } @@ -317,7 +319,7 @@ public void testServeTwoObservablesOnSamePort() throws InterruptedException { MathObservable.sumInteger(ro1).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); ro2.reduce(new Func2() { @@ -328,7 +330,7 @@ public String call(String t1, String t2) { }).toBlocking().forEach(new Action1() { @Override public void call(String t1) { - Assert.assertEquals("abcde", t1); + Assertions.assertEquals("abcde", t1); } }); } @@ -363,7 +365,7 @@ public void testServedMergedObservables() { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(20200, t1.intValue()); // sum of number 0-200 + Assertions.assertEquals(20200, t1.intValue()); // sum of number 0-200 } }); } @@ -400,7 +402,7 @@ public void testServedMergedObservablesAddAfterServe() { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(45150, t1.intValue()); // sum of number 0-200 + Assertions.assertEquals(45150, t1.intValue()); // sum of number 0-200 } }); } @@ -442,7 +444,7 @@ public void testServedMergedObservablesAddAfterConnect() { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(80200, t1.intValue()); // sum of number 0-200 + Assertions.assertEquals(80200, t1.intValue()); // sum of number 0-200 } }); } @@ -475,7 +477,7 @@ public void testRoundRobinSlottingServer() { MathObservable.sumInteger(merged).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); @@ -528,30 +530,32 @@ public Integer call(Integer t1) { MathObservable.sumInteger(oc2).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } - @Test(expected = RuntimeException.class) + @Test public void testError() { - PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); - Observable os = Observable.create(new OnSubscribe() { - @Override - public void call(Subscriber subscriber) { - subscriber.onNext(1); - subscriber.onError(new Exception("test-exception")); - } - }); - int serverPort = portSelector.acquirePort(); - RemoteObservable.serve(serverPort, os, Codecs.integer()) + Assertions.assertThrows(RuntimeException.class, () -> { + PortSelectorWithinRange portSelector = new PortSelectorWithinRange(8000, 9000); + Observable os = Observable.create(new OnSubscribe() { + @Override + public void call(Subscriber subscriber) { + subscriber.onNext(1); + subscriber.onError(new Exception("test-exception")); + } + }); + int serverPort = portSelector.acquirePort(); + RemoteObservable.serve(serverPort, os, Codecs.integer()) .start(); - Observable oc = RemoteObservable.connect("localhost", serverPort, Codecs.integer()); - MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { - @Override - public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 - } + Observable oc = RemoteObservable.connect("localhost", serverPort, Codecs.integer()); + MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { + @Override + public void call(Integer t1) { + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 + } + }); }); } @@ -586,12 +590,12 @@ public void call(Subscriber subscriber) { Observable oc = RemoteObservable.connect("localhost", serverPort, Codecs.integer()); Subscription sub = oc.subscribe(); - Assert.assertEquals(false, sub.isUnsubscribed()); + Assertions.assertEquals(false, sub.isUnsubscribed()); Thread.sleep(1000); // allow a few iterations sub.unsubscribe(); Thread.sleep(5000); // allow time for unsubscribe to propagate - Assert.assertEquals(true, sub.isUnsubscribed()); - Assert.assertEquals(true, sourceSubscriptionUnsubscribed.getValue()); + Assertions.assertEquals(true, sub.isUnsubscribed()); + Assertions.assertEquals(true, sourceSubscriptionUnsubscribed.getValue()); } @@ -633,7 +637,7 @@ public void call(Subscriber subscriber) { Subscription subscription = oc2.subscribe(); // check client subscription - Assert.assertEquals(false, subscription.isUnsubscribed()); + Assertions.assertEquals(false, subscription.isUnsubscribed()); Thread.sleep(4000); // allow a few iterations to complete @@ -641,9 +645,9 @@ public void call(Subscriber subscriber) { subscription.unsubscribe(); Thread.sleep(7000); // allow time for unsubscribe to propagate // check client - Assert.assertEquals(true, subscription.isUnsubscribed()); + Assertions.assertEquals(true, subscription.isUnsubscribed()); // check source - Assert.assertEquals(true, sourceSubscriptionUnsubscribed.getValue()); + Assertions.assertEquals(true, sourceSubscriptionUnsubscribed.getValue()); } @Test @@ -680,7 +684,7 @@ public void testSubscribeParametersByFilteringOnServer() { MathObservable.sumInteger(oc).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(2550, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(2550, t1.intValue()); // sum of number 0-100 } }); } @@ -715,7 +719,7 @@ public void call(Notification notification) { } } }); - Assert.assertEquals(true, completed.getValue()); + Assertions.assertEquals(true, completed.getValue()); } } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ServeNestedTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ServeNestedTest.java index 024b88307..bb64cb97d 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ServeNestedTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ServeNestedTest.java @@ -17,8 +17,8 @@ package io.reactivex.mantis.remote.observable; import io.mantisrx.common.codec.Codecs; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.functions.Action1; import rx.observables.MathObservable; @@ -57,7 +57,7 @@ public void testServeNested() { MathObservable.sumInteger(ro).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } @@ -112,7 +112,7 @@ public void testServeNestedChained() { MathObservable.sumInteger(ro2).toBlocking().forEach(new Action1() { @Override public void call(Integer t1) { - Assert.assertEquals(5050, t1.intValue()); // sum of number 0-100 + Assertions.assertEquals(5050, t1.intValue()); // sum of number 0-100 } }); } diff --git a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ToDeltaEndpointInjectorTest.java b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ToDeltaEndpointInjectorTest.java index b03759869..764f8b61d 100644 --- a/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ToDeltaEndpointInjectorTest.java +++ b/mantis-remote-observable/src/test/java/io/reactivex/mantis/remote/observable/ToDeltaEndpointInjectorTest.java @@ -20,8 +20,8 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.observables.BlockingObservable; import rx.subjects.ReplaySubject; @@ -57,31 +57,31 @@ public void deltaTest() { // check for two adds Iterator iter = be.getIterator(); - Assert.assertTrue(iter.hasNext()); + Assertions.assertTrue(iter.hasNext()); EndpointChange ce1 = iter.next(); - Assert.assertEquals(ce1.getEndpoint().getSlotId(), "localhost:1234"); - Assert.assertEquals(ce1.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce1.getEndpoint().getSlotId(), "localhost:1234"); + Assertions.assertEquals(ce1.getType(), EndpointChange.Type.add); EndpointChange ce2 = iter.next(); - Assert.assertEquals(ce2.getEndpoint().getSlotId(), "localhost:2468"); - Assert.assertEquals(ce2.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce2.getEndpoint().getSlotId(), "localhost:2468"); + Assertions.assertEquals(ce2.getType(), EndpointChange.Type.add); // check for complete EndpointChange ce3 = iter.next(); - Assert.assertEquals(ce3.getEndpoint().getSlotId(), "localhost:2468"); - Assert.assertEquals(ce3.getType(), EndpointChange.Type.complete); + Assertions.assertEquals(ce3.getEndpoint().getSlotId(), "localhost:2468"); + Assertions.assertEquals(ce3.getType(), EndpointChange.Type.complete); // check for complete EndpointChange ce4 = iter.next(); - Assert.assertEquals(ce4.getEndpoint().getSlotId(), "localhost:1234"); - Assert.assertEquals(ce4.getType(), EndpointChange.Type.complete); + Assertions.assertEquals(ce4.getEndpoint().getSlotId(), "localhost:1234"); + Assertions.assertEquals(ce4.getType(), EndpointChange.Type.complete); // check for add EndpointChange ce5 = iter.next(); - Assert.assertEquals(ce5.getEndpoint().getSlotId(), "localhost:1234"); - Assert.assertEquals(ce5.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce5.getEndpoint().getSlotId(), "localhost:1234"); + Assertions.assertEquals(ce5.getType(), EndpointChange.Type.add); EndpointChange ce6 = iter.next(); - Assert.assertEquals(ce6.getEndpoint().getSlotId(), "localhost:2468"); - Assert.assertEquals(ce6.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce6.getEndpoint().getSlotId(), "localhost:2468"); + Assertions.assertEquals(ce6.getType(), EndpointChange.Type.add); } @Test @@ -117,33 +117,33 @@ public void deltaTestWithIds() { BlockingObservable be = service.deltas().toBlocking(); Iterator iter = be.getIterator(); - Assert.assertTrue(iter.hasNext()); + Assertions.assertTrue(iter.hasNext()); EndpointChange ce2 = iter.next(); - Assert.assertEquals(ce2.getEndpoint().getSlotId(), "xyz"); - Assert.assertEquals(ce2.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce2.getEndpoint().getSlotId(), "xyz"); + Assertions.assertEquals(ce2.getType(), EndpointChange.Type.add); EndpointChange ce1 = iter.next(); - Assert.assertEquals(ce1.getEndpoint().getSlotId(), "abc"); - Assert.assertEquals(ce1.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce1.getEndpoint().getSlotId(), "abc"); + Assertions.assertEquals(ce1.getType(), EndpointChange.Type.add); EndpointChange ce3 = iter.next(); - Assert.assertEquals(ce3.getEndpoint().getSlotId(), "xyz"); - Assert.assertEquals(ce3.getType(), EndpointChange.Type.complete); + Assertions.assertEquals(ce3.getEndpoint().getSlotId(), "xyz"); + Assertions.assertEquals(ce3.getType(), EndpointChange.Type.complete); EndpointChange ce4 = iter.next(); - Assert.assertEquals(ce4.getEndpoint().getSlotId(), "abc"); - Assert.assertEquals(ce4.getType(), EndpointChange.Type.complete); + Assertions.assertEquals(ce4.getEndpoint().getSlotId(), "abc"); + Assertions.assertEquals(ce4.getType(), EndpointChange.Type.complete); EndpointChange ce6 = iter.next(); - Assert.assertEquals(ce6.getEndpoint().getSlotId(), "xyz"); - Assert.assertEquals(ce6.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce6.getEndpoint().getSlotId(), "xyz"); + Assertions.assertEquals(ce6.getType(), EndpointChange.Type.add); EndpointChange ce5 = iter.next(); - Assert.assertEquals(ce5.getEndpoint().getSlotId(), "abc"); - Assert.assertEquals(ce5.getType(), EndpointChange.Type.add); + Assertions.assertEquals(ce5.getEndpoint().getSlotId(), "abc"); + Assertions.assertEquals(ce5.getType(), EndpointChange.Type.add); } } diff --git a/mantis-runtime-loader/build.gradle b/mantis-runtime-loader/build.gradle index 88c7ad32c..219b2922d 100644 --- a/mantis-runtime-loader/build.gradle +++ b/mantis-runtime-loader/build.gradle @@ -17,7 +17,7 @@ dependencies { api project(":mantis-control-plane:mantis-control-plane-client") - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoAll testImplementation(testFixtures(project(":mantis-common"))) diff --git a/mantis-runtime-loader/src/test/java/io/mantisrx/runtime/loader/SubscriptionStateHandlerImplTest.java b/mantis-runtime-loader/src/test/java/io/mantisrx/runtime/loader/SubscriptionStateHandlerImplTest.java index b3a3917b0..59b8bde78 100644 --- a/mantis-runtime-loader/src/test/java/io/mantisrx/runtime/loader/SubscriptionStateHandlerImplTest.java +++ b/mantis-runtime-loader/src/test/java/io/mantisrx/runtime/loader/SubscriptionStateHandlerImplTest.java @@ -16,9 +16,9 @@ package io.mantisrx.runtime.loader; -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 io.mantisrx.common.util.DelegateClock; import io.mantisrx.runtime.loader.SubscriptionStateHandlerImpl.SubscriptionState; @@ -27,7 +27,7 @@ import java.time.Instant; import java.time.ZoneId; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SubscriptionStateHandlerImplTest { @Test diff --git a/mantis-runtime/build.gradle b/mantis-runtime/build.gradle index f66ff3066..a05223c62 100644 --- a/mantis-runtime/build.gradle +++ b/mantis-runtime/build.gradle @@ -27,7 +27,7 @@ dependencies { compileOnly libraries.jsr305 compileOnly libraries.spectatorApi testImplementation libraries.spectatorApi - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoCore } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/core/MantisStreamImplTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/core/MantisStreamImplTest.java index 512abc007..7fcce19a9 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/core/MantisStreamImplTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/core/MantisStreamImplTest.java @@ -16,14 +16,15 @@ package io.mantisrx.runtime.core; +import static org.junit.jupiter.api.Assertions.assertEquals; + import io.mantisrx.shaded.com.google.common.collect.ImmutableList; import io.mantisrx.shaded.com.google.common.graph.ImmutableValueGraph; import io.mantisrx.shaded.com.google.common.graph.ValueGraphBuilder; import java.util.Set; -import junit.framework.TestCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class MantisStreamImplTest extends TestCase { +public class MantisStreamImplTest { @Test public void testGraphApi() { diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/core/functions/FunctionCombinatorTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/core/functions/FunctionCombinatorTest.java index a65ac8926..9c299e279 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/core/functions/FunctionCombinatorTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/core/functions/FunctionCombinatorTest.java @@ -16,7 +16,7 @@ package io.mantisrx.runtime.core.functions; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.MantisGroup; import io.mantisrx.runtime.Context; @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; public class FunctionCombinatorTest { diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/LocalJobExecutorNetworkedTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/LocalJobExecutorNetworkedTest.java index f691331f0..1f11e86d6 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/LocalJobExecutorNetworkedTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/LocalJobExecutorNetworkedTest.java @@ -19,8 +19,8 @@ import io.mantisrx.runtime.MachineDefinitions; import io.mantisrx.runtime.descriptor.SchedulingInfo; import java.util.Iterator; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class LocalJobExecutorNetworkedTest { @@ -38,7 +38,7 @@ public void testSingleStage() { iter.next(); count++; } - Assert.assertEquals(10, count); + Assertions.assertEquals(10, count); } @Test @@ -58,7 +58,7 @@ public void testSingleStageMultiWorker() { iter.next(); count++; } - Assert.assertEquals(20, count); + Assertions.assertEquals(20, count); } @@ -68,9 +68,9 @@ public void testTwoStage() { LocalJobExecutorNetworked.execute(provider.getJobInstance()); Iterator iter = provider.getItemsWritten().iterator(); - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(4, iter.next().intValue()); - Assert.assertEquals(16, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(4, iter.next().intValue()); + Assertions.assertEquals(16, iter.next().intValue()); } @Test @@ -85,9 +85,9 @@ public void testThreeStage() { LocalJobExecutorNetworked.execute(provider.getJobInstance(), scheduling); Iterator iter = provider.getItemsWritten().iterator(); - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(16, iter.next().intValue()); - Assert.assertEquals(256, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(16, iter.next().intValue()); + Assertions.assertEquals(256, iter.next().intValue()); } @Test @@ -102,9 +102,9 @@ public void testThreeStageTopology1_2_1() { LocalJobExecutorNetworked.execute(provider.getJobInstance(), scheduling); Iterator iter = provider.getItemsWritten().iterator(); - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(16, iter.next().intValue()); - Assert.assertEquals(256, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(16, iter.next().intValue()); + Assertions.assertEquals(256, iter.next().intValue()); } @Test @@ -120,7 +120,7 @@ public void testThreeStageTopology2_1_1() { // with two source instances, should have double the expected // input - Assert.assertEquals(10, provider.getItemsWritten().size()); + Assertions.assertEquals(10, provider.getItemsWritten().size()); } @Test @@ -137,6 +137,6 @@ public void testThreeStageTopology2_2_1() { // with two source instances, should have double the expected // input - Assert.assertEquals(10, provider.getItemsWritten().size()); + Assertions.assertEquals(10, provider.getItemsWritten().size()); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/ParameterDefinitionTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/ParameterDefinitionTest.java index d00f24dc4..db563cd99 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/ParameterDefinitionTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/ParameterDefinitionTest.java @@ -26,8 +26,8 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ParameterDefinitionTest { @@ -41,18 +41,19 @@ public void emptyCheck() { ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); } - @Test(expected = IllegalArgumentException.class) + @Test public void missingRequiredParameter() { - - Map> parameterDefinitions = new HashMap<>(); - parameterDefinitions.put("foo", new StringParameter() + Assertions.assertThrows(IllegalArgumentException.class, () -> { + Map> parameterDefinitions = new HashMap<>(); + parameterDefinitions.put("foo", new StringParameter() .name("foo") .required() .validator(Validators.alwaysPass()) .build()); - Map parameters = new HashMap<>(); - ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); + Map parameters = new HashMap<>(); + ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); + }); } @Test @@ -69,9 +70,9 @@ public void singleRequiredParameterCheck() { Map parameters = new HashMap<>(); parameters.put("foo", new Parameter("foo", "test")); parameterState = ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); - Assert.assertEquals(1, parameterState.size()); - Assert.assertEquals(true, parameterState.containsKey("foo")); - Assert.assertEquals("test", parameterState.get("foo")); + Assertions.assertEquals(1, parameterState.size()); + Assertions.assertEquals(true, parameterState.containsKey("foo")); + Assertions.assertEquals("test", parameterState.get("foo")); } @Test @@ -92,9 +93,9 @@ public void singleRequiredSingleNonRequiredParameterCheck() { Map parameters = new HashMap<>(); parameters.put("required", new Parameter("required", "test")); parameterState = ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); - Assert.assertEquals(1, parameterState.size()); - Assert.assertEquals(true, parameterState.containsKey("required")); - Assert.assertEquals("test", parameterState.get("required")); + Assertions.assertEquals(1, parameterState.size()); + Assertions.assertEquals(true, parameterState.containsKey("required")); + Assertions.assertEquals("test", parameterState.get("required")); } @Test @@ -109,7 +110,7 @@ public void testEnumParameter() { Map parameters = new HashMap<>(); parameters.put("foo", new Parameter("foo", "A")); Map parameterState = ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); - Assert.assertEquals(TestEnum.A, parameterState.get("foo")); + Assertions.assertEquals(TestEnum.A, parameterState.get("foo")); } ; @@ -127,23 +128,25 @@ public void testEnumCSVParameter() { parameters.put("foo", new Parameter("foo", " A , C ")); Map parameterState = ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); EnumSet foo = (EnumSet) parameterState.get("foo"); - Assert.assertTrue(foo.contains(TestEnum.A)); - Assert.assertTrue(foo.contains(TestEnum.C)); - Assert.assertFalse(foo.contains(TestEnum.B)); + Assertions.assertTrue(foo.contains(TestEnum.A)); + Assertions.assertTrue(foo.contains(TestEnum.C)); + Assertions.assertFalse(foo.contains(TestEnum.B)); } - @Test(expected = IllegalArgumentException.class) + @Test public void emptyEnumCSVListValidation() { - Map> parameterDefinitions = new HashMap<>(); - parameterDefinitions.put("foo", new EnumCSVParameter<>(TestEnum.class) + Assertions.assertThrows(IllegalArgumentException.class, () -> { + Map> parameterDefinitions = new HashMap<>(); + parameterDefinitions.put("foo", new EnumCSVParameter<>(TestEnum.class) .name("foo") .required() .validator(Validators.notNullOrEmptyEnumCSV()) .build()); - Map parameters = new HashMap<>(); - parameters.put("foo", new Parameter("foo", " ")); - ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); + Map parameters = new HashMap<>(); + parameters.put("foo", new Parameter("foo", " ")); + ParameterUtils.checkThenCreateState(parameterDefinitions, parameters); + }); } enum TestEnum {A, B, C} diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsGroupByTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsGroupByTest.java index f6d8c1073..3cd938e19 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsGroupByTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsGroupByTest.java @@ -30,8 +30,8 @@ import io.reactivex.mantis.remote.observable.ServeGroupedObservable; import java.util.Iterator; import java.util.List; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -75,25 +75,25 @@ public void testExecuteSource() { .toBlocking() .getIterator(); - Assert.assertTrue(iter.hasNext()); + Assertions.assertTrue(iter.hasNext()); // verify numbers are grouped by even/odd GroupedObservable even = iter.next(); // even is first due to zero - Assert.assertEquals("even", even.getKey()); + Assertions.assertEquals("even", even.getKey()); Iterator evenIter = even.toBlocking().getIterator(); - Assert.assertEquals(0, evenIter.next().intValue()); - Assert.assertEquals(2, evenIter.next().intValue()); - Assert.assertEquals(4, evenIter.next().intValue()); - Assert.assertEquals(6, evenIter.next().intValue()); + Assertions.assertEquals(0, evenIter.next().intValue()); + Assertions.assertEquals(2, evenIter.next().intValue()); + Assertions.assertEquals(4, evenIter.next().intValue()); + Assertions.assertEquals(6, evenIter.next().intValue()); GroupedObservable odd = iter.next(); - Assert.assertEquals("odd", odd.getKey()); + Assertions.assertEquals("odd", odd.getKey()); Iterator oddIter = odd.toBlocking().getIterator(); - Assert.assertEquals(1, oddIter.next().intValue()); - Assert.assertEquals(3, oddIter.next().intValue()); - Assert.assertEquals(5, oddIter.next().intValue()); - Assert.assertEquals(7, oddIter.next().intValue()); + Assertions.assertEquals(1, oddIter.next().intValue()); + Assertions.assertEquals(3, oddIter.next().intValue()); + Assertions.assertEquals(5, oddIter.next().intValue()); + Assertions.assertEquals(7, oddIter.next().intValue()); - Assert.assertEquals(false, iter.hasNext()); // should only have two groups + Assertions.assertEquals(false, iter.hasNext()); // should only have two groups } @SuppressWarnings( {"rawtypes", "unchecked"}) @@ -173,21 +173,21 @@ public void call(Subscriber subscriber) { // verify numbers are grouped by even/odd GroupedObservable even = iter.next(); // even is first due to zero - Assert.assertEquals("even", even.getKey()); + Assertions.assertEquals("even", even.getKey()); Iterator evenIter = even.toBlocking().getIterator(); - Assert.assertEquals(0, evenIter.next().intValue()); - Assert.assertEquals(4, evenIter.next().intValue()); - Assert.assertEquals(16, evenIter.next().intValue()); - Assert.assertEquals(36, evenIter.next().intValue()); + Assertions.assertEquals(0, evenIter.next().intValue()); + Assertions.assertEquals(4, evenIter.next().intValue()); + Assertions.assertEquals(16, evenIter.next().intValue()); + Assertions.assertEquals(36, evenIter.next().intValue()); GroupedObservable odd = iter.next(); - Assert.assertEquals("odd", odd.getKey()); + Assertions.assertEquals("odd", odd.getKey()); Iterator oddIter = odd.toBlocking().getIterator(); - Assert.assertEquals(1, oddIter.next().intValue()); - Assert.assertEquals(9, oddIter.next().intValue()); - Assert.assertEquals(25, oddIter.next().intValue()); - Assert.assertEquals(49, oddIter.next().intValue()); + Assertions.assertEquals(1, oddIter.next().intValue()); + Assertions.assertEquals(9, oddIter.next().intValue()); + Assertions.assertEquals(25, oddIter.next().intValue()); + Assertions.assertEquals(49, oddIter.next().intValue()); - Assert.assertEquals(false, iter.hasNext()); // should only have two groups + Assertions.assertEquals(false, iter.hasNext()); // should only have two groups } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsSingleStageTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsSingleStageTest.java index fc10ea13e..cb809c115 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsSingleStageTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsSingleStageTest.java @@ -21,8 +21,8 @@ import io.mantisrx.runtime.StageConfig; import io.reactivex.mantis.remote.observable.RxMetrics; import java.util.Iterator; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.functions.Action0; import rx.functions.Action1; import rx.subjects.BehaviorSubject; @@ -53,10 +53,10 @@ public void call(Throwable t) {} noOpAction, 0, workersInStageOneObservable, null, null, noOpAction, noOpError); Iterator iter = provider.getItemsWritten().iterator(); - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(1, iter.next().intValue()); - Assert.assertEquals(4, iter.next().intValue()); - Assert.assertEquals(9, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(1, iter.next().intValue()); + Assertions.assertEquals(4, iter.next().intValue()); + Assertions.assertEquals(9, iter.next().intValue()); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsTest.java index f5997d512..67c81626e 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/executor/StageExecutorsTest.java @@ -30,8 +30,8 @@ import io.reactivex.mantis.remote.observable.RxMetrics; import java.util.Iterator; import java.util.List; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Subscriber; @@ -71,10 +71,10 @@ public void testExecuteSource() { .getIterator(); // verify numbers are doubled - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(1, iter.next().intValue()); - Assert.assertEquals(4, iter.next().intValue()); - Assert.assertEquals(9, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(1, iter.next().intValue()); + Assertions.assertEquals(4, iter.next().intValue()); + Assertions.assertEquals(9, iter.next().intValue()); } @SuppressWarnings( {"rawtypes", "unchecked"}) @@ -125,9 +125,9 @@ public void call(Subscriber subscriber) { .getIterator(); // verify numbers are even - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(2, iter.next().intValue()); - Assert.assertEquals(4, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(2, iter.next().intValue()); + Assertions.assertEquals(4, iter.next().intValue()); } @SuppressWarnings( {"rawtypes", "unchecked"}) @@ -178,9 +178,9 @@ public void call(Throwable t) {} Iterator iter = provider.getItemsWritten().iterator(); // verify numbers are even - Assert.assertEquals(0, iter.next().intValue()); - Assert.assertEquals(2, iter.next().intValue()); - Assert.assertEquals(4, iter.next().intValue()); + Assertions.assertEquals(0, iter.next().intValue()); + Assertions.assertEquals(2, iter.next().intValue()); + Assertions.assertEquals(4, iter.next().intValue()); } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/ParametersTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/ParametersTest.java index badb51cf7..cbde55f26 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/ParametersTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/ParametersTest.java @@ -16,21 +16,21 @@ package io.mantisrx.runtime.parameter; -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.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ParametersTest { private Parameters parameters; - @Before + @BeforeEach public void setup() { final Set requiredParameters = new HashSet<>(); final Set parameterDefinitions = new HashSet<>(); diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SinkParameterTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SinkParameterTest.java index a4f88ca38..8e2a87b68 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SinkParameterTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SinkParameterTest.java @@ -16,9 +16,9 @@ package io.mantisrx.runtime.parameter; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SinkParameterTest { diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SourceJobParametersTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SourceJobParametersTest.java index 5153c64df..e50b084b6 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SourceJobParametersTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/parameter/SourceJobParametersTest.java @@ -16,13 +16,13 @@ package io.mantisrx.runtime.parameter; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.shaded.com.google.common.collect.ImmutableList; import io.mantisrx.shaded.com.google.common.collect.Lists; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SourceJobParametersTest { @Test diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/scheduler/MantisRxSingleThreadSchedulerTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/scheduler/MantisRxSingleThreadSchedulerTest.java index f86f55f85..489ba3641 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/scheduler/MantisRxSingleThreadSchedulerTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/scheduler/MantisRxSingleThreadSchedulerTest.java @@ -15,13 +15,13 @@ */ package io.mantisrx.runtime.scheduler; -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 io.mantisrx.common.metrics.rx.MonitorOperator; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observable; diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ClientResumePoliciesTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ClientResumePoliciesTest.java index b4a1e6510..37925e435 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ClientResumePoliciesTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ClientResumePoliciesTest.java @@ -16,11 +16,11 @@ package io.mantisrx.runtime.source.http; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -34,8 +34,8 @@ import mantis.io.reactivex.netty.protocol.http.client.HttpClient; import mantis.io.reactivex.netty.protocol.http.client.HttpClientRequest; import mantis.io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observer; import rx.Subscriber; @@ -52,7 +52,7 @@ public class ClientResumePoliciesTest { private HttpClientRequest request; @SuppressWarnings("unchecked") - @Before + @BeforeEach public void setup() { observer = new TestSourceObserver(); client = mock(HttpClient.class); @@ -80,8 +80,8 @@ public void testMaxRepeatOnCompletionAndError() throws Exception { assertNotNull(resumedOnError); assertEquals(RESPONSE_CONTENT, resumedOnError.toBlocking().first().getContent().toBlocking().first()); } else { - assertNull("The resumed on completion should be null as max repeat is passed", resumedOnCompleted); - assertNull("The resumed on error should be null as max repeat is passed", resumedOnError); + assertNull(resumedOnCompleted,"The resumed on completion should be null as max repeat is passed"); + assertNull(resumedOnError, "The resumed on error should be null as max repeat is passed"); } } @@ -116,8 +116,8 @@ public Long call() { assertNotNull(resumedOnCompleted); assertNotNull(resumedOnError); } else { - assertNull("The resumed on completion should be null as max repeat is passed", resumedOnCompleted); - assertNull("The resumed on error should be null as max repeat is passed", resumedOnError); + assertNull(resumedOnCompleted, "The resumed on completion should be null as max repeat is passed"); + assertNull(resumedOnError, "The resumed on error should be null as max repeat is passed"); } resumedOnCompleted.subscribe(new Subscriber>() { @@ -146,7 +146,7 @@ public void onNext(HttpClientResponse stringHttpClientResponse) { long elapsed = end.get(); long maxDelay = delay + delay / 2; - assertTrue(String.format("The delay should be more than %d milliseconds, but no more than %d milliseconds. The actual: %d", repeat * delay, repeat * maxDelay, elapsed), elapsed >= repeat * delay && elapsed <= repeat * maxDelay); + assertTrue(elapsed >= repeat * delay && elapsed <= repeat * maxDelay, String.format("The delay should be more than %d milliseconds, but no more than %d milliseconds. The actual: %d", repeat * delay, repeat * maxDelay, elapsed)); } @Test @@ -196,7 +196,7 @@ public void onNext(HttpClientResponse stringHttpClientResponse) { long elapsed = end.get(); long maxDelay = delay + delay / 2; - assertTrue(String.format("The delay should be more than %d milliseconds, but no more than %d milliseconds. The actual: %d", repeat * delay, repeat * maxDelay, elapsed), elapsed >= repeat * delay && elapsed <= repeat * maxDelay); + assertTrue(elapsed >= repeat * delay && elapsed <= repeat * maxDelay, String.format("The delay should be more than %d milliseconds, but no more than %d milliseconds. The actual: %d", repeat * delay, repeat * maxDelay, elapsed)); } @Test @@ -246,6 +246,6 @@ public void onNext(HttpClientResponse stringHttpClientResponse) { long elapsed = end.get(); long maxDelay = delay + delay / 2; - assertTrue(String.format("The delay should be more than %d millionseconds, but no more than %d millionseconds. The actual: %d", repeat * delay, repeat * maxDelay, elapsed), elapsed >= repeat * delay && elapsed <= repeat * maxDelay); + assertTrue(elapsed >= repeat * delay && elapsed <= repeat * maxDelay, String.format("The delay should be more than %d millionseconds, but no more than %d millionseconds. The actual: %d", repeat * delay, repeat * maxDelay, elapsed)); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java index a6a1b7dbc..e4bf30cd0 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java @@ -23,9 +23,9 @@ import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.SOURCE_COMPLETED; import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.SUBSCRIPTION_ENDED; import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.SUBSCRIPTION_ESTABLISHED; -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 io.mantisrx.runtime.Context; import io.mantisrx.runtime.source.Index; @@ -44,11 +44,11 @@ import java.util.concurrent.atomic.AtomicInteger; import mantis.io.reactivex.netty.client.RxClient.ServerInfo; import mantis.io.reactivex.netty.protocol.http.sse.ServerSentEvent; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.functions.Action0; import rx.functions.Action1; @@ -64,7 +64,7 @@ public class ContextualHttpSourceTest { private TestSourceObserver sourceObserver = new TestSourceObserver(); // Just make sure the unused port is out side the range of possible ports: [SEED_PORT, SEED_PORT + PORT_RANGE) - @BeforeClass + @BeforeAll public static void init() { int portStart = new Random().nextInt(PORT_RANGE) + SEED_PORT; @@ -72,12 +72,12 @@ public static void init() { localServerProvider.start(3, portStart); } - @AfterClass + @AfterAll public static void shutdown() throws Exception { localServerProvider.shutDown(); } - @Before + @BeforeEach public void setup() { sourceObserver = new TestSourceObserver(); } @@ -137,27 +137,27 @@ public void call() { fail(String.format("Waited at least %d seconds for the test to finish. Something is wrong", waitSeconds)); } - assertEquals("There should be as many as provided servers", localServerProvider.serverSize(), connectedServers.size()); - Assert.assertEquals(String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize()), counter.get(), RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize()); + assertEquals(localServerProvider.serverSize(), connectedServers.size(), "There should be as many as provided servers"); + Assertions.assertEquals(counter.get(), RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize(), String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize())); for (String data : RequestProcessor.smallStreamContent) { - assertEquals(String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize()), localServerProvider.serverSize(), result.get(data).get()); + assertEquals(localServerProvider.serverSize(), result.get(data).get(), String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize())); } for (ServerInfo server : localServerProvider.getServerInfos()) { - assertEquals("There should be one completion per server", 1, sourceObserver.getCount(server, EventType.SOURCE_COMPLETED)); - assertEquals("There should be one un-subscription per server", 1, sourceObserver.getCount(server, EventType.CONNECTION_UNSUBSCRIBED)); - assertEquals("There should be no error", 0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be one connection per server", 1, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED)); + assertEquals(1, sourceObserver.getCount(server, EventType.SOURCE_COMPLETED), "There should be one completion per server"); + assertEquals(1, sourceObserver.getCount(server, EventType.CONNECTION_UNSUBSCRIBED), "There should be one un-subscription per server"); + assertEquals(0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(1, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED), "There should be one connection per server"); } - assertEquals("There should be one completions", 1, sourceObserver.getCompletionCount()); + assertEquals(1, sourceObserver.getCompletionCount()); assertEquals(0, sourceObserver.getErrorCount()); Set events = sourceObserver.getEvents(); assertEquals(EXPECTED_EVENTS_SETS, events); for (EventType event : events) { - assertEquals("Each event should be recorded exactly once per server", localServerProvider.serverSize(), sourceObserver.getEventCount(event)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(event), "Each event should be recorded exactly once per server"); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java index 7661d4025..1b055f9db 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java @@ -17,7 +17,7 @@ package io.mantisrx.runtime.source.http; import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.*; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import io.mantisrx.common.codec.Codecs; import io.mantisrx.runtime.*; @@ -46,7 +46,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; -import org.junit.*; +import org.junit.jupiter.api.*; import rx.Observable; import rx.Subscription; import rx.functions.Action0; @@ -72,7 +72,7 @@ public class HttpSourceTest { private TestSourceObserver sourceObserver = new TestSourceObserver(); - @BeforeClass + @BeforeAll public static void init() { int portStart = new Random().nextInt(PORT_RANGE) + SEED_PORT; @@ -80,12 +80,12 @@ public static void init() { localServerProvider.start(3, portStart); } - @AfterClass + @AfterAll public static void shutdown() throws Exception { localServerProvider.shutDown(); } - @Before + @BeforeEach public void setup() { sourceObserver = new TestSourceObserver(); } @@ -139,24 +139,21 @@ public void call() { fail(String.format("Waited at least %d seconds for the test to finish. Something is wrong", waitSeconds)); } - Assert.assertEquals( - String.format("%d servers => the result has %d times of a single echo", - localServerProvider.serverSize(), - localServerProvider.serverSize()), + Assertions.assertEquals(localServerProvider.serverSize(), + counter.get(), String.format("%d servers => the result has %d times of a single echo", localServerProvider.serverSize(), - counter.get()); + localServerProvider.serverSize())); - assertEquals(String.format("%d servers => %d identical copies per message", + assertEquals(localServerProvider.serverSize(), + result.get(postContent).get(), String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), - localServerProvider.serverSize()), - localServerProvider.serverSize(), - result.get(postContent).get()); + localServerProvider.serverSize())); for (ServerInfo server : localServerProvider.getServerInfos()) { - assertEquals("There should be one completion per server", 1, sourceObserver.getCount(server, EventType.SOURCE_COMPLETED)); - assertEquals("There should be one un-subscription per server", 1, sourceObserver.getCount(server, EventType.CONNECTION_UNSUBSCRIBED)); - assertEquals("There should be no error", 0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be one connection per server", 1, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED)); + assertEquals(1, sourceObserver.getCount(server, EventType.SOURCE_COMPLETED), "There should be one completion per server"); + assertEquals(1, sourceObserver.getCount(server, EventType.CONNECTION_UNSUBSCRIBED), "There should be one un-subscription per server"); + assertEquals(0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(1, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED), "There should be one connection per server"); } assertEquals(1, sourceObserver.getCompletionCount()); @@ -166,7 +163,7 @@ public void call() { assertEquals(EXPECTED_EVENTS_SETS, events); for (EventType event : events) { - assertEquals("Each event should be recorded exactly once per server", localServerProvider.serverSize(), sourceObserver.getEventCount(event)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(event), "Each event should be recorded exactly once per server"); } } @@ -206,22 +203,21 @@ public void call() { fail(String.format("Waited at least %d seconds for the test to finish. Something is wrong", waitSeconds)); } - Assert.assertEquals( - String.format("%d servers => the result has %d times of a single stream", - localServerProvider.serverSize(), - localServerProvider.serverSize()), - counter.get(), - RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize()); + Assertions.assertEquals(counter.get(), + RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize(), + String.format("%d servers => the result has %d times of a single stream", + localServerProvider.serverSize(), + localServerProvider.serverSize())); for (String data : RequestProcessor.smallStreamContent) { - assertEquals(String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize()), localServerProvider.serverSize(), result.get(data).get()); + assertEquals(localServerProvider.serverSize(), result.get(data).get(), String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize())); } for (ServerInfo server : localServerProvider.getServerInfos()) { - assertEquals("There should be one completion per server", 1, sourceObserver.getCount(server, EventType.SOURCE_COMPLETED)); - assertEquals("There should be one un-subscription per server", 1, sourceObserver.getCount(server, EventType.CONNECTION_UNSUBSCRIBED)); - assertEquals("There should be no error", 0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be one connection per server", 1, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED)); + assertEquals(1, sourceObserver.getCount(server, EventType.SOURCE_COMPLETED), "There should be one completion per server"); + assertEquals(1, sourceObserver.getCount(server, EventType.CONNECTION_UNSUBSCRIBED), "There should be one un-subscription per server"); + assertEquals(0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(1, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED), "There should be one connection per server"); } assertEquals(1, sourceObserver.getCompletionCount()); @@ -231,7 +227,7 @@ public void call() { assertEquals(EXPECTED_EVENTS_SETS, events); for (EventType event : events) { - assertEquals("Each event should be recorded exactly once per server", localServerProvider.serverSize(), sourceObserver.getEventCount(event)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(event), "Each event should be recorded exactly once per server"); } } @@ -302,23 +298,21 @@ public void call(Throwable throwable) { fail(String.format("Waited at least %d seconds for the test to finish. Something is wrong", waitSeconds)); } - Assert.assertEquals(String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize()), counter.get(), maxRepeat); + Assertions.assertEquals(counter.get(), maxRepeat, String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize())); - assertTrue( - String.format("There should be at least %d completions after %d repeats (The last one may not have completion. Actual completion count: %d", - maxRepeat - 1, - maxRepeat, - sourceObserver.getCount(server, EventType.SOURCE_COMPLETED)), - maxRepeat - 1 <= sourceObserver.getCount(server, EventType.SOURCE_COMPLETED)); + assertTrue(maxRepeat - 1 <= sourceObserver.getCount(server, EventType.SOURCE_COMPLETED), String.format("There should be at least %d completions after %d repeats (The last one may not have completion. Actual completion count: %d", + maxRepeat - 1, + maxRepeat, + sourceObserver.getCount(server, EventType.SOURCE_COMPLETED))); - assertEquals("There should be no error", 0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be " + maxRepeat + " connection establishment in total", maxRepeat, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED)); + assertEquals(0, sourceObserver.getCount(server, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(maxRepeat, sourceObserver.getCount(server, EventType.CONNECTION_ESTABLISHED), "There should be " + maxRepeat + " connection establishment in total"); - assertEquals("There should no final completion", 0, sourceObserver.getCompletionCount()); + assertEquals(0, sourceObserver.getCompletionCount(), "There should no final completion"); assertEquals(0, sourceObserver.getErrorCount()); Set events = sourceObserver.getEvents(); - assertTrue("Polling Source always has subscriptions, so there won't be subscription_ended event. But other events should all be there", EXPECTED_EVENTS_SETS.containsAll(events)); + assertTrue(EXPECTED_EVENTS_SETS.containsAll(events), "Polling Source always has subscriptions, so there won't be subscription_ended event. But other events should all be there"); } @Test @@ -374,7 +368,7 @@ public void call(ServerSentEvent event) { * @throws Exception */ @Test - @Ignore(value = "This is meant to be run as an integration test. " + + @Disabled(value = "This is meant to be run as an integration test. " + "Also has test exclusion set for this package") public void testWithJobExecutionWillWorkForResubscription() throws Exception { final HttpSource source = HttpSources @@ -398,7 +392,7 @@ public String call(String o) { } @Test - @Ignore(value = "This is meant to be run as an integration test. " + + @Disabled(value = "This is meant to be run as an integration test. " + "Also has test exclusion set for this package") public void testDummySource() throws Exception { Source dummySource = new Source() { diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/LocalServerProvider.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/LocalServerProvider.java index 2e45c0066..670844c83 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/LocalServerProvider.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/LocalServerProvider.java @@ -16,7 +16,7 @@ package io.mantisrx.runtime.source.http; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import io.netty.bootstrap.ServerBootstrap; import io.netty.buffer.ByteBuf; diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/StaticServerPollerTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/StaticServerPollerTest.java index 38e2b7d46..3c6a5ddba 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/StaticServerPollerTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/StaticServerPollerTest.java @@ -16,8 +16,8 @@ package io.mantisrx.runtime.source.http; -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 io.mantisrx.runtime.source.http.impl.StaticServerPoller; import java.util.HashSet; @@ -25,9 +25,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; import mantis.io.reactivex.netty.client.RxClient.ServerInfo; -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 rx.functions.Action1; @@ -36,7 +36,7 @@ public class StaticServerPollerTest { private Set servers; private int pollingInterval = 1; - @Before + @BeforeEach public void setUp() throws Exception { servers = new HashSet<>(); for (int i = 0; i < 5; ++i) { @@ -44,7 +44,7 @@ public void setUp() throws Exception { } } - @After + @AfterEach public void tearDown() throws Exception { } @@ -59,7 +59,7 @@ public void pollingIsScheduled() throws Exception { .doOnNext(new Action1>() { @Override public void call(Set data) { - assertEquals("We should always see the same set of servers", servers, data); + assertEquals(servers, data, "We should always see the same set of servers"); count.incrementAndGet(); done.countDown(); } @@ -70,6 +70,6 @@ public void call(Set data) { long elapsed = (System.currentTimeMillis() - start) / 1000; System.out.println(elapsed); - assertTrue("The poller should have polled 5 times and the elaspsed time should be greater than 3", count.get() == 5 && elapsed <= 6); + assertTrue(count.get() == 5 && elapsed <= 6, "The poller should have polled 5 times and the elaspsed time should be greater than 3"); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/DefaultHttpServerProviderTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/DefaultHttpServerProviderTest.java index beddaad32..2f989df55 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/DefaultHttpServerProviderTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/DefaultHttpServerProviderTest.java @@ -16,7 +16,7 @@ package io.mantisrx.runtime.source.http.impl; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.runtime.source.http.ServerPoller; import java.util.ArrayList; @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import mantis.io.reactivex.netty.client.RxClient.ServerInfo; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.functions.Action0; import rx.functions.Action1; @@ -119,7 +119,7 @@ public int compare(ServerInfo o1, ServerInfo o2) { assertEquals(port, server.getPort()); } - assertEquals("The very last element should not be removed. ", max - 1, port); + assertEquals(max - 1, port, "The very last element should not be removed. "); } @Test @@ -210,7 +210,7 @@ public int compare(ServerInfo o1, ServerInfo o2) { assertEquals(port, server.getPort()); } - assertEquals("The very last two elements should not be removed. ", max - 2, port); + assertEquals(max - 2, port, "The very last two elements should not be removed. "); } @Test @@ -288,6 +288,6 @@ public int compare(ServerInfo o1, ServerInfo o2) { assertEquals(2, port); - assertEquals("No element should be removed. ", 0, removed.size()); + assertEquals(0, removed.size(), "No element should be removed. "); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java index b3bc9641e..071a1eaf8 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java @@ -23,9 +23,9 @@ import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.SOURCE_COMPLETED; import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.SUBSCRIPTION_ENDED; import static io.mantisrx.runtime.source.http.impl.HttpSourceImpl.HttpSourceEvent.EventType.SUBSCRIPTION_ESTABLISHED; -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 io.mantisrx.runtime.Context; import io.mantisrx.runtime.source.Index; @@ -57,11 +57,11 @@ import mantis.io.reactivex.netty.protocol.http.client.HttpClientBuilder; import mantis.io.reactivex.netty.protocol.http.client.HttpClientResponse; import mantis.io.reactivex.netty.protocol.http.sse.ServerSentEvent; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Subscriber; import rx.functions.Action0; @@ -80,7 +80,7 @@ public class HttpSourceImplTest { private static Set EXPECTED_EVENTS_SETS = new HashSet<>(Arrays.asList(expectedEvents)); private TestSourceObserver sourceObserver = new TestSourceObserver(); - @BeforeClass + @BeforeAll public static void init() { int port = new Random().nextInt(PORT_RANGE) + SEED_PORT; @@ -93,12 +93,12 @@ public static void init() { localServerProvider.start(3, port); } - @AfterClass + @AfterAll public static void shutDown() throws Exception { localServerProvider.shutDown(); } - @Before + @BeforeEach public void setup() { sourceObserver = new TestSourceObserver(); } @@ -143,16 +143,16 @@ public void call() { fail(String.format("Waited at least %d seconds for the test to finish. Something is wrong", waitSeconds)); } - assertEquals(String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize()), counter.get(), RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize()); + assertEquals(counter.get(), RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize(), String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize())); for (String data : RequestProcessor.smallStreamContent) { - assertEquals(String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize()), localServerProvider.serverSize(), result.get(data).get()); + assertEquals(localServerProvider.serverSize(), result.get(data).get(), String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize())); } for (Server server : localServerProvider.getServers()) { - assertEquals("There should be one completion per server", 1, sourceObserver.getCount(toServerInfo(server), EventType.SOURCE_COMPLETED)); - assertEquals("There should be one un-subscription per server", 1, sourceObserver.getCount(toServerInfo(server), EventType.CONNECTION_UNSUBSCRIBED)); - assertEquals("There should be no error", 0, sourceObserver.getCount(toServerInfo(server), EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be one connection per server", 1, sourceObserver.getCount(toServerInfo(server), EventType.CONNECTION_ESTABLISHED)); + assertEquals(1, sourceObserver.getCount(toServerInfo(server), EventType.SOURCE_COMPLETED), "There should be one completion per server"); + assertEquals(1, sourceObserver.getCount(toServerInfo(server), EventType.CONNECTION_UNSUBSCRIBED), "There should be one un-subscription per server"); + assertEquals(0, sourceObserver.getCount(toServerInfo(server), EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(1, sourceObserver.getCount(toServerInfo(server), EventType.CONNECTION_ESTABLISHED), "There should be one connection per server"); } assertEquals(1, sourceObserver.getCompletionCount()); @@ -162,10 +162,10 @@ public void call() { assertEquals(EXPECTED_EVENTS_SETS, events); for (EventType event : events) { - assertEquals("Each event should be recorded exactly once per server", localServerProvider.serverSize(), sourceObserver.getEventCount(event)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(event), "Each event should be recorded exactly once per server"); } - assertEquals("completed source should clean up its retry servers", 0, source.getRetryServers().size()); + assertEquals(0, source.getRetryServers().size(), "completed source should clean up its retry servers"); } @Test @@ -221,26 +221,26 @@ public void call() { fail(String.format("Waited at least %d seconds for the test to finish. Connection to at least one server is not unsubscribed.", waitSeconds)); } - assertTrue(String.format("Each server should emit at least one event before being canceled. Expected counter >= %d, actual counter: %d", localServerProvider.serverSize(), counter.get()), counter.get() >= localServerProvider.serverSize()); + assertTrue(counter.get() >= localServerProvider.serverSize(), String.format("Each server should emit at least one event before being canceled. Expected counter >= %d, actual counter: %d", localServerProvider.serverSize(), counter.get())); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals("There should be one completion per server", 1, sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED)); - assertEquals("There should be one un-subscription per server", 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_UNSUBSCRIBED)); - assertEquals("There should be no error", 0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be one connection per server", 1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED)); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED), "There should be one completion per server"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_UNSUBSCRIBED), "There should be one un-subscription per server"); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), "There should be one connection per server"); - assertEquals(String.format("There should be exactly one cancellation event per server for %d servers. ", localServerProvider.serverSize()), 1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_CANCELED)); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_CANCELED), String.format("There should be exactly one cancellation event per server for %d servers. ", localServerProvider.serverSize())); } - assertEquals("The source should emit exactly one completion event", 1, sourceObserver.getCompletionCount()); - assertEquals("The server should not have any error event", 0, sourceObserver.getErrorCount()); + assertEquals(1, sourceObserver.getCompletionCount(), "The source should emit exactly one completion event"); + assertEquals(0, sourceObserver.getErrorCount(), "The server should not have any error event"); Set events = sourceObserver.getEvents(); - assertEquals("Each server should have one occurrence per event type except server failure event", (EventType.values().length - 1), events.size()); + assertEquals((EventType.values().length - 1), events.size(), "Each server should have one occurrence per event type except server failure event"); for (EventType event : events) { - assertEquals("Each event should be recorded exactly once", localServerProvider.serverSize(), sourceObserver.getEventCount(event)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(event), "Each event should be recorded exactly once"); } } @@ -279,17 +279,16 @@ public void call() { .subscribe(); done.await(3000, TimeUnit.SECONDS); - assertEquals( - String.format("There should be exactly one response from each of the %d servers", localServerProvider.serverSize()), - localServerProvider.serverSize(), - counter.get()); + assertEquals(localServerProvider.serverSize(), + counter.get(), + String.format("There should be exactly one response from each of the %d servers", localServerProvider.serverSize())); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals("There should be one completion per server", 1, sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED)); - assertEquals("There should be one un-subscription per server", 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_UNSUBSCRIBED)); - assertEquals("There should be no error", 0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED)); - assertEquals("There should be one connection per server", 1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED)); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED), "There should be one completion per server"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_UNSUBSCRIBED), "There should be one un-subscription per server"); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), "There should be one connection per server"); } assertEquals(1, sourceObserver.getCompletionCount()); @@ -299,7 +298,7 @@ public void call() { assertEquals(EXPECTED_EVENTS_SETS, events); for (EventType event : events) { - assertEquals("Each event should be recorded exactly once per server", localServerProvider.serverSize(), sourceObserver.getEventCount(event)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(event), "Each event should be recorded exactly once per server"); } } @@ -361,8 +360,8 @@ public void onNext(ServerContext pair) { fail("The test case should finish way sooner than 5 seconds. "); } - Assert.assertNull("The connection error should be captured per server, therefore not propagated up to the entire source.", ex.get()); - Assert.assertNull("There should be no emitted item due to connection timeout", items.get()); + Assertions.assertNull(ex.get(), "The connection error should be captured per server, therefore not propagated up to the entire source."); + Assertions.assertNull(items.get(), "There should be no emitted item due to connection timeout"); } @Test @@ -451,15 +450,15 @@ public void onNext(ServerContext pair) { fail("The test case should finish way sooner than 5 seconds. "); } - Assert.assertNull("The timeout error should be captured by the client so it does not surface to the source", ex.get()); - Assert.assertNull("There should be no emitted item due to connection timeout", items.get()); + Assertions.assertNull(ex.get(), "The timeout error should be captured by the client so it does not surface to the source"); + Assertions.assertNull(items.get(), "There should be no emitted item due to connection timeout"); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals("There should be no source level error", 0, sourceObserver.getErrorCount()); - assertEquals("There should be one connection attempt per server", 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ATTEMPTED)); - assertEquals("There should be no established connection per server due to read timeout. ", 0, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ESTABLISHED)); - assertEquals("There should no subscribed server because of read timeout", 0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED)); + assertEquals(0, sourceObserver.getErrorCount(), "There should be no source level error"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ATTEMPTED), "There should be one connection attempt per server"); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ESTABLISHED), "There should be no established connection per server due to read timeout. "); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), "There should no subscribed server because of read timeout"); } } @@ -497,16 +496,16 @@ public void onNext(ServerContext pair) { fail("The test case should not finish at all"); } - Assert.assertNull("The timeout error should be captured by the client so it does not surface to the source", ex.get()); + Assertions.assertNull(ex.get(), "The timeout error should be captured by the client so it does not surface to the source"); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals("There should be no source level error", 0, sourceObserver.getErrorCount()); - assertEquals("There should be one connection attempt per server", 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ATTEMPTED)); - assertEquals("There should be one established connection per server ", 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ESTABLISHED)); - assertEquals("There should no subscribed server because of read timeout", 1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED)); + assertEquals(0, sourceObserver.getErrorCount(), "There should be no source level error"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ATTEMPTED), "There should be one connection attempt per server"); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ESTABLISHED), "There should be one established connection per server "); + assertEquals(1, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), "There should no subscribed server because of read timeout"); - assertEquals(String.format("There should be %d item before simulated error per server", eventCount), eventCount, items.get(serverInfo).size()); + assertEquals(eventCount, items.get(serverInfo).size(), String.format("There should be %d item before simulated error per server", eventCount)); } } @@ -577,52 +576,43 @@ public void call() { if (!done.await(5, TimeUnit.SECONDS)) { fail(String.format("All streaming should be done within %d seconds. ", wait)); } - assertEquals( - String.format("There should be exactly %d response from each of the %d servers", - maxRepeat, - localServerProvider.serverSize()), - maxRepeat * localServerProvider.serverSize(), - counter.get()); + assertEquals(maxRepeat * localServerProvider.serverSize(), + counter.get(), + String.format("There should be exactly %d response from each of the %d servers", + maxRepeat, + localServerProvider.serverSize())); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals( - String.format("There should be %d completion per server as resumption function should called %d times", - maxRepeat, - maxRepeat - 1), + assertEquals(maxRepeat, + sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED), + String.format("There should be %d completion per server as resumption function should called %d times", maxRepeat, - sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED)); + maxRepeat - 1)); - assertEquals("There should be no error", 0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED)); - assertEquals( - String.format("Connection per server should have been established %d times", maxRepeat), - 10, - sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED)); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED), "There should be no error"); + assertEquals(10, + sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), String.format("Connection per server should have been established %d times", maxRepeat)); } - assertEquals( - String.format("There are %d repeats, but there should be only one final completion", maxRepeat - 1), - 1, - sourceObserver.getCompletionCount()); + assertEquals(1, sourceObserver.getCompletionCount(), + String.format("There are %d repeats, but there should be only one final completion", maxRepeat - 1)); assertEquals(0, sourceObserver.getErrorCount()); Set events = sourceObserver.getEvents(); assertEquals(EXPECTED_EVENTS_SETS, events); - assertEquals("Each connection should be unsubscribed once by the subscriber", localServerProvider.serverSize(), sourceObserver.getEventCount(CONNECTION_UNSUBSCRIBED)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(CONNECTION_UNSUBSCRIBED), "Each connection should be unsubscribed once by the subscriber"); for (EventType eventType : new EventType[] {EventType.SOURCE_COMPLETED, EventType.SUBSCRIPTION_ESTABLISHED, EventType.CONNECTION_ATTEMPTED, EventType.CONNECTION_ESTABLISHED}) { - assertEquals( - String.format("Event %s should be recorded exactly %d times per server", eventType, maxRepeat), - maxRepeat * localServerProvider.serverSize(), - sourceObserver.getEventCount(eventType)); + assertEquals(maxRepeat * localServerProvider.serverSize(), + sourceObserver.getEventCount(eventType), String.format("Event %s should be recorded exactly %d times per server", eventType, maxRepeat)); } - assertEquals( - "Event SERVER_FOUND should be recorded exactly once per server", - localServerProvider.serverSize(), - sourceObserver.getEventCount(EventType.SERVER_FOUND)); + assertEquals(localServerProvider.serverSize(), + sourceObserver.getEventCount(EventType.SERVER_FOUND), + "Event SERVER_FOUND should be recorded exactly once per server"); } @Test @@ -705,30 +695,23 @@ public void call() { fail(String.format("All streaming should be done within %d seconds. ", wait)); } - assertEquals("All server should be resumed", localServerProvider.serverSize(), resumptionCounts.size()); + assertEquals(localServerProvider.serverSize(), resumptionCounts.size(), "All server should be resumed"); for (ServerInfo server : resumptionCounts.keySet()) { - assertTrue( - String.format("The server %s:%s should be resumed fewer than %d times", server.getHost(), server.getPort(), maxRepeat), - maxRepeat > resumptionCounts.get(server).get()); + assertTrue(maxRepeat > resumptionCounts.get(server).get(), String.format("The server %s:%s should be resumed fewer than %d times", server.getHost(), server.getPort(), maxRepeat)); } - assertTrue( - String.format("There should be at least %d response from each of the %d servers", - cutOff + 1, - localServerProvider.serverSize()), - (cutOff + 1) * localServerProvider.serverSize() <= counter.get()); + assertTrue((cutOff + 1) * localServerProvider.serverSize() <= counter.get(), String.format("There should be at least %d response from each of the %d servers", + cutOff + 1, + localServerProvider.serverSize())); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals("There should be no error", 0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED)); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED), "There should be no error"); } - assertEquals( - String.format("There are %d repeats, but there should be only one final completion", maxRepeat - 1), - 1, - sourceObserver.getCompletionCount()); + assertEquals(1, sourceObserver.getCompletionCount(), String.format("There are %d repeats, but there should be only one final completion", maxRepeat - 1)); - assertEquals("There should be no error", 0, sourceObserver.getErrorCount()); + assertEquals(0, sourceObserver.getErrorCount(), "There should be no error"); Set events = sourceObserver.getEvents(); Set expectedEvents = new HashSet<>(); @@ -744,18 +727,16 @@ public void call() { assertEquals(expectedEvents, events); - assertEquals("Each connection should be unsubscribed once by the subscriber", localServerProvider.serverSize(), sourceObserver.getEventCount(CONNECTION_UNSUBSCRIBED)); + assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(CONNECTION_UNSUBSCRIBED), "Each connection should be unsubscribed once by the subscriber"); for (EventType eventType : new EventType[] {EventType.SOURCE_COMPLETED, EventType.SUBSCRIPTION_ESTABLISHED, EventType.CONNECTION_ATTEMPTED, EventType.CONNECTION_ESTABLISHED}) { - assertTrue( - String.format("Event %s should be recorded at least %d times per server", eventType, cutOff), - (cutOff + 1) * localServerProvider.serverSize() <= sourceObserver.getEventCount(eventType)); + assertTrue((cutOff + 1) * localServerProvider.serverSize() <= sourceObserver.getEventCount(eventType), + String.format("Event %s should be recorded at least %d times per server", eventType, cutOff)); } for (EventType eventType : new EventType[] {EventType.SERVER_FOUND, EventType.SUBSCRIPTION_CANCELED}) { - assertEquals( - String.format("Event %s should be recorded exactly once per server", eventType), - localServerProvider.serverSize(), - sourceObserver.getEventCount(eventType)); + assertEquals(localServerProvider.serverSize(), + sourceObserver.getEventCount(eventType), + String.format("Event %s should be recorded exactly once per server", eventType)); } } @@ -830,16 +811,16 @@ public void onNext(ServerContext pair) { fail("The test case should finish way sooner than 10 seconds. "); } - Assert.assertNull("The timeout error should be captured by the client so it does not surface to the source", ex.get()); - Assert.assertNull("There should be no emitted item due to connection timeout", items.get()); + Assertions.assertNull(ex.get(), "The timeout error should be captured by the client so it does not surface to the source"); + Assertions.assertNull(items.get(), "There should be no emitted item due to connection timeout"); for (ServerInfo serverInfo : localServerProvider.getServerInfos()) { - assertEquals("There should be no source level error", 0, sourceObserver.getErrorCount()); - assertEquals("There should be one connection attempt per server per retry", maxRepeat + 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ATTEMPTED)); - assertEquals("There should be no established connection per server due to read timeout. ", 0, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ESTABLISHED)); - assertEquals("There should no subscribed server because of read timeout", 0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED)); + assertEquals(0, sourceObserver.getErrorCount(),"There should be no source level error"); + assertEquals(maxRepeat + 1, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ATTEMPTED), "There should be one connection attempt per server per retry"); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.CONNECTION_ESTABLISHED), "There should be no established connection per server due to read timeout. "); + assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), "There should no subscribed server because of read timeout"); - assertEquals("Each server will repeat exactly " + maxRepeat + " times", maxRepeat, resumptions.get(serverInfo).get()); + assertEquals(maxRepeat, resumptions.get(serverInfo).get(), "Each server will repeat exactly " + maxRepeat + " times"); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnCompletedTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnCompletedTest.java index 81d08545e..d8437396b 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnCompletedTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnCompletedTest.java @@ -16,15 +16,15 @@ package io.mantisrx.runtime.source.http.impl; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.Operator; import rx.Subscriber; @@ -81,9 +81,9 @@ public void onNext(Integer integer) { fail("Should finish within " + timeoutSecs + " seconds"); } - assertEquals(String.format("There should be exactly %d retries", repeat), repeat, retries.get()); - assertEquals("There should be exactly one onCompleted call", 1, completionCount.get()); + assertEquals(repeat, retries.get(), String.format("There should be exactly %d retries", repeat)); + assertEquals(1, completionCount.get(), "There should be exactly one onCompleted call"); List expected = Observable.range(1, max + repeat).toList().toBlocking().first(); - assertEquals("The collected should include the original stream plus every attempt", expected, collected); + assertEquals(expected, collected, "The collected should include the original stream plus every attempt"); } } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnErrorTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnErrorTest.java index 7831a2a0a..bbaa823af 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnErrorTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/OperatorResumeOnErrorTest.java @@ -16,15 +16,15 @@ package io.mantisrx.runtime.source.http.impl; -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.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Observable.OnSubscribe; import rx.Observable.Operator; @@ -65,7 +65,7 @@ public void onError(Throwable e) { @Override public void onNext(Integer integer) { - assertTrue("The integer should not be over the threshold. The integer value: " + integer, integer < threshold); + assertTrue(integer < threshold, "The integer should not be over the threshold. The integer value: " + integer); } }); @@ -74,9 +74,9 @@ public void onNext(Integer integer) { fail("Should finish within " + timeoutSecs + " seconds"); } - assertEquals(String.format("There should be exactly %d retries", repeat), repeat, retries.get()); - assertEquals("There should be exactly one onError", 1, errorCount.get()); - assertEquals("The error should be the user created one. ", TestException.class, error.get().getClass()); + assertEquals(repeat, retries.get(), String.format("There should be exactly %d retries", repeat)); + assertEquals(1, errorCount.get(), "There should be exactly one onError"); + assertEquals(TestException.class, error.get().getClass(), "The error should be the user created one. "); } private OperatorResumeOnError resumeWithFixNumberOfRetries(final Observable ints, final int repeat, final AtomicInteger retries) { diff --git a/mantis-server/mantis-server-agent/build.gradle b/mantis-server/mantis-server-agent/build.gradle index 4c54597eb..68fd01db6 100644 --- a/mantis-server/mantis-server-agent/build.gradle +++ b/mantis-server/mantis-server-agent/build.gradle @@ -27,7 +27,7 @@ dependencies { implementation libraries.slf4jApi implementation libraries.slf4jLog4j12 - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoAll testImplementation project(":mantis-server:mantis-server-worker") testImplementation(testFixtures(project(":mantis-control-plane:mantis-control-plane-core"))) diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/BlobStoreTest.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/BlobStoreTest.java index fc7cb7d7e..e059c378d 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/BlobStoreTest.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/BlobStoreTest.java @@ -24,7 +24,7 @@ import java.io.File; import java.net.URI; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Matchers; public class BlobStoreTest { diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/ResourceManagerGatewayCxnTest.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/ResourceManagerGatewayCxnTest.java index 2c1b8635c..91c59eb6f 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/ResourceManagerGatewayCxnTest.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/ResourceManagerGatewayCxnTest.java @@ -16,7 +16,8 @@ package io.mantisrx.server.agent; import static org.apache.flink.util.ExceptionUtils.stripExecutionException; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -40,8 +41,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executors; import org.apache.flink.api.common.time.Time; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Matchers; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -55,7 +56,7 @@ public class ResourceManagerGatewayCxnTest { private ResourceManagerGatewayCxn cxn; private TaskExecutorReport report; - @Before + @BeforeEach public void setup() { WorkerPorts workerPorts = new WorkerPorts(100, 101, 102, 103, 104); TaskExecutorID taskExecutorID = TaskExecutorID.of("taskExecutor"); @@ -97,17 +98,19 @@ public void testIfTaskExecutorRegistersItselfWithResourceManagerAndSendsHeartbea verify(gateway, atLeastOnce()).heartBeatFromTaskExecutor(heartbeat); } - @Test(expected = UnknownError.class) + @Test public void testWhenRegistrationFails() throws Throwable { - when(gateway.registerTaskExecutor(Matchers.eq(registration))).thenReturn( - CompletableFutures.exceptionallyCompletedFuture(new UnknownError("exception"))); - cxn.startAsync(); - CompletableFuture result = Services.stopAsync(cxn, Executors.newSingleThreadExecutor()); - try { - result.get(); - } catch (Exception e) { - throw stripExecutionException(e); - } + assertThrows(UnknownError.class, () -> { + when(gateway.registerTaskExecutor(Matchers.eq(registration))).thenReturn( + CompletableFutures.exceptionallyCompletedFuture(new UnknownError("exception"))); + cxn.startAsync(); + CompletableFuture result = Services.stopAsync(cxn, Executors.newSingleThreadExecutor()); + try { + result.get(); + } catch (Exception e) { + throw stripExecutionException(e); + } + }); } @Test diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/RuntimeTaskImplExecutorTest.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/RuntimeTaskImplExecutorTest.java index e24ec3080..40d385272 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/RuntimeTaskImplExecutorTest.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/RuntimeTaskImplExecutorTest.java @@ -15,8 +15,8 @@ */ package io.mantisrx.server.agent; -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 static org.mockito.Matchers.any; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; @@ -89,11 +89,11 @@ import mantis.io.reactivex.netty.client.RxClient.ServerInfo; import org.apache.flink.api.common.time.Time; import org.apache.flink.runtime.rpc.RpcService; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Subscription; @@ -116,7 +116,7 @@ public class RuntimeTaskImplExecutorTest { private final ObjectMapper objectMapper = new ObjectMapper(); private CollectingTaskLifecycleListener listener; - @Before + @BeforeEach public void setUp() throws IOException { final Properties props = new Properties(); props.setProperty("mantis.zookeeper.root", ""); @@ -178,13 +178,13 @@ private void start() throws Exception { taskExecutor.awaitRunning().get(2, TimeUnit.SECONDS); } - @After + @AfterEach public void tearDown() throws Exception { taskExecutor.close(); this.localApiServer.stop(0); } - @Ignore + @Disabled @Test public void testTaskExecutorEndToEndWithASingleStageJobByLoadingFromClassLoader() throws Exception { @@ -216,7 +216,7 @@ public void testTaskExecutorEndToEndWithASingleStageJobByLoadingFromClassLoader( new WorkerPorts(2, 3, 4, 5, 6), Optional.of(SineFunctionJobProvider.class.getName()))), Time.seconds(1)); wait.get(); - Assert.assertTrue(startedSignal.await(5, TimeUnit.SECONDS)); + Assertions.assertTrue(startedSignal.await(5, TimeUnit.SECONDS)); Subscription subscription = HttpSources.source(HttpClientFactories.sseClientFactory(), HttpRequestFactories.createGetFactory("/")) .withServerProvider(new HttpServerProvider() { @@ -244,7 +244,7 @@ public Observable getServersToRemove() { .takeUntil(point -> point.getX() > threshold) .subscribe(point -> log.info("point={}", point), error -> log.error("failed", error), () -> doneSignal.countDown()); - Assert.assertTrue(doneSignal.await(10, TimeUnit.SECONDS)); + Assertions.assertTrue(doneSignal.await(10, TimeUnit.SECONDS)); subscription.unsubscribe(); verify(resourceManagerGateway, times(1)).notifyTaskExecutorStatusChange( new TaskExecutorStatusChange(taskExecutor.getTaskExecutorID(), taskExecutor.getClusterID(), @@ -327,7 +327,7 @@ public void testWhenSuccessiveHeartbeatsFail() throws Exception { start(); Thread.sleep(1000); verify(resourceManagerGateway, times(2)).registerTaskExecutor(any()); - Assert.assertTrue(taskExecutor.isRegistered(Time.seconds(1)).get()); + Assertions.assertTrue(taskExecutor.isRegistered(Time.seconds(1)).get()); } @Test @@ -353,7 +353,7 @@ public void testWhenResourceManagerLeaderChanges() throws Exception { verify(newResourceClusterGateway, atLeastOnce()).heartBeatFromTaskExecutor(any()); // check if the task executor is registered - Assert.assertTrue(taskExecutor.isRegistered(Time.seconds(1)).get()); + Assertions.assertTrue(taskExecutor.isRegistered(Time.seconds(1)).get()); } @Test @@ -388,7 +388,7 @@ public void testWhenReregistrationFails() throws Exception { verify(newResourceManagerGateway2, atLeastOnce()).heartBeatFromTaskExecutor(any()); // check if the task executor is registered - Assert.assertTrue(taskExecutor.isRegistered(Time.seconds(1)).get()); + Assertions.assertTrue(taskExecutor.isRegistered(Time.seconds(1)).get()); } private static ResourceClusterGateway getHealthyGateway(String name) { diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/TestHadoopFileSystemBlobStore.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/TestHadoopFileSystemBlobStore.java index 8d7d06124..829c86e04 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/TestHadoopFileSystemBlobStore.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/TestHadoopFileSystemBlobStore.java @@ -24,7 +24,7 @@ import java.net.URI; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Matchers; public class TestHadoopFileSystemBlobStore { diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/WorkerConfigurationWritableTest.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/WorkerConfigurationWritableTest.java index e590ba529..464490f36 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/WorkerConfigurationWritableTest.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/WorkerConfigurationWritableTest.java @@ -16,9 +16,9 @@ package io.mantisrx.server.agent; -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 io.mantisrx.common.JsonSerializer; import io.mantisrx.runtime.loader.config.WorkerConfiguration; @@ -27,7 +27,7 @@ import io.mantisrx.server.worker.config.StaticPropertiesConfigurationFactory; import java.io.IOException; import java.util.Properties; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerConfigurationWritableTest { static String ConfigWritableToString(WorkerConfigurationWritable configurationWritable) throws IOException { diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCgroup.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCgroup.java index fe77aa921..8898dba6c 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCgroup.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCgroup.java @@ -16,12 +16,12 @@ package io.mantisrx.server.agent.metrics.cgroups; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import io.mantisrx.shaded.com.google.common.io.Resources; import java.io.IOException; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestCgroup { diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCpuAcctsSubsystemProcess.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCpuAcctsSubsystemProcess.java index 9f7fbed2d..34471a405 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCpuAcctsSubsystemProcess.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestCpuAcctsSubsystemProcess.java @@ -16,13 +16,13 @@ package io.mantisrx.server.agent.metrics.cgroups; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import io.mantisrx.runtime.loader.config.Usage; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestCpuAcctsSubsystemProcess { private final Cgroup cgroup = mock(Cgroup.class); diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestMemorySubsystemProcess.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestMemorySubsystemProcess.java index 4ddd8c082..8804253cd 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestMemorySubsystemProcess.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestMemorySubsystemProcess.java @@ -16,13 +16,13 @@ package io.mantisrx.server.agent.metrics.cgroups; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import io.mantisrx.runtime.loader.config.Usage; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestMemorySubsystemProcess { private final Cgroup cgroup = mock(Cgroup.class); diff --git a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestNetworkSubsystemProcess.java b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestNetworkSubsystemProcess.java index 941a18bb0..02d4c31ef 100644 --- a/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestNetworkSubsystemProcess.java +++ b/mantis-server/mantis-server-agent/src/test/java/io/mantisrx/server/agent/metrics/cgroups/TestNetworkSubsystemProcess.java @@ -16,11 +16,11 @@ package io.mantisrx.server.agent.metrics.cgroups; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.runtime.loader.config.Usage; import io.mantisrx.shaded.com.google.common.io.Resources; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TestNetworkSubsystemProcess { @Test diff --git a/mantis-server/mantis-server-worker-client/build.gradle b/mantis-server/mantis-server-worker-client/build.gradle index b87ceea4e..475e8972b 100644 --- a/mantis-server/mantis-server-worker-client/build.gradle +++ b/mantis-server/mantis-server-worker-client/build.gradle @@ -18,7 +18,7 @@ dependencies { api project(":mantis-control-plane:mantis-control-plane-core") api project(":mantis-control-plane:mantis-control-plane-client") - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoAll testImplementation libraries.spectatorApi testImplementation 'org.hamcrest:hamcrest-all:1.3' diff --git a/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/MetricsClientImplTest.java b/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/MetricsClientImplTest.java index 68428b267..65434cc63 100644 --- a/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/MetricsClientImplTest.java +++ b/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/MetricsClientImplTest.java @@ -16,7 +16,7 @@ package io.mantisrx.server.worker.client; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.common.MantisServerSentEvent; import io.mantisrx.common.metrics.measurement.CounterMeasurement; @@ -37,7 +37,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observable; diff --git a/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionFunctionTest.java b/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionFunctionTest.java index efc112228..b41325cf7 100644 --- a/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionFunctionTest.java +++ b/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionFunctionTest.java @@ -16,14 +16,14 @@ package io.mantisrx.server.worker.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import io.mantisrx.common.MantisServerSentEvent; import io.mantisrx.server.worker.TestSseServerFactory; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observable; diff --git a/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionTest.java b/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionTest.java index b5eddfcd1..10465af8c 100644 --- a/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionTest.java +++ b/mantis-server/mantis-server-worker-client/src/test/java/io/mantisrx/server/worker/client/SseWorkerConnectionTest.java @@ -16,8 +16,8 @@ package io.mantisrx.server.worker.client; -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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit; import mantis.io.reactivex.netty.protocol.http.client.HttpClientResponse; import mantis.io.reactivex.netty.protocol.http.sse.ServerSentEvent; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observable; diff --git a/mantis-server/mantis-server-worker/build.gradle b/mantis-server/mantis-server-worker/build.gradle index e1678ac5d..3bb738dbf 100644 --- a/mantis-server/mantis-server-worker/build.gradle +++ b/mantis-server/mantis-server-worker/build.gradle @@ -43,7 +43,7 @@ dependencies { implementation libraries.spectatorApi - testImplementation libraries.junit4 + testImplementation libraries.junitJupiter testImplementation libraries.mockitoAll testImplementation 'org.hamcrest:hamcrest-all:1.3' testImplementation libraries.vavrTest diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/DataDroppedPayloadSetterTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/DataDroppedPayloadSetterTest.java index 532629093..55b502f61 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/DataDroppedPayloadSetterTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/DataDroppedPayloadSetterTest.java @@ -21,7 +21,7 @@ import static io.mantisrx.server.core.stats.MetricStringConstants.DROP_COUNT; import static io.mantisrx.server.core.stats.MetricStringConstants.ON_NEXT_COUNT; import static io.reactivx.mantis.operators.DropOperator.METRIC_GROUP; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.netflix.spectator.api.DefaultRegistry; import io.mantisrx.common.metrics.Metrics; @@ -29,7 +29,7 @@ import io.mantisrx.common.metrics.spectator.MetricGroupId; import io.mantisrx.common.metrics.spectator.SpectatorRegistryFactory; import io.reactivx.mantis.operators.DropOperator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/HeartbeatTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/HeartbeatTest.java index eeb770374..129298580 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/HeartbeatTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/HeartbeatTest.java @@ -19,8 +19,8 @@ import io.mantisrx.server.core.Status; import io.mantisrx.server.core.StatusPayloads; import java.util.List; -import junit.framework.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class HeartbeatTest { @@ -35,14 +35,14 @@ public void testSingleUsePayloads() throws Exception { heartbeat.addSingleUsePayload("" + StatusPayloads.Type.IncomingDataDrop, "" + val2); final Status currentHeartbeatStatus = heartbeat.getCurrentHeartbeatStatus(); List payloads = currentHeartbeatStatus.getPayloads(); - Assert.assertEquals(2, payloads.size()); + Assertions.assertEquals(2, payloads.size()); int value = 0; for (Status.Payload p : payloads) { if (StatusPayloads.Type.valueOf(p.getType()) == StatusPayloads.Type.IncomingDataDrop) value = Integer.parseInt(p.getData()); } - Assert.assertEquals(val2, value); + Assertions.assertEquals(val2, value); payloads = heartbeat.getCurrentHeartbeatStatus().getPayloads(); - Assert.assertEquals(1, payloads.size()); + Assertions.assertEquals(1, payloads.size()); } } diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/WorkerExecutionOperationsNetworkStageTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/WorkerExecutionOperationsNetworkStageTest.java index 81b29cb02..a07885d12 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/WorkerExecutionOperationsNetworkStageTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/WorkerExecutionOperationsNetworkStageTest.java @@ -16,8 +16,8 @@ package io.mantisrx.server.worker; -import static junit.framework.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 io.mantisrx.runtime.MantisJobDurationType; import io.mantisrx.runtime.MantisJobState; @@ -31,7 +31,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.Subscription; import rx.schedulers.Schedulers; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/config/WorkerConfigurationTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/config/WorkerConfigurationTest.java index 1c84dfe3d..c262234e5 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/config/WorkerConfigurationTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/config/WorkerConfigurationTest.java @@ -16,12 +16,12 @@ package io.mantisrx.server.worker.config; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.runtime.loader.config.WorkerConfiguration; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.util.Properties; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class WorkerConfigurationTest { diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/AutoScaleMetricsConfigTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/AutoScaleMetricsConfigTest.java index 8fa20f94c..1fcd7e526 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/AutoScaleMetricsConfigTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/AutoScaleMetricsConfigTest.java @@ -18,11 +18,11 @@ import static io.reactivex.mantis.network.push.PushServerSse.DROPPED_COUNTER_METRIC_NAME; import static io.reactivex.mantis.network.push.PushServerSse.PROCESSED_COUNTER_METRIC_NAME; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import io.mantisrx.shaded.com.google.common.collect.ImmutableSet; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AutoScaleMetricsConfigTest { @Test diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java index 72757e283..371706acb 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java @@ -19,8 +19,8 @@ import static io.mantisrx.runtime.descriptor.StageScalingPolicy.ScalingReason.DataDrop; import static io.mantisrx.runtime.descriptor.StageScalingPolicy.ScalingReason.KafkaLag; import static io.mantisrx.runtime.descriptor.StageScalingPolicy.ScalingReason.UserDefined; -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 static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; @@ -43,7 +43,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.slf4j.Logger; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/SourceJobWorkerMetricsSubscriptionTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/SourceJobWorkerMetricsSubscriptionTest.java index e4b42f8cb..fd9baacc0 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/SourceJobWorkerMetricsSubscriptionTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/SourceJobWorkerMetricsSubscriptionTest.java @@ -16,7 +16,7 @@ package io.mantisrx.server.worker.jobmaster; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; import io.mantisrx.common.MantisServerSentEvent; @@ -31,7 +31,7 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; public class SourceJobWorkerMetricsSubscriptionTest { diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java index 6c945cad3..fd15268e6 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java @@ -20,8 +20,8 @@ import static io.mantisrx.server.core.stats.MetricStringConstants.KAFKA_CONSUMER_FETCH_MGR_METRIC_GROUP; import static io.reactivex.mantis.network.push.PushServerSse.DROPPED_COUNTER_METRIC_NAME; import static io.reactivex.mantis.network.push.PushServerSse.PROCESSED_COUNTER_METRIC_NAME; -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 static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; @@ -43,7 +43,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.slf4j.Logger; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsClutchConfigurationSelectorTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsClutchConfigurationSelectorTest.java index 195d35d30..fc342eec4 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsClutchConfigurationSelectorTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsClutchConfigurationSelectorTest.java @@ -16,8 +16,8 @@ package io.mantisrx.server.worker.jobmaster.clutch.rps; -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 com.netflix.control.clutch.Clutch; import com.netflix.control.clutch.ClutchConfiguration; @@ -28,7 +28,7 @@ import io.vavr.Tuple; import io.vavr.control.Option; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsMetricComputerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsMetricComputerTest.java index 1f07ae5e7..2dd176656 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsMetricComputerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsMetricComputerTest.java @@ -16,12 +16,12 @@ package io.mantisrx.server.worker.jobmaster.clutch.rps; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.netflix.control.clutch.Clutch; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RpsMetricComputerTest { @Test diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsScaleComputerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsScaleComputerTest.java index 74297500e..fa832c553 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsScaleComputerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/clutch/rps/RpsScaleComputerTest.java @@ -16,12 +16,12 @@ package io.mantisrx.server.worker.jobmaster.clutch.rps; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.netflix.control.clutch.ClutchConfiguration; import io.vavr.Tuple; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RpsScaleComputerTest { @Test diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/AdaptiveAutoScalerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/AdaptiveAutoScalerTest.java index cf8496388..a4427d361 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/AdaptiveAutoScalerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/AdaptiveAutoScalerTest.java @@ -24,7 +24,7 @@ import io.mantisrx.shaded.com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.concurrent.atomic.AtomicLong; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.observers.TestSubscriber; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/actuators/MantisStageActuatorTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/actuators/MantisStageActuatorTest.java index 2ea9e932d..3903f45ee 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/actuators/MantisStageActuatorTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/actuators/MantisStageActuatorTest.java @@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify; import io.mantisrx.server.worker.jobmaster.JobAutoScaler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.observers.TestSubscriber; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/controllers/PIDControllerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/controllers/PIDControllerTest.java index 2f46dba00..aaad77bfa 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/controllers/PIDControllerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/controllers/PIDControllerTest.java @@ -16,10 +16,10 @@ package io.mantisrx.server.worker.jobmaster.control.controllers; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import io.mantisrx.server.worker.jobmaster.control.Controller; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/ErrorComputerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/ErrorComputerTest.java index d4d4d166f..a80900cb7 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/ErrorComputerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/ErrorComputerTest.java @@ -16,7 +16,7 @@ package io.mantisrx.server.worker.jobmaster.control.utils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.observers.TestSubscriber; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/IntegratorTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/IntegratorTest.java index 4bed1de7f..19178e6da 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/IntegratorTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/control/utils/IntegratorTest.java @@ -16,7 +16,7 @@ package io.mantisrx.server.worker.jobmaster.control.utils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import rx.Observable; import rx.observers.TestSubscriber; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/mesos/TestMesosMetricsCollector.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/mesos/TestMesosMetricsCollector.java index c44b58b6b..42bd21473 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/mesos/TestMesosMetricsCollector.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/mesos/TestMesosMetricsCollector.java @@ -18,7 +18,7 @@ import io.mantisrx.runtime.loader.config.Usage; import lombok.extern.slf4j.Slf4j; -import org.junit.Test; +import org.junit.jupiter.api.Test; @Slf4j public class TestMesosMetricsCollector { From 036a68c040a543d01a273d26acf7a1883429995a Mon Sep 17 00:00:00 2001 From: Shreyaa Sharma Date: Tue, 21 Mar 2023 00:18:30 +0530 Subject: [PATCH 2/5] Cleanup --- .../mantisrx/server/core/WorkerHostTest.java | 8 ++------ .../discovery/MantisJobDiscoveryTest.java | 19 ------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java index c442ccbf8..d467108b5 100644 --- a/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java +++ b/mantis-control-plane/mantis-control-plane-core/src/test/java/io/mantisrx/server/core/WorkerHostTest.java @@ -16,7 +16,6 @@ package io.mantisrx.server.core; -import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -31,10 +30,7 @@ public void testEquals() { WorkerHost w2 = new WorkerHost("localhost", 1, ImmutableList.of(7001, 7002), MantisJobState.Accepted, 2, 7003, 7004); WorkerHost w3 = new WorkerHost("localhost", 1, ImmutableList.of(7001, 7002), MantisJobState.Accepted, 2, 7003, 7005); - // required? - assertAll( - () -> assertTrue(w1.equals(w2)), - () -> assertFalse(w1.equals(w3)) - ); + assertTrue(w1.equals(w2)); + assertFalse(w1.equals(w3)); } } diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java index 633e1c55b..7d923385a 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java @@ -59,23 +59,6 @@ public class MantisJobDiscoveryTest { private MrePublishConfiguration config; private MantisJobDiscovery jobDiscovery; -// public class WireMockExtension implements AfterEachCallback, BeforeEachCallback { -// static WireMockServer mantisAPI = new WireMockServer(); -// @Override -// public void beforeEach(ExtensionContext context) throws Exception { -// mantisAPI.start(); -// } -// -// @Override -// public void afterEach(ExtensionContext context) throws Exception { -// mantisAPI.shutdown(); -// } -// -// public static WireMockServer getMantisAPI() { -// return mantisAPI; -// } -// } - public MantisJobDiscoveryTest() { streamJobClusterMap.put(StreamType.DEFAULT_EVENT_STREAM, "RequestEventSubTrackerTestJobCluster"); streamJobClusterMap.put(StreamType.LOG_EVENT_STREAM, "LogEventSubTrackerTestJobCluster"); @@ -110,10 +93,8 @@ public void teardown() { mantisApi.shutdown(); } -// @ExtendWith(WireMockExtension.class) @Test public void testJobDiscoveryFetch() throws IOException { -// WireMockServer mantisAPI = WireMockExtension.getMantisAPI(); String jobCluster = "MantisJobDiscoveryTestJobCluster"; String jobId = jobCluster + "-1"; From 271afb7906b270a684dd5c711ed73ace5a10faee Mon Sep 17 00:00:00 2001 From: Shreyaa Sharma Date: Sat, 25 Mar 2023 03:06:45 +0530 Subject: [PATCH 3/5] Fixes: Adds jupiter to build.gradle, formatting fixes and removes comments --- build.gradle | 4 ++ .../master/jobcluster/JobClusterTest.java | 2 - .../jobcluster/job/JobClusterManagerTest.java | 4 -- .../master/jobcluster/job/JobTestTimeout.java | 10 ++--- ...impleFileResourceStorageProviderTests.java | 7 +--- .../DefaultSubscriptionTrackerTest.java | 7 +--- .../discovery/MantisJobDiscoveryTest.java | 3 +- .../mantisapi/DefaultMantisApiClientTest.java | 3 +- .../source/http/ContextualHttpSourceTest.java | 3 +- .../runtime/source/http/HttpSourceTest.java | 12 ++++-- .../source/http/impl/HttpSourceImplTest.java | 42 +++++++++++-------- 11 files changed, 48 insertions(+), 49 deletions(-) diff --git a/build.gradle b/build.gradle index 53e425c2f..af074a60f 100644 --- a/build.gradle +++ b/build.gradle @@ -156,6 +156,10 @@ subprojects { printReleasedArtifact.dependsOn(project.rootProject.snapshot) printAllReleasedArtifacts.dependsOn("${project.path}:printReleasedArtifact") } + + test { + useJUnitPlatform() + } } apply from: file('baseline.gradle') diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java index 98f096a23..2462f5d70 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java @@ -159,8 +159,6 @@ public class JobClusterTest { private IMantisPersistenceProvider storageProvider; private static LifecycleEventPublisher eventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); private static final String user = "mantis"; -// @Rule -// public TemporaryFolder rootDir = new TemporaryFolder(); @TempDir File rootDir; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java index 4e6763913..ae99b263a 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java @@ -131,12 +131,8 @@ public class JobClusterManagerTest { new WorkerEventSubscriberLoggingImpl()); private static final String user = "nj"; -// @Rule -// public TemporaryFolder rootDir = new TemporaryFolder(); @TempDir File rootDir; -// @Rule -// public Timeout globalTimeout = new Timeout(2000); @BeforeAll public static void setup() { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java index c5ea0f017..afbc529ac 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java @@ -21,9 +21,9 @@ // //import java.time.Instant; // -//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 com.google.common.collect.Lists; // @@ -51,7 +51,7 @@ // private static final String user = "mantis"; // private static IJobClusterDefinition jobClusterDefn ; // -// @BeforeClass +// @BeforeAll // public static void setup() { // system = ActorSystem.create(); // @@ -87,7 +87,7 @@ // // } // -// @AfterClass +// @AfterAll // public static void tearDown() { // ((SimpleCachedFileStorageProvider)storageProvider).deleteAllFiles(); // TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java index 82513d0ef..1ccdc9426 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java @@ -40,16 +40,13 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -//import org.junit.rules.TemporaryFolder; @Slf4j public class SimpleFileResourceStorageProviderTests { static ActorSystem system; -// @Rule -// public TemporaryFolder storageDirectory = new TemporaryFolder(); @TempDir - File storageDirectory, testDirectory; + File storageDirectory; @BeforeAll public static void setup() throws IOException { @@ -163,7 +160,7 @@ public void testUpdateClusterSpec() throws ExecutionException, InterruptedExcept .id(spec.getId()) .build(); - SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, testDirectory); + SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory); CompletionStage updateFut = prov.registerAndUpdateClusterSpec(specWritable); log.info("res: " + updateFut.toCompletableFuture().get()); diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java index aa6f7e3da..c195c0d11 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/DefaultSubscriptionTrackerTest.java @@ -55,7 +55,7 @@ public class DefaultSubscriptionTrackerTest { private static final int subscriptionExpiryIntervalSec = 3; private final Map streamJobClusterMap = new HashMap<>(); - WireMockRule mantisWorker1, mantisWorker2, mantisWorker3; + public WireMockRule mantisWorker1 = new WireMockRule(options().dynamicPort()), mantisWorker2 = new WireMockRule(options().dynamicPort()), mantisWorker3 = new WireMockRule(options().dynamicPort()); private DefaultSubscriptionTracker subscriptionTracker; private MantisJobDiscovery mockJobDiscovery; private StreamManager mockStreamManager; @@ -97,9 +97,6 @@ public void setup() { Registry registry = new DefaultRegistry(); mockJobDiscovery = mock(MantisJobDiscovery.class); mockStreamManager = spy(new StreamManager(registry, mrePublishConfiguration)); - mantisWorker1 = new WireMockRule(options().dynamicPort()); - mantisWorker2 = new WireMockRule(options().dynamicPort()); - mantisWorker3 = new WireMockRule(options().dynamicPort()); mantisWorker1.start(); mantisWorker2.start(); mantisWorker3.start(); @@ -129,7 +126,7 @@ public void testSubscriptionsResolveToMajorityAmongWorkers() throws IOException MantisServerSubscriptionEnvelope w1Subs = SubscriptionsHelper.createSubsEnvelope(2, 0); mantisWorker1.stubFor(get(urlMatching("/\\?jobId=.*")) .willReturn(aResponse() - .withStatus(200) + .withStatus(400) .withBody(DefaultObjectMapper.getInstance().writeValueAsBytes(w1Subs))) ); diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java index 7d923385a..9d0b12e01 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/MantisJobDiscoveryTest.java @@ -55,7 +55,7 @@ public class MantisJobDiscoveryTest { private static final Logger logger = LoggerFactory.getLogger(MantisJobDiscoveryTest.class); private final Map streamJobClusterMap = new HashMap<>(); - WireMockRule mantisApi; + WireMockRule mantisApi = new WireMockRule(options().dynamicPort()); private MrePublishConfiguration config; private MantisJobDiscovery jobDiscovery; @@ -80,7 +80,6 @@ private MrePublishConfiguration testConfig() { @BeforeEach public void setup() { - mantisApi = new WireMockRule(options().dynamicPort()); mantisApi.start(); config = testConfig(); Registry registry = new DefaultRegistry(); diff --git a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java index 4fef2dab2..32e447322 100644 --- a/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java +++ b/mantis-publish/mantis-publish-core/src/test/java/io/mantisrx/publish/internal/discovery/mantisapi/DefaultMantisApiClientTest.java @@ -48,11 +48,10 @@ import org.junit.jupiter.api.Test; public class DefaultMantisApiClientTest { - WireMockRule mantisAPI; + WireMockRule mantisAPI = new WireMockRule(options().dynamicPort()); @BeforeEach public void setup() { - mantisAPI = new WireMockRule(options().dynamicPort()); mantisAPI.start(); } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java index e4bf30cd0..0be88d500 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/ContextualHttpSourceTest.java @@ -45,7 +45,6 @@ import mantis.io.reactivex.netty.client.RxClient.ServerInfo; import mantis.io.reactivex.netty.protocol.http.sse.ServerSentEvent; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -138,7 +137,7 @@ public void call() { } assertEquals(localServerProvider.serverSize(), connectedServers.size(), "There should be as many as provided servers"); - Assertions.assertEquals(counter.get(), RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize(), String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize())); + assertEquals(counter.get(), RequestProcessor.smallStreamContent.size() * localServerProvider.serverSize(), String.format("%d servers => the result has %d times of a single stream", localServerProvider.serverSize(), localServerProvider.serverSize())); for (String data : RequestProcessor.smallStreamContent) { assertEquals(localServerProvider.serverSize(), result.get(data).get(), String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize())); } diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java index 1b055f9db..0c923f69e 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/HttpSourceTest.java @@ -139,13 +139,17 @@ public void call() { fail(String.format("Waited at least %d seconds for the test to finish. Something is wrong", waitSeconds)); } - Assertions.assertEquals(localServerProvider.serverSize(), - counter.get(), String.format("%d servers => the result has %d times of a single echo", + assertEquals( + localServerProvider.serverSize(), + counter.get(), + String.format("%d servers => the result has %d times of a single echo", localServerProvider.serverSize(), localServerProvider.serverSize())); - assertEquals(localServerProvider.serverSize(), - result.get(postContent).get(), String.format("%d servers => %d identical copies per message", + assertEquals( + localServerProvider.serverSize(), + result.get(postContent).get(), + String.format("%d servers => %d identical copies per message", localServerProvider.serverSize(), localServerProvider.serverSize())); diff --git a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java index 071a1eaf8..a0e1064d2 100644 --- a/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java +++ b/mantis-runtime/src/test/java/io/mantisrx/runtime/source/http/impl/HttpSourceImplTest.java @@ -279,8 +279,9 @@ public void call() { .subscribe(); done.await(3000, TimeUnit.SECONDS); - assertEquals(localServerProvider.serverSize(), - counter.get(), + assertEquals( + localServerProvider.serverSize(), + counter.get(), String.format("There should be exactly one response from each of the %d servers", localServerProvider.serverSize())); for (Server server : localServerProvider.getServers()) { @@ -576,23 +577,24 @@ public void call() { if (!done.await(5, TimeUnit.SECONDS)) { fail(String.format("All streaming should be done within %d seconds. ", wait)); } - assertEquals(maxRepeat * localServerProvider.serverSize(), - counter.get(), + assertEquals( + maxRepeat * localServerProvider.serverSize(), + counter.get(), String.format("There should be exactly %d response from each of the %d servers", maxRepeat, localServerProvider.serverSize())); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); - assertEquals(maxRepeat, - sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED), + assertEquals( + maxRepeat, + sourceObserver.getCount(serverInfo, EventType.SOURCE_COMPLETED), String.format("There should be %d completion per server as resumption function should called %d times", maxRepeat, maxRepeat - 1)); assertEquals(0, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_FAILED), "There should be no error"); - assertEquals(10, - sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), String.format("Connection per server should have been established %d times", maxRepeat)); + assertEquals(10, sourceObserver.getCount(serverInfo, EventType.SUBSCRIPTION_ESTABLISHED), String.format("Connection per server should have been established %d times", maxRepeat)); } assertEquals(1, sourceObserver.getCompletionCount(), @@ -605,13 +607,13 @@ public void call() { assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(CONNECTION_UNSUBSCRIBED), "Each connection should be unsubscribed once by the subscriber"); for (EventType eventType : new EventType[] {EventType.SOURCE_COMPLETED, EventType.SUBSCRIPTION_ESTABLISHED, EventType.CONNECTION_ATTEMPTED, EventType.CONNECTION_ESTABLISHED}) { - assertEquals(maxRepeat * localServerProvider.serverSize(), - sourceObserver.getEventCount(eventType), String.format("Event %s should be recorded exactly %d times per server", eventType, maxRepeat)); + assertEquals(maxRepeat * localServerProvider.serverSize(), sourceObserver.getEventCount(eventType), String.format("Event %s should be recorded exactly %d times per server", eventType, maxRepeat)); } - assertEquals(localServerProvider.serverSize(), - sourceObserver.getEventCount(EventType.SERVER_FOUND), + assertEquals( + localServerProvider.serverSize(), + sourceObserver.getEventCount(EventType.SERVER_FOUND), "Event SERVER_FOUND should be recorded exactly once per server"); } @@ -699,9 +701,11 @@ public void call() { for (ServerInfo server : resumptionCounts.keySet()) { assertTrue(maxRepeat > resumptionCounts.get(server).get(), String.format("The server %s:%s should be resumed fewer than %d times", server.getHost(), server.getPort(), maxRepeat)); } - assertTrue((cutOff + 1) * localServerProvider.serverSize() <= counter.get(), String.format("There should be at least %d response from each of the %d servers", - cutOff + 1, - localServerProvider.serverSize())); + assertTrue( + (cutOff + 1) * localServerProvider.serverSize() <= counter.get(), + String.format("There should be at least %d response from each of the %d servers", + cutOff + 1, + localServerProvider.serverSize())); for (Server server : localServerProvider.getServers()) { ServerInfo serverInfo = toServerInfo(server); @@ -729,13 +733,15 @@ public void call() { assertEquals(localServerProvider.serverSize(), sourceObserver.getEventCount(CONNECTION_UNSUBSCRIBED), "Each connection should be unsubscribed once by the subscriber"); for (EventType eventType : new EventType[] {EventType.SOURCE_COMPLETED, EventType.SUBSCRIPTION_ESTABLISHED, EventType.CONNECTION_ATTEMPTED, EventType.CONNECTION_ESTABLISHED}) { - assertTrue((cutOff + 1) * localServerProvider.serverSize() <= sourceObserver.getEventCount(eventType), + assertTrue( + (cutOff + 1) * localServerProvider.serverSize() <= sourceObserver.getEventCount(eventType), String.format("Event %s should be recorded at least %d times per server", eventType, cutOff)); } for (EventType eventType : new EventType[] {EventType.SERVER_FOUND, EventType.SUBSCRIPTION_CANCELED}) { - assertEquals(localServerProvider.serverSize(), - sourceObserver.getEventCount(eventType), + assertEquals( + localServerProvider.serverSize(), + sourceObserver.getEventCount(eventType), String.format("Event %s should be recorded exactly once per server", eventType)); } } From 456ee55d12b5749d2dbb4a47a1420835a1554f1e Mon Sep 17 00:00:00 2001 From: Shreyaa Sharma Date: Mon, 10 Apr 2023 22:49:27 +0530 Subject: [PATCH 4/5] Revert mantis-control-plane-server to junit4 Upgrade mockito in mantis-server-worker --- build.gradle | 12 ++- .../mantis-control-plane-server/build.gradle | 2 +- .../master/api/akka/route/JacksonTest.java | 4 +- .../route/LeaderRedirectionFilterTest.java | 6 +- .../route/LeaderRedirectionRouteTest.java | 16 ++-- .../route/pagination/ListObjectTests.java | 75 +++++++++---------- .../akka/route/utils/JobRouteUtilsTest.java | 4 +- .../akka/route/v0/AgentClusterRouteTest.java | 16 ++-- .../akka/route/v0/JobClusterRouteTest.java | 16 ++-- .../api/akka/route/v0/JobRouteTest.java | 8 +- .../route/v0/MasterDescriptionRouteTest.java | 6 +- .../akka/route/v1/AdminMasterRouteTest.java | 16 ++-- .../akka/route/v1/AgentClustersRouteTest.java | 16 ++-- .../akka/route/v1/JobArtifactSerdeTest.java | 4 +- .../akka/route/v1/JobClustersRouteTest.java | 14 ++-- .../route/v1/JobDiscoveryStreamRouteTest.java | 10 +-- .../api/akka/route/v1/JobsRouteTest.java | 10 +-- ...urceClusterNonLeaderRedirectRouteTest.java | 6 +- .../api/akka/route/v1/RouteTestBase.java | 16 ++-- .../master/events/WorkerRegistryV2Test.java | 18 ++--- .../master/jobcluster/JobClusterTest.java | 37 ++++----- .../jobcluster/JobDefinitionResolverTest.java | 8 +- .../master/jobcluster/JobManagerTest.java | 14 ++-- .../master/jobcluster/LabelCacheTest.java | 4 +- .../master/jobcluster/LabelManagerTest.java | 4 +- .../master/jobcluster/SLAEnforcerTest.java | 8 +- .../jobcluster/job/JobClusterManagerTest.java | 44 ++++++----- .../jobcluster/job/JobScaleUpDownTests.java | 18 ++--- .../master/jobcluster/job/JobTestHelper.java | 8 +- .../jobcluster/job/JobTestLifecycle.java | 16 ++-- .../jobcluster/job/JobTestMigrationTests.java | 14 ++-- .../master/jobcluster/job/JobTestTimeout.java | 16 ++-- .../job/MantisJobMetadataViewTest.java | 6 +- .../job/WorkerResubmitRateLimiterTest.java | 4 +- .../DisableTaskExecutorsRequestTest.java | 6 +- .../ExecutorStateManagerTests.java | 12 +-- .../ResourceClusterActorTest.java | 57 +++++++------- .../ResourceClusterScalerActorTests.java | 20 ++--- ...ResourceClustersHostManagerActorTests.java | 12 +-- .../TaskExecutorStateTest.java | 12 +-- ...impleFileResourceStorageProviderTests.java | 21 +++--- .../scheduler/AgentsErrorMonitorTest.java | 16 ++-- .../master/domain/DataFormatAdapterTest.java | 8 +- .../master/domain/JobClusterConfigTest.java | 27 +++---- .../server/master/domain/JobIdTest.java | 4 +- .../persistence/FileBasedStoreTest.java | 12 +-- .../mantis-server-worker/build.gradle | 2 +- .../worker/jobmaster/JobAutoScalerTest.java | 4 +- .../jobmaster/WorkerMetricHandlerTest.java | 4 +- 49 files changed, 347 insertions(+), 346 deletions(-) diff --git a/build.gradle b/build.gradle index af074a60f..d230395c7 100644 --- a/build.gradle +++ b/build.gradle @@ -38,9 +38,11 @@ ext.versions = [ flink : "1.14.2", hadoop : "2.7.7", jsr305 : "3.0.1", + junit4 : "4.11", junit5 : "5.4.+", mockito : "2.0.+", mockito3 : "3.+", + mockito4 : "4.8.+", spectator: "1.3.+", slf4j : "1.7.0", vavr : "0.9.2", @@ -57,6 +59,11 @@ ext.libraries = [ flinkRpcImpl : [ "org.apache.flink:flink-rpc-akka:${versions.flink}", ], + junit4 : [ + "junit:junit:${versions.junit4}", + "junit:junit-dep:${versions.junit4}", + "org.junit.vintage:junit-vintage-engine:${versions.junit5}", + ], hadoopCommon : "org.apache.hadoop:hadoop-common:${versions.hadoop}", hadoopS3 : "org.apache.hadoop:hadoop-aws:${versions.hadoop}", jsr305 : "com.google.code.findbugs:jsr305:${versions.jsr305}", // For Nonnull annotation @@ -69,6 +76,7 @@ ext.libraries = [ mockitoAll : "org.mockito:mockito-all:${versions.mockito}", mockitoCore : "org.mockito:mockito-core:${versions.mockito}", mockitoCore3 : "org.mockito:mockito-core:${versions.mockito3}", + mockitoCore4 : "org.mockito:mockito-core:${versions.mockito4}", mockneat : "net.andreinc:mockneat:0.4.8", rxJava : "io.reactivex:rxjava:1.3.8", rxNettyShaded : "com.netflix:mantis-rxnetty:0.4.19.1", @@ -158,7 +166,9 @@ subprojects { } test { - useJUnitPlatform() + useJUnitPlatform { + includeEngines 'junit-jupiter', 'junit-vintage' + } } } diff --git a/mantis-control-plane/mantis-control-plane-server/build.gradle b/mantis-control-plane/mantis-control-plane-server/build.gradle index ff19d321c..af01c2a28 100644 --- a/mantis-control-plane/mantis-control-plane-server/build.gradle +++ b/mantis-control-plane/mantis-control-plane-server/build.gradle @@ -55,7 +55,7 @@ dependencies { testImplementation "com.typesafe.akka:akka-testkit_$scalaBinaryVersion:$akkaVersion" testImplementation "com.typesafe.akka:akka-http-testkit_$scalaBinaryVersion:$akkaHttpVersion" - testImplementation libraries.junitJupiter + testImplementation libraries.junit4 testImplementation libraries.mockitoCore3 testImplementation "org.testng:testng:$testngVersion" testImplementation testFixtures(project(":mantis-common")) diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java index 8d003f140..2586fb4ed 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/JacksonTest.java @@ -16,7 +16,7 @@ package io.mantisrx.master.api.akka.route; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.Assert.*; import io.mantisrx.common.Ack; import io.mantisrx.master.jobcluster.job.MantisJobMetadataView; @@ -30,7 +30,7 @@ import java.io.ObjectOutputStream; import java.util.List; import java.util.Optional; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JacksonTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java index a1e24a40a..4eb6c27e0 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionFilterTest.java @@ -16,8 +16,8 @@ package io.mantisrx.master.api.akka.route; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import akka.http.javadsl.server.AllDirectives; import akka.http.javadsl.server.Route; @@ -27,7 +27,7 @@ import io.mantisrx.server.master.ILeadershipManager; import io.mantisrx.server.master.LeaderRedirectionFilter; import io.mantisrx.server.master.LeadershipManagerLocalImpl; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class LeaderRedirectionFilterTest extends AllDirectives { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java index 6986ad36b..95bc1bbf0 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/LeaderRedirectionRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import akka.NotUsed; import akka.actor.ActorSystem; @@ -46,9 +46,9 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -99,7 +99,7 @@ private String getResponseMessage(final String msg, final Throwable t) { private static final MasterMonitor masterMonitor = new LocalMasterMonitor(fakeMasterDesc); private static final ILeadershipManager leadershipMgr = new LeadershipManagerLocalImpl(fakeMasterDesc); - @BeforeAll + @BeforeClass public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -131,7 +131,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("MasterDescriptionRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java index 028ad4383..0ec49ddc5 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/pagination/ListObjectTests.java @@ -16,33 +16,30 @@ package io.mantisrx.master.api.akka.route.pagination; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; import java.util.Random; -import org.junit.jupiter.api.Test; +import org.junit.Test; import scala.Tuple1; public class ListObjectTests { private static final Random rnd = new Random(System.currentTimeMillis()); - @Test + @Test(expected = RuntimeException.class) public void testSortingByInvalidFieldName() { - assertThrows(RuntimeException.class, () -> { - try { - ListObject listobject = new ListObject.Builder() - .withObjects(generateList(10), TestObject.class) - .withSortField("invalidValue") - .withSortAscending(true) - .build(); - } catch (Exception e) { - assertTrue(e.getMessage().contains("Specified sort field is invalid.")); - throw e; - } - }); + try { + ListObject listobject = new ListObject.Builder() + .withObjects(generateList(10), TestObject.class) + .withSortField("invalidValue") + .withSortAscending(true) + .build(); + } catch (Exception e) { + assertTrue(e.getMessage().contains("Specified sort field is invalid.")); + throw e; + } } @Test @@ -113,20 +110,18 @@ public void testSortingByPublicValueFieldNameDescending() { } } - @Test + @Test(expected = RuntimeException.class) public void testSortingByPrivateValueFieldName() { - assertThrows(RuntimeException.class, () -> { - try { - ListObject listobject = new ListObject.Builder() - .withObjects(generateList(10), TestObject.class) - .withSortField("privateValue") - .withSortAscending(true) - .build(); - } catch (Exception e) { - assertTrue(e.getMessage().contains("Cannot access sort field.")); - throw e; - } - }); + try { + ListObject listobject = new ListObject.Builder() + .withObjects(generateList(10), TestObject.class) + .withSortField("privateValue") + .withSortAscending(true) + .build(); + } catch (Exception e) { + assertTrue(e.getMessage().contains("Cannot access sort field.")); + throw e; + } } @Test @@ -179,19 +174,17 @@ public void testPaginationLimit() { .build().list.size() == 5); } - @Test + @Test(expected = IllegalStateException.class) public void testPaginationInvalidLimit() { - assertThrows(IllegalStateException.class, () -> { - try { - int size = new ListObject.Builder() - .withObjects(generateList(10), TestObject.class) - .withLimit(-1) - .build().list.size(); - } catch (Exception e) { - assertTrue(e.getMessage().contains("limit needs to be greater than 0")); - throw e; - } - }); + try { + int size = new ListObject.Builder() + .withObjects(generateList(10), TestObject.class) + .withLimit(-1) + .build().list.size(); + } catch (Exception e) { + assertTrue(e.getMessage().contains("limit needs to be greater than 0")); + throw e; + } } @Test diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java index bd16b6fc3..3ad88a410 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/utils/JobRouteUtilsTest.java @@ -16,7 +16,7 @@ package io.mantisrx.master.api.akka.route.utils; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.Assert.assertEquals; import io.mantisrx.master.jobcluster.job.JobState; import io.mantisrx.master.jobcluster.job.worker.WorkerState; @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JobRouteUtilsTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java index f6c22e1aa..518465f0c 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/AgentClusterRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v0; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -68,9 +68,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observer; @@ -111,7 +111,7 @@ private String getResponseMessage(final String msg, final Throwable t) { private static CompletionStage binding; private static ActorSystem system = ActorSystem.create("AgentClusterRoutes"); - @BeforeAll + @BeforeClass public static void setup() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); t = new Thread(() -> { @@ -156,7 +156,7 @@ public static void setup() throws InterruptedException { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("V0AgentClusterRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java index 6f085267f..c717dd7c4 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobClusterRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v0; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -71,9 +71,9 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -112,7 +112,7 @@ private String getResponseMessage(final String msg, final Throwable t) { private static CompletionStage binding; private static ActorSystem system = ActorSystem.create("JobClusterRoutes"); - @BeforeAll + @BeforeClass public static void setup() throws Exception { TestHelpers.setupMasterConfig(); final CountDownLatch latch = new CountDownLatch(1); @@ -152,7 +152,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("V0JobClusterRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java index b806f9f5b..67cd06ec7 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/JobRouteTest.java @@ -16,10 +16,10 @@ package io.mantisrx.master.api.akka.route.v0; -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 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.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java index 67049e6e8..3cc525a10 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v0/MasterDescriptionRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v0; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import akka.NotUsed; import akka.actor.ActorSystem; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java index ad6e84cb8..b35e12eff 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AdminMasterRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v1; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import akka.NotUsed; import akka.http.javadsl.ConnectHttp; @@ -38,9 +38,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,7 +70,7 @@ public AdminMasterRouteTest(){ super("MasterDescriptionRouteTest", 8205); } - @BeforeAll + @BeforeClass public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -98,7 +98,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("MasterDescriptionRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java index d5922e792..2bee8e84f 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/AgentClustersRouteTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v1; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -67,9 +67,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observer; @@ -92,7 +92,7 @@ public AgentClustersRouteTest() { super("AgentClusterRoutes", 8202); } - @BeforeAll + @BeforeClass public static void setup() throws InterruptedException { TestHelpers.setupMasterConfig(); final CountDownLatch latch = new CountDownLatch(1); @@ -150,7 +150,7 @@ public static void setup() throws InterruptedException { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("V1AgentClusterRouteTest teardown"); binding diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java index f8a5ec897..5d07ffba9 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobArtifactSerdeTest.java @@ -16,7 +16,7 @@ package io.mantisrx.master.api.akka.route.v1; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.Assert.assertEquals; import io.mantisrx.master.api.akka.route.Jackson; import io.mantisrx.server.core.domain.ArtifactID; @@ -29,7 +29,7 @@ import io.mantisrx.shaded.com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.time.Instant; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JobArtifactSerdeTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java index 08b8b3534..41171342e 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobClustersRouteTest.java @@ -16,8 +16,8 @@ package io.mantisrx.master.api.akka.route.v1; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -60,9 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,7 +80,7 @@ public JobClustersRouteTest() { super("JobClustersRouteTest", SERVER_PORT); } - @BeforeAll + @BeforeClass public static void setup() throws Exception { TestHelpers.setupMasterConfig(); final CountDownLatch latch = new CountDownLatch(1); @@ -133,7 +133,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterAll + @AfterClass public static void tearDown() throws Exception { logger.info("V1JobClusterRouteTest teardown"); binding.thenCompose(ServerBinding::unbind) // trigger unbinding from the port diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java index 47036b2de..7a5f14cea 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobDiscoveryStreamRouteTest.java @@ -52,9 +52,9 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.CountDownLatch; import java.util.function.Function; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rx.Observable; @@ -72,7 +72,7 @@ public JobDiscoveryStreamRouteTest(){ super("JobDiscoveryRoute", SERVER_PORT); } - @BeforeAll + @BeforeClass public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -117,7 +117,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("JobDiscoveryRouteTest teardown"); if (binding != null) { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java index 089201394..3ba5541ef 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/JobsRouteTest.java @@ -79,9 +79,9 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.CountDownLatch; import java.util.function.Function; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.util.Strings; @@ -100,7 +100,7 @@ public JobsRouteTest() { super("JobsRoute", SERVER_PORT); } - @BeforeAll + @BeforeClass public static void setup() throws Exception { JobTestHelper.deleteAllFiles(); JobTestHelper.createDirsIfRequired(); @@ -237,7 +237,7 @@ public static void setup() throws Exception { latch.await(); } - @AfterAll + @AfterClass public static void teardown() { logger.info("V1JobsRouteTest teardown"); binding.thenCompose(ServerBinding::unbind) // trigger unbinding from the port diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java index 6b5c6be60..222bcdc0b 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/ResourceClusterNonLeaderRedirectRouteTest.java @@ -77,8 +77,8 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.BeforeClass; +import org.junit.Test; import org.mockito.ArgumentMatchers; public class ResourceClusterNonLeaderRedirectRouteTest extends JUnitRouteTest { @@ -114,7 +114,7 @@ resourceProviderAdapter, new InMemoryOnlyResourceClusterStorageProvider()), testRoute(new ResourceClustersNonLeaderRedirectRoute(resourceClusters, resourceClusterRouteHandlerWithTestAdapter, system) .createRoute(route -> route)); - @BeforeAll + @BeforeClass public static void init() { TestHelpers.setupMasterConfig(); } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java index d901b9def..7684487dc 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/api/akka/route/v1/RouteTestBase.java @@ -16,9 +16,9 @@ package io.mantisrx.master.api.akka.route.v1; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import akka.actor.ActorSystem; import akka.http.javadsl.Http; @@ -37,8 +37,8 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.util.Strings; @@ -54,7 +54,7 @@ public abstract class RouteTestBase { static ResponseValidatorFunc EMPTY_RESPONSE_VALIDATOR = (msg) -> { - assertTrue(Strings.isNullOrEmpty(msg), String.format("response [%s] is not empty", msg)); + assertTrue(String.format("response [%s] is not empty", msg), Strings.isNullOrEmpty(msg)); }; RouteTestBase(String testName, int port) { @@ -65,14 +65,14 @@ public abstract class RouteTestBase { this.serverPort = port; } - @BeforeAll + @BeforeClass public static void setupActorSystem() { system = ActorSystem.create(); materializer = Materializer.createMaterializer(system); http = Http.get(system); } - @AfterAll + @AfterClass public static void tearDownActorSystem() { try { http.shutdownAllConnectionPools(); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java index 9c0ddd703..dc118a511 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/events/WorkerRegistryV2Test.java @@ -19,10 +19,10 @@ import static io.mantisrx.master.events.LifecycleEventsProto.StatusEvent.StatusEventType.INFO; import static io.mantisrx.master.jobcluster.job.worker.MantisWorkerMetadataImpl.MANTIS_SYSTEM_ALLOCATED_NUM_PORTS; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -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 static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import akka.actor.ActorRef; @@ -53,9 +53,9 @@ import io.mantisrx.shaded.com.google.common.collect.Lists; import java.util.*; import java.util.concurrent.*; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; public class WorkerRegistryV2Test { @@ -67,7 +67,7 @@ public class WorkerRegistryV2Test { private static final String user = "mantis"; - @BeforeAll + @BeforeClass public static void setup() { system = ActorSystem.create(); @@ -80,7 +80,7 @@ public static void setup() { } - @AfterAll + @AfterClass public static void tearDown() { //((SimpleCachedFileStorageProvider)storageProvider).deleteAllFiles(); //JobTestHelper.deleteAllFiles(); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java index 2462f5d70..0ce1845ec 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobClusterTest.java @@ -52,10 +52,10 @@ import static io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyResponse; import static java.util.Optional.empty; import static java.util.Optional.of; -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 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.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doAnswer; @@ -133,12 +133,13 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; import org.mockito.stubbing.Answer; import rx.schedulers.Schedulers; @@ -159,10 +160,10 @@ public class JobClusterTest { private IMantisPersistenceProvider storageProvider; private static LifecycleEventPublisher eventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); private static final String user = "mantis"; - @TempDir - File rootDir; + @Rule + public TemporaryFolder rootDir = new TemporaryFolder(); - @BeforeAll + @BeforeClass public static void setup() { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -177,17 +178,17 @@ public static void setup() { TestHelpers.setupMasterConfig(); } - @AfterAll + @AfterClass public static void tearDown() { JobTestHelper.deleteAllFiles(); TestKit.shutdownActorSystem(system); system = null; } - @BeforeEach + @Before public void setupStorageProvider() { storageProvider = new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir), + new FileBasedStore(rootDir.getRoot()), eventPublisher); jobStore = new MantisJobStore(storageProvider); } @@ -1180,7 +1181,7 @@ public void testJobSubmitWithVersionAndNoSchedInfo() { } - @Disabled + @Ignore @Test public void testJobComplete() { TestKit probe = new TestKit(system); @@ -1441,7 +1442,7 @@ public void testJobSubmitTriggersSLAToKillOldHandlesErrors() { /** * {@see Github issue for more context} */ - @Disabled + @Ignore @Test public void testCronTriggersSLAToKillOld() { TestKit probe = new TestKit(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java index 2f0860a2f..2b7cf2df1 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobDefinitionResolverTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.jobcluster; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import io.mantisrx.common.Label; import io.mantisrx.runtime.JobConstraints; @@ -36,7 +36,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JobDefinitionResolverTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java index bced1fb69..b3dec2156 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/JobManagerTest.java @@ -17,10 +17,10 @@ package io.mantisrx.master.jobcluster; import static java.util.Optional.empty; -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 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.mockito.Mockito.*; import akka.actor.AbstractActor; @@ -39,8 +39,8 @@ import java.time.Instant; import java.util.List; import java.util.Optional; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.BeforeClass; +import org.junit.Test; public class JobManagerTest { @@ -48,7 +48,7 @@ public class JobManagerTest { private static AbstractActor.ActorContext context; private static MantisSchedulerFactory schedulerFactory; private static LifecycleEventPublisher publisher; - @BeforeAll + @BeforeClass public static void setup() { jobStore = mock(MantisJobStore.class); context = mock(AbstractActor.ActorContext.class); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java index f09b18853..82de9f1ce 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelCacheTest.java @@ -16,14 +16,14 @@ package io.mantisrx.master.jobcluster; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.Assert.*; import io.mantisrx.common.Label; import io.mantisrx.server.master.domain.JobId; import java.util.ArrayList; import java.util.List; import java.util.Set; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class LabelCacheTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java index f213448b8..7f8e9244d 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/LabelManagerTest.java @@ -17,7 +17,7 @@ package io.mantisrx.master.jobcluster; import static io.mantisrx.master.jobcluster.LabelManager.SystemLabels.*; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.Assert.assertEquals; import io.mantisrx.common.Label; import io.mantisrx.runtime.JobSla; @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class LabelManagerTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java index a4d4c3761..152206e84 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/SLAEnforcerTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.jobcluster; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import io.mantisrx.master.jobcluster.JobClusterActor.JobInfo; import io.mantisrx.master.jobcluster.job.JobState; @@ -28,7 +28,7 @@ import java.util.List; import java.util.Set; import org.joda.time.Instant; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class SLAEnforcerTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java index ae99b263a..aff29817d 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobClusterManagerTest.java @@ -26,11 +26,11 @@ import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS_CREATED; import static java.util.Optional.empty; import static java.util.Optional.of; -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 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.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; @@ -101,7 +101,6 @@ import io.mantisrx.server.master.scheduler.WorkerLaunched; import io.mantisrx.server.master.store.FileBasedStore; import io.mantisrx.shaded.com.google.common.collect.Lists; -import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.time.Duration; @@ -110,11 +109,13 @@ import java.util.Optional; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -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.junit.jupiter.api.io.TempDir; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.rules.Timeout; import org.mockito.Mockito; import rx.schedulers.Schedulers; import rx.subjects.BehaviorSubject; @@ -131,10 +132,13 @@ public class JobClusterManagerTest { new WorkerEventSubscriberLoggingImpl()); private static final String user = "nj"; - @TempDir - File rootDir; + @Rule + public TemporaryFolder rootDir = new TemporaryFolder(); - @BeforeAll + @Rule + public Timeout globalTimeout = new Timeout(2000); + + @BeforeClass public static void setup() { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -149,7 +153,7 @@ public static void setup() { TestHelpers.setupMasterConfig(); } - @BeforeEach + @Before public void setupState() { jobStoreMock = mock(MantisJobStore.class); schedulerMockFactory = mock(MantisSchedulerFactory.class); @@ -163,7 +167,7 @@ public void setupState() { true), ActorRef.noSender()); } - @AfterAll + @AfterClass public static void tearDown() { JobTestHelper.deleteAllFiles(); TestKit.shutdownActorSystem(system); @@ -259,7 +263,7 @@ private void createJobClusterAndAssert( "user"), probe.getRef()); JobClusterManagerProto.CreateJobClusterResponse resp = probe.expectMsgClass( JobClusterManagerProto.CreateJobClusterResponse.class); - assertEquals(SUCCESS_CREATED, resp.responseCode, resp.toString()); + assertEquals(resp.toString(), SUCCESS_CREATED, resp.responseCode); } private void submitJobAndAssert(ActorRef jobClusterManagerActor, String cluster) { @@ -291,7 +295,7 @@ public void testBootStrapJobClustersAndJobs1() { TestKit probe = new TestKit(system); JobTestHelper.deleteAllFiles(); MantisJobStore jobStore = new MantisJobStore(new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir), + new FileBasedStore(rootDir.getRoot()), eventPublisher)); MantisJobStore jobStoreSpied = Mockito.spy(jobStore); // MantisScheduler schedulerMock = mock(MantisScheduler.class); @@ -389,7 +393,7 @@ public void testBootStrapJobClustersAndJobs() { TestKit probe = new TestKit(system); JobTestHelper.deleteAllFiles(); MantisJobStore jobStore = new MantisJobStore(new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir), + new FileBasedStore(rootDir.getRoot()), eventPublisher)); MantisJobStore jobStoreSpied = Mockito.spy(jobStore); ActorRef jobClusterManagerActor = system.actorOf(JobClustersManagerActor.props( @@ -636,7 +640,7 @@ public void testBootstrapJobClusterAndJobsWithCorruptedWorkerPorts() TestKit probe = new TestKit(system); JobTestHelper.deleteAllFiles(); MantisJobStore jobStore = new MantisJobStore(new KeyValueBasedPersistenceProvider( - new FileBasedStore(rootDir), + new FileBasedStore(rootDir.getRoot()), eventPublisher)); MantisJobStore jobStoreSpied = Mockito.spy(jobStore); // MantisScheduler schedulerMock = mock(MantisScheduler.class); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java index 3f4a18198..16c6a48bd 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobScaleUpDownTests.java @@ -33,10 +33,10 @@ package io.mantisrx.master.jobcluster.job; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -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 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.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -79,9 +79,9 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import rx.schedulers.Schedulers; import rx.subjects.BehaviorSubject; @@ -90,14 +90,14 @@ public class JobScaleUpDownTests { static ActorSystem system; final LifecycleEventPublisher lifecycleEventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); - @BeforeAll + @BeforeClass public static void setup() { system = ActorSystem.create(); TestHelpers.setupMasterConfig(); } - @AfterAll + @AfterClass public static void tearDown() { TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java index 3cbc26630..a6354a67c 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestHelper.java @@ -17,9 +17,9 @@ package io.mantisrx.master.jobcluster.job; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -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.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import akka.actor.ActorRef; import akka.actor.ActorSystem; @@ -61,7 +61,7 @@ import java.time.Duration; import java.time.Instant; import java.util.Optional; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JobTestHelper { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java index 47a9bf7cf..09006c69e 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestLifecycle.java @@ -20,9 +20,9 @@ import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SERVER_ERROR; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; import static java.util.Optional.empty; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.timeout; @@ -68,9 +68,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import org.mockito.InOrder; import org.mockito.Mockito; @@ -83,7 +83,7 @@ public class JobTestLifecycle { private static final String user = "mantis"; - @BeforeAll + @BeforeClass public static void setup() { system = ActorSystem.create(); @@ -92,7 +92,7 @@ public static void setup() { jobStore = new MantisJobStore(storageProvider); } - @AfterAll + @AfterClass public static void tearDown() { JobTestHelper.deleteAllFiles(); TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java index 5758e87bf..9b1f92be2 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestMigrationTests.java @@ -17,8 +17,8 @@ package io.mantisrx.master.jobcluster.job; import static io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import akka.actor.ActorRef; @@ -53,9 +53,9 @@ import java.util.Optional; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; @@ -68,7 +68,7 @@ public class JobTestMigrationTests { final LifecycleEventPublisher eventPublisher = new LifecycleEventPublisherImpl(new AuditEventSubscriberLoggingImpl(), new StatusEventSubscriberLoggingImpl(), new WorkerEventSubscriberLoggingImpl()); - @BeforeAll + @BeforeClass public static void setup() { system = ActorSystem.create(); @@ -76,7 +76,7 @@ public static void setup() { } - @AfterAll + @AfterClass public static void tearDown() { //((SimpleCachedFileStorageProvider)storageProvider).deleteAllFiles(); TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java index afbc529ac..046cd318a 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/JobTestTimeout.java @@ -15,15 +15,15 @@ */ //package io.mantisrx.master.jobcluster.job; // -//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 static org.junit.Assert.assertFalse; +//import static org.junit.Assert.assertTrue; +//import static org.junit.Assert.fail; // //import java.time.Instant; // -//import org.junit.jupiter.api.AfterAll; -//import org.junit.jupiter.api.BeforeAll; -//import org.junit.jupiter.api.Test; +//import org.junit.AfterClass; +//import org.junit.BeforeClass; +//import org.junit.Test; // //import com.google.common.collect.Lists; // @@ -51,7 +51,7 @@ // private static final String user = "mantis"; // private static IJobClusterDefinition jobClusterDefn ; // -// @BeforeAll +// @BeforeClass // public static void setup() { // system = ActorSystem.create(); // @@ -87,7 +87,7 @@ // // } // -// @AfterAll +// @AfterClass // public static void tearDown() { // ((SimpleCachedFileStorageProvider)storageProvider).deleteAllFiles(); // TestKit.shutdownActorSystem(system); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java index 373979989..2c04cf68a 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/MantisJobMetadataViewTest.java @@ -16,8 +16,8 @@ package io.mantisrx.master.jobcluster.job; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import io.mantisrx.master.api.akka.payloads.PayloadUtils; import io.mantisrx.server.master.domain.DataFormatAdapter; @@ -27,7 +27,7 @@ import io.mantisrx.shaded.com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import java.util.Collections; -import org.junit.jupiter.api.Test; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java index 1fa8e7662..9559f6472 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/jobcluster/job/WorkerResubmitRateLimiterTest.java @@ -16,11 +16,11 @@ package io.mantisrx.master.jobcluster.job; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.Assert.*; import io.mantisrx.server.core.domain.WorkerId; import java.util.List; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class WorkerResubmitRateLimiterTest { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java index d86ed646b..ab276c005 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/DisableTaskExecutorsRequestTest.java @@ -16,14 +16,14 @@ package io.mantisrx.master.resourcecluster; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import io.mantisrx.server.master.resourcecluster.ClusterID; import io.mantisrx.shaded.com.google.common.collect.ImmutableMap; import java.time.Duration; import java.time.Instant; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class DisableTaskExecutorsRequestTest { private static final DisableTaskExecutorsRequest R1 = diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java index 26da803f5..755f045ec 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ExecutorStateManagerTests.java @@ -16,9 +16,9 @@ package io.mantisrx.master.resourcecluster; -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.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import io.mantisrx.common.WorkerPorts; @@ -43,8 +43,8 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.lang3.tuple.Pair; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.Before; +import org.junit.Test; public class ExecutorStateManagerTests { private final AtomicReference actual = @@ -111,7 +111,7 @@ public class ExecutorStateManagerTests { private final ExecutorStateManager stateManager = new ExecutorStateManagerImpl(); - @BeforeEach + @Before public void setup() { rpc.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java index 362f909e8..a952edcca 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterActorTest.java @@ -16,9 +16,8 @@ package io.mantisrx.master.resourcecluster; -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 static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -68,10 +67,10 @@ import java.util.Optional; import java.util.concurrent.ExecutionException; import org.apache.flink.util.ExceptionUtils; -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.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Matchers; @@ -156,18 +155,18 @@ public class ResourceClusterActorTest { private ResourceCluster resourceCluster; private JobMessageRouter jobMessageRouter; - @BeforeAll + @BeforeClass public static void setup() { actorSystem = ActorSystem.create(); } - @AfterAll + @AfterClass public static void teardown() { TestKit.shutdownActorSystem(actorSystem); actorSystem = null; } - @BeforeEach + @Before public void setupRpcService() { rpcService.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); mantisJobStore = mock(MantisJobStore.class); @@ -175,7 +174,7 @@ public void setupRpcService() { jobMessageRouter = mock(JobMessageRouter.class); } - @BeforeEach + @Before public void setupActor() { final Props props = ResourceClusterActor.props( @@ -582,29 +581,27 @@ public void testIfTaskExecutorsThatWereRunningTasksPreviouslyAndRunningCorrectly assertEquals(WORKER_ID, actualWorkerEvent.getWorkerId()); } - @Test + @Test(expected = TaskNotFoundException.class) public void testGetAssignedTaskExecutorAfterTaskCompletes() throws Throwable { - assertThrows(TaskNotFoundException.class, () -> { - assertEquals(Ack.getInstance(), resourceCluster.registerTaskExecutor(TASK_EXECUTOR_REGISTRATION).join()); - assertEquals( - Ack.getInstance(), - resourceCluster.heartBeatFromTaskExecutor( - new TaskExecutorHeartbeat(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); + assertEquals(Ack.getInstance(), resourceCluster.registerTaskExecutor(TASK_EXECUTOR_REGISTRATION).join()); + assertEquals( + Ack.getInstance(), + resourceCluster.heartBeatFromTaskExecutor( + new TaskExecutorHeartbeat(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); - assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorFor(MACHINE_DEFINITION, WORKER_ID).join()); - assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join()); - assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( - new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.occupied(WORKER_ID))).join()); + assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorFor(MACHINE_DEFINITION, WORKER_ID).join()); + assertEquals(TASK_EXECUTOR_ID, resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join()); + assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( + new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.occupied(WORKER_ID))).join()); - assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( - new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); + assertEquals(Ack.getInstance(), resourceCluster.notifyTaskExecutorStatusChange( + new TaskExecutorStatusChange(TASK_EXECUTOR_ID, CLUSTER_ID, TaskExecutorReport.available())).join()); - try { - TaskExecutorID result = resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join(); + try { + TaskExecutorID result = resourceCluster.getTaskExecutorAssignedFor(WORKER_ID).join(); - } catch (Exception e) { - throw ExceptionUtils.stripCompletionException(e); - } - }); + } catch (Exception e) { + throw ExceptionUtils.stripCompletionException(e); + } } } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java index 9dd7d5644..e37570262 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClusterScalerActorTests.java @@ -17,9 +17,9 @@ package io.mantisrx.master.resourcecluster; import static io.mantisrx.master.resourcecluster.ResourceClusterActorTest.actorSystem; -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.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -55,10 +55,10 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; -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.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; public class ResourceClusterScalerActorTests { private static final ClusterID CLUSTER_ID = ClusterID.of("clusterId"); @@ -78,18 +78,18 @@ public class ResourceClusterScalerActorTests { private static final MachineDefinition MACHINE_DEFINITION_M = new MachineDefinition(3, 4096, 700, 10240, 5); - @BeforeAll + @BeforeClass public static void setup() { actorSystem = ActorSystem.create(); } - @AfterAll + @AfterClass public static void teardown() { TestKit.shutdownActorSystem(actorSystem); actorSystem = null; } - @BeforeEach + @Before public void setupMocks() { clusterActorProbe = new TestKit(actorSystem); hostActorProbe = new TestKit(actorSystem); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java index f12ae4fa4..4cfdf15ed 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/ResourceClustersHostManagerActorTests.java @@ -16,7 +16,7 @@ package io.mantisrx.master.resourcecluster; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.any; import static org.mockito.Mockito.argThat; import static org.mockito.Mockito.atMost; @@ -50,14 +50,14 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import lombok.val; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; public class ResourceClustersHostManagerActorTests { static ActorSystem system; - @BeforeAll + @BeforeClass public static void setup() { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -68,7 +68,7 @@ public static void setup() { system = ActorSystem.create("ResourceClusterManagerUnitTest", config.withFallback(ConfigFactory.load())); } - @AfterAll + @AfterClass public static void tearDown() { TestKit.shutdownActorSystem(system); system = null; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java index c615d71cd..ddb7c399e 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/TaskExecutorStateTest.java @@ -16,9 +16,9 @@ package io.mantisrx.master.resourcecluster; -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.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import io.mantisrx.common.WorkerPorts; @@ -42,8 +42,8 @@ import java.time.ZoneId; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.Before; +import org.junit.Test; public class TaskExecutorStateTest { private final AtomicReference actual = @@ -68,7 +68,7 @@ public class TaskExecutorStateTest { ImmutableMap.of("attr1", "attr2"); private static final WorkerId WORKER_ID = WorkerId.fromIdUnsafe("late-sine-function-tutorial-1-worker-0-1"); - @BeforeEach + @Before public void setup() { rpc.registerGateway(TASK_EXECUTOR_ADDRESS, gateway); } diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java index 1ccdc9426..2f47f3d44 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/resourcecluster/resourceprovider/SimpleFileResourceStorageProviderTests.java @@ -16,8 +16,8 @@ package io.mantisrx.master.resourcecluster.resourceprovider; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import akka.actor.ActorSystem; import com.typesafe.config.Config; @@ -37,18 +37,19 @@ import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; @Slf4j public class SimpleFileResourceStorageProviderTests { static ActorSystem system; - @TempDir - File storageDirectory; + @Rule + public TemporaryFolder storageDirectory = new TemporaryFolder(); - @BeforeAll + @BeforeClass public static void setup() throws IOException { Config config = ConfigFactory.parseString("akka {\n" + " loggers = [\"akka.testkit.TestEventListener\"]\n" + @@ -63,7 +64,7 @@ public static void setup() throws IOException { public void testResourceClusterRules() throws ExecutionException, InterruptedException, IOException { final ClusterID clusterId = ClusterID.of("mantisRCMTest2"); final ContainerSkuID smallSkuId = ContainerSkuID.of("small"); - SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory); + SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory.newFolder("test")); ResourceClusterScaleSpec rule1 = ResourceClusterScaleSpec.builder() .clusterId(clusterId) @@ -160,7 +161,7 @@ public void testUpdateClusterSpec() throws ExecutionException, InterruptedExcept .id(spec.getId()) .build(); - SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory); + SimpleFileResourceClusterStorageProvider prov = new SimpleFileResourceClusterStorageProvider(system, storageDirectory.newFolder("test")); CompletionStage updateFut = prov.registerAndUpdateClusterSpec(specWritable); log.info("res: " + updateFut.toCompletableFuture().get()); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java index ebd9aa980..fa81031c9 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/master/scheduler/AgentsErrorMonitorTest.java @@ -17,9 +17,9 @@ package io.mantisrx.master.scheduler; import static io.mantisrx.master.scheduler.AgentsErrorMonitorActor.props; -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.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -33,9 +33,9 @@ import io.mantisrx.server.master.scheduler.MantisScheduler; import java.util.ArrayList; import java.util.List; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; import rx.functions.Action1; public class AgentsErrorMonitorTest { @@ -44,13 +44,13 @@ public class AgentsErrorMonitorTest { private static TestKit probe; - @BeforeAll + @BeforeClass public static void setup() { system = ActorSystem.create(); probe = new TestKit(system); } - @AfterAll + @AfterClass public static void tearDown() { TestKit.shutdownActorSystem(system); system = null; diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java index 98fbda2b3..683c078b9 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/DataFormatAdapterTest.java @@ -17,9 +17,9 @@ package io.mantisrx.server.master.domain; import static java.util.Optional.of; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import io.mantisrx.common.Label; import io.mantisrx.common.WorkerPorts; @@ -68,7 +68,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class DataFormatAdapterTest { public static final MachineDefinition DEFAULT_MACHINE_DEFINITION = new MachineDefinition(1, 10, 10, 10, 2); diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java index c62e4d8f3..34ec8d21f 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobClusterConfigTest.java @@ -16,16 +16,15 @@ package io.mantisrx.server.master.domain; -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.Assert.assertTrue; +import static org.junit.Assert.fail; import io.mantisrx.runtime.JobOwner; import io.mantisrx.runtime.MachineDefinition; import io.mantisrx.runtime.WorkerMigrationConfig; import io.mantisrx.runtime.descriptor.SchedulingInfo; import io.mantisrx.shaded.com.google.common.collect.Lists; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JobClusterConfigTest { @@ -56,18 +55,17 @@ public void happyTest() { fail(); } } - @Test + @Test(expected = Exception.class) public void noSchedInfoFails() { - assertThrows(Exception.class, () -> { - String name = "noSchedInfoFails"; + String name = "noSchedInfoFails"; - JobClusterConfig clusterConfig = new JobClusterConfig.Builder() + JobClusterConfig clusterConfig = new JobClusterConfig.Builder() .withArtifactName("myart") .withSchedulingInfo(null) .withVersion("0.0.1") .build(); - final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() + final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() .withJobClusterConfig(clusterConfig) .withName(name) .withParameters(Lists.newArrayList()) @@ -76,21 +74,19 @@ public void noSchedInfoFails() { .withOwner(new JobOwner("Nick", "Mantis", "desc", "nma@netflix.com", "repo")) .withMigrationConfig(WorkerMigrationConfig.DEFAULT) .build(); - }); } - @Test + @Test(expected = Exception.class) public void noArtifactNameFails() { - assertThrows(Exception.class, () -> { - String name = "noArtifactNameFails"; + String name = "noArtifactNameFails"; - JobClusterConfig clusterConfig = new JobClusterConfig.Builder() + JobClusterConfig clusterConfig = new JobClusterConfig.Builder() .withArtifactName(null) .withSchedulingInfo(DEFAULT_SCHED_INFO) .withVersion("0.0.1") .build(); - final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() + final JobClusterDefinitionImpl fakeJobCluster = new JobClusterDefinitionImpl.Builder() .withJobClusterConfig(clusterConfig) .withName(name) .withUser("nj") @@ -99,7 +95,6 @@ public void noArtifactNameFails() { .withOwner(new JobOwner("Nick", "Mantis", "desc", "nma@netflix.com", "repo")) .withMigrationConfig(WorkerMigrationConfig.DEFAULT) .build(); - }); } @Test public void noVersionAutogenerate() { diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java index e8cbbe061..4daf5b6cf 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/domain/JobIdTest.java @@ -16,10 +16,10 @@ package io.mantisrx.server.master.domain; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.Assert.assertEquals; import java.util.Optional; -import org.junit.jupiter.api.Test; +import org.junit.Test; public class JobIdTest { @Test diff --git a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java index 0aebfa8ad..631e4ef71 100644 --- a/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java +++ b/mantis-control-plane/mantis-control-plane-server/src/test/java/io/mantisrx/server/master/persistence/FileBasedStoreTest.java @@ -17,9 +17,9 @@ package io.mantisrx.server.master.persistence; import static io.mantisrx.master.jobcluster.job.worker.MantisWorkerMetadataImpl.MANTIS_SYSTEM_ALLOCATED_NUM_PORTS; -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.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import io.mantisrx.common.Label; import io.mantisrx.common.WorkerPorts; @@ -61,8 +61,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.Test; public class FileBasedStoreTest { private final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -70,7 +70,7 @@ public class FileBasedStoreTest { private final FileBasedStore fileProvider = new FileBasedStore(); - @AfterEach + @After public void tearDown() { fileProvider.reset(); } diff --git a/mantis-server/mantis-server-worker/build.gradle b/mantis-server/mantis-server-worker/build.gradle index 3bb738dbf..6d73b7cb6 100644 --- a/mantis-server/mantis-server-worker/build.gradle +++ b/mantis-server/mantis-server-worker/build.gradle @@ -44,7 +44,7 @@ dependencies { implementation libraries.spectatorApi testImplementation libraries.junitJupiter - testImplementation libraries.mockitoAll + testImplementation libraries.mockitoCore4 testImplementation 'org.hamcrest:hamcrest-all:1.3' testImplementation libraries.vavrTest testImplementation(testFixtures(project(":mantis-common"))) diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java index 371706acb..ba5491867 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/JobAutoScalerTest.java @@ -21,8 +21,8 @@ import static io.mantisrx.runtime.descriptor.StageScalingPolicy.ScalingReason.UserDefined; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; import io.mantisrx.runtime.Context; diff --git a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java index fd15268e6..ea1843b15 100644 --- a/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java +++ b/mantis-server/mantis-server-worker/src/test/java/io/mantisrx/server/worker/jobmaster/WorkerMetricHandlerTest.java @@ -22,8 +22,8 @@ import static io.reactivex.mantis.network.push.PushServerSse.PROCESSED_COUNTER_METRIC_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; From cd200f6970bf2e740a432406ebf6dc547e0b6926 Mon Sep 17 00:00:00 2001 From: Shreyaa Sharma Date: Mon, 10 Apr 2023 22:50:01 +0530 Subject: [PATCH 5/5] Upgrade dependencies.lock --- mantis-client/dependencies.lock | 41 +++--- mantis-common/dependencies.lock | 45 +++--- .../dependencies.lock | 135 ++---------------- .../mantis-connector-job/dependencies.lock | 14 +- .../mantis-connector-kafka/dependencies.lock | 57 ++++---- .../dependencies.lock | 12 +- .../dependencies.lock | 45 +++--- .../dependencies.lock | 45 +++--- .../dependencies.lock | 11 +- mantis-discovery-proto/dependencies.lock | 33 +++-- .../dependencies.lock | 30 ++-- .../mantis-publish-core/dependencies.lock | 18 +-- .../dependencies.lock | 28 ++-- .../mantis-publish-netty/dependencies.lock | 20 +-- mantis-remote-observable/dependencies.lock | 41 +++--- mantis-runtime-loader/dependencies.lock | 45 +++--- mantis-runtime/dependencies.lock | 41 +++--- .../mantis-server-agent/dependencies.lock | 45 +++--- .../dependencies.lock | 45 +++--- .../mantis-server-worker/dependencies.lock | 57 ++++---- .../mantis-source-job-kafka/dependencies.lock | 20 +-- .../dependencies.lock | 14 +- 22 files changed, 420 insertions(+), 422 deletions(-) diff --git a/mantis-client/dependencies.lock b/mantis-client/dependencies.lock index 902e9021e..7050be460 100644 --- a/mantis-client/dependencies.lock +++ b/mantis-client/dependencies.lock @@ -172,11 +172,14 @@ } }, "baseline-exact-dependencies-test": { - "junit:junit": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" @@ -681,12 +684,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -723,6 +720,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, @@ -893,12 +899,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -947,6 +947,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, diff --git a/mantis-common/dependencies.lock b/mantis-common/dependencies.lock index 0e40cf5e4..1867c2ab4 100644 --- a/mantis-common/dependencies.lock +++ b/mantis-common/dependencies.lock @@ -65,12 +65,6 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.commons:commons-lang3": { "locked": "3.5" }, @@ -83,6 +77,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, @@ -271,12 +274,6 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "locked": "1.0" }, @@ -292,6 +289,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, @@ -552,12 +558,6 @@ ], "locked": "0.9.2" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -576,6 +576,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, diff --git a/mantis-connectors/mantis-connector-iceberg/dependencies.lock b/mantis-connectors/mantis-connector-iceberg/dependencies.lock index a623bb6e0..0df1ceffb 100644 --- a/mantis-connectors/mantis-connector-iceberg/dependencies.lock +++ b/mantis-connectors/mantis-connector-iceberg/dependencies.lock @@ -5,113 +5,14 @@ } }, "baseline-exact-dependencies-main": { - "com.netflix:mantis-rxnetty": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "0.4.19.1" - }, - "io.mantisrx:mantis-common": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-network", - "io.mantisrx:mantis-runtime" - ], - "project": true - }, - "io.mantisrx:mantis-common-serde": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "project": true - }, - "io.mantisrx:mantis-network": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-runtime" - ], - "project": true - }, - "io.mantisrx:mantis-remote-observable": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-runtime" - ], - "project": true - }, - "io.mantisrx:mantis-runtime": { - "project": true - }, - "io.mantisrx:mantis-shaded": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common", - "io.mantisrx:mantis-common-serde" - ], - "project": true - }, - "io.netty:netty-buffer": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "4.1.17.Final" - }, - "io.netty:netty-codec-http": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "4.1.17.Final" - }, - "io.netty:netty-handler": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-network" - ], - "locked": "4.1.17.Final" - }, - "io.netty:netty-transport-native-epoll": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "4.1.17.Final" - }, - "io.reactivex:rxjava": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "1.3.8" - }, - "org.jctools:jctools-core": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "1.2.1" - }, "org.slf4j:slf4j-api": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common", - "io.mantisrx:mantis-runtime" - ], - "locked": "1.7.6" - }, - "org.slf4j:slf4j-log4j12": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], "locked": "1.7.0" - }, - "org.xerial.snappy:snappy-java": { - "firstLevelTransitive": [ - "io.mantisrx:mantis-common" - ], - "locked": "1.1.9.1" } }, "baseline-exact-dependencies-test": { "com.netflix.spectator:spectator-api": { "locked": "1.3.10" }, - "org.apache.hadoop:hadoop-common": { - "locked": "2.7.3" - }, - "org.apache.iceberg:iceberg-data": { - "locked": "0.14.1" - }, "org.junit.jupiter:junit-jupiter-api": { "locked": "5.4.2" }, @@ -359,6 +260,9 @@ ], "locked": "1.0" }, + "org.apache.hadoop:hadoop-common": { + "locked": "2.7.3" + }, "org.jctools:jctools-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -371,14 +275,14 @@ "io.mantisrx:mantis-remote-observable", "io.mantisrx:mantis-runtime" ], - "locked": "1.7.6" + "locked": "1.7.10" }, "org.slf4j:slf4j-log4j12": { "firstLevelTransitive": [ "io.mantisrx:mantis-common", "io.mantisrx:mantis-remote-observable" ], - "locked": "1.7.0" + "locked": "1.7.10" }, "org.xerial.snappy:snappy-java": { "firstLevelTransitive": [ @@ -387,32 +291,6 @@ "locked": "1.1.9.1" } }, - "shadow": { - "org.apache.avro:avro": { - "locked": "1.10.2" - }, - "org.apache.hadoop:hadoop-common": { - "locked": "2.7.3" - }, - "org.apache.iceberg:iceberg-api": { - "locked": "0.14.1" - }, - "org.apache.iceberg:iceberg-core": { - "locked": "0.14.1" - }, - "org.apache.iceberg:iceberg-data": { - "locked": "0.14.1" - }, - "org.apache.iceberg:iceberg-parquet": { - "locked": "0.14.1" - }, - "org.apache.parquet:parquet-hadoop": { - "locked": "1.12.0" - }, - "org.slf4j:slf4j-log4j12": { - "locked": "1.7.10" - } - }, "testAnnotationProcessor": { "org.projectlombok:lombok": { "locked": "1.18.20" @@ -701,6 +579,9 @@ "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, + "org.projectlombok:lombok": { + "locked": "1.18.20" + }, "org.slf4j:slf4j-api": { "firstLevelTransitive": [ "io.mantisrx:mantis-common", diff --git a/mantis-connectors/mantis-connector-job/dependencies.lock b/mantis-connectors/mantis-connector-job/dependencies.lock index a1ce20559..adf7cfcc8 100644 --- a/mantis-connectors/mantis-connector-job/dependencies.lock +++ b/mantis-connectors/mantis-connector-job/dependencies.lock @@ -18,7 +18,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -199,7 +199,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -388,13 +388,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ @@ -656,7 +656,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -840,13 +840,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ diff --git a/mantis-connectors/mantis-connector-kafka/dependencies.lock b/mantis-connectors/mantis-connector-kafka/dependencies.lock index caa733c59..6b78d1a36 100644 --- a/mantis-connectors/mantis-connector-kafka/dependencies.lock +++ b/mantis-connectors/mantis-connector-kafka/dependencies.lock @@ -106,11 +106,14 @@ "com.github.tomakehurst:wiremock-jre8": { "locked": "2.21.0" }, - "junit:junit": { - "locked": "4.12" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" @@ -118,10 +121,10 @@ }, "compileClasspath": { "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "locked": "0.82.0" @@ -236,10 +239,10 @@ }, "runtimeClasspath": { "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ @@ -388,10 +391,10 @@ "locked": "2.21.0" }, "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "locked": "0.82.0" @@ -467,12 +470,6 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.12" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.kafka:kafka-clients": { "locked": "2.2.2" }, @@ -482,6 +479,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -513,10 +519,10 @@ "locked": "2.21.0" }, "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ @@ -618,12 +624,6 @@ ], "locked": "0.9.2" }, - "junit:junit": { - "locked": "4.12" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -639,6 +639,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, diff --git a/mantis-connectors/mantis-connector-publish/dependencies.lock b/mantis-connectors/mantis-connector-publish/dependencies.lock index 429ddb1d2..56713bef7 100644 --- a/mantis-connectors/mantis-connector-publish/dependencies.lock +++ b/mantis-connectors/mantis-connector-publish/dependencies.lock @@ -124,7 +124,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -304,13 +304,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ @@ -531,7 +531,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -715,13 +715,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ diff --git a/mantis-control-plane/mantis-control-plane-client/dependencies.lock b/mantis-control-plane/mantis-control-plane-client/dependencies.lock index 861346788..30b79fc1e 100644 --- a/mantis-control-plane/mantis-control-plane-client/dependencies.lock +++ b/mantis-control-plane/mantis-control-plane-client/dependencies.lock @@ -65,18 +65,21 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.jctools:jctools-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -491,12 +494,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -536,6 +533,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -668,12 +674,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -719,6 +719,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, diff --git a/mantis-control-plane/mantis-control-plane-core/dependencies.lock b/mantis-control-plane/mantis-control-plane-core/dependencies.lock index db23ebff2..676ed2839 100644 --- a/mantis-control-plane/mantis-control-plane-core/dependencies.lock +++ b/mantis-control-plane/mantis-control-plane-core/dependencies.lock @@ -77,12 +77,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -119,6 +113,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -455,12 +458,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -497,6 +494,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -894,12 +900,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -948,6 +948,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, diff --git a/mantis-control-plane/mantis-control-plane-server/dependencies.lock b/mantis-control-plane/mantis-control-plane-server/dependencies.lock index f937fde48..06506be05 100644 --- a/mantis-control-plane/mantis-control-plane-server/dependencies.lock +++ b/mantis-control-plane/mantis-control-plane-server/dependencies.lock @@ -132,6 +132,9 @@ ], "locked": "20180813" }, + "org.junit.vintage:junit-vintage-engine": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "3.12.4" }, @@ -663,6 +666,9 @@ ], "locked": "20180813" }, + "org.junit.vintage:junit-vintage-engine": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "3.12.4" }, @@ -816,7 +822,7 @@ "locked": "2.12.5" }, "junit:junit": { - "locked": "4.11" + "locked": "4.12" }, "junit:junit-dep": { "locked": "4.11" @@ -869,6 +875,9 @@ ], "locked": "20180813" }, + "org.junit.vintage:junit-vintage-engine": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "3.12.4" }, diff --git a/mantis-discovery-proto/dependencies.lock b/mantis-discovery-proto/dependencies.lock index 021074b6f..30c62d521 100644 --- a/mantis-discovery-proto/dependencies.lock +++ b/mantis-discovery-proto/dependencies.lock @@ -5,11 +5,14 @@ } }, "baseline-exact-dependencies-test": { - "junit:junit": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" } }, "compileClasspath": { @@ -45,11 +48,14 @@ "io.mantisrx:mantis-shaded": { "project": true }, - "junit:junit": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" }, "org.projectlombok:lombok": { "locked": "1.18.20" @@ -65,11 +71,14 @@ ], "locked": "0.9.2" }, - "junit:junit": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" } } } \ No newline at end of file diff --git a/mantis-examples/mantis-examples-mantis-publish-sample/dependencies.lock b/mantis-examples/mantis-examples-mantis-publish-sample/dependencies.lock index 54427aba6..2a3995b9b 100644 --- a/mantis-examples/mantis-examples-mantis-publish-sample/dependencies.lock +++ b/mantis-examples/mantis-examples-mantis-publish-sample/dependencies.lock @@ -12,13 +12,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -71,13 +71,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -141,7 +141,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ @@ -149,13 +149,13 @@ "io.mantisrx:mantis-publish-netty", "io.mantisrx:mantis-publish-netty-guice" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-netty-guice" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -261,13 +261,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -326,7 +326,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ @@ -334,13 +334,13 @@ "io.mantisrx:mantis-publish-netty", "io.mantisrx:mantis-publish-netty-guice" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-netty-guice" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ diff --git a/mantis-publish/mantis-publish-core/dependencies.lock b/mantis-publish/mantis-publish-core/dependencies.lock index fce9aa7f1..5f5c11d3c 100644 --- a/mantis-publish/mantis-publish-core/dependencies.lock +++ b/mantis-publish/mantis-publish-core/dependencies.lock @@ -6,7 +6,7 @@ }, "baseline-exact-dependencies-main": { "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-ext-ipc": { "locked": "0.134.0" @@ -52,10 +52,10 @@ }, "compileClasspath": { "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "locked": "0.134.0" @@ -93,10 +93,10 @@ }, "runtimeClasspath": { "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "locked": "0.134.0" @@ -140,10 +140,10 @@ "locked": "2.21.0" }, "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "locked": "0.134.0" @@ -197,10 +197,10 @@ "locked": "2.21.0" }, "com.netflix.archaius:archaius2-api": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "locked": "0.134.0" diff --git a/mantis-publish/mantis-publish-netty-guice/dependencies.lock b/mantis-publish/mantis-publish-netty-guice/dependencies.lock index 3006c8a1b..768e7485a 100644 --- a/mantis-publish/mantis-publish-netty-guice/dependencies.lock +++ b/mantis-publish/mantis-publish-netty-guice/dependencies.lock @@ -9,10 +9,10 @@ "locked": "4.2.2" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-ext-ipc": { "locked": "0.96.0" @@ -52,13 +52,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -110,17 +110,17 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core", "io.mantisrx:mantis-publish-netty" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -205,13 +205,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -273,17 +273,17 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core", "io.mantisrx:mantis-publish-netty" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-guice": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ diff --git a/mantis-publish/mantis-publish-netty/dependencies.lock b/mantis-publish/mantis-publish-netty/dependencies.lock index 87e33e035..19f4dd46e 100644 --- a/mantis-publish/mantis-publish-netty/dependencies.lock +++ b/mantis-publish/mantis-publish-netty/dependencies.lock @@ -9,10 +9,10 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -67,10 +67,10 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -116,13 +116,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -190,10 +190,10 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -249,13 +249,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ diff --git a/mantis-remote-observable/dependencies.lock b/mantis-remote-observable/dependencies.lock index de66523db..ffa5c434c 100644 --- a/mantis-remote-observable/dependencies.lock +++ b/mantis-remote-observable/dependencies.lock @@ -83,11 +83,14 @@ } }, "baseline-exact-dependencies-test": { - "junit:junit": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" } }, "compileClasspath": { @@ -330,18 +333,21 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.jctools:jctools-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.projectlombok:lombok": { "locked": "1.18.20" }, @@ -429,12 +435,6 @@ ], "locked": "0.9.2" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -447,6 +447,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.slf4j:slf4j-api": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" diff --git a/mantis-runtime-loader/dependencies.lock b/mantis-runtime-loader/dependencies.lock index 12117fc25..627ea29e7 100644 --- a/mantis-runtime-loader/dependencies.lock +++ b/mantis-runtime-loader/dependencies.lock @@ -54,18 +54,21 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.jctools:jctools-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -501,12 +504,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -543,6 +540,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -684,12 +690,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -738,6 +738,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, diff --git a/mantis-runtime/dependencies.lock b/mantis-runtime/dependencies.lock index 75bb93024..fc45cf130 100644 --- a/mantis-runtime/dependencies.lock +++ b/mantis-runtime/dependencies.lock @@ -8,11 +8,14 @@ "com.netflix.spectator:spectator-api": { "locked": "1.3.10" }, - "junit:junit": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" }, - "junit:junit-dep": { - "locked": "4.11" + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" @@ -310,18 +313,21 @@ ], "locked": "1.3.8" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.jctools:jctools-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, @@ -438,12 +444,6 @@ ], "locked": "0.9.2" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -456,6 +456,15 @@ ], "locked": "1.2.1" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-core": { "locked": "2.0.111-beta" }, diff --git a/mantis-server/mantis-server-agent/dependencies.lock b/mantis-server/mantis-server-agent/dependencies.lock index 4b1a2bf06..e8c2c4b53 100644 --- a/mantis-server/mantis-server-agent/dependencies.lock +++ b/mantis-server/mantis-server-agent/dependencies.lock @@ -154,12 +154,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -196,6 +190,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -739,12 +742,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.lingala.zip4j:zip4j": { "locked": "2.9.0" }, @@ -787,6 +784,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -1001,12 +1007,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -1086,6 +1086,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, diff --git a/mantis-server/mantis-server-worker-client/dependencies.lock b/mantis-server/mantis-server-worker-client/dependencies.lock index 46030458e..cea08ac7d 100644 --- a/mantis-server/mantis-server-worker-client/dependencies.lock +++ b/mantis-server/mantis-server-worker-client/dependencies.lock @@ -8,15 +8,18 @@ "com.netflix.spectator:spectator-api": { "locked": "1.3.10" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.hamcrest:hamcrest-all": { "locked": "1.3" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" } @@ -436,12 +439,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -481,6 +478,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, @@ -624,12 +630,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -681,6 +681,15 @@ ], "locked": "20180813" }, + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, "org.mockito:mockito-all": { "locked": "2.0.2-beta" }, diff --git a/mantis-server/mantis-server-worker/dependencies.lock b/mantis-server/mantis-server-worker/dependencies.lock index 3488a6ff8..4b9c61709 100644 --- a/mantis-server/mantis-server-worker/dependencies.lock +++ b/mantis-server/mantis-server-worker/dependencies.lock @@ -105,12 +105,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "org.apache.flink:flink-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-control-plane-core" @@ -150,8 +144,17 @@ ], "locked": "20180813" }, - "org.mockito:mockito-all": { - "locked": "2.0.2-beta" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, + "org.mockito:mockito-core": { + "locked": "4.8.1" }, "org.skife.config:config-magic": { "firstLevelTransitive": [ @@ -774,12 +777,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "nz.ac.waikato.cms.moa:moa": { "locked": "2017.06" }, @@ -825,8 +822,17 @@ ], "locked": "20180813" }, - "org.mockito:mockito-all": { - "locked": "2.0.2-beta" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, + "org.mockito:mockito-core": { + "locked": "4.8.1" }, "org.projectlombok:lombok": { "locked": "1.18.20" @@ -1022,12 +1028,6 @@ ], "locked": "2.12.5" }, - "junit:junit": { - "locked": "4.11" - }, - "junit:junit-dep": { - "locked": "4.11" - }, "net.jcip:jcip-annotations": { "firstLevelTransitive": [ "io.mantisrx:mantis-common" @@ -1103,8 +1103,17 @@ ], "locked": "20180813" }, - "org.mockito:mockito-all": { - "locked": "2.0.2-beta" + "org.junit.jupiter:junit-jupiter-api": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-engine": { + "locked": "5.4.2" + }, + "org.junit.jupiter:junit-jupiter-params": { + "locked": "5.4.2" + }, + "org.mockito:mockito-core": { + "locked": "4.8.1" }, "org.skife.config:config-magic": { "firstLevelTransitive": [ diff --git a/mantis-source-jobs/mantis-source-job-kafka/dependencies.lock b/mantis-source-jobs/mantis-source-job-kafka/dependencies.lock index 25a967ca9..065064a22 100644 --- a/mantis-source-jobs/mantis-source-job-kafka/dependencies.lock +++ b/mantis-source-jobs/mantis-source-job-kafka/dependencies.lock @@ -9,13 +9,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -138,13 +138,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -275,13 +275,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ @@ -444,13 +444,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -576,13 +576,13 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-connector-kafka" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ diff --git a/mantis-source-jobs/mantis-source-job-publish/dependencies.lock b/mantis-source-jobs/mantis-source-job-publish/dependencies.lock index b466eb1d9..fdef77334 100644 --- a/mantis-source-jobs/mantis-source-job-publish/dependencies.lock +++ b/mantis-source-jobs/mantis-source-job-publish/dependencies.lock @@ -15,7 +15,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -213,7 +213,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -405,14 +405,14 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core", "io.mantisrx:mantis-publish-netty" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [ @@ -658,7 +658,7 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.spectator:spectator-api": { "firstLevelTransitive": [ @@ -857,14 +857,14 @@ "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.archaius:archaius2-core": { "firstLevelTransitive": [ "io.mantisrx:mantis-publish-core", "io.mantisrx:mantis-publish-netty" ], - "locked": "2.3.20" + "locked": "2.3.21" }, "com.netflix.rxjava:rxjava-math": { "firstLevelTransitive": [