Search in sources :

Example 1 with CreateOfferRecommendation

use of com.mesosphere.sdk.offer.CreateOfferRecommendation in project dcos-commons by mesosphere.

the class UninstallRecorderTest method testHandlingOfUnexpectedOfferRecommendation.

@Test
public void testHandlingOfUnexpectedOfferRecommendation() throws Exception {
    Protos.Resource resource = ResourceTestUtils.getUnreservedCpus(1.0);
    OfferRecommendation unsupportedOfferRecommendation = new CreateOfferRecommendation(null, resource);
    StateStore mockStateStore = mock(StateStore.class);
    OperationRecorder operationRecorder = new UninstallRecorder(mockStateStore, null);
    // should just return without error
    operationRecorder.record(unsupportedOfferRecommendation);
}
Also used : Protos(org.apache.mesos.Protos) StateStore(com.mesosphere.sdk.state.StateStore) OperationRecorder(com.mesosphere.sdk.offer.OperationRecorder) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) OfferRecommendation(com.mesosphere.sdk.offer.OfferRecommendation) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) Test(org.junit.Test)

Example 2 with CreateOfferRecommendation

use of com.mesosphere.sdk.offer.CreateOfferRecommendation in project dcos-commons by mesosphere.

the class ResourceCleanupStepTest method testMixedUpdateOfferStatus.

@Test
public void testMixedUpdateOfferStatus() throws Exception {
    OfferRecommendation rec1 = new CreateOfferRecommendation(null, ResourceTestUtils.getReservedRootVolume(999.0));
    OfferRecommendation rec2 = new UnreserveOfferRecommendation(null, ResourceTestUtils.getReservedCpus(1.0, TestConstants.RESOURCE_ID));
    resourceCleanupStep.start();
    resourceCleanupStep.updateOfferStatus(Arrays.asList(rec1, rec2));
    assert resourceCleanupStep.getStatus().equals(Status.COMPLETE);
}
Also used : UnreserveOfferRecommendation(com.mesosphere.sdk.offer.UnreserveOfferRecommendation) UnreserveOfferRecommendation(com.mesosphere.sdk.offer.UnreserveOfferRecommendation) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) OfferRecommendation(com.mesosphere.sdk.offer.OfferRecommendation) CreateOfferRecommendation(com.mesosphere.sdk.offer.CreateOfferRecommendation) Test(org.junit.Test)

Aggregations

CreateOfferRecommendation (com.mesosphere.sdk.offer.CreateOfferRecommendation)2 OfferRecommendation (com.mesosphere.sdk.offer.OfferRecommendation)2 Test (org.junit.Test)2 OperationRecorder (com.mesosphere.sdk.offer.OperationRecorder)1 UnreserveOfferRecommendation (com.mesosphere.sdk.offer.UnreserveOfferRecommendation)1 StateStore (com.mesosphere.sdk.state.StateStore)1 Protos (org.apache.mesos.Protos)1