From d3bb69a66776e9f410150c4030ddb15981f58fb9 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Wed, 26 Oct 2016 15:30:08 +0900 Subject: [PATCH] YARN-5575. Many classes use bare yarn. properties instead of the defined constants. Contributed by Daniel Templeton. --- .../hadoop/ipc/TestMRCJCSocketFactory.java | 5 +- .../hadoop/mapreduce/v2/TestMRJobs.java | 5 +- .../mapred/gridmix/GridmixTestUtils.java | 5 +- .../TestDistributedShell.java | 9 ++- .../TestDistributedShellWithNodeLabels.java | 12 ++-- .../hadoop/yarn/client/cli/TestYarnCLI.java | 4 +- ...melineAuthenticationFilterInitializer.java | 55 +++++++++---------- .../ReservationACLsTestBase.java | 7 +-- .../resourcemanager/TestAppManager.java | 10 ++-- .../yarn/server/resourcemanager/TestRM.java | 3 +- .../resourcemanager/TestRMAdminService.java | 40 ++++++++------ .../resourcemanager/TestRMProxyUsersConf.java | 49 +++++++++-------- .../TestWorkPreservingRMRestart.java | 3 +- .../ahs/TestRMApplicationHistoryWriter.java | 5 +- ...tProportionalCapacityPreemptionPolicy.java | 3 +- .../capacity/TestApplicationLimits.java | 14 ++--- .../TestCapacitySchedulerQueueACLs.java | 3 +- .../scheduler/capacity/TestLeafQueue.java | 6 +- .../scheduler/capacity/TestReservations.java | 6 +- .../fair/TestFairSchedulerEventLog.java | 2 +- .../fair/TestFairSchedulerQueueACLs.java | 2 +- .../TestRMWebServicesAppsModification.java | 5 +- ...ServicesDelegationTokenAuthentication.java | 6 +- ...MWebServicesHttpStaticUserPermissions.java | 4 +- .../webapp/TestRMWebServicesReservation.java | 5 +- 25 files changed, 132 insertions(+), 136 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/ipc/TestMRCJCSocketFactory.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/ipc/TestMRCJCSocketFactory.java index 02742988f6..123947a39a 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/ipc/TestMRCJCSocketFactory.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/ipc/TestMRCJCSocketFactory.java @@ -33,6 +33,7 @@ import org.apache.hadoop.mapreduce.MRConfig; import org.apache.hadoop.mapreduce.v2.MiniMRYarnCluster; import org.apache.hadoop.net.StandardSocketFactory; +import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.junit.Assert; import org.junit.Test; @@ -87,9 +88,9 @@ public void testSocketFactory() throws IOException { jconf.set("hadoop.rpc.socket.factory.class.default", "org.apache.hadoop.ipc.DummySocketFactory"); jconf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME); - String rmAddress = jconf.get("yarn.resourcemanager.address"); + String rmAddress = jconf.get(YarnConfiguration.RM_ADDRESS); String[] split = rmAddress.split(":"); - jconf.set("yarn.resourcemanager.address", split[0] + ':' + jconf.set(YarnConfiguration.RM_ADDRESS, split[0] + ':' + (Integer.parseInt(split[1]) + 10)); client = new JobClient(jconf); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java index 32b3a42a2a..7a0c43e14e 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java @@ -163,7 +163,7 @@ public static void setup() throws IOException { Configuration conf = new Configuration(); conf.set("fs.defaultFS", remoteFs.getUri().toString()); // use HDFS conf.set(MRJobConfig.MR_AM_STAGING_DIR, "/apps_staging_dir"); - conf.setInt("yarn.cluster.max-application-priority", 10); + conf.setInt(YarnConfiguration.MAX_CLUSTER_LEVEL_APPLICATION_PRIORITY, 10); mrCluster.init(conf); mrCluster.start(); } @@ -418,8 +418,7 @@ public void testJobWithChangePriority() throws Exception { // set master address to local to test that local mode applied if framework // equals local sleepConf.set(MRConfig.MASTER_ADDRESS, "local"); - sleepConf - .setInt("yarn.app.mapreduce.am.scheduler.heartbeat.interval-ms", 5); + sleepConf.setInt(MRJobConfig.MR_AM_TO_RM_HEARTBEAT_INTERVAL_MS, 5); SleepJob sleepJob = new SleepJob(); sleepJob.setConf(sleepConf); diff --git a/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/GridmixTestUtils.java b/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/GridmixTestUtils.java index 50865b53da..70525407b9 100644 --- a/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/GridmixTestUtils.java +++ b/hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/GridmixTestUtils.java @@ -11,6 +11,7 @@ import org.apache.hadoop.mapreduce.MRJobConfig; import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig; import org.apache.hadoop.conf.Configuration; +import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import java.io.IOException; @@ -45,8 +46,8 @@ public static void initCluster(Class caller) throws IOException { Configuration conf = new Configuration(); // conf.set("mapred.queue.names", "default,q1,q2"); conf.set("mapred.queue.names", "default"); - conf.set("yarn.scheduler.capacity.root.queues", "default"); - conf.set("yarn.scheduler.capacity.root.default.capacity", "100.0"); + conf.set(PREFIX + "root.queues", "default"); + conf.set(PREFIX + "root.default.capacity", "100.0"); conf.setBoolean(GRIDMIX_USE_QUEUE_IN_TRACE, false); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java index 9b99bd2caa..300ea67497 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java @@ -220,7 +220,8 @@ private void setupInternal(int numNodeManager, float timelineVersion) throw new RuntimeException("Could not find 'yarn-site.xml' dummy file in classpath"); } Configuration yarnClusterConfig = yarnCluster.getConfig(); - yarnClusterConfig.set("yarn.application.classpath", new File(url.getPath()).getParent()); + yarnClusterConfig.set(YarnConfiguration.YARN_APPLICATION_CLASSPATH, + new File(url.getPath()).getParent()); //write the document to a buffer (not directly to the file, as that //can cause the file being written to get read -which will then fail. ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); @@ -234,8 +235,7 @@ private void setupInternal(int numNodeManager, float timelineVersion) FileContext fsContext = FileContext.getLocalFSFileContext(); fsContext .delete( - new Path(conf - .get("yarn.timeline-service.leveldb-timeline-store.path")), + new Path(conf.get(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH)), true); try { Thread.sleep(2000); @@ -263,8 +263,7 @@ public void tearDown() throws IOException { FileContext fsContext = FileContext.getLocalFSFileContext(); fsContext .delete( - new Path(conf - .get("yarn.timeline-service.leveldb-timeline-store.path")), + new Path(conf.get(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH)), true); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShellWithNodeLabels.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShellWithNodeLabels.java index c651d32cfa..143e5c4e47 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShellWithNodeLabels.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShellWithNodeLabels.java @@ -28,6 +28,7 @@ import org.apache.hadoop.yarn.server.nodemanager.NodeManager; import org.apache.hadoop.yarn.server.resourcemanager.RMContext; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; +import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -57,13 +58,12 @@ private void initializeNodeLabels() throws IOException { labelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(labels); // Setup queue access to node labels - distShellTest.conf.set("yarn.scheduler.capacity.root.accessible-node-labels", "x"); - distShellTest.conf.set("yarn.scheduler.capacity.root.accessible-node-labels.x.capacity", - "100"); - distShellTest.conf.set("yarn.scheduler.capacity.root.default.accessible-node-labels", "x"); - distShellTest.conf.set( - "yarn.scheduler.capacity.root.default.accessible-node-labels.x.capacity", + distShellTest.conf.set(PREFIX + "root.accessible-node-labels", "x"); + distShellTest.conf.set(PREFIX + "root.accessible-node-labels.x.capacity", "100"); + distShellTest.conf.set(PREFIX + "root.default.accessible-node-labels", "x"); + distShellTest.conf.set(PREFIX + + "root.default.accessible-node-labels.x.capacity", "100"); rmContext.getScheduler().reinitialize(distShellTest.conf, rmContext); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java index ef6436534e..c4d2e09447 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java @@ -80,6 +80,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.util.Records; import org.apache.hadoop.yarn.util.Times; +import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -1704,8 +1705,7 @@ public void testGetQueueInfoPreemptionDisabled() throws Exception { "org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity." + "ProportionalCapacityPreemptionPolicy"); conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true); - conf.setBoolean( - "yarn.scheduler.capacity.root.a.a1.disable_preemption", true); + conf.setBoolean(PREFIX + "root.a.a1.disable_preemption", true); MiniYARNCluster cluster = new MiniYARNCluster("testReservationAPIs", 2, 1, 1); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/security/TestTimelineAuthenticationFilterInitializer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/security/TestTimelineAuthenticationFilterInitializer.java index 1e89309f6d..430911eaa3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/security/TestTimelineAuthenticationFilterInitializer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/security/TestTimelineAuthenticationFilterInitializer.java @@ -23,6 +23,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.http.FilterContainer; import org.apache.hadoop.yarn.conf.YarnConfiguration; +import static org.apache.hadoop.yarn.server.timeline.security.TimelineAuthenticationFilterInitializer.PREFIX; import org.junit.Test; import org.mockito.Mockito; @@ -35,36 +36,30 @@ public void testProxyUserConfiguration() { for (int i = 0; i < 3; ++i) { Configuration conf = new YarnConfiguration(); switch (i) { - case 0: - // hadoop.proxyuser prefix - conf.set("hadoop.proxyuser.foo.hosts", "*"); - conf.set("hadoop.proxyuser.foo.users", "*"); - conf.set("hadoop.proxyuser.foo.groups", "*"); - break; - case 1: - // yarn.timeline-service.http-authentication.proxyuser prefix - conf.set("yarn.timeline-service.http-authentication.proxyuser.foo.hosts", - "*"); - conf.set("yarn.timeline-service.http-authentication.proxyuser.foo.users", - "*"); - conf.set("yarn.timeline-service.http-authentication.proxyuser.foo.groups", - "*"); - break; - case 2: - // hadoop.proxyuser prefix has been overwritten by - // yarn.timeline-service.http-authentication.proxyuser prefix - conf.set("hadoop.proxyuser.foo.hosts", "bar"); - conf.set("hadoop.proxyuser.foo.users", "bar"); - conf.set("hadoop.proxyuser.foo.groups", "bar"); - conf.set("yarn.timeline-service.http-authentication.proxyuser.foo.hosts", - "*"); - conf.set("yarn.timeline-service.http-authentication.proxyuser.foo.users", - "*"); - conf.set("yarn.timeline-service.http-authentication.proxyuser.foo.groups", - "*"); - break; - default: - break; + case 0: + // hadoop.proxyuser prefix + conf.set("hadoop.proxyuser.foo.hosts", "*"); + conf.set("hadoop.proxyuser.foo.users", "*"); + conf.set("hadoop.proxyuser.foo.groups", "*"); + break; + case 1: + // yarn.timeline-service.http-authentication.proxyuser prefix + conf.set(PREFIX + "proxyuser.foo.hosts", "*"); + conf.set(PREFIX + "proxyuser.foo.users", "*"); + conf.set(PREFIX + "proxyuser.foo.groups", "*"); + break; + case 2: + // hadoop.proxyuser prefix has been overwritten by + // yarn.timeline-service.http-authentication.proxyuser prefix + conf.set("hadoop.proxyuser.foo.hosts", "bar"); + conf.set("hadoop.proxyuser.foo.users", "bar"); + conf.set("hadoop.proxyuser.foo.groups", "bar"); + conf.set(PREFIX + "proxyuser.foo.hosts", "*"); + conf.set(PREFIX + "proxyuser.foo.users", "*"); + conf.set(PREFIX + "proxyuser.foo.groups", "*"); + break; + default: + break; } TimelineAuthenticationFilterInitializer initializer = diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ReservationACLsTestBase.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ReservationACLsTestBase.java index c536d8d327..03bc8897ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ReservationACLsTestBase.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ReservationACLsTestBase.java @@ -549,8 +549,8 @@ private static Configuration createCapacitySchedulerConfiguration() { csConf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true); csConf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); csConf.setBoolean(YarnConfiguration.YARN_RESERVATION_ACL_ENABLE, true); - csConf.set("yarn.resourcemanager.scheduler.class", CapacityScheduler - .class.getName()); + csConf.set(YarnConfiguration.RM_SCHEDULER, + CapacityScheduler.class.getName()); return csConf; } @@ -602,8 +602,7 @@ private static Configuration createFairSchedulerConfiguration() throws fsConf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true); fsConf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); fsConf.setBoolean(YarnConfiguration.YARN_RESERVATION_ACL_ENABLE, true); - fsConf.set("yarn.resourcemanager.scheduler.class", FairScheduler.class - .getName()); + fsConf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName()); return fsConf; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java index 68f1e22842..3db0d65160 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java @@ -80,6 +80,7 @@ import org.apache.hadoop.yarn.util.Records; import org.apache.hadoop.yarn.util.resource.ResourceCalculator; import org.apache.hadoop.yarn.util.resource.Resources; +import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -291,12 +292,11 @@ public void testQueueSubmitWithNoPermission() throws IOException { YarnConfiguration conf = new YarnConfiguration(); conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getCanonicalName()); - conf.set("yarn.scheduler.capacity.root.acl_submit_applications", " "); - conf.set("yarn.scheduler.capacity.root.acl_administer_queue", " "); + conf.set(PREFIX + "root.acl_submit_applications", " "); + conf.set(PREFIX + "root.acl_administer_queue", " "); - conf.set("yarn.scheduler.capacity.root.default.acl_submit_applications", - " "); - conf.set("yarn.scheduler.capacity.root.default.acl_administer_queue", " "); + conf.set(PREFIX + "root.default.acl_submit_applications", " "); + conf.set(PREFIX + "root.default.acl_administer_queue", " "); conf.set(YarnConfiguration.YARN_ACL_ENABLE, "true"); MockRM mockRM = new MockRM(conf); ClientRMService rmService = mockRM.getClientRMService(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java index ee6d51adb3..61fd8844ad 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java @@ -69,6 +69,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM; import org.apache.log4j.Level; import org.apache.log4j.LogManager; @@ -136,7 +137,7 @@ public void testAppWithNoContainers() throws Exception { public void testAppOnMultiNode() throws Exception { Logger rootLogger = LogManager.getRootLogger(); rootLogger.setLevel(Level.DEBUG); - conf.set("yarn.scheduler.capacity.node-locality-delay", "-1"); + conf.set(CapacitySchedulerConfiguration.NODE_LOCALITY_DELAY, "-1"); MockRM rm = new MockRM(conf); rm.start(); MockNM nm1 = rm.registerNode("h1:1234", 5120); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMAdminService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMAdminService.java index a3022f7a48..fa01b55164 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMAdminService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMAdminService.java @@ -68,6 +68,9 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; +import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_PROXY_USER_PREFIX; +import static org.apache.hadoop.yarn.server.resourcemanager.resource.DynamicResourceConfiguration.NODES; +import static org.apache.hadoop.yarn.server.resourcemanager.resource.DynamicResourceConfiguration.PREFIX; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -165,7 +168,8 @@ public void testAdminRefreshQueuesWithFileSystemBasedConfigurationProvider() CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(); - csConf.set("yarn.scheduler.capacity.maximum-applications", "5000"); + csConf.set(CapacitySchedulerConfiguration.MAXIMUM_SYSTEM_APPLICATIONS, + "5000"); uploadConfiguration(csConf, "capacity-scheduler.xml"); rm.adminService.refreshQueues(RefreshQueuesRequest.newInstance()); @@ -226,9 +230,9 @@ public void testRefreshNodesResourceWithFileSystemBasedConfigurationProvider() DynamicResourceConfiguration drConf = new DynamicResourceConfiguration(); - drConf.set("yarn.resource.dynamic.nodes", "h1:1234"); - drConf.set("yarn.resource.dynamic.h1:1234.vcores", "4"); - drConf.set("yarn.resource.dynamic.h1:1234.memory", "4096"); + drConf.set(PREFIX + NODES, "h1:1234"); + drConf.set(PREFIX + "h1:1234.vcores", "4"); + drConf.set(PREFIX + "h1:1234.memory", "4096"); uploadConfiguration(drConf, "dynamic-resources.xml"); rm.adminService.refreshNodesResources( @@ -266,9 +270,9 @@ public void testRefreshNodesResourceWithResourceReturnInRegistration() DynamicResourceConfiguration drConf = new DynamicResourceConfiguration(); - drConf.set("yarn.resource.dynamic.nodes", "h1:1234"); - drConf.set("yarn.resource.dynamic.h1:1234.vcores", "4"); - drConf.set("yarn.resource.dynamic.h1:1234.memory", "4096"); + drConf.set(PREFIX + NODES, "h1:1234"); + drConf.set(PREFIX + "h1:1234.vcores", "4"); + drConf.set(PREFIX + "h1:1234.memory", "4096"); uploadConfiguration(drConf, "dynamic-resources.xml"); rm.adminService.refreshNodesResources( @@ -316,9 +320,9 @@ public void testRefreshNodesResourceWithResourceReturnInHeartbeat() DynamicResourceConfiguration drConf = new DynamicResourceConfiguration(); - drConf.set("yarn.resource.dynamic.nodes", "h1:1234"); - drConf.set("yarn.resource.dynamic.h1:1234.vcores", "4"); - drConf.set("yarn.resource.dynamic.h1:1234.memory", "4096"); + drConf.set(PREFIX + NODES, "h1:1234"); + drConf.set(PREFIX + "h1:1234.vcores", "4"); + drConf.set(PREFIX + "h1:1234.memory", "4096"); uploadConfiguration(drConf, "dynamic-resources.xml"); rm.adminService.refreshNodesResources( @@ -364,9 +368,9 @@ public void testResourcePersistentForNMRegistrationWithNewResource() DynamicResourceConfiguration drConf = new DynamicResourceConfiguration(); - drConf.set("yarn.resource.dynamic.nodes", "h1:1234"); - drConf.set("yarn.resource.dynamic.h1:1234.vcores", "4"); - drConf.set("yarn.resource.dynamic.h1:1234.memory", "4096"); + drConf.set(PREFIX + NODES, "h1:1234"); + drConf.set(PREFIX + "h1:1234.vcores", "4"); + drConf.set(PREFIX + "h1:1234.memory", "4096"); uploadConfiguration(drConf, "dynamic-resources.xml"); rm.adminService.refreshNodesResources( @@ -611,8 +615,8 @@ private void verifyServiceACLsRefresh(ServiceAuthorizationManager manager, .get("hadoop.proxyuser.test.hosts").contains("test_hosts")); Configuration yarnConf = new Configuration(false); - yarnConf.set("yarn.resourcemanager.proxyuser.test.groups", "test_groups_1"); - yarnConf.set("yarn.resourcemanager.proxyuser.test.hosts", "test_hosts_1"); + yarnConf.set(RM_PROXY_USER_PREFIX + "test.groups", "test_groups_1"); + yarnConf.set(RM_PROXY_USER_PREFIX + "test.hosts", "test_hosts_1"); uploadConfiguration(yarnConf, "yarn-site.xml"); // RM specific configs will overwrite the common ones @@ -809,7 +813,8 @@ public void testRMHAWithFileSystemBasedConfiguration() throws IOException, CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(); - csConf.set("yarn.scheduler.capacity.maximum-applications", "5000"); + csConf.set(CapacitySchedulerConfiguration.MAXIMUM_SYSTEM_APPLICATIONS, + "5000"); uploadConfiguration(csConf, "capacity-scheduler.xml"); rm1.adminService.refreshQueues(RefreshQueuesRequest.newInstance()); @@ -897,7 +902,8 @@ public void testRMInitialsWithFileSystemBasedConfigurationProvider() CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(); - csConf.set("yarn.scheduler.capacity.maximum-applications", "5000"); + csConf.set(CapacitySchedulerConfiguration.MAXIMUM_SYSTEM_APPLICATIONS, + "5000"); uploadConfiguration(csConf, "capacity-scheduler.xml"); String aclsString = "alice,bob users,wheel"; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMProxyUsersConf.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMProxyUsersConf.java index f6d239d9a9..2b67a31d59 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMProxyUsersConf.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMProxyUsersConf.java @@ -26,6 +26,7 @@ import org.apache.hadoop.security.authorize.AuthorizationException; import org.apache.hadoop.security.authorize.ProxyUsers; import org.apache.hadoop.yarn.conf.YarnConfiguration; +import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_PROXY_USER_PREFIX; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -50,30 +51,30 @@ public static Collection headers() { public TestRMProxyUsersConf(int round) { conf = new YarnConfiguration(); switch (round) { - case 0: - // hadoop.proxyuser prefix - conf.set("hadoop.proxyuser.foo.hosts", ipAddress); - conf.set("hadoop.proxyuser.foo.users", "bar"); - conf.set("hadoop.proxyuser.foo.groups", "bar_group"); - break; - case 1: - // yarn.resourcemanager.proxyuser prefix - conf.set("yarn.resourcemanager.proxyuser.foo.hosts", ipAddress); - conf.set("yarn.resourcemanager.proxyuser.foo.users", "bar"); - conf.set("yarn.resourcemanager.proxyuser.foo.groups", "bar_group"); - break; - case 2: - // hadoop.proxyuser prefix has been overwritten by - // yarn.resourcemanager.proxyuser prefix - conf.set("hadoop.proxyuser.foo.hosts", "xyz"); - conf.set("hadoop.proxyuser.foo.users", "xyz"); - conf.set("hadoop.proxyuser.foo.groups", "xyz"); - conf.set("yarn.resourcemanager.proxyuser.foo.hosts", ipAddress); - conf.set("yarn.resourcemanager.proxyuser.foo.users", "bar"); - conf.set("yarn.resourcemanager.proxyuser.foo.groups", "bar_group"); - break; - default: - break; + case 0: + // hadoop.proxyuser prefix + conf.set("hadoop.proxyuser.foo.hosts", ipAddress); + conf.set("hadoop.proxyuser.foo.users", "bar"); + conf.set("hadoop.proxyuser.foo.groups", "bar_group"); + break; + case 1: + // yarn.resourcemanager.proxyuser prefix + conf.set(RM_PROXY_USER_PREFIX + "foo.hosts", ipAddress); + conf.set(RM_PROXY_USER_PREFIX + "foo.users", "bar"); + conf.set(RM_PROXY_USER_PREFIX + "foo.groups", "bar_group"); + break; + case 2: + // hadoop.proxyuser prefix has been overwritten by + // yarn.resourcemanager.proxyuser prefix + conf.set("hadoop.proxyuser.foo.hosts", "xyz"); + conf.set("hadoop.proxyuser.foo.users", "xyz"); + conf.set("hadoop.proxyuser.foo.groups", "xyz"); + conf.set(RM_PROXY_USER_PREFIX + "foo.hosts", ipAddress); + conf.set(RM_PROXY_USER_PREFIX + "foo.users", "bar"); + conf.set(RM_PROXY_USER_PREFIX + "foo.groups", "bar_group"); + break; + default: + break; } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java index a9f1f634be..c4cf2560f8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java @@ -94,6 +94,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; +import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import static org.junit.Assert.*; import static org.mockito.Mockito.mock; @@ -644,7 +645,7 @@ public void testCapacitySchedulerRecovery() throws Exception { rm1.clearQueueMetrics(app1_2); rm1.clearQueueMetrics(app2); - csConf.set("yarn.scheduler.capacity.root.Default.QueueB.state", "STOPPED"); + csConf.set(PREFIX + "root.Default.QueueB.state", "STOPPED"); // Re-start RM rm2 = new MockRM(csConf, memStore); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java index dde98121a7..b55012304c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java @@ -389,10 +389,9 @@ private void testRMWritingMassiveHistory(boolean isFS) throws Exception { YarnConfiguration conf = new YarnConfiguration(); if (isFS) { conf.setBoolean(FairSchedulerConfiguration.ASSIGN_MULTIPLE, true); - conf.set("yarn.resourcemanager.scheduler.class", - FairScheduler.class.getName()); + conf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName()); } else { - conf.set("yarn.resourcemanager.scheduler.class", + conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getName()); } // don't process history events diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java index b6329b78bf..21f6eb5c00 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java @@ -157,8 +157,7 @@ public void setup() { conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true); // FairScheduler doesn't support this test, // Set CapacityScheduler as the scheduler for this test. - conf.set("yarn.resourcemanager.scheduler.class", - CapacityScheduler.class.getName()); + conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getName()); mClock = mock(Clock.class); mCS = mock(CapacityScheduler.class); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestApplicationLimits.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestApplicationLimits.java index 175f5bbdc1..963f50b169 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestApplicationLimits.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestApplicationLimits.java @@ -60,6 +60,7 @@ import org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator; import org.apache.hadoop.yarn.util.resource.ResourceCalculator; import org.apache.hadoop.yarn.util.resource.Resources; +import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -339,11 +340,8 @@ public void testLimitsComputation() throws Exception { ); // Change the per-queue max AM resources percentage. - csConf.setFloat( - "yarn.scheduler.capacity." + - queue.getQueuePath() + - ".maximum-am-resource-percent", - 0.5f); + csConf.setFloat(PREFIX + queue.getQueuePath() + + ".maximum-am-resource-percent", 0.5f); // Re-create queues to get new configs. queues = new HashMap(); root = @@ -364,10 +362,8 @@ public void testLimitsComputation() throws Exception { Resource.newInstance(400*GB, 1)); // Change the per-queue max applications. - csConf.setInt( - "yarn.scheduler.capacity." + - queue.getQueuePath() + - ".maximum-applications", 9999); + csConf.setInt(PREFIX + queue.getQueuePath() + ".maximum-applications", + 9999); // Re-create queues to get new configs. queues = new HashMap(); root = diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerQueueACLs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerQueueACLs.java index 14ea21b89f..5feb94b587 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerQueueACLs.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerQueueACLs.java @@ -66,7 +66,8 @@ protected Configuration createConfiguration() { csConf.setAcls(CapacitySchedulerConfiguration.ROOT, aclsOnRootQueue); csConf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); - csConf.set("yarn.resourcemanager.scheduler.class", CapacityScheduler.class.getName()); + csConf.set(YarnConfiguration.RM_SCHEDULER, + CapacityScheduler.class.getName()); return csConf; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java index 9134889f3e..51b567bcce 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestLeafQueue.java @@ -154,9 +154,9 @@ private void setUpInternal(ResourceCalculator rC) throws Exception { csConf = new CapacitySchedulerConfiguration(); - csConf.setBoolean("yarn.scheduler.capacity.user-metrics.enable", true); - csConf.setBoolean( - "yarn.scheduler.capacity.reservations-continue-look-all-nodes", false); + csConf.setBoolean(CapacitySchedulerConfiguration.ENABLE_USER_METRICS, true); + csConf.setBoolean(CapacitySchedulerConfiguration.RESERVE_CONT_LOOK_ALL_NODES, + false); final String newRoot = "root" + System.currentTimeMillis(); setupQueueConfiguration(csConf, newRoot); YarnConfiguration conf = new YarnConfiguration(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestReservations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestReservations.java index 5e2007c0cb..8fe85c971c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestReservations.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestReservations.java @@ -112,7 +112,7 @@ private void setup(CapacitySchedulerConfiguration csConf) throws Exception { private void setup(CapacitySchedulerConfiguration csConf, boolean addUserLimits) throws Exception { - csConf.setBoolean("yarn.scheduler.capacity.user-metrics.enable", true); + csConf.setBoolean(CapacitySchedulerConfiguration.ENABLE_USER_METRICS, true); final String newRoot = "root" + System.currentTimeMillis(); // final String newRoot = "root"; @@ -502,8 +502,8 @@ public void testReservationNoContinueLook() throws Exception { queues = new HashMap(); // test that the deadlock occurs when turned off CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(); - csConf.setBoolean( - "yarn.scheduler.capacity.reservations-continue-look-all-nodes", false); + csConf.setBoolean(CapacitySchedulerConfiguration.RESERVE_CONT_LOOK_ALL_NODES, + false); setup(csConf); // Manipulate queue 'a' diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerEventLog.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerEventLog.java index a8741d2f7f..09c2370395 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerEventLog.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerEventLog.java @@ -45,7 +45,7 @@ public void setUp() throws IOException { Configuration conf = new YarnConfiguration(); conf.setClass(YarnConfiguration.RM_SCHEDULER, FairScheduler.class, ResourceScheduler.class); - conf.set("yarn.scheduler.fair.event-log-enabled", "true"); + conf.set(FairSchedulerConfiguration.EVENT_LOG_ENABLED, "true"); // All tests assume only one assignment per node update conf.set(FairSchedulerConfiguration.ASSIGN_MULTIPLE, "false"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerQueueACLs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerQueueACLs.java index a09cfe8c9c..32aab5531f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerQueueACLs.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairSchedulerQueueACLs.java @@ -55,7 +55,7 @@ protected Configuration createConfiguration() throws IOException { fsConf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE); fsConf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); - fsConf.set("yarn.resourcemanager.scheduler.class", FairScheduler.class.getName()); + fsConf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName()); return fsConf; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java index 37e44d49f0..8b7e47602b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesAppsModification.java @@ -189,7 +189,7 @@ protected void configureServlets() { private class CapTestServletModule extends TestServletModule { @Override public void configureScheduler() { - conf.set("yarn.resourcemanager.scheduler.class", + conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getName()); } } @@ -215,8 +215,7 @@ public void configureScheduler() { } catch(IOException e) { } conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, FS_ALLOC_FILE); - conf.set("yarn.resourcemanager.scheduler.class", - FairScheduler.class.getName()); + conf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName()); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesDelegationTokenAuthentication.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesDelegationTokenAuthentication.java index 4e26bd1ce6..b406fdbf0e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesDelegationTokenAuthentication.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesDelegationTokenAuthentication.java @@ -58,7 +58,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo; -import org.apache.hadoop.yarn.util.ConverterUtils; import org.codehaus.jettison.json.JSONObject; import org.junit.AfterClass; import org.junit.Assert; @@ -66,6 +65,7 @@ import org.junit.Test; import com.sun.jersey.api.client.ClientResponse.Status; +import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_PROXY_USER_PREFIX; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -159,8 +159,8 @@ private static void setupAndStartRM() throws Exception { rmconf.set(YarnConfiguration.NM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY, httpSpnegoKeytabFile.getAbsolutePath()); rmconf.setBoolean("mockrm.webapp.enabled", true); - rmconf.set("yarn.resourcemanager.proxyuser.client.hosts", "*"); - rmconf.set("yarn.resourcemanager.proxyuser.client.groups", "*"); + rmconf.set(RM_PROXY_USER_PREFIX + "client.hosts", "*"); + rmconf.set(RM_PROXY_USER_PREFIX + "client.groups", "*"); UserGroupInformation.setConfiguration(rmconf); rm = new MockRM(rmconf); rm.start(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesHttpStaticUserPermissions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesHttpStaticUserPermissions.java index 3d47233778..60c6f5e950 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesHttpStaticUserPermissions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesHttpStaticUserPermissions.java @@ -104,8 +104,8 @@ private static void setupAndStartRM() throws Exception { rmconf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); rmconf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); - rmconf.set("yarn.resourcemanager.principal", spnegoPrincipal); - rmconf.set("yarn.resourcemanager.keytab", + rmconf.set(YarnConfiguration.RM_PRINCIPAL, spnegoPrincipal); + rmconf.set(YarnConfiguration.RM_KEYTAB, spnegoKeytabFile.getAbsolutePath()); rmconf.setBoolean("mockrm.webapp.enabled", true); UserGroupInformation.setConfiguration(rmconf); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java index 5f55e34d66..41863f6489 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java @@ -170,7 +170,7 @@ protected void configureServlets() { private static class CapTestServletModule extends TestServletModule { @Override public void configureScheduler() { - conf.set("yarn.resourcemanager.scheduler.class", + conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getName()); } } @@ -196,8 +196,7 @@ public void configureScheduler() { } catch (IOException e) { } conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, FS_ALLOC_FILE); - conf.set("yarn.resourcemanager.scheduler.class", - FairScheduler.class.getName()); + conf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName()); } }