use of org.apache.hadoop.yarn.api.records.ReservationId in project hadoop by apache.
the class TestRMWebServicesReservation method testQueueOnlyRequestListReservation.
@Test
public void testQueueOnlyRequestListReservation() throws Exception {
rm.start();
setupCluster(100);
ReservationId id1 = getReservationIdTestHelper(1);
ReservationId id2 = getReservationIdTestHelper(2);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, clock.getTime(), "res_1", id1);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, clock.getTime(), "res_2", id2);
WebResource resource = constructWebResource(LIST_RESERVATION_PATH).queryParam("queue", DEFAULT_QUEUE);
JSONObject json = testListReservationHelper(resource);
if (!this.isAuthenticationEnabled() && json == null) {
return;
}
assertEquals(json.getJSONArray("reservations").length(), 2);
testRDLHelper(json.getJSONArray("reservations").getJSONObject(0));
testRDLHelper(json.getJSONArray("reservations").getJSONObject(1));
rm.stop();
}
use of org.apache.hadoop.yarn.api.records.ReservationId in project hadoop by apache.
the class TestRMWebServicesReservation method testDeleteReservation.
@Test
public void testDeleteReservation() throws JSONException, Exception {
rm.start();
for (int i = 0; i < 100; i++) {
MockNM amNodeManager = rm.registerNode("127.0.0." + i + ":1234", 100 * 1024);
amNodeManager.nodeHeartbeat(true);
}
ReservationId rid = getReservationIdTestHelper(1);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, rid);
testDeleteReservationHelper("reservation/delete", rid, MediaType.APPLICATION_JSON);
rm.stop();
}
use of org.apache.hadoop.yarn.api.records.ReservationId in project hadoop by apache.
the class TestRMWebServicesReservation method testInvalidReservationIdRequestListReservation.
@Test
public void testInvalidReservationIdRequestListReservation() throws Exception {
rm.start();
setupCluster(100);
ReservationId id1 = getReservationIdTestHelper(1);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, clock.getTime(), "res_1", id1);
WebResource resource = constructWebResource(LIST_RESERVATION_PATH).queryParam("queue", DEFAULT_QUEUE);
if (id1 != null) {
resource = resource.queryParam("reservation-id", "invalid" + id1.toString());
}
JSONObject response = testListReservationHelper(resource, Status.NOT_FOUND);
rm.stop();
}
use of org.apache.hadoop.yarn.api.records.ReservationId in project hadoop by apache.
the class TestRMWebServicesReservation method testSubmitReservation.
@Test
public void testSubmitReservation() throws Exception {
rm.start();
setupCluster(100);
ReservationId rid = getReservationIdTestHelper(1);
ClientResponse response = reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, rid);
if (this.isAuthenticationEnabled()) {
assertTrue(isHttpSuccessResponse(response));
verifyReservationCount(1);
}
rm.stop();
}
use of org.apache.hadoop.yarn.api.records.ReservationId in project hadoop by apache.
the class TestRMWebServicesReservation method testReservationIdRequestListReservation.
@Test
public void testReservationIdRequestListReservation() throws Exception {
rm.start();
setupCluster(100);
ReservationId id1 = getReservationIdTestHelper(1);
ReservationId id2 = getReservationIdTestHelper(2);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, clock.getTime(), "res_1", id1);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, clock.getTime(), "res_1", id1);
reservationSubmissionTestHelper("reservation/submit", MediaType.APPLICATION_JSON, clock.getTime(), "res_2", id2);
WebResource resource = constructWebResource(LIST_RESERVATION_PATH).queryParam("include-resource-allocations", "true").queryParam("queue", DEFAULT_QUEUE);
if (id1 != null) {
resource = resource.queryParam("reservation-id", id1.toString());
}
JSONObject json = testListReservationHelper(resource);
if (!this.isAuthenticationEnabled() && json == null) {
return;
}
JSONObject reservations = json.getJSONObject("reservations");
testRDLHelper(reservations);
String reservationId = reservations.getString("reservation-id");
assertEquals(id1.toString(), reservationId);
rm.stop();
}
Aggregations