/** * Create an instance of {@link EmrPigStep } * */ public EmrPigStep createEmrPigStep() { return new EmrPigStep(); }
/** * Create an instance of {@link EmrPigStep } * */ public EmrPigStep createEmrPigStep() { return new EmrPigStep(); }
/** * Create an instance of {@link EmrPigStep } * */ public EmrPigStep createEmrPigStep() { return new EmrPigStep(); }
public Object createNewInstance() { return new EmrPigStep(); }
public Object createNewInstance() { return new EmrPigStep(); }
public Object createNewInstance() { return new EmrPigStep(); }
@Override public Object buildResponseFromRequest(Object stepRequest) { EmrPigStepAddRequest emrPigStepAddRequest = (EmrPigStepAddRequest) stepRequest; EmrPigStep step = new EmrPigStep(); step.setNamespace(emrPigStepAddRequest.getNamespace()); step.setEmrClusterDefinitionName(emrPigStepAddRequest.getEmrClusterDefinitionName()); step.setEmrClusterName(emrPigStepAddRequest.getEmrClusterName()); step.setStepName(emrPigStepAddRequest.getStepName().trim()); step.setScriptLocation(emrPigStepAddRequest.getScriptLocation().trim().replaceAll(getS3ManagedReplaceString(), emrHelper.getS3StagingLocation())); // Add the script arguments if (!CollectionUtils.isEmpty(emrPigStepAddRequest.getScriptArguments())) { List<String> scriptArguments = new ArrayList<>(); step.setScriptArguments(scriptArguments); for (String argument : emrPigStepAddRequest.getScriptArguments()) { scriptArguments.add(argument.trim()); } } step.setContinueOnError(emrPigStepAddRequest.isContinueOnError()); return step; }
@Override public Object buildResponseFromRequest(Object stepRequest) { EmrPigStepAddRequest emrPigStepAddRequest = (EmrPigStepAddRequest) stepRequest; EmrPigStep step = new EmrPigStep(); step.setNamespace(emrPigStepAddRequest.getNamespace()); step.setEmrClusterDefinitionName(emrPigStepAddRequest.getEmrClusterDefinitionName()); step.setEmrClusterName(emrPigStepAddRequest.getEmrClusterName()); step.setStepName(emrPigStepAddRequest.getStepName().trim()); step.setScriptLocation(emrPigStepAddRequest.getScriptLocation().trim().replaceAll(getS3ManagedReplaceString(), emrHelper.getS3StagingLocation())); // Add the script arguments if (!CollectionUtils.isEmpty(emrPigStepAddRequest.getScriptArguments())) { List<String> scriptArguments = new ArrayList<>(); step.setScriptArguments(scriptArguments); for (String argument : emrPigStepAddRequest.getScriptArguments()) { scriptArguments.add(argument.trim()); } } step.setContinueOnError(emrPigStepAddRequest.isContinueOnError()); return step; }
@Test public void testAddPigStepToEmrCluster() throws Exception { // Create an add step request. EmrPigStepAddRequest emrPigStepAddRequest = new EmrPigStepAddRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, EMR_CLUSTER_NAME, EMR_STEP_NAME, EMR_STEP_SCRIPT_LOCATION, Arrays.asList(ATTRIBUTE_NAME_1_MIXED_CASE), CONTINUE_ON_ERROR, EMR_CLUSTER_ID, AWS_ACCOUNT_ID); // Create an add step response. EmrPigStep emrPigStep = new EmrPigStep(EMR_STEP_ID, NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, EMR_CLUSTER_NAME, EMR_STEP_NAME, EMR_STEP_SCRIPT_LOCATION, Arrays.asList(ATTRIBUTE_NAME_1_MIXED_CASE), CONTINUE_ON_ERROR, EMR_CLUSTER_ID); // Mock the external calls. when(emrService.addStepToCluster(emrPigStepAddRequest)).thenReturn(emrPigStep); // Call the method under test. EmrPigStep result = emrRestController.addPigStepToEmrCluster(emrPigStepAddRequest); // Verify the external calls. verify(emrService).addStepToCluster(emrPigStepAddRequest); verifyNoMoreInteractionsHelper(); // Validate the results. assertEquals(emrPigStep, result); }
EmrPigStep pigStep = new EmrPigStep(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, request.getEmrClusterName(), null, null, null, null, null, null); pigStep.setStepName("Test Pig"); pigStep.setContinueOnError(true);