From 2778068bd77f8feccfa6c11592e86ed1a3ffa040 Mon Sep 17 00:00:00 2001
From: Ashutosh Gupta
Date: Sun, 7 Aug 2022 20:59:43 +0100
Subject: [PATCH] YARN-6946. Upgrade JUnit from 4 to 5 in hadoop-yarn-common
---
.../hadoop-yarn/hadoop-yarn-common/pom.xml | 25 +-
.../java/org/apache/hadoop/yarn/MockApps.java | 4 +-
.../hadoop/yarn/TestContainerLaunchRPC.java | 20 +-
.../hadoop/yarn/TestContainerLogAppender.java | 5 +-
.../TestContainerResourceIncreaseRPC.java | 34 +-
.../apache/hadoop/yarn/TestRPCFactories.java | 20 +-
.../apache/hadoop/yarn/TestRecordFactory.java | 28 +-
.../hadoop/yarn/TestRpcFactoryProvider.java | 30 +-
.../TestYarnUncaughtExceptionHandler.java | 16 +-
.../yarn/api/BasePBImplRecordsTest.java | 48 ++-
.../yarn/api/TestApplicationAttemptId.java | 46 ++-
.../hadoop/yarn/api/TestApplicationId.java | 34 +-
.../hadoop/yarn/api/TestApplicatonReport.java | 24 +-
.../hadoop/yarn/api/TestContainerId.java | 56 +--
.../yarn/api/TestGetApplicationsRequest.java | 93 +++--
.../apache/hadoop/yarn/api/TestNodeId.java | 30 +-
.../hadoop/yarn/api/TestPBImplRecords.java | 362 +++++++++---------
.../TestPlacementConstraintPBConversion.java | 95 ++---
.../hadoop/yarn/api/TestResourcePBImpl.java | 135 +++----
.../hadoop/yarn/api/TestResourceRequest.java | 10 +-
.../yarn/api/TestTimelineEntityGroupId.java | 33 +-
.../pb/TestGetApplicationsRequestPBImpl.java | 63 +--
.../api/records/TestResourceUtilization.java | 96 ++---
.../TestApplicationClientProtocolRecords.java | 30 +-
...estApplicationSubmissionContextPBImpl.java | 65 ++--
.../api/records/impl/pb/TestProtoUtils.java | 9 +-
.../pb/TestSerializedExceptionPBImpl.java | 42 +-
.../records/timeline/TestTimelineRecords.java | 154 ++++----
.../TestTimelineServiceRecords.java | 124 +++---
...estPlacementConstraintTransformations.java | 84 ++--
.../hadoop/yarn/client/TestClientRMProxy.java | 47 +--
.../client/api/impl/TestTimelineClient.java | 169 ++++----
.../api/impl/TestTimelineClientForATS1_5.java | 55 +--
.../api/impl/TestTimelineClientV2Impl.java | 193 +++++-----
.../impl/TestTimelineReaderClientImpl.java | 65 ++--
.../apache/hadoop/yarn/conf/TestHAUtil.java | 107 +++---
.../yarn/conf/TestYarnConfiguration.java | 85 ++--
.../hadoop/yarn/event/InlineDispatcher.java | 3 -
.../yarn/event/TestAsyncDispatcher.java | 101 ++---
.../impl/pb/TestRpcClientFactoryPBImpl.java | 9 +-
.../impl/pb/TestRpcServerFactoryPBImpl.java | 9 +-
.../apache/hadoop/yarn/ipc/TestRPCUtil.java | 53 ++-
.../LogAggregationTestUtils.java | 4 +-
.../TestAggregatedLogDeletionService.java | 309 +++++++--------
.../TestAggregatedLogFormat.java | 91 ++---
.../TestAggregatedLogsBlock.java | 40 +-
.../TestContainerLogsUtils.java | 5 +-
.../TestLogAggregationMetaCollector.java | 51 +--
.../FakeLogAggregationFileController.java | 10 +-
.../TestLogAggregationFileController.java | 31 +-
...stLogAggregationFileControllerFactory.java | 142 +++----
...stLogAggregationIndexedFileController.java | 98 ++---
.../AggregatedLogDeletionServiceForTest.java | 6 +-
.../testutils/LogAggregationTestcase.java | 39 +-
.../LogAggregationTestcaseBuilder.java | 12 +-
.../testutils/MockRMClientUtils.java | 4 +-
.../yarn/nodelabels/NodeLabelTestBase.java | 50 +--
.../TestCommonNodeLabelsManager.java | 286 +++++++-------
.../TestFileSystemNodeLabelsStore.java | 142 +++----
.../yarn/nodelabels/TestNodeLabelUtil.java | 40 +-
.../ResourceTypesTestHelper.java | 11 +-
.../TestDockerClientConfigHandler.java | 27 +-
.../security/TestYARNTokenIdentifier.java | 333 ++++++++--------
.../security/TestApplicationACLsManager.java | 73 ++--
.../hadoop/yarn/util/TestAdHocLogDumper.java | 33 +-
.../org/apache/hadoop/yarn/util/TestApps.java | 27 +-
.../hadoop/yarn/util/TestBoundedAppender.java | 67 ++--
.../hadoop/yarn/util/TestConverterUtils.java | 64 ++--
.../hadoop/yarn/util/TestFSDownload.java | 268 ++++++-------
.../hadoop/yarn/util/TestLRUCacheHashMap.java | 19 +-
.../TestLog4jWarningErrorMetricsAppender.java | 195 +++++-----
.../yarn/util/TestProcfsBasedProcessTree.java | 263 +++++++------
.../hadoop/yarn/util/TestRackResolver.java | 38 +-
.../TestRackResolverScriptBasedMapping.java | 10 +-
.../TestResourceCalculatorProcessTree.java | 15 +-
.../yarn/util/TestTimelineServiceHelper.java | 25 +-
.../apache/hadoop/yarn/util/TestTimes.java | 38 +-
.../util/TestWindowsBasedProcessTree.java | 22 +-
.../hadoop/yarn/util/TestYarnVersionInfo.java | 33 +-
...tomResourceTypesConfigurationProvider.java | 16 +-
.../util/resource/TestResourceCalculator.java | 157 ++++----
.../yarn/util/resource/TestResourceUtils.java | 239 ++++++------
.../yarn/util/resource/TestResources.java | 153 ++++----
.../util/timeline/TestShortenedFlowName.java | 18 +-
.../hadoop/yarn/webapp/JerseyTestBase.java | 4 +-
.../webapp/MyTestJAXBContextResolver.java | 5 +-
.../hadoop/yarn/webapp/MyTestWebService.java | 1 +
.../hadoop/yarn/webapp/TestParseRoute.java | 66 ++--
.../hadoop/yarn/webapp/TestSubViews.java | 16 +-
.../apache/hadoop/yarn/webapp/TestWebApp.java | 151 ++++----
.../yarn/webapp/WebServicesTestUtils.java | 20 +-
.../yarn/webapp/hamlet2/TestHamlet.java | 39 +-
.../yarn/webapp/hamlet2/TestHamletImpl.java | 29 +-
.../webapp/hamlet2/TestParseSelector.java | 32 +-
.../log/AggregatedLogsBlockForTest.java | 1 -
.../yarn/webapp/test/TestWebAppTests.java | 43 ++-
.../hadoop/yarn/webapp/test/WebAppTests.java | 29 +-
.../yarn/webapp/util/TestWebAppUtils.java | 65 ++--
.../webapp/util/TestWebServiceClient.java | 15 +-
.../yarn/webapp/view/TestCommonViews.java | 22 +-
.../yarn/webapp/view/TestHtmlBlock.java | 26 +-
.../hadoop/yarn/webapp/view/TestHtmlPage.java | 19 +-
.../yarn/webapp/view/TestInfoBlock.java | 34 +-
.../webapp/view/TestTwoColumnCssPage.java | 6 +-
.../yarn/webapp/view/TestTwoColumnLayout.java | 6 +-
hadoop-yarn-project/pom.xml | 2 +
106 files changed, 3599 insertions(+), 3247 deletions(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
index a04ff52be9749..46cbca4e2adb7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
@@ -103,11 +103,6 @@
org.apache.hadoop
hadoop-annotations
-
- junit
- junit
- test
-
org.mockito
mockito-core
@@ -138,6 +133,26 @@
bcprov-jdk15on
test
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ test
+
com.sun.jersey.jersey-test-framework
jersey-test-framework-grizzly2
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
index f59f00e6e853f..11d54d6e6aeb2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
@@ -20,11 +20,11 @@
import java.util.Iterator;
+import org.apache.hadoop.thirdparty.com.google.common.collect.Iterators;
+
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.thirdparty.com.google.common.collect.Iterators;
-
/**
* Utilities to generate fake test apps
*/
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
index 279a37b7d19b2..94f1e520e4f31 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
@@ -24,8 +24,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.Server;
import org.apache.hadoop.net.NetUtils;
@@ -35,12 +37,12 @@
import org.apache.hadoop.yarn.api.protocolrecords.CommitResponse;
import org.apache.hadoop.yarn.api.protocolrecords.ContainerUpdateRequest;
import org.apache.hadoop.yarn.api.protocolrecords.ContainerUpdateResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.GetLocalizationStatusesRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetLocalizationStatusesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.IncreaseContainersResourceRequest;
import org.apache.hadoop.yarn.api.protocolrecords.IncreaseContainersResourceResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.ReInitializeContainerRequest;
import org.apache.hadoop.yarn.api.protocolrecords.ReInitializeContainerResponse;
import org.apache.hadoop.yarn.api.protocolrecords.ResourceLocalizationRequest;
@@ -70,8 +72,9 @@
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/*
* Test that the container launcher rpc times out properly. This is used
@@ -86,7 +89,7 @@ public class TestContainerLaunchRPC {
.getRecordFactory(null);
@Test
- public void testHadoopProtoRPCTimeout() throws Exception {
+ void testHadoopProtoRPCTimeout() throws Exception {
testRPCTimeout(HadoopYarnProtoRPC.class.getName());
}
@@ -136,16 +139,15 @@ private void testRPCTimeout(String rpcClass) throws Exception {
proxy.startContainers(allRequests);
} catch (Exception e) {
LOG.info(StringUtils.stringifyException(e));
- Assert.assertEquals("Error, exception is not: "
- + SocketTimeoutException.class.getName(),
- SocketTimeoutException.class.getName(), e.getClass().getName());
+ assertEquals(SocketTimeoutException.class.getName(), e.getClass().getName(),
+ "Error, exception is not: " + SocketTimeoutException.class.getName());
return;
}
} finally {
server.stop();
}
- Assert.fail("timeout exception should have occurred!");
+ fail("timeout exception should have occurred!");
}
public static Token newContainerToken(NodeId nodeId, byte[] password,
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLogAppender.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLogAppender.java
index 6b8e537a4c559..26acfd7bad87b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLogAppender.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLogAppender.java
@@ -18,14 +18,15 @@
package org.apache.hadoop.yarn;
+import org.junit.jupiter.api.Test;
+
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
-import org.junit.Test;
public class TestContainerLogAppender {
@Test
- public void testAppendInClose() throws Exception {
+ void testAppendInClose() throws Exception {
final ContainerLogAppender claAppender = new ContainerLogAppender();
claAppender.setName("testCLA");
claAppender.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerResourceIncreaseRPC.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerResourceIncreaseRPC.java
index c3dac91467237..e615036d8139f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerResourceIncreaseRPC.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerResourceIncreaseRPC.java
@@ -18,8 +18,16 @@
package org.apache.hadoop.yarn;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketTimeoutException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.Server;
import org.apache.hadoop.net.NetUtils;
@@ -59,14 +67,9 @@
import org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
-import org.junit.Assert;
-import org.junit.Test;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketTimeoutException;
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/*
* Test that the container resource increase rpc times out properly.
@@ -78,7 +81,7 @@ public class TestContainerResourceIncreaseRPC {
TestContainerResourceIncreaseRPC.class);
@Test
- public void testHadoopProtoRPCTimeout() throws Exception {
+ void testHadoopProtoRPCTimeout() throws Exception {
testRPCTimeout(HadoopYarnProtoRPC.class.getName());
}
@@ -122,15 +125,14 @@ private void testRPCTimeout(String rpcClass) throws Exception {
proxy.updateContainer(request);
} catch (Exception e) {
LOG.info(StringUtils.stringifyException(e));
- Assert.assertEquals("Error, exception is not: "
- + SocketTimeoutException.class.getName(),
- SocketTimeoutException.class.getName(), e.getClass().getName());
+ assertEquals(SocketTimeoutException.class.getName(), e.getClass().getName(),
+ "Error, exception is not: " + SocketTimeoutException.class.getName());
return;
}
} finally {
server.stop();
}
- Assert.fail("timeout exception should have occurred!");
+ fail("timeout exception should have occurred!");
}
public static Token newContainerToken(NodeId nodeId, byte[] password,
@@ -157,11 +159,9 @@ public StartContainersResponse startContainers(
}
@Override
- public StopContainersResponse
- stopContainers(StopContainersRequest requests) throws YarnException,
- IOException {
- Exception e = new Exception("Dummy function", new Exception(
- "Dummy function cause"));
+ public StopContainersResponse stopContainers(StopContainersRequest requests)
+ throws YarnException, IOException {
+ Exception e = new Exception("Dummy function", new Exception("Dummy function cause"));
throw new YarnException(e);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java
index 765b165e90fa8..6c283c6674421 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPCFactories.java
@@ -21,7 +21,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.Server;
@@ -37,16 +37,16 @@
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl;
import org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.fail;
public class TestRPCFactories {
-
-
-
+
+
@Test
- public void test() {
+ void test() {
testPbServerFactory();
-
+
testPbClientFactory();
}
@@ -64,7 +64,7 @@ private void testPbServerFactory() {
server.start();
} catch (YarnRuntimeException e) {
e.printStackTrace();
- Assert.fail("Failed to create server");
+ fail("Failed to create server");
} finally {
if (server != null) {
server.stop();
@@ -92,12 +92,12 @@ private void testPbClientFactory() {
amrmClient = (ApplicationMasterProtocol) RpcClientFactoryPBImpl.get().getClient(ApplicationMasterProtocol.class, 1, NetUtils.getConnectAddress(server), conf);
} catch (YarnRuntimeException e) {
e.printStackTrace();
- Assert.fail("Failed to create client");
+ fail("Failed to create client");
}
} catch (YarnRuntimeException e) {
e.printStackTrace();
- Assert.fail("Failed to create server");
+ fail("Failed to create server");
} finally {
if (server != null) {
server.stop();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java
index 9492988c946fc..8be77ba6288c6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRecordFactory.java
@@ -18,39 +18,41 @@
package org.apache.hadoop.yarn;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.hadoop.yarn.factories.RecordFactory;
-import org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateResponsePBImpl;
-import org.junit.Test;
+import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
+import org.apache.hadoop.yarn.factories.RecordFactory;
+import org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
public class TestRecordFactory {
-
+
@Test
- public void testPbRecordFactory() {
+ void testPbRecordFactory() {
RecordFactory pbRecordFactory = RecordFactoryPBImpl.get();
-
+
try {
AllocateResponse response =
pbRecordFactory.newRecordInstance(AllocateResponse.class);
- Assert.assertEquals(AllocateResponsePBImpl.class, response.getClass());
+ assertEquals(AllocateResponsePBImpl.class, response.getClass());
} catch (YarnRuntimeException e) {
e.printStackTrace();
- Assert.fail("Failed to crete record");
+ fail("Failed to crete record");
}
-
+
try {
AllocateRequest response =
pbRecordFactory.newRecordInstance(AllocateRequest.class);
- Assert.assertEquals(AllocateRequestPBImpl.class, response.getClass());
+ assertEquals(AllocateRequestPBImpl.class, response.getClass());
} catch (YarnRuntimeException e) {
e.printStackTrace();
- Assert.fail("Failed to crete record");
+ fail("Failed to crete record");
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java
index 005a71bbd97c5..a8cc98e4e453e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRpcFactoryProvider.java
@@ -18,7 +18,7 @@
package org.apache.hadoop.yarn;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -28,21 +28,23 @@
import org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl;
import org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl;
import org.apache.hadoop.yarn.factory.providers.RpcFactoryProvider;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
public class TestRpcFactoryProvider {
@Test
- public void testFactoryProvider() {
+ void testFactoryProvider() {
Configuration conf = new Configuration();
RpcClientFactory clientFactory = null;
RpcServerFactory serverFactory = null;
-
-
+
+
clientFactory = RpcFactoryProvider.getClientFactory(conf);
serverFactory = RpcFactoryProvider.getServerFactory(conf);
- Assert.assertEquals(RpcClientFactoryPBImpl.class, clientFactory.getClass());
- Assert.assertEquals(RpcServerFactoryPBImpl.class, serverFactory.getClass());
+ assertEquals(RpcClientFactoryPBImpl.class, clientFactory.getClass());
+ assertEquals(RpcServerFactoryPBImpl.class, serverFactory.getClass());
conf.set(YarnConfiguration.IPC_CLIENT_FACTORY_CLASS, "unknown");
conf.set(YarnConfiguration.IPC_SERVER_FACTORY_CLASS, "unknown");
@@ -50,28 +52,30 @@ public void testFactoryProvider() {
try {
clientFactory = RpcFactoryProvider.getClientFactory(conf);
- Assert.fail("Expected an exception - unknown serializer");
+ fail("Expected an exception - unknown serializer");
} catch (YarnRuntimeException e) {
}
try {
serverFactory = RpcFactoryProvider.getServerFactory(conf);
- Assert.fail("Expected an exception - unknown serializer");
+ fail("Expected an exception - unknown serializer");
} catch (YarnRuntimeException e) {
}
-
+
conf = new Configuration();
conf.set(YarnConfiguration.IPC_CLIENT_FACTORY_CLASS, "NonExistantClass");
conf.set(YarnConfiguration.IPC_SERVER_FACTORY_CLASS, RpcServerFactoryPBImpl.class.getName());
-
+
try {
clientFactory = RpcFactoryProvider.getClientFactory(conf);
- Assert.fail("Expected an exception - unknown class");
+ fail("Expected an exception - unknown class");
} catch (YarnRuntimeException e) {
}
try {
serverFactory = RpcFactoryProvider.getServerFactory(conf);
} catch (YarnRuntimeException e) {
- Assert.fail("Error while loading factory using reflection: [" + RpcServerFactoryPBImpl.class.getName() + "]");
+ fail(
+ "Error while loading factory using reflection: [" + RpcServerFactoryPBImpl.class.getName()
+ + "]");
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestYarnUncaughtExceptionHandler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestYarnUncaughtExceptionHandler.java
index 05bcdb982c431..e0201cfcd1557 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestYarnUncaughtExceptionHandler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestYarnUncaughtExceptionHandler.java
@@ -18,18 +18,20 @@
package org.apache.hadoop.yarn;
-import static org.junit.Assert.assertSame;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
public class TestYarnUncaughtExceptionHandler {
private static final YarnUncaughtExceptionHandler exHandler =
new YarnUncaughtExceptionHandler();
+
/**
* Throw {@code YarnRuntimeException} inside thread and
* check {@code YarnUncaughtExceptionHandler} instance
@@ -37,7 +39,7 @@ public class TestYarnUncaughtExceptionHandler {
* @throws InterruptedException
*/
@Test
- public void testUncaughtExceptionHandlerWithRuntimeException()
+ void testUncaughtExceptionHandlerWithRuntimeException()
throws InterruptedException {
final YarnUncaughtExceptionHandler spyYarnHandler = spy(exHandler);
final YarnRuntimeException yarnException = new YarnRuntimeException(
@@ -67,7 +69,7 @@ public void run() {
* @throws InterruptedException
*/
@Test
- public void testUncaughtExceptionHandlerWithError()
+ void testUncaughtExceptionHandlerWithError()
throws InterruptedException {
ExitUtil.disableSystemExit();
final YarnUncaughtExceptionHandler spyErrorHandler = spy(exHandler);
@@ -96,7 +98,7 @@ public void run() {
* @throws InterruptedException
*/
@Test
- public void testUncaughtExceptionHandlerWithOutOfMemoryError()
+ void testUncaughtExceptionHandlerWithOutOfMemoryError()
throws InterruptedException {
ExitUtil.disableSystemHalt();
final YarnUncaughtExceptionHandler spyOomHandler = spy(exHandler);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java
index 5697923c9974d..1060eba72df90 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/BasePBImplRecordsTest.java
@@ -17,26 +17,37 @@
*/
package org.apache.hadoop.yarn.api;
-import org.apache.commons.lang3.Range;
-import org.apache.hadoop.util.Lists;
-import org.apache.hadoop.util.Sets;
-import org.apache.hadoop.yarn.api.resource.PlacementConstraint;
-import org.apache.hadoop.yarn.api.resource.PlacementConstraints;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.nio.ByteBuffer;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
import org.apache.hadoop.thirdparty.com.google.common.collect.Maps;
-
-import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.lang.reflect.*;
-import java.nio.ByteBuffer;
-import java.util.*;
+import org.apache.commons.lang3.Range;
+import org.apache.hadoop.util.Lists;
+import org.apache.hadoop.util.Sets;
+import org.apache.hadoop.yarn.api.resource.PlacementConstraint;
+import org.apache.hadoop.yarn.api.resource.PlacementConstraints;
import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.NODE;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints
- .PlacementTargets.allocationTag;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.PlacementTargets.allocationTag;
import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.targetIn;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Generic helper class to validate protocol records.
@@ -220,7 +231,7 @@ private Map getGetSetPairs(Class recordClass)
p.getMethod = m;
ret.put(propertyName, p);
} else {
- Assert.fail("Multiple get method with same name: " + recordClass
+ fail("Multiple get method with same name: " + recordClass
+ p.propertyName);
}
}
@@ -281,18 +292,17 @@ protected void validatePBImplRecord(Class recordClass,
gsp.setMethod.invoke(origRecord, gsp.testValue);
}
Object ret = getProto.invoke(origRecord);
- Assert.assertNotNull(recordClass.getName() + "#getProto returns null", ret);
+ assertNotNull(ret, recordClass.getName() + "#getProto returns null");
if (!(protoClass.isAssignableFrom(ret.getClass()))) {
- Assert.fail("Illegal getProto method return type: " + ret.getClass());
+ fail("Illegal getProto method return type: " + ret.getClass());
}
R deserRecord = pbConstructor.newInstance(ret);
- Assert.assertEquals("whole " + recordClass + " records should be equal",
- origRecord, deserRecord);
+ assertEquals(origRecord, deserRecord, "whole " + recordClass + " records should be equal");
for (GetSetPair gsp : getSetPairs.values()) {
Object origValue = gsp.getMethod.invoke(origRecord);
Object deserValue = gsp.getMethod.invoke(deserRecord);
- Assert.assertEquals("property " + recordClass.getName() + "#"
- + gsp.propertyName + " should be equal", origValue, deserValue);
+ assertEquals(origValue, deserValue, "property " + recordClass.getName() + "#"
+ + gsp.propertyName + " should be equal");
}
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java
index f54ed78ac1ea4..b2ef3ef1a4498 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationAttemptId.java
@@ -19,41 +19,45 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestApplicationAttemptId {
@Test
- public void testApplicationAttemptId() {
+ void testApplicationAttemptId() {
ApplicationAttemptId a1 = createAppAttemptId(10l, 1, 1);
ApplicationAttemptId a2 = createAppAttemptId(10l, 1, 2);
ApplicationAttemptId a3 = createAppAttemptId(10l, 2, 1);
ApplicationAttemptId a4 = createAppAttemptId(8l, 1, 4);
ApplicationAttemptId a5 = createAppAttemptId(10l, 1, 1);
-
- Assert.assertTrue(a1.equals(a5));
- Assert.assertFalse(a1.equals(a2));
- Assert.assertFalse(a1.equals(a3));
- Assert.assertFalse(a1.equals(a4));
-
- Assert.assertTrue(a1.compareTo(a5) == 0);
- Assert.assertTrue(a1.compareTo(a2) < 0);
- Assert.assertTrue(a1.compareTo(a3) < 0);
- Assert.assertTrue(a1.compareTo(a4) > 0);
-
- Assert.assertTrue(a1.hashCode() == a5.hashCode());
- Assert.assertFalse(a1.hashCode() == a2.hashCode());
- Assert.assertFalse(a1.hashCode() == a3.hashCode());
- Assert.assertFalse(a1.hashCode() == a4.hashCode());
-
+
+ assertEquals(a1, a5);
+ assertNotEquals(a1, a2);
+ assertNotEquals(a1, a3);
+ assertNotEquals(a1, a4);
+
+ assertTrue(a1.compareTo(a5) == 0);
+ assertTrue(a1.compareTo(a2) < 0);
+ assertTrue(a1.compareTo(a3) < 0);
+ assertTrue(a1.compareTo(a4) > 0);
+
+ assertTrue(a1.hashCode() == a5.hashCode());
+ assertFalse(a1.hashCode() == a2.hashCode());
+ assertFalse(a1.hashCode() == a3.hashCode());
+ assertFalse(a1.hashCode() == a4.hashCode());
+
long ts = System.currentTimeMillis();
ApplicationAttemptId a6 = createAppAttemptId(ts, 543627, 33492611);
- Assert.assertEquals("appattempt_10_0001_000001", a1.toString());
- Assert.assertEquals("appattempt_" + ts + "_543627_33492611", a6.toString());
+ assertEquals("appattempt_10_0001_000001", a1.toString());
+ assertEquals("appattempt_" + ts + "_543627_33492611", a6.toString());
}
private ApplicationAttemptId createAppAttemptId(
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java
index ea25a64c95dbf..d084468b3ac38 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicationId.java
@@ -18,36 +18,40 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestApplicationId {
@Test
- public void testApplicationId() {
+ void testApplicationId() {
ApplicationId a1 = ApplicationId.newInstance(10l, 1);
ApplicationId a2 = ApplicationId.newInstance(10l, 2);
ApplicationId a3 = ApplicationId.newInstance(10l, 1);
ApplicationId a4 = ApplicationId.newInstance(8l, 3);
- Assert.assertFalse(a1.equals(a2));
- Assert.assertFalse(a1.equals(a4));
- Assert.assertTrue(a1.equals(a3));
+ assertNotEquals(a1, a2);
+ assertNotEquals(a1, a4);
+ assertEquals(a1, a3);
+
+ assertTrue(a1.compareTo(a2) < 0);
+ assertTrue(a1.compareTo(a3) == 0);
+ assertTrue(a1.compareTo(a4) > 0);
- Assert.assertTrue(a1.compareTo(a2) < 0);
- Assert.assertTrue(a1.compareTo(a3) == 0);
- Assert.assertTrue(a1.compareTo(a4) > 0);
+ assertTrue(a1.hashCode() == a3.hashCode());
+ assertFalse(a1.hashCode() == a2.hashCode());
+ assertFalse(a2.hashCode() == a4.hashCode());
- Assert.assertTrue(a1.hashCode() == a3.hashCode());
- Assert.assertFalse(a1.hashCode() == a2.hashCode());
- Assert.assertFalse(a2.hashCode() == a4.hashCode());
-
long ts = System.currentTimeMillis();
ApplicationId a5 = ApplicationId.newInstance(ts, 45436343);
- Assert.assertEquals("application_10_0001", a1.toString());
- Assert.assertEquals("application_" + ts + "_45436343", a5.toString());
+ assertEquals("application_10_0001", a1.toString());
+ assertEquals("application_" + ts + "_45436343", a5.toString());
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java
index ea39a4ccdba09..c0904ec09faef 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestApplicatonReport.java
@@ -18,6 +18,8 @@
package org.apache.hadoop.yarn.api;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
@@ -25,13 +27,15 @@
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
public class TestApplicatonReport {
@Test
- public void testApplicationReport() {
+ void testApplicationReport() {
long timestamp = System.currentTimeMillis();
ApplicationReport appReport1 =
createApplicationReport(1, 1, timestamp);
@@ -39,15 +43,15 @@ public void testApplicationReport() {
createApplicationReport(1, 1, timestamp);
ApplicationReport appReport3 =
createApplicationReport(1, 1, timestamp);
- Assert.assertEquals(appReport1, appReport2);
- Assert.assertEquals(appReport2, appReport3);
+ assertEquals(appReport1, appReport2);
+ assertEquals(appReport2, appReport3);
appReport1.setApplicationId(null);
- Assert.assertNull(appReport1.getApplicationId());
- Assert.assertNotSame(appReport1, appReport2);
+ assertNull(appReport1.getApplicationId());
+ assertNotSame(appReport1, appReport2);
appReport2.setCurrentApplicationAttemptId(null);
- Assert.assertNull(appReport2.getCurrentApplicationAttemptId());
- Assert.assertNotSame(appReport2, appReport3);
- Assert.assertNull(appReport1.getAMRMToken());
+ assertNull(appReport2.getCurrentApplicationAttemptId());
+ assertNotSame(appReport2, appReport3);
+ assertNull(appReport1.getAMRMToken());
}
protected static ApplicationReport createApplicationReport(
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
index 1643301072b81..73d585d8f688d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
@@ -19,57 +19,61 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestContainerId {
@Test
- public void testContainerId() {
+ void testContainerId() {
ContainerId c1 = newContainerId(1, 1, 10l, 1);
ContainerId c2 = newContainerId(1, 1, 10l, 2);
ContainerId c3 = newContainerId(1, 1, 10l, 1);
ContainerId c4 = newContainerId(1, 3, 10l, 1);
ContainerId c5 = newContainerId(1, 3, 8l, 1);
- Assert.assertTrue(c1.equals(c3));
- Assert.assertFalse(c1.equals(c2));
- Assert.assertFalse(c1.equals(c4));
- Assert.assertFalse(c1.equals(c5));
+ assertEquals(c1, c3);
+ assertNotEquals(c1, c2);
+ assertNotEquals(c1, c4);
+ assertNotEquals(c1, c5);
+
+ assertTrue(c1.compareTo(c3) == 0);
+ assertTrue(c1.compareTo(c2) < 0);
+ assertTrue(c1.compareTo(c4) < 0);
+ assertTrue(c1.compareTo(c5) > 0);
- Assert.assertTrue(c1.compareTo(c3) == 0);
- Assert.assertTrue(c1.compareTo(c2) < 0);
- Assert.assertTrue(c1.compareTo(c4) < 0);
- Assert.assertTrue(c1.compareTo(c5) > 0);
+ assertTrue(c1.hashCode() == c3.hashCode());
+ assertFalse(c1.hashCode() == c2.hashCode());
+ assertFalse(c1.hashCode() == c4.hashCode());
+ assertFalse(c1.hashCode() == c5.hashCode());
- Assert.assertTrue(c1.hashCode() == c3.hashCode());
- Assert.assertFalse(c1.hashCode() == c2.hashCode());
- Assert.assertFalse(c1.hashCode() == c4.hashCode());
- Assert.assertFalse(c1.hashCode() == c5.hashCode());
-
long ts = System.currentTimeMillis();
ContainerId c6 = newContainerId(36473, 4365472, ts, 25645811);
- Assert.assertEquals("container_10_0001_01_000001", c1.toString());
- Assert.assertEquals(25645811, 0xffffffffffL & c6.getContainerId());
- Assert.assertEquals(0, c6.getContainerId() >> 40);
- Assert.assertEquals("container_" + ts + "_36473_4365472_25645811",
+ assertEquals("container_10_0001_01_000001", c1.toString());
+ assertEquals(25645811, 0xffffffffffL & c6.getContainerId());
+ assertEquals(0, c6.getContainerId() >> 40);
+ assertEquals("container_" + ts + "_36473_4365472_25645811",
c6.toString());
ContainerId c7 = newContainerId(36473, 4365472, ts, 4298334883325L);
- Assert.assertEquals(999799999997L, 0xffffffffffL & c7.getContainerId());
- Assert.assertEquals(3, c7.getContainerId() >> 40);
- Assert.assertEquals(
+ assertEquals(999799999997L, 0xffffffffffL & c7.getContainerId());
+ assertEquals(3, c7.getContainerId() >> 40);
+ assertEquals(
"container_e03_" + ts + "_36473_4365472_999799999997",
c7.toString());
ContainerId c8 = newContainerId(36473, 4365472, ts, 844424930131965L);
- Assert.assertEquals(1099511627773L, 0xffffffffffL & c8.getContainerId());
- Assert.assertEquals(767, c8.getContainerId() >> 40);
- Assert.assertEquals(
+ assertEquals(1099511627773L, 0xffffffffffL & c8.getContainerId());
+ assertEquals(767, c8.getContainerId() >> 40);
+ assertEquals(
"container_e767_" + ts + "_36473_4365472_1099511627773",
c8.toString());
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java
index c46c2bc0a9b5e..b91df652693da 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestGetApplicationsRequest.java
@@ -21,93 +21,86 @@
import java.util.HashSet;
import java.util.Set;
+import org.junit.jupiter.api.Test;
+
import org.apache.commons.lang3.Range;
import org.apache.hadoop.yarn.api.protocolrecords.ApplicationsRequestScope;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetApplicationsRequestPBImpl;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestGetApplicationsRequest {
@Test
- public void testGetApplicationsRequest(){
+ void testGetApplicationsRequest() {
GetApplicationsRequest request = GetApplicationsRequest.newInstance();
-
- EnumSet appStates =
- EnumSet.of(YarnApplicationState.ACCEPTED);
+
+ EnumSet appStates =
+ EnumSet.of(YarnApplicationState.ACCEPTED);
request.setApplicationStates(appStates);
-
+
Set tags = new HashSet();
tags.add("tag1");
request.setApplicationTags(tags);
-
+
Set types = new HashSet();
types.add("type1");
request.setApplicationTypes(types);
-
+
long startBegin = System.currentTimeMillis();
long startEnd = System.currentTimeMillis() + 1;
request.setStartRange(startBegin, startEnd);
long finishBegin = System.currentTimeMillis() + 2;
long finishEnd = System.currentTimeMillis() + 3;
request.setFinishRange(finishBegin, finishEnd);
-
+
long limit = 100L;
request.setLimit(limit);
-
+
Set queues = new HashSet();
queues.add("queue1");
request.setQueues(queues);
-
-
+
+
Set users = new HashSet();
users.add("user1");
request.setUsers(users);
-
+
ApplicationsRequestScope scope = ApplicationsRequestScope.ALL;
request.setScope(scope);
-
+
GetApplicationsRequest requestFromProto = new GetApplicationsRequestPBImpl(
- ((GetApplicationsRequestPBImpl)request).getProto());
-
+ ((GetApplicationsRequestPBImpl) request).getProto());
+
// verify the whole record equals with original record
- Assert.assertEquals(requestFromProto, request);
+ assertEquals(requestFromProto, request);
// verify all properties are the same as original request
- Assert.assertEquals(
- "ApplicationStates from proto is not the same with original request",
- requestFromProto.getApplicationStates(), appStates);
-
- Assert.assertEquals(
- "ApplicationTags from proto is not the same with original request",
- requestFromProto.getApplicationTags(), tags);
-
- Assert.assertEquals(
- "ApplicationTypes from proto is not the same with original request",
- requestFromProto.getApplicationTypes(), types);
-
- Assert.assertEquals(
- "StartRange from proto is not the same with original request",
- requestFromProto.getStartRange(), Range.between(startBegin, startEnd));
-
- Assert.assertEquals(
- "FinishRange from proto is not the same with original request",
- requestFromProto.getFinishRange(),
- Range.between(finishBegin, finishEnd));
-
- Assert.assertEquals(
- "Limit from proto is not the same with original request",
- requestFromProto.getLimit(), limit);
-
- Assert.assertEquals(
- "Queues from proto is not the same with original request",
- requestFromProto.getQueues(), queues);
-
- Assert.assertEquals(
- "Users from proto is not the same with original request",
- requestFromProto.getUsers(), users);
+ assertEquals(requestFromProto.getApplicationStates(), appStates,
+ "ApplicationStates from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getApplicationTags(), tags,
+ "ApplicationTags from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getApplicationTypes(), types,
+ "ApplicationTypes from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getStartRange(), Range.between(startBegin, startEnd),
+ "StartRange from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getFinishRange(), Range.between(finishBegin, finishEnd),
+ "FinishRange from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getLimit(), limit,
+ "Limit from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getQueues(), queues,
+ "Queues from proto is not the same with original request");
+
+ assertEquals(requestFromProto.getUsers(), users,
+ "Users from proto is not the same with original request");
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java
index 32d31a30b021e..2a4092d915a36 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestNodeId.java
@@ -18,32 +18,36 @@
package org.apache.hadoop.yarn.api;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.yarn.api.records.NodeId;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestNodeId {
@Test
- public void testNodeId() {
+ void testNodeId() {
NodeId nodeId1 = NodeId.newInstance("10.18.52.124", 8041);
NodeId nodeId2 = NodeId.newInstance("10.18.52.125", 8038);
NodeId nodeId3 = NodeId.newInstance("10.18.52.124", 8041);
NodeId nodeId4 = NodeId.newInstance("10.18.52.124", 8039);
- Assert.assertTrue(nodeId1.equals(nodeId3));
- Assert.assertFalse(nodeId1.equals(nodeId2));
- Assert.assertFalse(nodeId3.equals(nodeId4));
+ assertEquals(nodeId1, nodeId3);
+ assertNotEquals(nodeId1, nodeId2);
+ assertNotEquals(nodeId3, nodeId4);
- Assert.assertTrue(nodeId1.compareTo(nodeId3) == 0);
- Assert.assertTrue(nodeId1.compareTo(nodeId2) < 0);
- Assert.assertTrue(nodeId3.compareTo(nodeId4) > 0);
+ assertTrue(nodeId1.compareTo(nodeId3) == 0);
+ assertTrue(nodeId1.compareTo(nodeId2) < 0);
+ assertTrue(nodeId3.compareTo(nodeId4) > 0);
- Assert.assertTrue(nodeId1.hashCode() == nodeId3.hashCode());
- Assert.assertFalse(nodeId1.hashCode() == nodeId2.hashCode());
- Assert.assertFalse(nodeId3.hashCode() == nodeId4.hashCode());
+ assertTrue(nodeId1.hashCode() == nodeId3.hashCode());
+ assertFalse(nodeId1.hashCode() == nodeId2.hashCode());
+ assertFalse(nodeId3.hashCode() == nodeId4.hashCode());
- Assert.assertEquals("10.18.52.124:8041", nodeId1.toString());
+ assertEquals("10.18.52.124:8041", nodeId1.toString());
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
index 2edd7b74792a9..3bc76cbfe0518 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
@@ -16,9 +16,15 @@
* limitations under the License.
*/
package org.apache.hadoop.yarn.api;
+
import java.io.IOException;
import java.util.Arrays;
+import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableSet;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import org.apache.commons.lang3.Range;
import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequestProto;
import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenResponseProto;
@@ -133,8 +139,8 @@
import org.apache.hadoop.yarn.api.records.LogAggregationContext;
import org.apache.hadoop.yarn.api.records.NMToken;
import org.apache.hadoop.yarn.api.records.NodeAttribute;
-import org.apache.hadoop.yarn.api.records.NodeAttributeKey;
import org.apache.hadoop.yarn.api.records.NodeAttributeInfo;
+import org.apache.hadoop.yarn.api.records.NodeAttributeKey;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.NodeLabel;
import org.apache.hadoop.yarn.api.records.NodeReport;
@@ -189,8 +195,8 @@
import org.apache.hadoop.yarn.api.records.impl.pb.ExecutionTypeRequestPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.LocalResourcePBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.NMTokenPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.NodeAttributeKeyPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.NodeAttributeInfoPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.NodeAttributeKeyPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.NodeAttributePBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.NodeLabelPBImpl;
@@ -201,8 +207,8 @@
import org.apache.hadoop.yarn.api.records.impl.pb.PreemptionMessagePBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.PreemptionResourceRequestPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.PriorityPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.QueueInfoPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.QueueConfigurationsPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.QueueInfoPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.QueueUserACLInfoPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourceBlacklistRequestPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourceOptionPBImpl;
@@ -232,8 +238,8 @@
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ExecutionTypeRequestProto;
import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.NodeAttributeKeyProto;
import org.apache.hadoop.yarn.proto.YarnProtos.NodeAttributeInfoProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.NodeAttributeKeyProto;
import org.apache.hadoop.yarn.proto.YarnProtos.NodeAttributeProto;
import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.NodeLabelProto;
@@ -245,8 +251,8 @@
import org.apache.hadoop.yarn.proto.YarnProtos.PreemptionMessageProto;
import org.apache.hadoop.yarn.proto.YarnProtos.PreemptionResourceRequestProto;
import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.QueueInfoProto;
import org.apache.hadoop.yarn.proto.YarnProtos.QueueConfigurationsProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.QueueInfoProto;
import org.apache.hadoop.yarn.proto.YarnProtos.QueueUserACLInfoProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceBlacklistRequestProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceOptionProto;
@@ -374,19 +380,15 @@
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.UpdateNodeResourceRequestPBImpl;
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.UpdateNodeResourceResponsePBImpl;
import org.apache.hadoop.yarn.util.resource.Resources;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableSet;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Test class for YARN API protocol records.
*/
public class TestPBImplRecords extends BasePBImplRecordsTest {
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
typeValueCache.put(Range.class, Range.between(1000L, 2000L));
typeValueCache.put(URL.class, URL.newInstance(
@@ -474,326 +476,326 @@ public static void setup() throws Exception {
}
@Test
- public void testAllocateRequestPBImpl() throws Exception {
+ void testAllocateRequestPBImpl() throws Exception {
validatePBImplRecord(AllocateRequestPBImpl.class, AllocateRequestProto.class);
}
@Test
- public void testAllocateResponsePBImpl() throws Exception {
+ void testAllocateResponsePBImpl() throws Exception {
validatePBImplRecord(AllocateResponsePBImpl.class, AllocateResponseProto.class);
}
@Test
- public void testCancelDelegationTokenRequestPBImpl() throws Exception {
+ void testCancelDelegationTokenRequestPBImpl() throws Exception {
validatePBImplRecord(CancelDelegationTokenRequestPBImpl.class,
CancelDelegationTokenRequestProto.class);
}
@Test
- public void testCancelDelegationTokenResponsePBImpl() throws Exception {
+ void testCancelDelegationTokenResponsePBImpl() throws Exception {
validatePBImplRecord(CancelDelegationTokenResponsePBImpl.class,
CancelDelegationTokenResponseProto.class);
}
@Test
- public void testFinishApplicationMasterRequestPBImpl() throws Exception {
+ void testFinishApplicationMasterRequestPBImpl() throws Exception {
validatePBImplRecord(FinishApplicationMasterRequestPBImpl.class,
FinishApplicationMasterRequestProto.class);
}
@Test
- public void testFinishApplicationMasterResponsePBImpl() throws Exception {
+ void testFinishApplicationMasterResponsePBImpl() throws Exception {
validatePBImplRecord(FinishApplicationMasterResponsePBImpl.class,
FinishApplicationMasterResponseProto.class);
}
@Test
- public void testGetApplicationAttemptReportRequestPBImpl() throws Exception {
+ void testGetApplicationAttemptReportRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptReportRequestPBImpl.class,
GetApplicationAttemptReportRequestProto.class);
}
@Test
- public void testGetApplicationAttemptReportResponsePBImpl() throws Exception {
+ void testGetApplicationAttemptReportResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptReportResponsePBImpl.class,
GetApplicationAttemptReportResponseProto.class);
}
@Test
- public void testGetApplicationAttemptsRequestPBImpl() throws Exception {
+ void testGetApplicationAttemptsRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptsRequestPBImpl.class,
GetApplicationAttemptsRequestProto.class);
}
@Test
- public void testGetApplicationAttemptsResponsePBImpl() throws Exception {
+ void testGetApplicationAttemptsResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationAttemptsResponsePBImpl.class,
GetApplicationAttemptsResponseProto.class);
}
@Test
- public void testGetApplicationReportRequestPBImpl() throws Exception {
+ void testGetApplicationReportRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationReportRequestPBImpl.class,
GetApplicationReportRequestProto.class);
}
@Test
- public void testGetApplicationReportResponsePBImpl() throws Exception {
+ void testGetApplicationReportResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationReportResponsePBImpl.class,
GetApplicationReportResponseProto.class);
}
@Test
- public void testGetApplicationsRequestPBImpl() throws Exception {
+ void testGetApplicationsRequestPBImpl() throws Exception {
validatePBImplRecord(GetApplicationsRequestPBImpl.class,
GetApplicationsRequestProto.class);
}
@Test
- public void testGetApplicationsResponsePBImpl() throws Exception {
+ void testGetApplicationsResponsePBImpl() throws Exception {
validatePBImplRecord(GetApplicationsResponsePBImpl.class,
GetApplicationsResponseProto.class);
}
@Test
- public void testGetClusterMetricsRequestPBImpl() throws Exception {
+ void testGetClusterMetricsRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterMetricsRequestPBImpl.class,
GetClusterMetricsRequestProto.class);
}
@Test
- public void testGetClusterMetricsResponsePBImpl() throws Exception {
+ void testGetClusterMetricsResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterMetricsResponsePBImpl.class,
GetClusterMetricsResponseProto.class);
}
@Test
- public void testGetClusterNodesRequestPBImpl() throws Exception {
+ void testGetClusterNodesRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterNodesRequestPBImpl.class,
GetClusterNodesRequestProto.class);
}
@Test
- public void testGetClusterNodesResponsePBImpl() throws Exception {
+ void testGetClusterNodesResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterNodesResponsePBImpl.class,
GetClusterNodesResponseProto.class);
}
@Test
- public void testGetContainerReportRequestPBImpl() throws Exception {
+ void testGetContainerReportRequestPBImpl() throws Exception {
validatePBImplRecord(GetContainerReportRequestPBImpl.class,
GetContainerReportRequestProto.class);
}
@Test
- public void testGetContainerReportResponsePBImpl() throws Exception {
+ void testGetContainerReportResponsePBImpl() throws Exception {
validatePBImplRecord(GetContainerReportResponsePBImpl.class,
GetContainerReportResponseProto.class);
}
@Test
- public void testGetContainersRequestPBImpl() throws Exception {
+ void testGetContainersRequestPBImpl() throws Exception {
validatePBImplRecord(GetContainersRequestPBImpl.class,
GetContainersRequestProto.class);
}
@Test
- public void testGetContainersResponsePBImpl() throws Exception {
+ void testGetContainersResponsePBImpl() throws Exception {
validatePBImplRecord(GetContainersResponsePBImpl.class,
GetContainersResponseProto.class);
}
@Test
- public void testGetContainerStatusesRequestPBImpl() throws Exception {
+ void testGetContainerStatusesRequestPBImpl() throws Exception {
validatePBImplRecord(GetContainerStatusesRequestPBImpl.class,
GetContainerStatusesRequestProto.class);
}
@Test
- public void testGetContainerStatusesResponsePBImpl() throws Exception {
+ void testGetContainerStatusesResponsePBImpl() throws Exception {
validatePBImplRecord(GetContainerStatusesResponsePBImpl.class,
GetContainerStatusesResponseProto.class);
}
@Test
- public void testGetDelegationTokenRequestPBImpl() throws Exception {
+ void testGetDelegationTokenRequestPBImpl() throws Exception {
validatePBImplRecord(GetDelegationTokenRequestPBImpl.class,
GetDelegationTokenRequestProto.class);
}
@Test
- public void testGetDelegationTokenResponsePBImpl() throws Exception {
+ void testGetDelegationTokenResponsePBImpl() throws Exception {
validatePBImplRecord(GetDelegationTokenResponsePBImpl.class,
GetDelegationTokenResponseProto.class);
}
@Test
- public void testGetNewApplicationRequestPBImpl() throws Exception {
+ void testGetNewApplicationRequestPBImpl() throws Exception {
validatePBImplRecord(GetNewApplicationRequestPBImpl.class,
GetNewApplicationRequestProto.class);
}
@Test
- public void testGetNewApplicationResponsePBImpl() throws Exception {
+ void testGetNewApplicationResponsePBImpl() throws Exception {
validatePBImplRecord(GetNewApplicationResponsePBImpl.class,
GetNewApplicationResponseProto.class);
}
@Test
- public void testGetQueueInfoRequestPBImpl() throws Exception {
+ void testGetQueueInfoRequestPBImpl() throws Exception {
validatePBImplRecord(GetQueueInfoRequestPBImpl.class,
GetQueueInfoRequestProto.class);
}
@Test
- public void testGetQueueInfoResponsePBImpl() throws Exception {
+ void testGetQueueInfoResponsePBImpl() throws Exception {
validatePBImplRecord(GetQueueInfoResponsePBImpl.class,
GetQueueInfoResponseProto.class);
}
@Test
- public void testGetQueueUserAclsInfoRequestPBImpl() throws Exception {
+ void testGetQueueUserAclsInfoRequestPBImpl() throws Exception {
validatePBImplRecord(GetQueueUserAclsInfoRequestPBImpl.class,
GetQueueUserAclsInfoRequestProto.class);
}
@Test
- public void testGetQueueUserAclsInfoResponsePBImpl() throws Exception {
+ void testGetQueueUserAclsInfoResponsePBImpl() throws Exception {
validatePBImplRecord(GetQueueUserAclsInfoResponsePBImpl.class,
GetQueueUserAclsInfoResponseProto.class);
}
@Test
- public void testKillApplicationRequestPBImpl() throws Exception {
+ void testKillApplicationRequestPBImpl() throws Exception {
validatePBImplRecord(KillApplicationRequestPBImpl.class,
KillApplicationRequestProto.class);
}
@Test
- public void testKillApplicationResponsePBImpl() throws Exception {
+ void testKillApplicationResponsePBImpl() throws Exception {
validatePBImplRecord(KillApplicationResponsePBImpl.class,
KillApplicationResponseProto.class);
}
@Test
- public void testMoveApplicationAcrossQueuesRequestPBImpl() throws Exception {
+ void testMoveApplicationAcrossQueuesRequestPBImpl() throws Exception {
validatePBImplRecord(MoveApplicationAcrossQueuesRequestPBImpl.class,
MoveApplicationAcrossQueuesRequestProto.class);
}
@Test
- public void testMoveApplicationAcrossQueuesResponsePBImpl() throws Exception {
+ void testMoveApplicationAcrossQueuesResponsePBImpl() throws Exception {
validatePBImplRecord(MoveApplicationAcrossQueuesResponsePBImpl.class,
MoveApplicationAcrossQueuesResponseProto.class);
}
@Test
- public void testRegisterApplicationMasterRequestPBImpl() throws Exception {
+ void testRegisterApplicationMasterRequestPBImpl() throws Exception {
validatePBImplRecord(RegisterApplicationMasterRequestPBImpl.class,
RegisterApplicationMasterRequestProto.class);
}
@Test
- public void testRegisterApplicationMasterResponsePBImpl() throws Exception {
+ void testRegisterApplicationMasterResponsePBImpl() throws Exception {
validatePBImplRecord(RegisterApplicationMasterResponsePBImpl.class,
RegisterApplicationMasterResponseProto.class);
}
@Test
- public void testRenewDelegationTokenRequestPBImpl() throws Exception {
+ void testRenewDelegationTokenRequestPBImpl() throws Exception {
validatePBImplRecord(RenewDelegationTokenRequestPBImpl.class,
RenewDelegationTokenRequestProto.class);
}
@Test
- public void testRenewDelegationTokenResponsePBImpl() throws Exception {
+ void testRenewDelegationTokenResponsePBImpl() throws Exception {
validatePBImplRecord(RenewDelegationTokenResponsePBImpl.class,
RenewDelegationTokenResponseProto.class);
}
@Test
- public void testStartContainerRequestPBImpl() throws Exception {
+ void testStartContainerRequestPBImpl() throws Exception {
validatePBImplRecord(StartContainerRequestPBImpl.class,
StartContainerRequestProto.class);
}
@Test
- public void testStartContainersRequestPBImpl() throws Exception {
+ void testStartContainersRequestPBImpl() throws Exception {
validatePBImplRecord(StartContainersRequestPBImpl.class,
StartContainersRequestProto.class);
}
@Test
- public void testStartContainersResponsePBImpl() throws Exception {
+ void testStartContainersResponsePBImpl() throws Exception {
validatePBImplRecord(StartContainersResponsePBImpl.class,
StartContainersResponseProto.class);
}
@Test
- public void testStopContainersRequestPBImpl() throws Exception {
+ void testStopContainersRequestPBImpl() throws Exception {
validatePBImplRecord(StopContainersRequestPBImpl.class,
StopContainersRequestProto.class);
}
@Test
- public void testStopContainersResponsePBImpl() throws Exception {
+ void testStopContainersResponsePBImpl() throws Exception {
validatePBImplRecord(StopContainersResponsePBImpl.class,
StopContainersResponseProto.class);
}
@Test
- public void testIncreaseContainersResourceRequestPBImpl() throws Exception {
+ void testIncreaseContainersResourceRequestPBImpl() throws Exception {
validatePBImplRecord(IncreaseContainersResourceRequestPBImpl.class,
IncreaseContainersResourceRequestProto.class);
}
@Test
- public void testIncreaseContainersResourceResponsePBImpl() throws Exception {
+ void testIncreaseContainersResourceResponsePBImpl() throws Exception {
validatePBImplRecord(IncreaseContainersResourceResponsePBImpl.class,
IncreaseContainersResourceResponseProto.class);
}
@Test
- public void testSubmitApplicationRequestPBImpl() throws Exception {
+ void testSubmitApplicationRequestPBImpl() throws Exception {
validatePBImplRecord(SubmitApplicationRequestPBImpl.class,
SubmitApplicationRequestProto.class);
}
@Test
- public void testSubmitApplicationResponsePBImpl() throws Exception {
+ void testSubmitApplicationResponsePBImpl() throws Exception {
validatePBImplRecord(SubmitApplicationResponsePBImpl.class,
SubmitApplicationResponseProto.class);
}
- @Test
- @Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testApplicationAttemptIdPBImpl() throws Exception {
+ @Test
+ @Disabled
+ void testApplicationAttemptIdPBImpl() throws Exception {
validatePBImplRecord(ApplicationAttemptIdPBImpl.class,
ApplicationAttemptIdProto.class);
}
@Test
- public void testApplicationAttemptReportPBImpl() throws Exception {
+ void testApplicationAttemptReportPBImpl() throws Exception {
validatePBImplRecord(ApplicationAttemptReportPBImpl.class,
ApplicationAttemptReportProto.class);
}
- @Test
- @Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testApplicationIdPBImpl() throws Exception {
+ @Test
+ @Disabled
+ void testApplicationIdPBImpl() throws Exception {
validatePBImplRecord(ApplicationIdPBImpl.class, ApplicationIdProto.class);
}
@Test
- public void testApplicationReportPBImpl() throws Exception {
+ void testApplicationReportPBImpl() throws Exception {
validatePBImplRecord(ApplicationReportPBImpl.class,
ApplicationReportProto.class);
}
@Test
- public void testApplicationResourceUsageReportPBImpl() throws Exception {
+ void testApplicationResourceUsageReportPBImpl() throws Exception {
excludedPropertiesMap.put(ApplicationResourceUsageReportPBImpl.class.getClass(),
Arrays.asList("PreemptedResourceSecondsMap", "ResourceSecondsMap"));
validatePBImplRecord(ApplicationResourceUsageReportPBImpl.class,
@@ -801,550 +803,550 @@ public void testApplicationResourceUsageReportPBImpl() throws Exception {
}
@Test
- public void testApplicationSubmissionContextPBImpl() throws Exception {
+ void testApplicationSubmissionContextPBImpl() throws Exception {
validatePBImplRecord(ApplicationSubmissionContextPBImpl.class,
ApplicationSubmissionContextProto.class);
-
+
ApplicationSubmissionContext ctx =
ApplicationSubmissionContext.newInstance(null, null, null, null, null,
false, false, 0, Resources.none(), null, false, null, null);
-
- Assert.assertNotNull(ctx.getResource());
+
+ assertNotNull(ctx.getResource());
}
- @Test
- @Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testContainerIdPBImpl() throws Exception {
+ @Test
+ @Disabled
+ void testContainerIdPBImpl() throws Exception {
validatePBImplRecord(ContainerIdPBImpl.class, ContainerIdProto.class);
}
@Test
- public void testContainerRetryPBImpl() throws Exception {
+ void testContainerRetryPBImpl() throws Exception {
validatePBImplRecord(ContainerRetryContextPBImpl.class,
ContainerRetryContextProto.class);
}
@Test
- public void testContainerLaunchContextPBImpl() throws Exception {
+ void testContainerLaunchContextPBImpl() throws Exception {
validatePBImplRecord(ContainerLaunchContextPBImpl.class,
ContainerLaunchContextProto.class);
}
@Test
- public void testResourceLocalizationRequest() throws Exception {
+ void testResourceLocalizationRequest() throws Exception {
validatePBImplRecord(ResourceLocalizationRequestPBImpl.class,
YarnServiceProtos.ResourceLocalizationRequestProto.class);
}
@Test
- public void testResourceLocalizationResponse() throws Exception {
+ void testResourceLocalizationResponse() throws Exception {
validatePBImplRecord(ResourceLocalizationResponsePBImpl.class,
YarnServiceProtos.ResourceLocalizationResponseProto.class);
}
@Test
- public void testContainerPBImpl() throws Exception {
+ void testContainerPBImpl() throws Exception {
validatePBImplRecord(ContainerPBImpl.class, ContainerProto.class);
}
@Test
- public void testContainerReportPBImpl() throws Exception {
+ void testContainerReportPBImpl() throws Exception {
validatePBImplRecord(ContainerReportPBImpl.class, ContainerReportProto.class);
}
@Test
- public void testUpdateContainerRequestPBImpl() throws Exception {
+ void testUpdateContainerRequestPBImpl() throws Exception {
validatePBImplRecord(UpdateContainerRequestPBImpl.class,
YarnServiceProtos.UpdateContainerRequestProto.class);
}
@Test
- public void testContainerStatusPBImpl() throws Exception {
+ void testContainerStatusPBImpl() throws Exception {
validatePBImplRecord(ContainerStatusPBImpl.class, ContainerStatusProto.class);
}
@Test
- public void testLocalResourcePBImpl() throws Exception {
+ void testLocalResourcePBImpl() throws Exception {
validatePBImplRecord(LocalResourcePBImpl.class, LocalResourceProto.class);
}
@Test
- public void testNMTokenPBImpl() throws Exception {
+ void testNMTokenPBImpl() throws Exception {
validatePBImplRecord(NMTokenPBImpl.class, NMTokenProto.class);
}
- @Test
- @Ignore
// ignore cause ApplicationIdPBImpl is immutable
- public void testNodeIdPBImpl() throws Exception {
+ @Test
+ @Disabled
+ void testNodeIdPBImpl() throws Exception {
validatePBImplRecord(NodeIdPBImpl.class, NodeIdProto.class);
}
@Test
- public void testNodeReportPBImpl() throws Exception {
+ void testNodeReportPBImpl() throws Exception {
validatePBImplRecord(NodeReportPBImpl.class, NodeReportProto.class);
}
@Test
- public void testPreemptionContainerPBImpl() throws Exception {
+ void testPreemptionContainerPBImpl() throws Exception {
validatePBImplRecord(PreemptionContainerPBImpl.class,
PreemptionContainerProto.class);
}
@Test
- public void testPreemptionContractPBImpl() throws Exception {
+ void testPreemptionContractPBImpl() throws Exception {
validatePBImplRecord(PreemptionContractPBImpl.class,
PreemptionContractProto.class);
}
@Test
- public void testPreemptionMessagePBImpl() throws Exception {
+ void testPreemptionMessagePBImpl() throws Exception {
validatePBImplRecord(PreemptionMessagePBImpl.class,
PreemptionMessageProto.class);
}
@Test
- public void testPreemptionResourceRequestPBImpl() throws Exception {
+ void testPreemptionResourceRequestPBImpl() throws Exception {
validatePBImplRecord(PreemptionResourceRequestPBImpl.class,
PreemptionResourceRequestProto.class);
}
@Test
- public void testPriorityPBImpl() throws Exception {
+ void testPriorityPBImpl() throws Exception {
validatePBImplRecord(PriorityPBImpl.class, PriorityProto.class);
}
@Test
- public void testQueueInfoPBImpl() throws Exception {
+ void testQueueInfoPBImpl() throws Exception {
validatePBImplRecord(QueueInfoPBImpl.class, QueueInfoProto.class);
}
@Test
- public void testQueueConfigurationsPBImpl() throws Exception{
+ void testQueueConfigurationsPBImpl() throws Exception {
validatePBImplRecord(QueueConfigurationsPBImpl.class,
QueueConfigurationsProto.class);
}
@Test
- public void testQueueUserACLInfoPBImpl() throws Exception {
+ void testQueueUserACLInfoPBImpl() throws Exception {
validatePBImplRecord(QueueUserACLInfoPBImpl.class,
QueueUserACLInfoProto.class);
}
@Test
- public void testResourceBlacklistRequestPBImpl() throws Exception {
+ void testResourceBlacklistRequestPBImpl() throws Exception {
validatePBImplRecord(ResourceBlacklistRequestPBImpl.class,
ResourceBlacklistRequestProto.class);
}
- @Test
- @Ignore
// ignore as ResourceOptionPBImpl is immutable
- public void testResourceOptionPBImpl() throws Exception {
+ @Test
+ @Disabled
+ void testResourceOptionPBImpl() throws Exception {
validatePBImplRecord(ResourceOptionPBImpl.class, ResourceOptionProto.class);
}
@Test
- public void testResourcePBImpl() throws Exception {
+ void testResourcePBImpl() throws Exception {
validatePBImplRecord(ResourcePBImpl.class, ResourceProto.class);
}
@Test
- public void testResourceRequestPBImpl() throws Exception {
+ void testResourceRequestPBImpl() throws Exception {
validatePBImplRecord(ResourceRequestPBImpl.class, ResourceRequestProto.class);
}
@Test
- public void testResourceSizingPBImpl() throws Exception {
+ void testResourceSizingPBImpl() throws Exception {
validatePBImplRecord(ResourceSizingPBImpl.class, ResourceSizingProto.class);
}
@Test
- public void testSchedulingRequestPBImpl() throws Exception {
+ void testSchedulingRequestPBImpl() throws Exception {
validatePBImplRecord(SchedulingRequestPBImpl.class,
SchedulingRequestProto.class);
}
@Test
- public void testSerializedExceptionPBImpl() throws Exception {
+ void testSerializedExceptionPBImpl() throws Exception {
validatePBImplRecord(SerializedExceptionPBImpl.class,
SerializedExceptionProto.class);
}
@Test
- public void testStrictPreemptionContractPBImpl() throws Exception {
+ void testStrictPreemptionContractPBImpl() throws Exception {
validatePBImplRecord(StrictPreemptionContractPBImpl.class,
StrictPreemptionContractProto.class);
}
@Test
- public void testTokenPBImpl() throws Exception {
+ void testTokenPBImpl() throws Exception {
validatePBImplRecord(TokenPBImpl.class, TokenProto.class);
}
@Test
- public void testURLPBImpl() throws Exception {
+ void testURLPBImpl() throws Exception {
validatePBImplRecord(URLPBImpl.class, URLProto.class);
}
@Test
- public void testYarnClusterMetricsPBImpl() throws Exception {
+ void testYarnClusterMetricsPBImpl() throws Exception {
validatePBImplRecord(YarnClusterMetricsPBImpl.class,
YarnClusterMetricsProto.class);
}
@Test
- public void testRefreshAdminAclsRequestPBImpl() throws Exception {
+ void testRefreshAdminAclsRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshAdminAclsRequestPBImpl.class,
RefreshAdminAclsRequestProto.class);
}
@Test
- public void testRefreshAdminAclsResponsePBImpl() throws Exception {
+ void testRefreshAdminAclsResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshAdminAclsResponsePBImpl.class,
RefreshAdminAclsResponseProto.class);
}
@Test
- public void testRefreshNodesRequestPBImpl() throws Exception {
+ void testRefreshNodesRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshNodesRequestPBImpl.class,
RefreshNodesRequestProto.class);
}
@Test
- public void testRefreshNodesResponsePBImpl() throws Exception {
+ void testRefreshNodesResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshNodesResponsePBImpl.class,
RefreshNodesResponseProto.class);
}
@Test
- public void testRefreshQueuesRequestPBImpl() throws Exception {
+ void testRefreshQueuesRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshQueuesRequestPBImpl.class,
RefreshQueuesRequestProto.class);
}
@Test
- public void testRefreshQueuesResponsePBImpl() throws Exception {
+ void testRefreshQueuesResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshQueuesResponsePBImpl.class,
RefreshQueuesResponseProto.class);
}
@Test
- public void testRefreshNodesResourcesRequestPBImpl() throws Exception {
+ void testRefreshNodesResourcesRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshNodesResourcesRequestPBImpl.class,
RefreshNodesResourcesRequestProto.class);
}
@Test
- public void testRefreshNodesResourcesResponsePBImpl() throws Exception {
+ void testRefreshNodesResourcesResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshNodesResourcesResponsePBImpl.class,
RefreshNodesResourcesResponseProto.class);
}
@Test
- public void testRefreshServiceAclsRequestPBImpl() throws Exception {
+ void testRefreshServiceAclsRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshServiceAclsRequestPBImpl.class,
RefreshServiceAclsRequestProto.class);
}
@Test
- public void testRefreshServiceAclsResponsePBImpl() throws Exception {
+ void testRefreshServiceAclsResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshServiceAclsResponsePBImpl.class,
RefreshServiceAclsResponseProto.class);
}
@Test
- public void testRefreshSuperUserGroupsConfigurationRequestPBImpl()
+ void testRefreshSuperUserGroupsConfigurationRequestPBImpl()
throws Exception {
validatePBImplRecord(RefreshSuperUserGroupsConfigurationRequestPBImpl.class,
RefreshSuperUserGroupsConfigurationRequestProto.class);
}
@Test
- public void testRefreshSuperUserGroupsConfigurationResponsePBImpl()
+ void testRefreshSuperUserGroupsConfigurationResponsePBImpl()
throws Exception {
validatePBImplRecord(RefreshSuperUserGroupsConfigurationResponsePBImpl.class,
RefreshSuperUserGroupsConfigurationResponseProto.class);
}
@Test
- public void testRefreshUserToGroupsMappingsRequestPBImpl() throws Exception {
+ void testRefreshUserToGroupsMappingsRequestPBImpl() throws Exception {
validatePBImplRecord(RefreshUserToGroupsMappingsRequestPBImpl.class,
RefreshUserToGroupsMappingsRequestProto.class);
}
@Test
- public void testRefreshUserToGroupsMappingsResponsePBImpl() throws Exception {
+ void testRefreshUserToGroupsMappingsResponsePBImpl() throws Exception {
validatePBImplRecord(RefreshUserToGroupsMappingsResponsePBImpl.class,
RefreshUserToGroupsMappingsResponseProto.class);
}
@Test
- public void testUpdateNodeResourceRequestPBImpl() throws Exception {
+ void testUpdateNodeResourceRequestPBImpl() throws Exception {
validatePBImplRecord(UpdateNodeResourceRequestPBImpl.class,
UpdateNodeResourceRequestProto.class);
}
@Test
- public void testUpdateNodeResourceResponsePBImpl() throws Exception {
+ void testUpdateNodeResourceResponsePBImpl() throws Exception {
validatePBImplRecord(UpdateNodeResourceResponsePBImpl.class,
UpdateNodeResourceResponseProto.class);
}
@Test
- public void testReservationSubmissionRequestPBImpl() throws Exception {
+ void testReservationSubmissionRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationSubmissionRequestPBImpl.class,
ReservationSubmissionRequestProto.class);
}
@Test
- public void testReservationSubmissionResponsePBImpl() throws Exception {
+ void testReservationSubmissionResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationSubmissionResponsePBImpl.class,
ReservationSubmissionResponseProto.class);
}
@Test
- public void testReservationUpdateRequestPBImpl() throws Exception {
+ void testReservationUpdateRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationUpdateRequestPBImpl.class,
ReservationUpdateRequestProto.class);
}
@Test
- public void testReservationUpdateResponsePBImpl() throws Exception {
+ void testReservationUpdateResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationUpdateResponsePBImpl.class,
ReservationUpdateResponseProto.class);
}
@Test
- public void testReservationDeleteRequestPBImpl() throws Exception {
+ void testReservationDeleteRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationDeleteRequestPBImpl.class,
ReservationDeleteRequestProto.class);
}
@Test
- public void testReservationDeleteResponsePBImpl() throws Exception {
+ void testReservationDeleteResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationDeleteResponsePBImpl.class,
ReservationDeleteResponseProto.class);
}
@Test
- public void testReservationListRequestPBImpl() throws Exception {
+ void testReservationListRequestPBImpl() throws Exception {
validatePBImplRecord(ReservationListRequestPBImpl.class,
- ReservationListRequestProto.class);
+ ReservationListRequestProto.class);
}
@Test
- public void testReservationListResponsePBImpl() throws Exception {
+ void testReservationListResponsePBImpl() throws Exception {
validatePBImplRecord(ReservationListResponsePBImpl.class,
- ReservationListResponseProto.class);
+ ReservationListResponseProto.class);
}
@Test
- public void testAddToClusterNodeLabelsRequestPBImpl() throws Exception {
+ void testAddToClusterNodeLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(AddToClusterNodeLabelsRequestPBImpl.class,
AddToClusterNodeLabelsRequestProto.class);
}
-
+
@Test
- public void testAddToClusterNodeLabelsResponsePBImpl() throws Exception {
+ void testAddToClusterNodeLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(AddToClusterNodeLabelsResponsePBImpl.class,
AddToClusterNodeLabelsResponseProto.class);
}
-
+
@Test
- public void testRemoveFromClusterNodeLabelsRequestPBImpl() throws Exception {
+ void testRemoveFromClusterNodeLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(RemoveFromClusterNodeLabelsRequestPBImpl.class,
RemoveFromClusterNodeLabelsRequestProto.class);
}
-
+
@Test
- public void testRemoveFromClusterNodeLabelsResponsePBImpl() throws Exception {
+ void testRemoveFromClusterNodeLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(RemoveFromClusterNodeLabelsResponsePBImpl.class,
RemoveFromClusterNodeLabelsResponseProto.class);
}
-
+
@Test
- public void testGetClusterNodeLabelsRequestPBImpl() throws Exception {
+ void testGetClusterNodeLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterNodeLabelsRequestPBImpl.class,
GetClusterNodeLabelsRequestProto.class);
}
@Test
- public void testGetClusterNodeLabelsResponsePBImpl() throws Exception {
+ void testGetClusterNodeLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterNodeLabelsResponsePBImpl.class,
GetClusterNodeLabelsResponseProto.class);
}
-
+
@Test
- public void testReplaceLabelsOnNodeRequestPBImpl() throws Exception {
+ void testReplaceLabelsOnNodeRequestPBImpl() throws Exception {
validatePBImplRecord(ReplaceLabelsOnNodeRequestPBImpl.class,
ReplaceLabelsOnNodeRequestProto.class);
}
@Test
- public void testReplaceLabelsOnNodeResponsePBImpl() throws Exception {
+ void testReplaceLabelsOnNodeResponsePBImpl() throws Exception {
validatePBImplRecord(ReplaceLabelsOnNodeResponsePBImpl.class,
ReplaceLabelsOnNodeResponseProto.class);
}
-
+
@Test
- public void testGetNodeToLabelsRequestPBImpl() throws Exception {
+ void testGetNodeToLabelsRequestPBImpl() throws Exception {
validatePBImplRecord(GetNodesToLabelsRequestPBImpl.class,
GetNodesToLabelsRequestProto.class);
}
@Test
- public void testGetNodeToLabelsResponsePBImpl() throws Exception {
+ void testGetNodeToLabelsResponsePBImpl() throws Exception {
validatePBImplRecord(GetNodesToLabelsResponsePBImpl.class,
GetNodesToLabelsResponseProto.class);
}
@Test
- public void testGetLabelsToNodesRequestPBImpl() throws Exception {
+ void testGetLabelsToNodesRequestPBImpl() throws Exception {
validatePBImplRecord(GetLabelsToNodesRequestPBImpl.class,
GetLabelsToNodesRequestProto.class);
}
@Test
- public void testGetLabelsToNodesResponsePBImpl() throws Exception {
+ void testGetLabelsToNodesResponsePBImpl() throws Exception {
validatePBImplRecord(GetLabelsToNodesResponsePBImpl.class,
GetLabelsToNodesResponseProto.class);
}
-
+
@Test
- public void testNodeLabelAttributesPBImpl() throws Exception {
+ void testNodeLabelAttributesPBImpl() throws Exception {
validatePBImplRecord(NodeLabelPBImpl.class,
NodeLabelProto.class);
}
-
+
@Test
- public void testCheckForDecommissioningNodesRequestPBImpl() throws Exception {
+ void testCheckForDecommissioningNodesRequestPBImpl() throws Exception {
validatePBImplRecord(CheckForDecommissioningNodesRequestPBImpl.class,
CheckForDecommissioningNodesRequestProto.class);
}
@Test
- public void testCheckForDecommissioningNodesResponsePBImpl() throws Exception {
+ void testCheckForDecommissioningNodesResponsePBImpl() throws Exception {
validatePBImplRecord(CheckForDecommissioningNodesResponsePBImpl.class,
CheckForDecommissioningNodesResponseProto.class);
}
@Test
- public void testExecutionTypeRequestPBImpl() throws Exception {
+ void testExecutionTypeRequestPBImpl() throws Exception {
validatePBImplRecord(ExecutionTypeRequestPBImpl.class,
ExecutionTypeRequestProto.class);
}
@Test
- public void testGetAllResourceProfilesResponsePBImpl() throws Exception {
+ void testGetAllResourceProfilesResponsePBImpl() throws Exception {
validatePBImplRecord(GetAllResourceProfilesResponsePBImpl.class,
GetAllResourceProfilesResponseProto.class);
}
@Test
- public void testGetResourceProfileRequestPBImpl() throws Exception {
+ void testGetResourceProfileRequestPBImpl() throws Exception {
validatePBImplRecord(GetResourceProfileRequestPBImpl.class,
GetResourceProfileRequestProto.class);
}
@Test
- public void testGetResourceProfileResponsePBImpl() throws Exception {
+ void testGetResourceProfileResponsePBImpl() throws Exception {
validatePBImplRecord(GetResourceProfileResponsePBImpl.class,
GetResourceProfileResponseProto.class);
}
@Test
- public void testResourceTypesInfoPBImpl() throws Exception {
+ void testResourceTypesInfoPBImpl() throws Exception {
validatePBImplRecord(ResourceTypeInfoPBImpl.class,
YarnProtos.ResourceTypeInfoProto.class);
}
@Test
- public void testGetAllResourceTypesInfoRequestPBImpl() throws Exception {
+ void testGetAllResourceTypesInfoRequestPBImpl() throws Exception {
validatePBImplRecord(GetAllResourceTypeInfoRequestPBImpl.class,
YarnServiceProtos.GetAllResourceTypeInfoRequestProto.class);
}
@Test
- public void testGetAllResourceTypesInfoResponsePBImpl() throws Exception {
+ void testGetAllResourceTypesInfoResponsePBImpl() throws Exception {
validatePBImplRecord(GetAllResourceTypeInfoResponsePBImpl.class,
YarnServiceProtos.GetAllResourceTypeInfoResponseProto.class);
}
@Test
- public void testNodeAttributeKeyPBImpl() throws Exception {
+ void testNodeAttributeKeyPBImpl() throws Exception {
validatePBImplRecord(NodeAttributeKeyPBImpl.class,
NodeAttributeKeyProto.class);
}
@Test
- public void testNodeToAttributeValuePBImpl() throws Exception {
+ void testNodeToAttributeValuePBImpl() throws Exception {
validatePBImplRecord(NodeToAttributeValuePBImpl.class,
NodeToAttributeValueProto.class);
}
@Test
- public void testNodeAttributePBImpl() throws Exception {
+ void testNodeAttributePBImpl() throws Exception {
validatePBImplRecord(NodeAttributePBImpl.class, NodeAttributeProto.class);
}
@Test
- public void testNodeAttributeInfoPBImpl() throws Exception {
+ void testNodeAttributeInfoPBImpl() throws Exception {
validatePBImplRecord(NodeAttributeInfoPBImpl.class,
NodeAttributeInfoProto.class);
}
@Test
- public void testNodeToAttributesPBImpl() throws Exception {
+ void testNodeToAttributesPBImpl() throws Exception {
validatePBImplRecord(NodeToAttributesPBImpl.class,
NodeToAttributesProto.class);
}
@Test
- public void testNodesToAttributesMappingRequestPBImpl() throws Exception {
+ void testNodesToAttributesMappingRequestPBImpl() throws Exception {
validatePBImplRecord(NodesToAttributesMappingRequestPBImpl.class,
NodesToAttributesMappingRequestProto.class);
}
@Test
- public void testGetAttributesToNodesRequestPBImpl() throws Exception {
+ void testGetAttributesToNodesRequestPBImpl() throws Exception {
validatePBImplRecord(GetAttributesToNodesRequestPBImpl.class,
YarnServiceProtos.GetAttributesToNodesRequestProto.class);
}
@Test
- public void testGetAttributesToNodesResponsePBImpl() throws Exception {
+ void testGetAttributesToNodesResponsePBImpl() throws Exception {
validatePBImplRecord(GetAttributesToNodesResponsePBImpl.class,
YarnServiceProtos.GetAttributesToNodesResponseProto.class);
}
@Test
- public void testGetClusterNodeAttributesRequestPBImpl() throws Exception {
+ void testGetClusterNodeAttributesRequestPBImpl() throws Exception {
validatePBImplRecord(GetClusterNodeAttributesRequestPBImpl.class,
YarnServiceProtos.GetClusterNodeAttributesRequestProto.class);
}
@Test
- public void testGetClusterNodeAttributesResponsePBImpl() throws Exception {
+ void testGetClusterNodeAttributesResponsePBImpl() throws Exception {
validatePBImplRecord(GetClusterNodeAttributesResponsePBImpl.class,
YarnServiceProtos.GetClusterNodeAttributesResponseProto.class);
}
@Test
- public void testGetNodesToAttributesRequestPBImpl() throws Exception {
+ void testGetNodesToAttributesRequestPBImpl() throws Exception {
validatePBImplRecord(GetNodesToAttributesRequestPBImpl.class,
YarnServiceProtos.GetNodesToAttributesRequestProto.class);
}
@Test
- public void testGetNodesToAttributesResponsePBImpl() throws Exception {
+ void testGetNodesToAttributesResponsePBImpl() throws Exception {
validatePBImplRecord(GetNodesToAttributesResponsePBImpl.class,
YarnServiceProtos.GetNodesToAttributesResponseProto.class);
}
@Test
- public void testGetEnhancedHeadroomPBImpl() throws Exception {
+ void testGetEnhancedHeadroomPBImpl() throws Exception {
validatePBImplRecord(EnhancedHeadroomPBImpl.class,
YarnServiceProtos.EnhancedHeadroomProto.class);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPlacementConstraintPBConversion.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPlacementConstraintPBConversion.java
index bd245e29ce9a2..300fc6a42b084 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPlacementConstraintPBConversion.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPlacementConstraintPBConversion.java
@@ -18,17 +18,10 @@
package org.apache.hadoop.yarn.api;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.NODE;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.RACK;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.cardinality;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.maxCardinality;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.or;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.targetCardinality;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.targetIn;
-import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.PlacementTargets.allocationTag;
-
import java.util.Iterator;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.api.pb.PlacementConstraintFromProtoConverter;
import org.apache.hadoop.yarn.api.pb.PlacementConstraintToProtoConverter;
import org.apache.hadoop.yarn.api.resource.PlacementConstraint;
@@ -40,8 +33,18 @@
import org.apache.hadoop.yarn.proto.YarnProtos.CompositePlacementConstraintProto.CompositeType;
import org.apache.hadoop.yarn.proto.YarnProtos.PlacementConstraintProto;
import org.apache.hadoop.yarn.proto.YarnProtos.SimplePlacementConstraintProto;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.NODE;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.PlacementTargets.allocationTag;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.RACK;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.cardinality;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.maxCardinality;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.or;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.targetCardinality;
+import static org.apache.hadoop.yarn.api.resource.PlacementConstraints.targetIn;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test class for {@link PlacementConstraintToProtoConverter} and
@@ -50,10 +53,10 @@
public class TestPlacementConstraintPBConversion {
@Test
- public void testTargetConstraintProtoConverter() {
+ void testTargetConstraintProtoConverter() {
AbstractConstraint sConstraintExpr =
targetIn(NODE, allocationTag("hbase-m"));
- Assert.assertTrue(sConstraintExpr instanceof SingleConstraint);
+ assertTrue(sConstraintExpr instanceof SingleConstraint);
SingleConstraint single = (SingleConstraint) sConstraintExpr;
PlacementConstraint sConstraint =
PlacementConstraints.build(sConstraintExpr);
@@ -63,14 +66,14 @@ public void testTargetConstraintProtoConverter() {
new PlacementConstraintToProtoConverter(sConstraint);
PlacementConstraintProto protoConstraint = toProtoConverter.convert();
- Assert.assertTrue(protoConstraint.hasSimpleConstraint());
- Assert.assertFalse(protoConstraint.hasCompositeConstraint());
+ assertTrue(protoConstraint.hasSimpleConstraint());
+ assertFalse(protoConstraint.hasCompositeConstraint());
SimplePlacementConstraintProto sProto =
protoConstraint.getSimpleConstraint();
- Assert.assertEquals(single.getScope(), sProto.getScope());
- Assert.assertEquals(single.getMinCardinality(), sProto.getMinCardinality());
- Assert.assertEquals(single.getMaxCardinality(), sProto.getMaxCardinality());
- Assert.assertEquals(single.getTargetExpressions().size(),
+ assertEquals(single.getScope(), sProto.getScope());
+ assertEquals(single.getMinCardinality(), sProto.getMinCardinality());
+ assertEquals(single.getMaxCardinality(), sProto.getMaxCardinality());
+ assertEquals(single.getTargetExpressions().size(),
sProto.getTargetExpressionsList().size());
// Convert from proto.
@@ -79,21 +82,21 @@ public void testTargetConstraintProtoConverter() {
PlacementConstraint newConstraint = fromProtoConverter.convert();
AbstractConstraint newConstraintExpr = newConstraint.getConstraintExpr();
- Assert.assertTrue(newConstraintExpr instanceof SingleConstraint);
+ assertTrue(newConstraintExpr instanceof SingleConstraint);
SingleConstraint newSingle = (SingleConstraint) newConstraintExpr;
- Assert.assertEquals(single.getScope(), newSingle.getScope());
- Assert.assertEquals(single.getMinCardinality(),
+ assertEquals(single.getScope(), newSingle.getScope());
+ assertEquals(single.getMinCardinality(),
newSingle.getMinCardinality());
- Assert.assertEquals(single.getMaxCardinality(),
+ assertEquals(single.getMaxCardinality(),
newSingle.getMaxCardinality());
- Assert.assertEquals(single.getTargetExpressions(),
+ assertEquals(single.getTargetExpressions(),
newSingle.getTargetExpressions());
}
@Test
- public void testCardinalityConstraintProtoConverter() {
+ void testCardinalityConstraintProtoConverter() {
AbstractConstraint sConstraintExpr = cardinality(RACK, 3, 10);
- Assert.assertTrue(sConstraintExpr instanceof SingleConstraint);
+ assertTrue(sConstraintExpr instanceof SingleConstraint);
SingleConstraint single = (SingleConstraint) sConstraintExpr;
PlacementConstraint sConstraint =
PlacementConstraints.build(sConstraintExpr);
@@ -111,17 +114,17 @@ public void testCardinalityConstraintProtoConverter() {
PlacementConstraint newConstraint = fromProtoConverter.convert();
AbstractConstraint newConstraintExpr = newConstraint.getConstraintExpr();
- Assert.assertTrue(newConstraintExpr instanceof SingleConstraint);
+ assertTrue(newConstraintExpr instanceof SingleConstraint);
SingleConstraint newSingle = (SingleConstraint) newConstraintExpr;
compareSimpleConstraints(single, newSingle);
}
@Test
- public void testCompositeConstraintProtoConverter() {
+ void testCompositeConstraintProtoConverter() {
AbstractConstraint constraintExpr =
or(targetIn(RACK, allocationTag("spark")), maxCardinality(NODE, 3),
targetCardinality(RACK, 2, 10, allocationTag("zk")));
- Assert.assertTrue(constraintExpr instanceof Or);
+ assertTrue(constraintExpr instanceof Or);
PlacementConstraint constraint = PlacementConstraints.build(constraintExpr);
Or orExpr = (Or) constraintExpr;
@@ -130,14 +133,14 @@ public void testCompositeConstraintProtoConverter() {
new PlacementConstraintToProtoConverter(constraint);
PlacementConstraintProto protoConstraint = toProtoConverter.convert();
- Assert.assertFalse(protoConstraint.hasSimpleConstraint());
- Assert.assertTrue(protoConstraint.hasCompositeConstraint());
+ assertFalse(protoConstraint.hasSimpleConstraint());
+ assertTrue(protoConstraint.hasCompositeConstraint());
CompositePlacementConstraintProto cProto =
protoConstraint.getCompositeConstraint();
- Assert.assertEquals(CompositeType.OR, cProto.getCompositeType());
- Assert.assertEquals(3, cProto.getChildConstraintsCount());
- Assert.assertEquals(0, cProto.getTimedChildConstraintsCount());
+ assertEquals(CompositeType.OR, cProto.getCompositeType());
+ assertEquals(3, cProto.getChildConstraintsCount());
+ assertEquals(0, cProto.getTimedChildConstraintsCount());
Iterator orChildren = orExpr.getChildren().iterator();
Iterator orProtoChildren =
cProto.getChildConstraintsList().iterator();
@@ -153,9 +156,9 @@ public void testCompositeConstraintProtoConverter() {
PlacementConstraint newConstraint = fromProtoConverter.convert();
AbstractConstraint newConstraintExpr = newConstraint.getConstraintExpr();
- Assert.assertTrue(newConstraintExpr instanceof Or);
+ assertTrue(newConstraintExpr instanceof Or);
Or newOrExpr = (Or) newConstraintExpr;
- Assert.assertEquals(3, newOrExpr.getChildren().size());
+ assertEquals(3, newOrExpr.getChildren().size());
orChildren = orExpr.getChildren().iterator();
Iterator newOrChildren =
newOrExpr.getChildren().iterator();
@@ -169,26 +172,26 @@ public void testCompositeConstraintProtoConverter() {
private void compareSimpleConstraintToProto(SingleConstraint constraint,
PlacementConstraintProto proto) {
- Assert.assertTrue(proto.hasSimpleConstraint());
- Assert.assertFalse(proto.hasCompositeConstraint());
+ assertTrue(proto.hasSimpleConstraint());
+ assertFalse(proto.hasCompositeConstraint());
SimplePlacementConstraintProto sProto = proto.getSimpleConstraint();
- Assert.assertEquals(constraint.getScope(), sProto.getScope());
- Assert.assertEquals(constraint.getMinCardinality(),
+ assertEquals(constraint.getScope(), sProto.getScope());
+ assertEquals(constraint.getMinCardinality(),
sProto.getMinCardinality());
- Assert.assertEquals(constraint.getMaxCardinality(),
+ assertEquals(constraint.getMaxCardinality(),
sProto.getMaxCardinality());
- Assert.assertEquals(constraint.getTargetExpressions().size(),
+ assertEquals(constraint.getTargetExpressions().size(),
sProto.getTargetExpressionsList().size());
}
private void compareSimpleConstraints(SingleConstraint single,
SingleConstraint newSingle) {
- Assert.assertEquals(single.getScope(), newSingle.getScope());
- Assert.assertEquals(single.getMinCardinality(),
+ assertEquals(single.getScope(), newSingle.getScope());
+ assertEquals(single.getMinCardinality(),
newSingle.getMinCardinality());
- Assert.assertEquals(single.getMaxCardinality(),
+ assertEquals(single.getMaxCardinality(),
newSingle.getMaxCardinality());
- Assert.assertEquals(single.getTargetExpressions(),
+ assertEquals(single.getTargetExpressions(),
newSingle.getTargetExpressions());
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourcePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourcePBImpl.java
index c92e73f44fd40..f564932bd4023 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourcePBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourcePBImpl.java
@@ -20,6 +20,10 @@
import java.io.File;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceInformation;
@@ -29,20 +33,19 @@
import org.apache.hadoop.yarn.proto.YarnProtos;
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
import org.apache.hadoop.yarn.util.resource.TestResourceUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
+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;
/**
* Test class to handle various proto related tests for resources.
*/
public class TestResourcePBImpl {
- @Before
+ @BeforeEach
public void setup() throws Exception {
ResourceUtils.resetResourceTypes();
@@ -51,7 +54,7 @@ public void setup() throws Exception {
TestResourceUtils.setupResourceTypes(conf, resourceTypesFile);
}
- @After
+ @AfterEach
public void teardown() {
Configuration conf = new YarnConfiguration();
File source = new File(
@@ -63,80 +66,80 @@ public void teardown() {
}
@Test
- public void testEmptyResourcePBInit() throws Exception {
+ void testEmptyResourcePBInit() throws Exception {
Resource res = new ResourcePBImpl();
// Assert to check it sets resource value and unit to default.
- Assert.assertEquals(0, res.getMemorySize());
- Assert.assertEquals(ResourceInformation.MEMORY_MB.getUnits(),
+ assertEquals(0, res.getMemorySize());
+ assertEquals(ResourceInformation.MEMORY_MB.getUnits(),
res.getResourceInformation(ResourceInformation.MEMORY_MB.getName())
.getUnits());
- Assert.assertEquals(ResourceInformation.VCORES.getUnits(),
+ assertEquals(ResourceInformation.VCORES.getUnits(),
res.getResourceInformation(ResourceInformation.VCORES.getName())
.getUnits());
}
@Test
- public void testResourcePBInitFromOldPB() throws Exception {
+ void testResourcePBInitFromOldPB() throws Exception {
YarnProtos.ResourceProto proto =
YarnProtos.ResourceProto.newBuilder().setMemory(1024).setVirtualCores(3)
.build();
// Assert to check it sets resource value and unit to default.
Resource res = new ResourcePBImpl(proto);
- Assert.assertEquals(1024, res.getMemorySize());
- Assert.assertEquals(3, res.getVirtualCores());
- Assert.assertEquals(ResourceInformation.MEMORY_MB.getUnits(),
+ assertEquals(1024, res.getMemorySize());
+ assertEquals(3, res.getVirtualCores());
+ assertEquals(ResourceInformation.MEMORY_MB.getUnits(),
res.getResourceInformation(ResourceInformation.MEMORY_MB.getName())
.getUnits());
- Assert.assertEquals(ResourceInformation.VCORES.getUnits(),
+ assertEquals(ResourceInformation.VCORES.getUnits(),
res.getResourceInformation(ResourceInformation.VCORES.getName())
.getUnits());
}
@Test
@SuppressWarnings("deprecation")
- public void testGetMemory() {
+ void testGetMemory() {
Resource res = new ResourcePBImpl();
long memorySize = Integer.MAX_VALUE + 1L;
res.setMemorySize(memorySize);
- assertEquals("No need to cast if both are long", memorySize,
- res.getMemorySize());
- assertEquals("Cast to Integer.MAX_VALUE if the long is greater than "
- + "Integer.MAX_VALUE", Integer.MAX_VALUE, res.getMemory());
+ assertEquals(memorySize, res.getMemorySize(), "No need to cast if both are long");
+ assertEquals(Integer.MAX_VALUE, res.getMemory(),
+ "Cast to Integer.MAX_VALUE if the long is greater than " + "Integer.MAX_VALUE");
}
@Test
- public void testGetVirtualCores() {
+ void testGetVirtualCores() {
Resource res = new ResourcePBImpl();
long vcores = Integer.MAX_VALUE + 1L;
res.getResourceInformation("vcores").setValue(vcores);
- assertEquals("No need to cast if both are long", vcores,
- res.getResourceInformation("vcores").getValue());
- assertEquals("Cast to Integer.MAX_VALUE if the long is greater than "
- + "Integer.MAX_VALUE", Integer.MAX_VALUE, res.getVirtualCores());
+ assertEquals(vcores,
+ res.getResourceInformation("vcores").getValue(),
+ "No need to cast if both are long");
+ assertEquals(Integer.MAX_VALUE, res.getVirtualCores(),
+ "Cast to Integer.MAX_VALUE if the long is greater than " + "Integer.MAX_VALUE");
}
@Test
- public void testResourcePBWithExtraResources() throws Exception {
+ void testResourcePBWithExtraResources() throws Exception {
//Resource 'resource1' has been passed as 4T
//4T should be converted to 4000G
YarnProtos.ResourceInformationProto riProto =
YarnProtos.ResourceInformationProto.newBuilder().setType(
YarnProtos.ResourceTypeInfoProto.newBuilder().
- setName("resource1").setType(
+ setName("resource1").setType(
YarnProtos.ResourceTypesProto.COUNTABLE).getType()).
- setValue(4).setUnits("T").setKey("resource1").build();
+ setValue(4).setUnits("T").setKey("resource1").build();
YarnProtos.ResourceProto proto =
YarnProtos.ResourceProto.newBuilder().setMemory(1024).
- setVirtualCores(3).addResourceValueMap(riProto).build();
+ setVirtualCores(3).addResourceValueMap(riProto).build();
Resource res = new ResourcePBImpl(proto);
- Assert.assertEquals(4000,
+ assertEquals(4000,
res.getResourceInformation("resource1").getValue());
- Assert.assertEquals("G",
+ assertEquals("G",
res.getResourceInformation("resource1").getUnits());
//Resource 'resource2' has been passed as 4M
@@ -144,18 +147,18 @@ public void testResourcePBWithExtraResources() throws Exception {
YarnProtos.ResourceInformationProto riProto1 =
YarnProtos.ResourceInformationProto.newBuilder().setType(
YarnProtos.ResourceTypeInfoProto.newBuilder().
- setName("resource2").setType(
+ setName("resource2").setType(
YarnProtos.ResourceTypesProto.COUNTABLE).getType()).
- setValue(4).setUnits("M").setKey("resource2").build();
+ setValue(4).setUnits("M").setKey("resource2").build();
YarnProtos.ResourceProto proto1 =
YarnProtos.ResourceProto.newBuilder().setMemory(1024).
- setVirtualCores(3).addResourceValueMap(riProto1).build();
+ setVirtualCores(3).addResourceValueMap(riProto1).build();
Resource res1 = new ResourcePBImpl(proto1);
- Assert.assertEquals(4000000000L,
+ assertEquals(4000000000L,
res1.getResourceInformation("resource2").getValue());
- Assert.assertEquals("m",
+ assertEquals("m",
res1.getResourceInformation("resource2").getUnits());
//Resource 'resource1' has been passed as 3M
@@ -163,23 +166,23 @@ public void testResourcePBWithExtraResources() throws Exception {
YarnProtos.ResourceInformationProto riProto2 =
YarnProtos.ResourceInformationProto.newBuilder().setType(
YarnProtos.ResourceTypeInfoProto.newBuilder().
- setName("resource1").setType(
+ setName("resource1").setType(
YarnProtos.ResourceTypesProto.COUNTABLE).getType()).
- setValue(3).setUnits("M").setKey("resource1").build();
+ setValue(3).setUnits("M").setKey("resource1").build();
YarnProtos.ResourceProto proto2 =
YarnProtos.ResourceProto.newBuilder().setMemory(1024).
- setVirtualCores(3).addResourceValueMap(riProto2).build();
+ setVirtualCores(3).addResourceValueMap(riProto2).build();
Resource res2 = new ResourcePBImpl(proto2);
- Assert.assertEquals(0,
+ assertEquals(0,
res2.getResourceInformation("resource1").getValue());
- Assert.assertEquals("G",
+ assertEquals("G",
res2.getResourceInformation("resource1").getUnits());
}
@Test
- public void testResourceTags() {
+ void testResourceTags() {
YarnProtos.ResourceInformationProto riProto =
YarnProtos.ResourceInformationProto.newBuilder()
.setType(
@@ -201,19 +204,19 @@ public void testResourceTags() {
.build();
Resource res = new ResourcePBImpl(proto);
- Assert.assertNotNull(res.getResourceInformation("yarn.io/test-volume"));
- Assert.assertEquals(10,
+ assertNotNull(res.getResourceInformation("yarn.io/test-volume"));
+ assertEquals(10,
res.getResourceInformation("yarn.io/test-volume")
.getValue());
- Assert.assertEquals("G",
+ assertEquals("G",
res.getResourceInformation("yarn.io/test-volume")
.getUnits());
- Assert.assertEquals(3,
+ assertEquals(3,
res.getResourceInformation("yarn.io/test-volume")
.getTags().size());
- Assert.assertFalse(res.getResourceInformation("yarn.io/test-volume")
+ assertFalse(res.getResourceInformation("yarn.io/test-volume")
.getTags().isEmpty());
- Assert.assertTrue(res.getResourceInformation("yarn.io/test-volume")
+ assertTrue(res.getResourceInformation("yarn.io/test-volume")
.getAttributes().isEmpty());
boolean protoConvertExpected = false;
@@ -225,13 +228,13 @@ public void testResourceTags() {
&& pf.getTagsCount() == 3;
}
}
- Assert.assertTrue("Expecting resource's protobuf message"
- + " contains 0 attributes and 3 tags",
- protoConvertExpected);
+ assertTrue(protoConvertExpected,
+ "Expecting resource's protobuf message"
+ + " contains 0 attributes and 3 tags");
}
@Test
- public void testResourceAttributes() {
+ void testResourceAttributes() {
YarnProtos.ResourceInformationProto riProto =
YarnProtos.ResourceInformationProto.newBuilder()
.setType(
@@ -260,19 +263,19 @@ public void testResourceAttributes() {
.build();
Resource res = new ResourcePBImpl(proto);
- Assert.assertNotNull(res.getResourceInformation("yarn.io/test-volume"));
- Assert.assertEquals(10,
+ assertNotNull(res.getResourceInformation("yarn.io/test-volume"));
+ assertEquals(10,
res.getResourceInformation("yarn.io/test-volume")
.getValue());
- Assert.assertEquals("G",
+ assertEquals("G",
res.getResourceInformation("yarn.io/test-volume")
.getUnits());
- Assert.assertEquals(2,
+ assertEquals(2,
res.getResourceInformation("yarn.io/test-volume")
.getAttributes().size());
- Assert.assertTrue(res.getResourceInformation("yarn.io/test-volume")
+ assertTrue(res.getResourceInformation("yarn.io/test-volume")
.getTags().isEmpty());
- Assert.assertFalse(res.getResourceInformation("yarn.io/test-volume")
+ assertFalse(res.getResourceInformation("yarn.io/test-volume")
.getAttributes().isEmpty());
boolean protoConvertExpected = false;
@@ -284,20 +287,20 @@ public void testResourceAttributes() {
&& pf.getTagsCount() == 0;
}
}
- Assert.assertTrue("Expecting resource's protobuf message"
- + " contains 2 attributes and 0 tags",
- protoConvertExpected);
+ assertTrue(protoConvertExpected,
+ "Expecting resource's protobuf message"
+ + " contains 2 attributes and 0 tags");
}
@Test
- public void testParsingResourceTags() {
+ void testParsingResourceTags() {
ResourceInformation info =
ResourceUtils.getResourceTypes().get("resource3");
- Assert.assertTrue(info.getAttributes().isEmpty());
- Assert.assertFalse(info.getTags().isEmpty());
+ assertTrue(info.getAttributes().isEmpty());
+ assertFalse(info.getTags().isEmpty());
assertThat(info.getTags()).hasSize(2);
info.getTags().remove("resource3_tag_1");
info.getTags().remove("resource3_tag_2");
- Assert.assertTrue(info.getTags().isEmpty());
+ assertTrue(info.getTags().isEmpty());
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourceRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourceRequest.java
index aef838cd17ebf..d3f3fe90d48c1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourceRequest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestResourceRequest.java
@@ -17,13 +17,15 @@
*/
package org.apache.hadoop.yarn.api;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.api.records.ExecutionType;
import org.apache.hadoop.yarn.api.records.ExecutionTypeRequest;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
/**
* The class to test {@link ResourceRequest}.
@@ -31,7 +33,7 @@
public class TestResourceRequest {
@Test
- public void testEqualsOnExecutionTypeRequest() {
+ void testEqualsOnExecutionTypeRequest() {
ResourceRequest resourceRequestA =
ResourceRequest.newInstance(Priority.newInstance(0), "localhost",
Resource.newInstance(1024, 1), 1, false, "",
@@ -42,6 +44,6 @@ public void testEqualsOnExecutionTypeRequest() {
Resource.newInstance(1024, 1), 1, false, "",
ExecutionTypeRequest.newInstance(ExecutionType.GUARANTEED, false));
- Assert.assertFalse(resourceRequestA.equals(resourceRequestB));
+ assertNotEquals(resourceRequestA, resourceRequestB);
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java
index 55b149640d3b8..952b7fede764f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestTimelineEntityGroupId.java
@@ -18,15 +18,20 @@
package org.apache.hadoop.yarn.api;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestTimelineEntityGroupId {
@Test
- public void testTimelineEntityGroupId() {
+ void testTimelineEntityGroupId() {
ApplicationId appId1 = ApplicationId.newInstance(1234, 1);
ApplicationId appId2 = ApplicationId.newInstance(1234, 2);
TimelineEntityGroupId group1 = TimelineEntityGroupId.newInstance(appId1, "1");
@@ -34,19 +39,19 @@ public void testTimelineEntityGroupId() {
TimelineEntityGroupId group3 = TimelineEntityGroupId.newInstance(appId2, "1");
TimelineEntityGroupId group4 = TimelineEntityGroupId.newInstance(appId1, "1");
- Assert.assertTrue(group1.equals(group4));
- Assert.assertFalse(group1.equals(group2));
- Assert.assertFalse(group1.equals(group3));
+ assertEquals(group1, group4);
+ assertNotEquals(group1, group2);
+ assertNotEquals(group1, group3);
- Assert.assertTrue(group1.compareTo(group4) == 0);
- Assert.assertTrue(group1.compareTo(group2) < 0);
- Assert.assertTrue(group1.compareTo(group3) < 0);
+ assertTrue(group1.compareTo(group4) == 0);
+ assertTrue(group1.compareTo(group2) < 0);
+ assertTrue(group1.compareTo(group3) < 0);
- Assert.assertTrue(group1.hashCode() == group4.hashCode());
- Assert.assertFalse(group1.hashCode() == group2.hashCode());
- Assert.assertFalse(group1.hashCode() == group3.hashCode());
+ assertTrue(group1.hashCode() == group4.hashCode());
+ assertFalse(group1.hashCode() == group2.hashCode());
+ assertFalse(group1.hashCode() == group3.hashCode());
- Assert.assertEquals("timelineEntityGroupId_1234_1_1", group1.toString());
- Assert.assertEquals(TimelineEntityGroupId.fromString("timelineEntityGroupId_1234_1_1"), group1);
+ assertEquals("timelineEntityGroupId_1234_1_1", group1.toString());
+ assertEquals(TimelineEntityGroupId.fromString("timelineEntityGroupId_1234_1_1"), group1);
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/TestGetApplicationsRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/TestGetApplicationsRequestPBImpl.java
index 35f9aa54e6478..beea949b5e537 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/TestGetApplicationsRequestPBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/TestGetApplicationsRequestPBImpl.java
@@ -18,57 +18,64 @@
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
import org.apache.hadoop.util.Sets;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsRequestProto;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
-@RunWith(Parameterized.class)
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
public class TestGetApplicationsRequestPBImpl {
- @Parameter
@SuppressWarnings("checkstyle:visibilitymodifier")
public GetApplicationsRequestPBImpl impl;
- @Test
- public void testAppTagsLowerCaseConversionDefault() {
- impl.setApplicationTags(Sets.newHashSet("ABcd", "efgH"));
- impl.getApplicationTags().forEach(s ->
- assertEquals(s, s.toLowerCase()));
+ @MethodSource("data")
+ @ParameterizedTest
+ void testAppTagsLowerCaseConversionDefault(
+ GetApplicationsRequestPBImpl applicationsRequestPBImpl) {
+ initTestGetApplicationsRequestPBImpl(applicationsRequestPBImpl);
+ applicationsRequestPBImpl.setApplicationTags(Sets.newHashSet("ABcd", "efgH"));
+ applicationsRequestPBImpl.getApplicationTags().forEach(s -> assertEquals(s, s.toLowerCase()));
}
- @Test
- public void testAppTagsLowerCaseConversionDisabled() {
+ @MethodSource("data")
+ @ParameterizedTest
+ void testAppTagsLowerCaseConversionDisabled(
+ GetApplicationsRequestPBImpl applicationsRequestPBImpl) {
+ initTestGetApplicationsRequestPBImpl(applicationsRequestPBImpl);
GetApplicationsRequestPBImpl.setForceLowerCaseTags(false);
- impl.setApplicationTags(Sets.newHashSet("ABcd", "efgH"));
- impl.getApplicationTags().forEach(s ->
- assertNotEquals(s, s.toLowerCase()));
+ applicationsRequestPBImpl.setApplicationTags(Sets.newHashSet("ABcd", "efgH"));
+ applicationsRequestPBImpl.getApplicationTags()
+ .forEach(s -> assertNotEquals(s, s.toLowerCase()));
}
- @Test
- public void testAppTagsLowerCaseConversionEnabled() {
+ @MethodSource("data")
+ @ParameterizedTest
+ void testAppTagsLowerCaseConversionEnabled(
+ GetApplicationsRequestPBImpl applicationsRequestPBImpl) {
+ initTestGetApplicationsRequestPBImpl(applicationsRequestPBImpl);
GetApplicationsRequestPBImpl.setForceLowerCaseTags(true);
- impl.setApplicationTags(Sets.newHashSet("ABcd", "efgH"));
- impl.getApplicationTags().forEach(s ->
- assertEquals(s, s.toLowerCase()));
+ applicationsRequestPBImpl.setApplicationTags(Sets.newHashSet("ABcd", "efgH"));
+ applicationsRequestPBImpl.getApplicationTags().forEach(s -> assertEquals(s, s.toLowerCase()));
}
- @Parameters
public static Collection
");
}
- @Test public void testTable() {
+ @Test
+ void testTable() {
Hamlet h = newHamlet().
title("test table").
link("style.css");
@@ -90,7 +99,8 @@ public class TestHamlet {
verify(out, atLeast(1)).print("");
}
- @Test public void testEnumAttrs() {
+ @Test
+ void testEnumAttrs() {
Hamlet h = newHamlet().
meta_http("Content-type", "text/html; charset=utf-8").
title("test enum attrs").
@@ -109,7 +119,8 @@ public class TestHamlet {
verify(out).print(" rel=\"start index\"");
}
- @Test public void testScriptStyle() {
+ @Test
+ void testScriptStyle() {
Hamlet h = newHamlet().
script("a.js").script("b.js").
style("h1 { font-size: 1.2em }");
@@ -121,7 +132,8 @@ public class TestHamlet {
verify(out).print(" type=\"text/css\"");
}
- @Test public void testPreformatted() {
+ @Test
+ void testPreformatted() {
Hamlet h = newHamlet().
div().
i("inline before pre").
@@ -144,7 +156,8 @@ static class TestView2 implements SubView {
@Override public void renderPartial() {}
}
- @Test public void testSubViews() {
+ @Test
+ void testSubViews() {
Hamlet h = newHamlet().
title("test sub-views").
div("#view1").__(TestView1.class).__().
@@ -153,8 +166,8 @@ static class TestView2 implements SubView {
PrintWriter out = h.getWriter();
out.flush();
assertEquals(0, h.nestLevel);
- verify(out).print("["+ TestView1.class.getName() +"]");
- verify(out).print("["+ TestView2.class.getName() +"]");
+ verify(out).print("[" + TestView1.class.getName() + "]");
+ verify(out).print("[" + TestView2.class.getName() + "]");
}
static Hamlet newHamlet() {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestHamletImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestHamletImpl.java
index 3b19aa30c3d11..6a3e90b568930 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestHamletImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestHamletImpl.java
@@ -18,19 +18,29 @@
package org.apache.hadoop.yarn.webapp.hamlet2;
import java.io.PrintWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.*;
+import org.junit.jupiter.api.Test;
-import org.apache.hadoop.yarn.webapp.hamlet2.HamletSpec.*;
+import org.apache.hadoop.yarn.webapp.hamlet2.HamletSpec.CoreAttrs;
+import org.apache.hadoop.yarn.webapp.hamlet2.HamletSpec.H1;
+import org.apache.hadoop.yarn.webapp.hamlet2.HamletSpec.LINK;
+import org.apache.hadoop.yarn.webapp.hamlet2.HamletSpec.SCRIPT;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
public class TestHamletImpl {
/**
* Test the generic implementation methods
* @see TestHamlet for Hamlet syntax
*/
- @Test public void testGeneric() {
+ @Test
+ void testGeneric() {
PrintWriter out = spy(new PrintWriter(System.out));
HamletImpl hi = new HamletImpl(out, 0, false);
hi.
@@ -66,7 +76,8 @@ public class TestHamletImpl {
verify(out, never()).print("");
}
- @Test public void testSetSelector() {
+ @Test
+ void testSetSelector() {
CoreAttrs e = mock(CoreAttrs.class);
HamletImpl.setSelector(e, "#id.class");
@@ -81,7 +92,8 @@ public class TestHamletImpl {
verify(t).__("heading");
}
- @Test public void testSetLinkHref() {
+ @Test
+ void testSetLinkHref() {
LINK link = mock(LINK.class);
HamletImpl.setLinkHref(link, "uri");
HamletImpl.setLinkHref(link, "style.css");
@@ -93,7 +105,8 @@ public class TestHamletImpl {
verifyNoMoreInteractions(link);
}
- @Test public void testSetScriptSrc() {
+ @Test
+ void testSetScriptSrc() {
SCRIPT script = mock(SCRIPT.class);
HamletImpl.setScriptSrc(script, "uri");
HamletImpl.setScriptSrc(script, "script.js");
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestParseSelector.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestParseSelector.java
index e2141e6942c09..a340f1491f352 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestParseSelector.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet2/TestParseSelector.java
@@ -17,41 +17,51 @@
*/
package org.apache.hadoop.yarn.webapp.hamlet2;
-import org.junit.Test;
-
-import static org.apache.hadoop.yarn.webapp.hamlet2.HamletImpl.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.yarn.webapp.WebAppException;
+import static org.apache.hadoop.yarn.webapp.hamlet2.HamletImpl.S_CLASS;
+import static org.apache.hadoop.yarn.webapp.hamlet2.HamletImpl.S_ID;
+import static org.apache.hadoop.yarn.webapp.hamlet2.HamletImpl.parseSelector;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
public class TestParseSelector {
- @Test public void testNormal() {
+ @Test
+ void testNormal() {
String[] res = parseSelector("#id.class");
assertEquals("id", res[S_ID]);
assertEquals("class", res[S_CLASS]);
}
- @Test public void testMultiClass() {
+ @Test
+ void testMultiClass() {
String[] res = parseSelector("#id.class1.class2");
assertEquals("id", res[S_ID]);
assertEquals("class1 class2", res[S_CLASS]);
}
- @Test public void testMissingId() {
+ @Test
+ void testMissingId() {
String[] res = parseSelector(".class");
assertNull(res[S_ID]);
assertEquals("class", res[S_CLASS]);
}
- @Test public void testMissingClass() {
+ @Test
+ void testMissingClass() {
String[] res = parseSelector("#id");
assertEquals("id", res[S_ID]);
assertNull(res[S_CLASS]);
}
- @Test(expected=WebAppException.class) public void testMissingAll() {
- parseSelector("");
+ @Test
+ void testMissingAll() {
+ assertThrows(WebAppException.class, () -> {
+ parseSelector("");
+ });
}
}
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlockForTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlockForTest.java
index 57e6c81659b97..e171ee1fc5684 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlockForTest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/log/AggregatedLogsBlockForTest.java
@@ -20,7 +20,6 @@
import java.util.HashMap;
import java.util.Map;
-
import javax.servlet.http.HttpServletRequest;
import org.apache.hadoop.conf.Configuration;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/TestWebAppTests.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/TestWebAppTests.java
index e2f2bfa1b2583..aef8ea463e645 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/TestWebAppTests.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/TestWebAppTests.java
@@ -18,23 +18,26 @@
package org.apache.hadoop.yarn.webapp.test;
-import com.google.inject.AbstractModule;
-import com.google.inject.Injector;
-import com.google.inject.servlet.RequestScoped;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.junit.Test;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-import org.slf4j.LoggerFactory;
+import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
+import com.google.inject.servlet.RequestScoped;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.mockito.Mockito.verify;
public class TestWebAppTests {
static final Logger LOG = LoggerFactory.getLogger(TestWebAppTests.class);
- @Test public void testInstances() throws Exception {
+ @Test
+ void testInstances() throws Exception {
Injector injector = WebAppTests.createMockInjector(this);
HttpServletRequest req = injector.getInstance(HttpServletRequest.class);
HttpServletResponse res = injector.getInstance(HttpServletResponse.class);
@@ -61,24 +64,27 @@ static class Bar implements Foo {
static class FooBar extends Bar {
}
- @Test public void testCreateInjector() throws Exception {
+ @Test
+ void testCreateInjector() throws Exception {
Bar bar = new Bar();
Injector injector = WebAppTests.createMockInjector(Foo.class, bar);
logInstances(injector.getInstance(HttpServletRequest.class),
- injector.getInstance(HttpServletResponse.class),
- injector.getInstance(HttpServletResponse.class).getWriter());
+ injector.getInstance(HttpServletResponse.class),
+ injector.getInstance(HttpServletResponse.class).getWriter());
assertSame(bar, injector.getInstance(Foo.class));
}
- @Test public void testCreateInjector2() {
+ @Test
+ void testCreateInjector2() {
final FooBar foobar = new FooBar();
Bar bar = new Bar();
Injector injector = WebAppTests.createMockInjector(Foo.class, bar,
new AbstractModule() {
- @Override protected void configure() {
- bind(Bar.class).toInstance(foobar);
- }
- });
+ @Override
+ protected void configure() {
+ bind(Bar.class).toInstance(foobar);
+ }
+ });
assertNotSame(bar, injector.getInstance(Bar.class));
assertSame(foobar, injector.getInstance(Bar.class));
}
@@ -87,11 +93,12 @@ static class FooBar extends Bar {
static class ScopeTest {
}
- @Test public void testRequestScope() {
+ @Test
+ void testRequestScope() {
Injector injector = WebAppTests.createMockInjector(this);
assertSame(injector.getInstance(ScopeTest.class),
- injector.getInstance(ScopeTest.class));
+ injector.getInstance(ScopeTest.class));
}
private void logInstances(HttpServletRequest req, HttpServletResponse res,
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/WebAppTests.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/WebAppTests.java
index da009d4d28e21..41c56ce1b61a1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/WebAppTests.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/test/WebAppTests.java
@@ -18,30 +18,29 @@
package org.apache.hadoop.yarn.webapp.test;
-import org.apache.hadoop.yarn.webapp.Controller;
-import org.apache.hadoop.yarn.webapp.SubView;
-import org.apache.hadoop.yarn.webapp.View;
-import org.apache.hadoop.yarn.webapp.WebAppException;
-
+import java.io.IOException;
+import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
-import com.google.inject.Module;
-import com.google.inject.Scopes;
-import com.google.inject.servlet.RequestScoped;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import com.google.inject.Module;
import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.servlet.RequestScoped;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
+import org.apache.hadoop.yarn.webapp.Controller;
+import org.apache.hadoop.yarn.webapp.SubView;
+import org.apache.hadoop.yarn.webapp.View;
+import org.apache.hadoop.yarn.webapp.WebAppException;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
public class WebAppTests {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebAppUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebAppUtils.java
index d6f78b18c1bc2..2d9c39aba8b8d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebAppUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebAppUtils.java
@@ -18,14 +18,18 @@
package org.apache.hadoop.yarn.webapp.util;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.http.HttpServer2;
@@ -35,13 +39,10 @@
import org.apache.hadoop.security.alias.CredentialProviderFactory;
import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-import javax.servlet.http.HttpServletRequest;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
public class TestWebAppUtils {
private static final String RM1_NODE_ID = "rm1";
@@ -53,7 +54,7 @@ public class TestWebAppUtils {
private static final String anyIpAddress = "1.2.3.4";
private static Map savedStaticResolution = new HashMap<>();
- @BeforeClass
+ @BeforeAll
public static void initializeDummyHostnameResolution() throws Exception {
String previousIpAddress;
for (String hostName : dummyHostNames) {
@@ -64,7 +65,7 @@ public static void initializeDummyHostnameResolution() throws Exception {
}
}
- @AfterClass
+ @AfterAll
public static void restoreDummyHostnameResolution() throws Exception {
for (Map.Entry hostnameToIpEntry : savedStaticResolution.entrySet()) {
NetUtils.addStaticResolution(hostnameToIpEntry.getKey(), hostnameToIpEntry.getValue());
@@ -72,7 +73,7 @@ public static void restoreDummyHostnameResolution() throws Exception {
}
@Test
- public void TestRMWebAppURLRemoteAndLocal() throws UnknownHostException {
+ void TestRMWebAppURLRemoteAndLocal() throws UnknownHostException {
Configuration configuration = new Configuration();
final String rmAddress = "host1:8088";
configuration.set(YarnConfiguration.RM_WEBAPP_ADDRESS, rmAddress);
@@ -84,30 +85,32 @@ public void TestRMWebAppURLRemoteAndLocal() throws UnknownHostException {
configuration.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + "," + RM2_NODE_ID);
String rmRemoteUrl = WebAppUtils.getResolvedRemoteRMWebAppURLWithoutScheme(configuration);
- Assert.assertEquals("ResolvedRemoteRMWebAppUrl should resolve to the first HA RM address", rm1Address, rmRemoteUrl);
+ assertEquals(rm1Address, rmRemoteUrl,
+ "ResolvedRemoteRMWebAppUrl should resolve to the first HA RM address");
String rmLocalUrl = WebAppUtils.getResolvedRMWebAppURLWithoutScheme(configuration);
- Assert.assertEquals("ResolvedRMWebAppUrl should resolve to the default RM webapp address", rmAddress, rmLocalUrl);
+ assertEquals(rmAddress, rmLocalUrl,
+ "ResolvedRMWebAppUrl should resolve to the default RM webapp address");
}
@Test
- public void testGetPassword() throws Exception {
+ void testGetPassword() throws Exception {
Configuration conf = provisionCredentialsForSSL();
// use WebAppUtils as would be used by loadSslConfiguration
- Assert.assertEquals("keypass",
+ assertEquals("keypass",
WebAppUtils.getPassword(conf, WebAppUtils.WEB_APP_KEY_PASSWORD_KEY));
- Assert.assertEquals("storepass",
+ assertEquals("storepass",
WebAppUtils.getPassword(conf, WebAppUtils.WEB_APP_KEYSTORE_PASSWORD_KEY));
- Assert.assertEquals("trustpass",
+ assertEquals("trustpass",
WebAppUtils.getPassword(conf, WebAppUtils.WEB_APP_TRUSTSTORE_PASSWORD_KEY));
// let's make sure that a password that doesn't exist returns null
- Assert.assertEquals(null, WebAppUtils.getPassword(conf,"invalid-alias"));
+ assertNull(WebAppUtils.getPassword(conf, "invalid-alias"));
}
@Test
- public void testLoadSslConfiguration() throws Exception {
+ void testLoadSslConfiguration() throws Exception {
Configuration conf = provisionCredentialsForSSL();
TestBuilder builder = (TestBuilder) new TestBuilder();
@@ -116,12 +119,12 @@ public void testLoadSslConfiguration() throws Exception {
String keypass = "keypass";
String storepass = "storepass";
- String trustpass = "trustpass";
+ String trustpass = "trustpass";
// make sure we get the right passwords in the builder
- assertEquals(keypass, ((TestBuilder)builder).keypass);
- assertEquals(storepass, ((TestBuilder)builder).keystorePassword);
- assertEquals(trustpass, ((TestBuilder)builder).truststorePassword);
+ assertEquals(keypass, ((TestBuilder) builder).keypass);
+ assertEquals(storepass, ((TestBuilder) builder).keystorePassword);
+ assertEquals(trustpass, ((TestBuilder) builder).truststorePassword);
}
protected Configuration provisionCredentialsForSSL() throws IOException,
@@ -145,11 +148,11 @@ protected Configuration provisionCredentialsForSSL() throws IOException,
char[] trustpass = {'t', 'r', 'u', 's', 't', 'p', 'a', 's', 's'};
// ensure that we get nulls when the key isn't there
- assertEquals(null, provider.getCredentialEntry(
+ assertNull(provider.getCredentialEntry(
WebAppUtils.WEB_APP_KEY_PASSWORD_KEY));
- assertEquals(null, provider.getCredentialEntry(
+ assertNull(provider.getCredentialEntry(
WebAppUtils.WEB_APP_KEYSTORE_PASSWORD_KEY));
- assertEquals(null, provider.getCredentialEntry(
+ assertNull(provider.getCredentialEntry(
WebAppUtils.WEB_APP_TRUSTSTORE_PASSWORD_KEY));
// create new aliases
@@ -180,7 +183,7 @@ protected Configuration provisionCredentialsForSSL() throws IOException,
}
@Test
- public void testAppendQueryParams() throws Exception {
+ void testAppendQueryParams() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String targetUri = "/test/path";
Mockito.when(request.getCharacterEncoding()).thenReturn(null);
@@ -194,12 +197,12 @@ public void testAppendQueryParams() throws Exception {
for (Map.Entry entry : paramResultMap.entrySet()) {
Mockito.when(request.getQueryString()).thenReturn(entry.getKey());
String uri = WebAppUtils.appendQueryParams(request, targetUri);
- Assert.assertEquals(entry.getValue(), uri);
+ assertEquals(entry.getValue(), uri);
}
}
@Test
- public void testGetHtmlEscapedURIWithQueryString() throws Exception {
+ void testGetHtmlEscapedURIWithQueryString() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String targetUri = "/test/path";
Mockito.when(request.getCharacterEncoding()).thenReturn(null);
@@ -214,7 +217,7 @@ public void testGetHtmlEscapedURIWithQueryString() throws Exception {
for (Map.Entry entry : paramResultMap.entrySet()) {
Mockito.when(request.getQueryString()).thenReturn(entry.getKey());
String uri = WebAppUtils.getHtmlEscapedURIWithQueryString(request);
- Assert.assertEquals(entry.getValue(), uri);
+ assertEquals(entry.getValue(), uri);
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebServiceClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebServiceClient.java
index 99a5783628e9a..b51dcf88bcbf7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebServiceClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/util/TestWebServiceClient.java
@@ -22,6 +22,8 @@
import java.net.URI;
import java.net.URL;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.http.HttpServer2;
@@ -29,8 +31,9 @@
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.junit.Assert;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
public class TestWebServiceClient {
@@ -43,17 +46,17 @@ public class TestWebServiceClient {
static final String SERVLET_PATH_ECHO = "/" + SERVLET_NAME_ECHO;
@Test
- public void testGetWebServiceClient() throws Exception {
+ void testGetWebServiceClient() throws Exception {
Configuration conf = new Configuration();
conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, "HTTPS_ONLY");
WebServiceClient.initialize(conf);
WebServiceClient client = WebServiceClient.getWebServiceClient();
- Assert.assertNotNull(client.getSSLFactory());
+ assertNotNull(client.getSSLFactory());
WebServiceClient.destroy();
}
@Test
- public void testCreateClient() throws Exception {
+ void testCreateClient() throws Exception {
Configuration conf = new Configuration();
conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, "HTTPS_ONLY");
File base = new File(BASEDIR);
@@ -91,7 +94,7 @@ public void testCreateClient() throws Exception {
WebServiceClient client = WebServiceClient.getWebServiceClient();
HttpURLConnection conn = client.getHttpURLConnectionFactory()
.getHttpURLConnection(u);
- Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
+ assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
WebServiceClient.destroy();
server.stop();
FileUtil.fullyDelete(new File(BASEDIR));
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestCommonViews.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestCommonViews.java
index a29b152e9f45e..028bc6ad18c20 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestCommonViews.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestCommonViews.java
@@ -19,36 +19,36 @@
package org.apache.hadoop.yarn.webapp.view;
import com.google.inject.Injector;
+import org.junit.jupiter.api.Test;
import org.apache.hadoop.yarn.webapp.ResponseInfo;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.apache.hadoop.yarn.webapp.view.ErrorPage;
-import org.apache.hadoop.yarn.webapp.view.FooterBlock;
-import org.apache.hadoop.yarn.webapp.view.HeaderBlock;
-import org.apache.hadoop.yarn.webapp.view.JQueryUI;
-
-import org.junit.Test;
public class TestCommonViews {
- @Test public void testErrorPage() {
+ @Test
+ void testErrorPage() {
Injector injector = WebAppTests.testPage(ErrorPage.class);
}
- @Test public void testHeaderBlock() {
+ @Test
+ void testHeaderBlock() {
WebAppTests.testBlock(HeaderBlock.class);
}
- @Test public void testFooterBlock() {
+ @Test
+ void testFooterBlock() {
WebAppTests.testBlock(FooterBlock.class);
}
- @Test public void testJQueryUI() {
+ @Test
+ void testJQueryUI() {
WebAppTests.testBlock(JQueryUI.class);
}
- @Test public void testInfoBlock() {
+ @Test
+ void testInfoBlock() {
Injector injector = WebAppTests.createMockInjector(this);
ResponseInfo info = injector.getInstance(ResponseInfo.class);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlBlock.java
index e510dd57ba85f..de9bd454de54a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlBlock.java
@@ -18,15 +18,16 @@
package org.apache.hadoop.yarn.webapp.view;
-import com.google.inject.Injector;
-
import java.io.PrintWriter;
+import com.google.inject.Injector;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.webapp.WebAppException;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.junit.Test;
-import static org.mockito.Mockito.*;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.verify;
public class TestHtmlBlock {
public static class TestBlock extends HtmlBlock {
@@ -54,7 +55,8 @@ public void render(Page.HTML<__> html) {
}
}
- @Test public void testUsual() {
+ @Test
+ void testUsual() {
Injector injector = WebAppTests.testBlock(TestBlock.class);
PrintWriter out = injector.getInstance(PrintWriter.class);
@@ -62,11 +64,17 @@ public void render(Page.HTML<__> html) {
verify(out).print("test note");
}
- @Test(expected=WebAppException.class) public void testShortBlock() {
- WebAppTests.testBlock(ShortBlock.class);
+ @Test
+ void testShortBlock() {
+ assertThrows(WebAppException.class, () -> {
+ WebAppTests.testBlock(ShortBlock.class);
+ });
}
- @Test(expected=WebAppException.class) public void testShortPage() {
- WebAppTests.testPage(ShortPage.class);
+ @Test
+ void testShortPage() {
+ assertThrows(WebAppException.class, () -> {
+ WebAppTests.testPage(ShortPage.class);
+ });
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java
index beed31fb478bb..ce8bbc9d85162 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestHtmlPage.java
@@ -18,16 +18,17 @@
package org.apache.hadoop.yarn.webapp.view;
-import com.google.inject.Injector;
-
import java.io.PrintWriter;
+import com.google.inject.Injector;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.webapp.MimeType;
import org.apache.hadoop.yarn.webapp.WebAppException;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.junit.Test;
-import static org.mockito.Mockito.*;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.verify;
public class TestHtmlPage {
@@ -49,7 +50,8 @@ public void render(Page.HTML<__> html) {
}
}
- @Test public void testUsual() {
+ @Test
+ void testUsual() {
Injector injector = WebAppTests.testPage(TestView.class);
PrintWriter out = injector.getInstance(PrintWriter.class);
@@ -64,7 +66,10 @@ public void render(Page.HTML<__> html) {
verify(out).print("test note");
}
- @Test(expected=WebAppException.class) public void testShort() {
- WebAppTests.testPage(ShortView.class);
+ @Test
+ void testShort() {
+ assertThrows(WebAppException.class, () -> {
+ WebAppTests.testPage(ShortView.class);
+ });
}
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java
index 751aa2cabe4c9..1f0a4a6467eb0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java
@@ -21,13 +21,15 @@
import java.io.PrintWriter;
import java.io.StringWriter;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import org.apache.hadoop.yarn.webapp.ResponseInfo;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.junit.Before;
-import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestInfoBlock {
@@ -86,30 +88,32 @@ public MultilineInfoBlock() {
}
}
- @Before
+ @BeforeEach
public void setup() {
sw = new StringWriter();
pw = new PrintWriter(sw);
}
- @Test(timeout=60000L)
- public void testMultilineInfoBlock() throws Exception{
+ @Test
+ @Timeout(60000L)
+ void testMultilineInfoBlock() throws Exception {
WebAppTests.testBlock(MultilineInfoBlock.class);
TestInfoBlock.pw.flush();
String output = TestInfoBlock.sw.toString().replaceAll(" +", " ");
String expectedMultilineData1 = String.format("%n"
- + " %n Multiple_line_value%n | %n"
- + " %n This is one line.%n | %n");
+ + " %n Multiple_line_value%n | %n"
+ + " %n This is one line.%n | %n");
String expectedMultilineData2 = String.format("
%n"
- + " %n Multiple_line_value%n | %n %n %n"
- + " This is first line.%n %n %n"
- + " This is second line.%n %n");
+ + " | %n Multiple_line_value%n | %n %n %n"
+ + " This is first line.%n %n %n"
+ + " This is second line.%n %n");
assertTrue(output.contains(expectedMultilineData1) && output.contains(expectedMultilineData2));
}
-
- @Test(timeout=60000L)
- public void testJavaScriptInfoBlock() throws Exception{
+
+ @Test
+ @Timeout(60000L)
+ void testJavaScriptInfoBlock() throws Exception {
WebAppTests.testBlock(JavaScriptInfoBlock.class);
TestInfoBlock.pw.flush();
String output = TestInfoBlock.sw.toString();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnCssPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnCssPage.java
index 20df4093ad355..a6ec759e8939f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnCssPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnCssPage.java
@@ -18,11 +18,12 @@
package org.apache.hadoop.yarn.webapp.view;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.MockApps;
import org.apache.hadoop.yarn.webapp.Controller;
import org.apache.hadoop.yarn.webapp.WebApps;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.junit.Test;
public class TestTwoColumnCssPage {
@@ -57,7 +58,8 @@ public void render(Page.HTML<__> html) {
}
}
- @Test public void shouldNotThrow() {
+ @Test
+ void shouldNotThrow() {
WebAppTests.testPage(TwoColumnCssLayout.class);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnLayout.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnLayout.java
index 52ae6ae9bd53f..d2e4176d7726e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnLayout.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestTwoColumnLayout.java
@@ -18,10 +18,11 @@
package org.apache.hadoop.yarn.webapp.view;
+import org.junit.jupiter.api.Test;
+
import org.apache.hadoop.yarn.webapp.Controller;
import org.apache.hadoop.yarn.webapp.WebApps;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.junit.Test;
public class TestTwoColumnLayout {
@@ -34,7 +35,8 @@ public void index() {
}
}
- @Test public void shouldNotThrow() {
+ @Test
+ void shouldNotThrow() {
WebAppTests.testPage(TwoColumnLayout.class);
}
diff --git a/hadoop-yarn-project/pom.xml b/hadoop-yarn-project/pom.xml
index abaf2e869c48f..4aaee38b08d79 100644
--- a/hadoop-yarn-project/pom.xml
+++ b/hadoop-yarn-project/pom.xml
@@ -211,4 +211,6 @@
+
+
|