Example usage for com.amazonaws.services.elasticmapreduce.model ClusterState BOOTSTRAPPING

List of usage examples for com.amazonaws.services.elasticmapreduce.model ClusterState BOOTSTRAPPING

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticmapreduce.model ClusterState BOOTSTRAPPING.

Prototype

ClusterState BOOTSTRAPPING

To view the source code for com.amazonaws.services.elasticmapreduce.model ClusterState BOOTSTRAPPING.

Click Source Link

Usage

From source file:org.finra.dm.dao.impl.MockEmrOperationsImpl.java

License:Apache License

@Override
public String runEmrJobFlow(AmazonElasticMapReduceClient emrClient, RunJobFlowRequest jobFlowRequest) {
    String clusterStatus = ClusterState.BOOTSTRAPPING.toString();

    if (StringUtils.isNotBlank(jobFlowRequest.getAmiVersion())) {
        if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_THROTTLING_EXCEPTION)) {
            AmazonServiceException throttlingException = new AmazonServiceException(
                    "test throttling exception");
            throttlingException.setErrorCode("ThrottlingException");

            throw throttlingException;
        } else if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_BAD_REQUEST)) {
            AmazonServiceException badRequestException = new AmazonServiceException(
                    MockAwsOperationsHelper.AMAZON_BAD_REQUEST);
            badRequestException.setStatusCode(HttpStatus.SC_BAD_REQUEST);
            throw badRequestException;
        } else if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_NOT_FOUND)) {
            AmazonServiceException notFoundException = new AmazonServiceException(
                    MockAwsOperationsHelper.AMAZON_NOT_FOUND);
            notFoundException.setStatusCode(HttpStatus.SC_NOT_FOUND);
            throw notFoundException;
        } else if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_SERVICE_EXCEPTION)) {
            throw new AmazonServiceException(MockAwsOperationsHelper.AMAZON_SERVICE_EXCEPTION);
        } else if (jobFlowRequest.getAmiVersion()
                .equals(MockAwsOperationsHelper.AMAZON_CLUSTER_STATUS_WAITING)) {
            clusterStatus = ClusterState.WAITING.toString();
        } else if (jobFlowRequest.getAmiVersion()
                .equals(MockAwsOperationsHelper.AMAZON_CLUSTER_STATUS_RUNNING)) {
            clusterStatus = ClusterState.RUNNING.toString();
        }//from  w  w  w . j ava 2 s  .  c  o  m
    }

    return createNewCluster(jobFlowRequest, clusterStatus).getJobFlowId();
}

From source file:org.finra.herd.dao.impl.MockEmrOperationsImpl.java

License:Apache License

@Override
public String runEmrJobFlow(AmazonElasticMapReduceClient emrClient, RunJobFlowRequest jobFlowRequest) {
    String clusterStatus = ClusterState.BOOTSTRAPPING.toString();

    StatusChangeReason reason = new StatusChangeReason(ClusterStateChangeReasonCode.USER_REQUEST.toString(),
            "Started " + clusterStatus);
    StatusTimeline timeline = new StatusTimeline();
    timeline.setCreationTime(HerdDateUtils.getXMLGregorianCalendarValue(new Date()));

    if (StringUtils.isNotBlank(jobFlowRequest.getAmiVersion())) {
        if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_THROTTLING_EXCEPTION)) {
            AmazonServiceException throttlingException = new AmazonServiceException(
                    "test throttling exception");
            throttlingException.setErrorCode("ThrottlingException");

            throw throttlingException;
        } else if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_BAD_REQUEST)) {
            AmazonServiceException badRequestException = new AmazonServiceException(
                    MockAwsOperationsHelper.AMAZON_BAD_REQUEST);
            badRequestException.setStatusCode(HttpStatus.SC_BAD_REQUEST);
            throw badRequestException;
        } else if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_NOT_FOUND)) {
            AmazonServiceException notFoundException = new AmazonServiceException(
                    MockAwsOperationsHelper.AMAZON_NOT_FOUND);
            notFoundException.setStatusCode(HttpStatus.SC_NOT_FOUND);
            throw notFoundException;
        } else if (jobFlowRequest.getAmiVersion().equals(MockAwsOperationsHelper.AMAZON_SERVICE_EXCEPTION)) {
            throw new AmazonServiceException(MockAwsOperationsHelper.AMAZON_SERVICE_EXCEPTION);
        } else if (jobFlowRequest.getAmiVersion()
                .equals(MockAwsOperationsHelper.AMAZON_CLUSTER_STATUS_WAITING)) {
            clusterStatus = ClusterState.WAITING.toString();
        } else if (jobFlowRequest.getAmiVersion()
                .equals(MockAwsOperationsHelper.AMAZON_CLUSTER_STATUS_RUNNING)) {
            clusterStatus = ClusterState.RUNNING.toString();
        }//from   ww w  . j a  v  a 2  s.c  o  m
    }

    return createNewCluster(jobFlowRequest, clusterStatus, reason, timeline).getJobFlowId();
}