EmrHelper extends AwsHelper { public StepConfig getEmrHadoopJarStepConfig(String stepName, String jarLocation, String mainClass, List<String> scriptArguments, Boolean isContinueOnError) { ActionOnFailure actionOnFailure = ActionOnFailure.CANCEL_AND_WAIT; if (isContinueOnError != null && isContinueOnError) { actionOnFailure = ActionOnFailure.CONTINUE; } if (CollectionUtils.isEmpty(scriptArguments)) { return new StepConfig().withName(stepName.trim()).withActionOnFailure(actionOnFailure) .withHadoopJarStep(new HadoopJarStepConfig().withJar(jarLocation.trim()).withMainClass(mainClass)); } else { return new StepConfig().withName(stepName.trim()).withActionOnFailure(actionOnFailure).withHadoopJarStep( new HadoopJarStepConfig().withJar(jarLocation.trim()).withMainClass(mainClass) .withArgs(scriptArguments.toArray(new String[scriptArguments.size()]))); } }  String buildEmrClusterName(String namespaceCd, String emrDefinitionName, String clusterName); String getActiveEmrClusterId(String emrClusterId, String emrClusterName, String accountId); EmrParamsDto getEmrParamsDtoByAccountId(String accountId); EmrDao getEmrDao(); void setEmrDao(EmrDao emrDao); StepConfig getEmrHadoopJarStepConfig(String stepName, String jarLocation, String mainClass, List<String> scriptArguments, Boolean isContinueOnError); String getS3StagingLocation(String trustingAccountStagingBucketName); boolean isActiveEmrState(String status); boolean isInstanceDefinitionsEmpty(InstanceDefinitions instanceDefinitions); List<EmrClusterInstanceFleet> buildEmrClusterInstanceFleetFromAwsResult(ListInstanceFleetsResult awsInstanceFleetsResult);  }
@Test public void testEmrHadoopJarStepConfig() { StepConfig stepConfig = emrHelper.getEmrHadoopJarStepConfig("step_name", "jar_location", null, null, false); assertNotNull("step not retuned", stepConfig); assertEquals("name not found", "step_name", stepConfig.getName()); assertEquals("jar not found", "jar_location", stepConfig.getHadoopJarStep().getJar()); }
@Test public void testEmrHadoopJarStepConfigNoContinueOnError() { StepConfig stepConfig = emrHelper.getEmrHadoopJarStepConfig("step_name", "jar_location", null, null, null); assertNotNull("step not retuned", stepConfig); assertEquals("name not found", "step_name", stepConfig.getName()); assertEquals("jar not found", "jar_location", stepConfig.getHadoopJarStep().getJar()); }
@Test public void testEmrHadoopJarStepConfigContinueOnError() { StepConfig stepConfig = emrHelper.getEmrHadoopJarStepConfig("step_name", "jar_location", null, null, true); assertNotNull("step not retuned", stepConfig); assertEquals("name not found", "step_name", stepConfig.getName()); assertEquals("jar not found", "jar_location", stepConfig.getHadoopJarStep().getJar()); }
@Test public void testEmrHadoopJarStepConfigWithArguments() { List<String> arguments = new ArrayList<>(); arguments.add("arg1"); StepConfig stepConfig = emrHelper.getEmrHadoopJarStepConfig("step_name", "jar_location", null, arguments, false); assertNotNull("step not returned", stepConfig); assertEquals("name not found", "step_name", stepConfig.getName()); assertEquals("jar not found", "jar_location", stepConfig.getHadoopJarStep().getJar()); assertNotNull("arguments not found", stepConfig.getHadoopJarStep().getArgs()); }