use of com.amazonaws.services.elasticmapreduce.model.DescribeClusterRequest in project herd by FINRAOS.
the class EmrDaoTest method getEmrClusterByIdAssertCallDescribeCluster.
@Test
public void getEmrClusterByIdAssertCallDescribeCluster() throws Exception {
String clusterId = "clusterId";
Cluster expectedCluster = new Cluster();
when(mockEmrOperations.describeClusterRequest(any(), any())).thenAnswer(new Answer<DescribeClusterResult>() {
@Override
public DescribeClusterResult answer(InvocationOnMock invocation) throws Throwable {
DescribeClusterRequest describeClusterRequest = invocation.getArgument(1);
assertEquals(clusterId, describeClusterRequest.getClusterId());
DescribeClusterResult describeClusterResult = new DescribeClusterResult();
describeClusterResult.setCluster(expectedCluster);
return describeClusterResult;
}
});
assertEquals(expectedCluster, emrDao.getEmrClusterById(clusterId, new AwsParamsDto()));
}
use of com.amazonaws.services.elasticmapreduce.model.DescribeClusterRequest in project herd by FINRAOS.
the class EmrDaoTest method getEmrClusterStatusByIdAssertReturnNullWhenClusterIsNull.
@Test
public void getEmrClusterStatusByIdAssertReturnNullWhenClusterIsNull() throws Exception {
String clusterId = "clusterId";
when(mockEmrOperations.describeClusterRequest(any(), any())).then(new Answer<DescribeClusterResult>() {
@Override
public DescribeClusterResult answer(InvocationOnMock invocation) throws Throwable {
DescribeClusterRequest describeClusterRequest = invocation.getArgument(1);
assertEquals(clusterId, describeClusterRequest.getClusterId());
return new DescribeClusterResult();
}
});
assertNull(emrDao.getEmrClusterStatusById(clusterId, new AwsParamsDto()));
}
use of com.amazonaws.services.elasticmapreduce.model.DescribeClusterRequest in project herd by FINRAOS.
the class EmrDaoTest method getEmrClusterStatusByIdAssertReturnClusterState.
@Test
public void getEmrClusterStatusByIdAssertReturnClusterState() throws Exception {
String clusterId = "clusterId";
ClusterState expectedState = ClusterState.BOOTSTRAPPING;
when(mockEmrOperations.describeClusterRequest(any(), any())).then(new Answer<DescribeClusterResult>() {
@Override
public DescribeClusterResult answer(InvocationOnMock invocation) throws Throwable {
DescribeClusterRequest describeClusterRequest = invocation.getArgument(1);
assertEquals(clusterId, describeClusterRequest.getClusterId());
DescribeClusterResult describeClusterResult = new DescribeClusterResult();
Cluster cluster = new Cluster();
ClusterStatus status = new ClusterStatus();
status.setState(expectedState);
cluster.setStatus(status);
describeClusterResult.setCluster(cluster);
return describeClusterResult;
}
});
assertEquals(expectedState.toString(), emrDao.getEmrClusterStatusById(clusterId, new AwsParamsDto()));
}
Aggregations