Skip to content
Merged
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 @@ -20,7 +20,7 @@

import static javax.servlet.http.HttpServletResponse.SC_ACCEPTED;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
Expand Down Expand Up @@ -143,6 +143,8 @@

import net.jcip.annotations.NotThreadSafe;

import javax.servlet.http.HttpServletRequest;

/**
* This test validate E2E the correctness of the RouterWebServices. It starts
* Router, RM and NM in 3 different processes to avoid servlet conflicts. Each
Expand Down Expand Up @@ -423,7 +425,7 @@ public void testSchedulerInfoXML() throws Exception {

/**
* This test validates the correctness of
* {@link RMWebServiceProtocol#getNodes()} inside Router.
* {@link RMWebServiceProtocol#getNodes(String)} inside Router.
*/
@Test(timeout = 2000)
public void testNodesEmptyXML() throws Exception {
Expand All @@ -444,7 +446,7 @@ public void testNodesEmptyXML() throws Exception {

/**
* This test validates the correctness of
* {@link RMWebServiceProtocol#getNodes()} inside Router.
* {@link RMWebServiceProtocol#getNodes(String)} inside Router.
*/
@Test(timeout = 2000)
public void testNodesXML() throws Exception {
Expand All @@ -465,7 +467,7 @@ public void testNodesXML() throws Exception {

/**
* This test validates the correctness of
* {@link RMWebServiceProtocol#getNode()} inside Router.
* {@link RMWebServiceProtocol#getNode(String)} inside Router.
*/
@Test(timeout = 2000)
public void testNodeXML() throws Exception {
Expand Down Expand Up @@ -528,7 +530,7 @@ public void testUpdateNodeResource() throws Exception {

/**
* This test validates the correctness of
* {@link RMWebServiceProtocol#getActivities()} inside Router.
* {@link RMWebServiceProtocol#getActivities(HttpServletRequest, String, String)} inside Router.
*/
@Test(timeout = 2000)
public void testActiviesXML() throws Exception {
Expand Down Expand Up @@ -600,7 +602,7 @@ public void testDumpSchedulerLogsXML() throws Exception {
performCall(RM_WEB_SERVICE_PATH + SCHEDULER_LOGS,
null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
ClientResponse response = performCall(
Expand All @@ -623,7 +625,7 @@ public void testNewApplicationXML() throws Exception {
RM_WEB_SERVICE_PATH + APPS_NEW_APPLICATION, null,
null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
ClientResponse response = performCall(
Expand All @@ -646,7 +648,7 @@ public void testSubmitApplicationXML() throws Exception {
ClientResponse badResponse = performCall(
RM_WEB_SERVICE_PATH + APPS, null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
ApplicationSubmissionContextInfo context =
Expand Down Expand Up @@ -771,7 +773,7 @@ public void testUpdateAppStateXML() throws Exception {
ClientResponse badResponse = performCall(
pathApp, null, null, null, POST);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
AppState appState = new AppState("KILLED");
Expand Down Expand Up @@ -820,7 +822,7 @@ public void testUpdateAppPriorityXML() throws Exception {
RM_WEB_SERVICE_PATH + format(APPS_APPID_PRIORITY, appId),
null, null, null, POST);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
AppPriority appPriority = new AppPriority(1);
Expand Down Expand Up @@ -870,7 +872,7 @@ public void testUpdateAppQueueXML() throws Exception {
RM_WEB_SERVICE_PATH + format(APPS_APPID_QUEUE, appId),
null, null, null, POST);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
AppQueue appQueue = new AppQueue("default");
Expand Down Expand Up @@ -945,7 +947,7 @@ public void testUpdateAppTimeoutsXML() throws Exception {
RM_WEB_SERVICE_PATH + format(APPS_TIMEOUT, appId),
null, null, null, POST);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with a bad request
AppTimeoutInfo appTimeoutInfo = new AppTimeoutInfo();
Expand All @@ -971,7 +973,7 @@ public void testNewReservationXML() throws Exception {
RM_WEB_SERVICE_PATH + RESERVATION_NEW,
null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
ClientResponse response = performCall(
Expand All @@ -995,7 +997,7 @@ public void testSubmitReservationXML() throws Exception {
RM_WEB_SERVICE_PATH + RESERVATION_SUBMIT, null,
null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
ReservationSubmissionRequestInfo context =
Expand All @@ -1022,7 +1024,7 @@ public void testUpdateReservationXML() throws Exception {
ClientResponse badResponse = performCall(
RM_WEB_SERVICE_PATH + RESERVATION_UPDATE, null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
String reservationId = getNewReservationId().getReservationId();
Expand All @@ -1048,7 +1050,7 @@ public void testDeleteReservationXML() throws Exception {
ClientResponse badResponse = performCall(
RM_WEB_SERVICE_PATH + RESERVATION_DELETE, null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
String reservationId = getNewReservationId().getReservationId();
Expand Down Expand Up @@ -1185,7 +1187,7 @@ public void testAddToClusterNodeLabelsXML() throws Exception {
RM_WEB_SERVICE_PATH + ADD_NODE_LABELS,
null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method

Expand Down Expand Up @@ -1213,7 +1215,7 @@ public void testRemoveFromClusterNodeLabelsXML()
ClientResponse badResponse = performCall(
RM_WEB_SERVICE_PATH + REMOVE_NODE_LABELS, null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
addNodeLabel();
Expand All @@ -1238,7 +1240,7 @@ public void testReplaceLabelsOnNodesXML() throws Exception {
ClientResponse badResponse = performCall(
RM_WEB_SERVICE_PATH + REPLACE_NODE_TO_LABELS, null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
addNodeLabel();
Expand Down Expand Up @@ -1267,7 +1269,7 @@ public void testReplaceLabelsOnNodeXML() throws Exception {
ClientResponse badResponse = performCall(
pathNode, null, null, null, PUT);

assertEquals(SC_INTERNAL_SERVER_ERROR, badResponse.getStatus());
assertEquals(SC_SERVICE_UNAVAILABLE, badResponse.getStatus());

// Test with the correct HTTP method
addNodeLabel();
Expand Down