Skip to content

Commit

Permalink
YARN-11577. Fix CheckStyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 committed Oct 27, 2023
1 parent b0d7a32 commit 6fe1093
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public static ClientResponse performCall(final String routerAddress, final Strin
builder = toRouterWR.entity(context, APPLICATION_JSON);
builder = builder.accept(APPLICATION_JSON);
} else {
builder = toRouter.accept(APPLICATION_JSON);
builder = toRouterWR.accept(APPLICATION_JSON);
}

ClientResponse response = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsEntryList;
import org.apache.hadoop.yarn.server.router.subcluster.TestFederationSubCluster;
import org.apache.hadoop.yarn.server.router.webapp.dao.FederationClusterInfo;
import org.apache.hadoop.yarn.server.router.webapp.dao.FederationClusterUserInfo;
Expand Down Expand Up @@ -99,6 +100,7 @@
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.ADD_NODE_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.GET_NODE_TO_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.REMOVE_NODE_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.REPLACE_NODE_TO_LABELS;
import static org.apache.hadoop.yarn.server.router.subcluster.TestFederationSubCluster.format;
import static org.apache.hadoop.yarn.server.router.webapp.HTTPMethods.POST;
import static org.apache.hadoop.yarn.server.router.webapp.HTTPMethods.PUT;
Expand Down Expand Up @@ -595,7 +597,18 @@ public void testRemoveFromClusterNodeLabels() throws Exception {
ClientResponse response = TestFederationSubCluster.performCall(ROUTER_WEB_ADDRESS,
RM_WEB_SERVICE_PATH + REMOVE_NODE_LABELS,
LABELS, "default", null, POST);
assertEquals(SC_BAD_REQUEST, response.getStatus());
assertEquals(SC_OK, response.getStatus());
String entity = response.getEntity(String.class);
assertNotNull(entity);
}

@Test
public void testReplaceLabelsOnNodes() throws Exception {
testFederationSubCluster.addNodeLabel(ROUTER_WEB_ADDRESS);
NodeToLabelsEntryList context = new NodeToLabelsEntryList();
ClientResponse response = TestFederationSubCluster.performCall(ROUTER_WEB_ADDRESS,
RM_WEB_SERVICE_PATH + REPLACE_NODE_TO_LABELS,
null, null, context, POST);
String entity = response.getEntity(String.class);
assertNotNull(entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerQueueInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceOptionInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ActivitiesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppActivitiesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceOptionInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.StatisticsItemInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NewApplication;
Expand All @@ -56,6 +56,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsEntryList;
import org.apache.hadoop.yarn.server.router.subcluster.TestFederationSubCluster;
import org.apache.hadoop.yarn.server.router.webapp.dao.FederationClusterInfo;
import org.apache.hadoop.yarn.server.router.webapp.dao.FederationClusterUserInfo;
Expand All @@ -80,11 +81,12 @@
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.NODES;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.STATES;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.NODES_NODEID;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.NODE_RESOURCE;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.NODES_NODEID_REPLACE_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.SCHEDULER_ACTIVITIES;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APPS_NEW_APPLICATION;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APP_STATISTICS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APPS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APP_ID;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APPS_APPID_APPATTEMPTS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APPS_APPID_STATE;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APPS_APPID_PRIORITY;
Expand All @@ -101,8 +103,9 @@
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.ADD_NODE_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.GET_NODE_TO_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.APP_ID;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.REMOVE_NODE_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.REPLACE_NODE_TO_LABELS;
import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts.NODE_RESOURCE;
import static org.apache.hadoop.yarn.server.router.subcluster.TestFederationSubCluster.format;
import static org.apache.hadoop.yarn.server.router.webapp.HTTPMethods.POST;
import static org.apache.hadoop.yarn.server.router.webapp.HTTPMethods.PUT;
Expand Down Expand Up @@ -605,7 +608,31 @@ public void testRemoveFromClusterNodeLabels() throws Exception {
ClientResponse response = TestFederationSubCluster.performCall(ROUTER_WEB_ADDRESS,
RM_WEB_SERVICE_PATH + REMOVE_NODE_LABELS,
LABELS, "default", null, POST);
assertEquals(SC_BAD_REQUEST, response.getStatus());
assertEquals(SC_OK, response.getStatus());
String entity = response.getEntity(String.class);
assertNotNull(entity);
}

@Test
public void testReplaceLabelsOnNodes() throws Exception {
testFederationSubCluster.addNodeLabel(ROUTER_WEB_ADDRESS);
NodeToLabelsEntryList context = new NodeToLabelsEntryList();
ClientResponse response = TestFederationSubCluster.performCall(ROUTER_WEB_ADDRESS,
RM_WEB_SERVICE_PATH + REPLACE_NODE_TO_LABELS,
null, null, context, POST);
String entity = response.getEntity(String.class);
assertNotNull(entity);
}

@Test
public void testReplaceLabelsOnNode() throws Exception {
String rm1NodeId = testFederationSubCluster.getNodeId(SC1_RM_WEB_ADDRESS);
String pathNode = RM_WEB_SERVICE_PATH +
format(NODES_NODEID_REPLACE_LABELS, rm1NodeId);
testFederationSubCluster.addNodeLabel(ROUTER_WEB_ADDRESS);
ClientResponse response = TestFederationSubCluster.performCall(ROUTER_WEB_ADDRESS,
pathNode, LABELS, "default", null, POST);
assertEquals(SC_OK, response.getStatus());
String entity = response.getEntity(String.class);
assertNotNull(entity);
}
Expand Down

0 comments on commit 6fe1093

Please sign in to comment.