Search in sources :

Example 1 with ListInstanceFleetsRequest

use of com.amazonaws.services.elasticmapreduce.model.ListInstanceFleetsRequest in project herd by FINRAOS.

the class EmrDaoImplTest method testGetListInstanceFleetsResult.

@Test
public void testGetListInstanceFleetsResult() {
    // Create an AWS parameters DTO.
    AwsParamsDto awsParamsDto = new AwsParamsDto(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, HTTP_PROXY_HOST, HTTP_PROXY_PORT);
    // Create a mock AmazonElasticMapReduceClient.
    AmazonElasticMapReduceClient amazonElasticMapReduceClient = mock(AmazonElasticMapReduceClient.class);
    // Create a list instance fleets request.
    ListInstanceFleetsRequest listInstanceFleetsRequest = new ListInstanceFleetsRequest().withClusterId(EMR_CLUSTER_ID);
    // Create a list instance fleets result.
    ListInstanceFleetsResult listInstanceFleetsResult = new ListInstanceFleetsResult().withMarker(MARKER);
    // Mock the external calls.
    when(awsClientFactory.getEmrClient(awsParamsDto)).thenReturn(amazonElasticMapReduceClient);
    when(emrOperations.listInstanceFleets(amazonElasticMapReduceClient, listInstanceFleetsRequest)).thenReturn(listInstanceFleetsResult);
    // Call the method under test.
    ListInstanceFleetsResult result = emrDaoImpl.getListInstanceFleetsResult(EMR_CLUSTER_ID, awsParamsDto);
    // Verify the external calls.
    verify(awsClientFactory).getEmrClient(awsParamsDto);
    verify(emrOperations).listInstanceFleets(amazonElasticMapReduceClient, listInstanceFleetsRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(listInstanceFleetsResult, result);
}
Also used : ListInstanceFleetsRequest(com.amazonaws.services.elasticmapreduce.model.ListInstanceFleetsRequest) AwsParamsDto(org.finra.herd.model.dto.AwsParamsDto) ListInstanceFleetsResult(com.amazonaws.services.elasticmapreduce.model.ListInstanceFleetsResult) AmazonElasticMapReduceClient(com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Aggregations

AmazonElasticMapReduceClient (com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClient)1 ListInstanceFleetsRequest (com.amazonaws.services.elasticmapreduce.model.ListInstanceFleetsRequest)1 ListInstanceFleetsResult (com.amazonaws.services.elasticmapreduce.model.ListInstanceFleetsResult)1 AbstractDaoTest (org.finra.herd.dao.AbstractDaoTest)1 AwsParamsDto (org.finra.herd.model.dto.AwsParamsDto)1 Test (org.junit.Test)1