Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import static org.junit.Assert.fail;

import java.io.StringReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import javax.ws.rs.core.MediaType;
Expand All @@ -34,7 +36,6 @@
import org.apache.hadoop.http.JettyUtils;
import org.apache.hadoop.mapreduce.v2.app.AppContext;
import org.apache.hadoop.mapreduce.v2.app.MockAppContext;
import org.apache.hadoop.util.Sets;
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
import org.apache.hadoop.yarn.webapp.GuiceServletConfig;
import org.apache.hadoop.yarn.webapp.JerseyTestBase;
Expand Down Expand Up @@ -75,7 +76,7 @@ private static class WebServletModule extends ServletModule {
protected void configureServlets() {

appContext = new MockAppContext(0, 1, 1, 1);
appContext.setBlacklistedNodes(Sets.newHashSet("badnode1", "badnode2"));
appContext.setBlacklistedNodes(new HashSet<>(Arrays.asList("badnode1", "badnode2")));

bind(JAXBContextResolver.class);
bind(AMWebServices.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

Expand All @@ -44,7 +45,6 @@
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.Lists;
import org.apache.hadoop.util.Sets;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -398,12 +398,9 @@ public static void verifyFileStatuses(List<Path> expectedPaths,
List<FileStatus> fetchedStatuses, final FileSystem localFs) {
Assert.assertEquals(expectedPaths.size(), fetchedStatuses.size());

Iterable<Path> fqExpectedPaths =
expectedPaths.stream().map(
input -> localFs.makeQualified(input)).collect(Collectors.toList());


Set<Path> expectedPathSet = Sets.newHashSet(fqExpectedPaths);
Set<Path> expectedPathSet = expectedPaths.stream().map(
localFs::makeQualified).collect(Collectors.toSet());
for (FileStatus fileStatus : fetchedStatuses) {
if (!expectedPathSet.remove(localFs.makeQualified(fileStatus.getPath()))) {
Assert.fail("Found extra fetched status: " + fileStatus.getPath());
Expand All @@ -421,7 +418,7 @@ private void verifySplits(List<String> expected, List<InputSplit> splits) {
input-> ((FileSplit) input).getPath().toString())
.collect(Collectors.toList());

Set<String> expectedSet = Sets.newHashSet(expected);
Set<String> expectedSet = new HashSet<>(expected);
for (String splitPathString : pathsFromSplits) {
if (!expectedSet.remove(splitPathString)) {
Assert.fail("Found extra split: " + splitPathString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.apache.hadoop.mapreduce.v2.hs.HistoryContext;
import org.apache.hadoop.mapreduce.v2.hs.MockHistoryContext;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.Sets;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse;
Expand Down Expand Up @@ -77,6 +76,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -323,9 +323,9 @@ public void testGetAggregatedLogsMetaForFinishedApp() {

List<ContainerLogsInfo> responseList =
response.getEntity(new GenericType<List<ContainerLogsInfo>>(){});
Set<String> expectedIdStrings = Sets.newHashSet(
Set<String> expectedIdStrings = new HashSet<>(Arrays.asList(
CONTAINER_1_1_1.toString(), CONTAINER_1_1_2.toString(),
CONTAINER_1_1_3.toString(), CONTAINER_1_2_1.toString());
CONTAINER_1_1_3.toString(), CONTAINER_1_2_1.toString()));

assertResponseList(responseList, expectedIdStrings, false);

Expand Down Expand Up @@ -356,9 +356,9 @@ public void testGetAggregatedLogsMetaForRunningApp() {

List<ContainerLogsInfo> responseList =
response.getEntity(new GenericType<List<ContainerLogsInfo>>(){});
Set<String> expectedIdStrings = Sets.newHashSet(
Set<String> expectedIdStrings = new HashSet<>(Arrays.asList(
CONTAINER_2_1_1.toString(), CONTAINER_2_2_1.toString(),
CONTAINER_2_2_3.toString());
CONTAINER_2_2_3.toString()));
assertResponseList(responseList, expectedIdStrings, true);

for (ContainerLogsInfo logsInfo : responseList) {
Expand Down Expand Up @@ -389,9 +389,9 @@ public void testGetAggregatedLogsMetaForFinishedAppAttempt() {

List<ContainerLogsInfo> responseList =
response.getEntity(new GenericType<List<ContainerLogsInfo>>(){});
Set<String> expectedIdStrings = Sets.newHashSet(
Set<String> expectedIdStrings = new HashSet<>(Arrays.asList(
CONTAINER_1_1_1.toString(), CONTAINER_1_1_2.toString(),
CONTAINER_1_1_3.toString());
CONTAINER_1_1_3.toString()));
assertResponseList(responseList, expectedIdStrings, false);

for (ContainerLogsInfo logsInfo : responseList) {
Expand Down Expand Up @@ -422,8 +422,8 @@ public void testGetAggregatedLogsMetaForRunningAppAttempt() {

List<ContainerLogsInfo> responseList =
response.getEntity(new GenericType<List<ContainerLogsInfo>>(){});
Set<String> expectedIdStrings = Sets.newHashSet(
CONTAINER_2_2_1.toString(), CONTAINER_2_2_3.toString());
Set<String> expectedIdStrings = new HashSet<>(Arrays.asList(
CONTAINER_2_2_1.toString(), CONTAINER_2_2_3.toString()));
assertResponseList(responseList, expectedIdStrings, true);

for (ContainerLogsInfo logsInfo : responseList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.io.FileUtils;
Expand All @@ -40,7 +42,6 @@
import org.apache.hadoop.mapreduce.v2.MiniMRYarnCluster;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.Sets;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
Expand Down Expand Up @@ -298,8 +299,8 @@ private void checkNewTimelineEvent(ApplicationId appId,
jobEventFile.exists());
verifyEntity(jobEventFile, EventType.JOB_FINISHED.name(),
true, false, null, false);
Set<String> cfgsToCheck = Sets.newHashSet("dummy_conf1", "dummy_conf2",
"huge_dummy_conf1", "huge_dummy_conf2");
Set<String> cfgsToCheck = new HashSet<>(Arrays.asList("dummy_conf1", "dummy_conf2",
"huge_dummy_conf1", "huge_dummy_conf2"));
verifyEntity(jobEventFile, null, false, true, cfgsToCheck, false);

// for this test, we expect MR job metrics are published in YARN_APPLICATION
Expand Down