YARN-11050 (#3805)
This commit is contained in:
parent
4483607a4e
commit
07141426e0
|
@ -126,7 +126,7 @@ public final class RMWSConsts {
|
||||||
/** Path for {@code RMWebServiceProtocol#addToClusterNodeLabels}. */
|
/** Path for {@code RMWebServiceProtocol#addToClusterNodeLabels}. */
|
||||||
public static final String ADD_NODE_LABELS = "/add-node-labels";
|
public static final String ADD_NODE_LABELS = "/add-node-labels";
|
||||||
|
|
||||||
/** Path for {@code RMWebServiceProtocol#removeFromCluserNodeLabels}. */
|
/** Path for {@code RMWebServiceProtocol#removeFromClusterNodeLabels}. */
|
||||||
public static final String REMOVE_NODE_LABELS = "/remove-node-labels";
|
public static final String REMOVE_NODE_LABELS = "/remove-node-labels";
|
||||||
|
|
||||||
/** Path for {@code RMWebServiceProtocol#getLabelsOnNode}. */
|
/** Path for {@code RMWebServiceProtocol#getLabelsOnNode}. */
|
||||||
|
|
|
@ -398,7 +398,7 @@ public interface RMWebServiceProtocol {
|
||||||
* @return Response containing the status code
|
* @return Response containing the status code
|
||||||
* @throws Exception in case of bad request
|
* @throws Exception in case of bad request
|
||||||
*/
|
*/
|
||||||
Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
|
Response removeFromClusterNodeLabels(Set<String> oldNodeLabels,
|
||||||
HttpServletRequest hsr) throws Exception;
|
HttpServletRequest hsr) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1435,7 +1435,7 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol {
|
||||||
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
|
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
|
||||||
MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
|
MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
|
||||||
@Override
|
@Override
|
||||||
public Response removeFromCluserNodeLabels(
|
public Response removeFromClusterNodeLabels(
|
||||||
@QueryParam(RMWSConsts.LABELS) Set<String> oldNodeLabels,
|
@QueryParam(RMWSConsts.LABELS) Set<String> oldNodeLabels,
|
||||||
@Context HttpServletRequest hsr) throws Exception {
|
@Context HttpServletRequest hsr) throws Exception {
|
||||||
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
|
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
|
||||||
|
|
|
@ -330,7 +330,7 @@ public class DefaultRequestInterceptorREST
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
|
public Response removeFromClusterNodeLabels(Set<String> oldNodeLabels,
|
||||||
HttpServletRequest hsr) throws Exception {
|
HttpServletRequest hsr) throws Exception {
|
||||||
// oldNodeLabels is specified inside hsr
|
// oldNodeLabels is specified inside hsr
|
||||||
return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
|
return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
|
||||||
|
|
|
@ -1205,7 +1205,7 @@ public class FederationInterceptorREST extends AbstractRESTRequestInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
|
public Response removeFromClusterNodeLabels(Set<String> oldNodeLabels,
|
||||||
HttpServletRequest hsr) throws Exception {
|
HttpServletRequest hsr) throws Exception {
|
||||||
throw new NotImplementedException("Code is not implemented");
|
throw new NotImplementedException("Code is not implemented");
|
||||||
}
|
}
|
||||||
|
|
|
@ -637,13 +637,13 @@ public class RouterWebServices implements RMWebServiceProtocol {
|
||||||
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
|
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
|
||||||
MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
|
MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
|
||||||
@Override
|
@Override
|
||||||
public Response removeFromCluserNodeLabels(
|
public Response removeFromClusterNodeLabels(
|
||||||
@QueryParam(RMWSConsts.LABELS) Set<String> oldNodeLabels,
|
@QueryParam(RMWSConsts.LABELS) Set<String> oldNodeLabels,
|
||||||
@Context HttpServletRequest hsr) throws Exception {
|
@Context HttpServletRequest hsr) throws Exception {
|
||||||
init();
|
init();
|
||||||
RequestInterceptorChainWrapper pipeline = getInterceptorChain(hsr);
|
RequestInterceptorChainWrapper pipeline = getInterceptorChain(hsr);
|
||||||
return pipeline.getRootInterceptor()
|
return pipeline.getRootInterceptor()
|
||||||
.removeFromCluserNodeLabels(oldNodeLabels, hsr);
|
.removeFromClusterNodeLabels(oldNodeLabels, hsr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
|
|
|
@ -245,8 +245,8 @@ public abstract class BaseRouterWebServicesTest {
|
||||||
null, createHttpServletRequest(user));
|
null, createHttpServletRequest(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Response removeFromCluserNodeLabels(String user) throws Exception {
|
protected Response removeFromClusterNodeLabels(String user) throws Exception {
|
||||||
return routerWebService.removeFromCluserNodeLabels(
|
return routerWebService.removeFromClusterNodeLabels(
|
||||||
null, createHttpServletRequest(user));
|
null, createHttpServletRequest(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ public class MockRESTRequestInterceptor extends AbstractRESTRequestInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
|
public Response removeFromClusterNodeLabels(Set<String> oldNodeLabels,
|
||||||
HttpServletRequest hsr) throws Exception {
|
HttpServletRequest hsr) throws Exception {
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,9 +248,9 @@ public class PassThroughRESTRequestInterceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
|
public Response removeFromClusterNodeLabels(Set<String> oldNodeLabels,
|
||||||
HttpServletRequest hsr) throws Exception {
|
HttpServletRequest hsr) throws Exception {
|
||||||
return getNextInterceptor().removeFromCluserNodeLabels(oldNodeLabels, hsr);
|
return getNextInterceptor().removeFromClusterNodeLabels(oldNodeLabels, hsr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class TestRouterWebServices extends BaseRouterWebServicesTest {
|
||||||
Response response4 = addToClusterNodeLabels(user);
|
Response response4 = addToClusterNodeLabels(user);
|
||||||
Assert.assertNotNull(response4);
|
Assert.assertNotNull(response4);
|
||||||
|
|
||||||
Response response5 = removeFromCluserNodeLabels(user);
|
Response response5 = removeFromClusterNodeLabels(user);
|
||||||
Assert.assertNotNull(response5);
|
Assert.assertNotNull(response5);
|
||||||
|
|
||||||
NodeLabelsInfo nodeLabelsInfo2 = getLabelsOnNode(user);
|
NodeLabelsInfo nodeLabelsInfo2 = getLabelsOnNode(user);
|
||||||
|
|
|
@ -1203,10 +1203,10 @@ public class TestRouterWebServicesREST {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test validates the correctness of
|
* This test validates the correctness of
|
||||||
* {@link RMWebServiceProtocol#removeFromCluserNodeLabels()} inside Router.
|
* {@link RMWebServiceProtocol#removeFromClusterNodeLabels} inside Router.
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 2000)
|
@Test(timeout = 2000)
|
||||||
public void testRemoveFromCluserNodeLabelsXML()
|
public void testRemoveFromClusterNodeLabelsXML()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
// Test with a wrong HTTP method
|
// Test with a wrong HTTP method
|
||||||
|
|
Loading…
Reference in New Issue