Search in sources :

Example 1 with ReservationListRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsInvalidTimeInterval.

@Test
public void testListReservationsInvalidTimeInterval() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue(ReservationSystemTestUtil.reservationQ);
    request.setEndTime(1000);
    request.setStartTime(2000);
    when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn(this.plan);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.equals("The specified end time must be " + "greater than the specified start time."));
        LOG.info(message);
    }
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 2 with ReservationListRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsNormal.

@Test
public void testListReservationsNormal() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue(ReservationSystemTestUtil.reservationQ);
    request.setEndTime(1000);
    request.setStartTime(0);
    when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn(this.plan);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
    } catch (YarnException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(plan);
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 3 with ReservationListRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsInvalidTimeIntervalDefaults.

@Test
public void testListReservationsInvalidTimeIntervalDefaults() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue(ReservationSystemTestUtil.reservationQ);
    // Negative time gets converted to default values for Start Time and End
    // Time which are 0 and Long.MAX_VALUE respectively.
    request.setEndTime(-2);
    request.setStartTime(-1);
    when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn(this.plan);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
    } catch (YarnException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(plan);
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 4 with ReservationListRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsNullPlan.

@Test
public void testListReservationsNullPlan() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue(ReservationSystemTestUtil.reservationQ);
    when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn(null);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.equals("The specified queue: " + ReservationSystemTestUtil.reservationQ + " is not managed by reservation system." + " Please try again with a valid reservable queue."));
        LOG.info(message);
    }
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 5 with ReservationListRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsEmptyQueue.

@Test
public void testListReservationsEmptyQueue() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue("");
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.equals("The queue is not specified. Please try again with a valid " + "reservable queue."));
        LOG.info(message);
    }
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Aggregations

ReservationListRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest)5 ReservationListRequestPBImpl (org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl)5 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)5 Test (org.junit.Test)5