use of com.amazonaws.services.elasticmapreduce.model.AddJobFlowStepsRequest in project herd by FINRAOS.
the class EmrDaoTest method addEmrStepCallsAddJobFlowSteps.
@Test
public void addEmrStepCallsAddJobFlowSteps() throws Exception {
String clusterName = "clusterName";
StepConfig emrStepConfig = new StepConfig();
String clusterId = "clusterId";
String stepId = "stepId";
/*
* Mock the EmrOperations.listEmrClusters() call to return a known result.
*/
ListClustersResult listClustersResult = new ListClustersResult();
ClusterSummary clusterSummary = new ClusterSummary();
clusterSummary.setId(clusterId);
clusterSummary.setName(clusterName);
listClustersResult.setClusters(Arrays.asList(clusterSummary));
when(mockEmrOperations.listEmrClusters(any(), any())).thenReturn(listClustersResult);
/*
* Mock EmrOperations.addJobFlowStepsRequest() and assert parameters passed in.
*/
when(mockEmrOperations.addJobFlowStepsRequest(any(), any())).thenAnswer(new Answer<List<String>>() {
@Override
public List<String> answer(InvocationOnMock invocation) throws Throwable {
AddJobFlowStepsRequest addJobFlowStepsRequest = invocation.getArgument(1);
assertEquals(clusterId, addJobFlowStepsRequest.getJobFlowId());
List<StepConfig> steps = addJobFlowStepsRequest.getSteps();
assertEquals(1, steps.size());
assertEquals(emrStepConfig, steps.get(0));
// return a single step with the given stepId
return Arrays.asList(stepId);
}
});
assertEquals(stepId, emrDao.addEmrStep(clusterId, emrStepConfig, new AwsParamsDto()));
}
use of com.amazonaws.services.elasticmapreduce.model.AddJobFlowStepsRequest in project herd by FINRAOS.
the class EmrDaoImpl method addEmrStep.
@Override
public String addEmrStep(String clusterId, StepConfig emrStepConfig, AwsParamsDto awsParamsDto) throws Exception {
List<StepConfig> steps = new ArrayList<>();
steps.add(emrStepConfig);
// Add the job flow request
AddJobFlowStepsRequest jobFlowStepRequest = new AddJobFlowStepsRequest(clusterId, steps);
List<String> emrStepIds = emrOperations.addJobFlowStepsRequest(getEmrClient(awsParamsDto), jobFlowStepRequest);
return emrStepIds.get(0);
}
Aggregations