@Test public void testStopSteps_whenLeaveClusterAlive() throws Exception { boolean expectedStopSteps = true; Whitebox.setInternalState( emrClient, "alive", true ); PowerMockito.doNothing().when( emrClient, "terminateJobFlows" ); PowerMockito.doNothing().when( emrClient, "cancelStepExecution" ); boolean stopSteps = emrClient.stopSteps(); PowerMockito.verifyPrivate( emrClient, times( 0 ) ).invoke( "terminateJobFlows" ); PowerMockito.verifyPrivate( emrClient, times( 1 ) ).invoke( "cancelStepExecution" ); Assert.assertEquals( expectedStopSteps, stopSteps ); }
@Override public boolean stopSteps() { if ( alive ) { cancelStepExecution(); return true; } else { terminateJobFlows(); } return false; }
EmrClientImpl implements EmrClient { @Override public boolean stopSteps() { if ( alive ) { cancelStepExecution(); return true; } else { terminateJobFlows(); } return false; } }
EmrClientImpl implements EmrClient { @Override public boolean stopSteps() { if ( alive ) { cancelStepExecution(); return true; } else { terminateJobFlows(); } return false; } EmrClientImpl( AmazonElasticMapReduce emrClient ); }
EmrClientImpl implements EmrClient { @Override public boolean stopSteps() { if ( alive ) { cancelStepExecution(); return true; } else { terminateJobFlows(); } return false; } EmrClientImpl( AmazonElasticMapReduce emrClient ); @Override void runJobFlow( String stagingS3FileUrl, String stagingS3BucketUrl, String stepType, String mainClass,
                          String bootstrapActions,
                          AbstractAmazonJobEntry jobEntry
  ); @Override String getHadoopJobFlowId(); @Override String getStepId(); @Override void addStepToExistingJobFlow( String stagingS3FileUrl, String stagingS3BucketUrl, String stepType,
                                        String mainClass,
                                        AbstractAmazonJobEntry jobEntry ); @Override boolean isClusterRunning(); @Override boolean isStepRunning(); @Override boolean isRunning(); @Override String getCurrentClusterState(); @Override String getCurrentStepState(); @Override boolean isClusterTerminated(); @Override boolean isStepFailed(); @Override boolean isStepNotSuccess(); @VisibleForTesting static String removeLineBreaks( String multiLineFieldValue ); @Override boolean stopSteps(); @Override String getJobFlowLogUri(); }
EmrClientImpl implements EmrClient { @Override public boolean stopSteps() { if ( alive ) { cancelStepExecution(); return true; } else { terminateJobFlows(); } return false; } EmrClientImpl( AmazonElasticMapReduce emrClient ); @Override void runJobFlow( String stagingS3FileUrl, String stagingS3BucketUrl, String stepType, String mainClass,
                          String bootstrapActions,
                          AbstractAmazonJobEntry jobEntry
  ); @Override String getHadoopJobFlowId(); @Override String getStepId(); @Override void addStepToExistingJobFlow( String stagingS3FileUrl, String stagingS3BucketUrl, String stepType,
                                        String mainClass,
                                        AbstractAmazonJobEntry jobEntry ); @Override boolean isClusterRunning(); @Override boolean isStepRunning(); @Override boolean isRunning(); @Override String getCurrentClusterState(); @Override String getCurrentStepState(); @Override boolean isClusterTerminated(); @Override boolean isStepFailed(); @Override boolean isStepNotSuccess(); @VisibleForTesting static String removeLineBreaks( String multiLineFieldValue ); @Override boolean stopSteps(); @Override String getJobFlowLogUri();  }