/** * Create an instance of {@link EmrHadoopJarStepAddRequest } * */ public EmrHadoopJarStepAddRequest createEmrHadoopJarStepAddRequest() { return new EmrHadoopJarStepAddRequest(); }
@Override public void setRequestEmrClusterDefinitionName(Object stepRequest, String clusterDefinitionName) { ((EmrHadoopJarStepAddRequest) stepRequest).setEmrClusterDefinitionName(clusterDefinitionName); }
@Override public void setRequestEmrClusterName(Object stepRequest, String clusterName) { ((EmrHadoopJarStepAddRequest) stepRequest).setEmrClusterName(clusterName); }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); if (draftCopy instanceof EmrHadoopJarStepAddRequest) { final EmrHadoopJarStepAddRequest copy = ((EmrHadoopJarStepAddRequest) draftCopy); if (namespaceShouldBeCopiedAndSet == Boolean.TRUE) { String sourceNamespace; sourceNamespace = this.getNamespace(); String copyNamespace = ((String) strategy.copy(LocatorUtils.property(locator, "namespace", sourceNamespace), sourceNamespace, (this.namespace!= null))); copy.setNamespace(copyNamespace); } else { if (namespaceShouldBeCopiedAndSet == Boolean.FALSE) { if (emrClusterDefinitionNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEmrClusterDefinitionName; sourceEmrClusterDefinitionName = this.getEmrClusterDefinitionName(); String copyEmrClusterDefinitionName = ((String) strategy.copy(LocatorUtils.property(locator, "emrClusterDefinitionName", sourceEmrClusterDefinitionName), sourceEmrClusterDefinitionName, (this.emrClusterDefinitionName!= null))); copy.setEmrClusterDefinitionName(copyEmrClusterDefinitionName); } else { if (emrClusterDefinitionNameShouldBeCopiedAndSet == Boolean.FALSE) { if (emrClusterNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEmrClusterName; sourceEmrClusterName = this.getEmrClusterName(); String copyEmrClusterName = ((String) strategy.copy(LocatorUtils.property(locator, "emrClusterName", sourceEmrClusterName), sourceEmrClusterName, (this.emrClusterName!= null))); copy.setEmrClusterName(copyEmrClusterName); } else { if (emrClusterNameShouldBeCopiedAndSet == Boolean.FALSE) { if (stepNameShouldBeCopiedAndSet == Boolean.TRUE) {
@Override public Object buildResponseFromRequest(Object stepRequest) { EmrHadoopJarStepAddRequest emrHadoopJarStepAddRequest = (EmrHadoopJarStepAddRequest) stepRequest; EmrHadoopJarStep step = new EmrHadoopJarStep(); step.setNamespace(emrHadoopJarStepAddRequest.getNamespace()); step.setEmrClusterDefinitionName(emrHadoopJarStepAddRequest.getEmrClusterDefinitionName()); step.setEmrClusterName(emrHadoopJarStepAddRequest.getEmrClusterName()); step.setStepName(emrHadoopJarStepAddRequest.getStepName().trim()); step.setJarLocation(emrHadoopJarStepAddRequest.getJarLocation().trim().replaceAll(getS3ManagedReplaceString(), emrHelper.getS3StagingLocation())); if (emrHadoopJarStepAddRequest.getMainClass() != null) { step.setMainClass(emrHadoopJarStepAddRequest.getMainClass().trim()); } // Add the script arguments if (!CollectionUtils.isEmpty(emrHadoopJarStepAddRequest.getScriptArguments())) { List<String> scriptArguments = new ArrayList<>(); step.setScriptArguments(scriptArguments); for (String argument : emrHadoopJarStepAddRequest.getScriptArguments()) { scriptArguments.add(argument.trim()); } } step.setContinueOnError(emrHadoopJarStepAddRequest.isContinueOnError()); return step; }
@Override public void executeImpl(DelegateExecution execution) throws Exception { // Create the request. EmrHadoopJarStepAddRequest request = new EmrHadoopJarStepAddRequest(); populateCommonParams(request, execution); request.setJarLocation(getJarLocation(execution)); request.setMainClass(getMainClass(execution)); request.setScriptArguments(getScriptArguments(execution)); addEmrStepAndSetWorkflowVariables(request, execution); }
/** * This method tests the happy path scenario by testing all the step types */ @Test public void testEmrAddStepsHadoopNoMainClass() throws Exception { // Create the namespace entity. NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE); emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream())); EmrClusterCreateRequest request = getNewEmrClusterCreateRequest(); emrService.createCluster(request); // TODO: Why are we adding EMR steps to a list, but not doing anything with them once they're added? List<Serializable> emrSteps = new ArrayList<>(); EmrHadoopJarStepAddRequest hadoopJarStepRequest = new EmrHadoopJarStepAddRequest(); hadoopJarStepRequest.setNamespace(request.getNamespace()); hadoopJarStepRequest.setEmrClusterDefinitionName(request.getEmrClusterDefinitionName()); hadoopJarStepRequest.setEmrClusterName(request.getEmrClusterName()); hadoopJarStepRequest.setStepName("Hadoop Jar"); hadoopJarStepRequest.setJarLocation("s3://test-bucket-managed/app-a/test/hadoop-mapreduce-examples-2.4.0.jar"); emrSteps.add(hadoopJarStepRequest); EmrHadoopJarStep emrHadoopJarStep = (EmrHadoopJarStep) emrService.addStepToCluster(hadoopJarStepRequest); assertNotNull(emrHadoopJarStep); assertNotNull(emrHadoopJarStep.getId()); }
@Override public void setRequestNamespace(Object stepRequest, String namespace) { ((EmrHadoopJarStepAddRequest) stepRequest).setNamespace(namespace); }
@Override public void setRequestStepName(Object stepRequest, String stepName) { ((EmrHadoopJarStepAddRequest) stepRequest).setStepName(stepName); }
@Override public String getRequestEmrClusterDefinitionName(Object stepRequest) { return ((EmrHadoopJarStepAddRequest) stepRequest).getEmrClusterDefinitionName(); }
@Override public String getRequestAccountId(Object stepRequest) { return ((EmrHadoopJarStepAddRequest) stepRequest).getAccountId(); }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); if (draftCopy instanceof EmrHadoopJarStepAddRequest) { final EmrHadoopJarStepAddRequest copy = ((EmrHadoopJarStepAddRequest) draftCopy); if (namespaceShouldBeCopiedAndSet == Boolean.TRUE) { String sourceNamespace; sourceNamespace = this.getNamespace(); String copyNamespace = ((String) strategy.copy(LocatorUtils.property(locator, "namespace", sourceNamespace), sourceNamespace, (this.namespace!= null))); copy.setNamespace(copyNamespace); } else { if (namespaceShouldBeCopiedAndSet == Boolean.FALSE) { if (emrClusterDefinitionNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEmrClusterDefinitionName; sourceEmrClusterDefinitionName = this.getEmrClusterDefinitionName(); String copyEmrClusterDefinitionName = ((String) strategy.copy(LocatorUtils.property(locator, "emrClusterDefinitionName", sourceEmrClusterDefinitionName), sourceEmrClusterDefinitionName, (this.emrClusterDefinitionName!= null))); copy.setEmrClusterDefinitionName(copyEmrClusterDefinitionName); } else { if (emrClusterDefinitionNameShouldBeCopiedAndSet == Boolean.FALSE) { if (emrClusterNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEmrClusterName; sourceEmrClusterName = this.getEmrClusterName(); String copyEmrClusterName = ((String) strategy.copy(LocatorUtils.property(locator, "emrClusterName", sourceEmrClusterName), sourceEmrClusterName, (this.emrClusterName!= null))); copy.setEmrClusterName(copyEmrClusterName); } else { if (emrClusterNameShouldBeCopiedAndSet == Boolean.FALSE) { if (stepNameShouldBeCopiedAndSet == Boolean.TRUE) {
@Override public Object buildResponseFromRequest(Object stepRequest) { EmrHadoopJarStepAddRequest emrHadoopJarStepAddRequest = (EmrHadoopJarStepAddRequest) stepRequest; EmrHadoopJarStep step = new EmrHadoopJarStep(); step.setNamespace(emrHadoopJarStepAddRequest.getNamespace()); step.setEmrClusterDefinitionName(emrHadoopJarStepAddRequest.getEmrClusterDefinitionName()); step.setEmrClusterName(emrHadoopJarStepAddRequest.getEmrClusterName()); step.setStepName(emrHadoopJarStepAddRequest.getStepName().trim()); step.setJarLocation(emrHadoopJarStepAddRequest.getJarLocation().trim().replaceAll(getS3ManagedReplaceString(), emrHelper.getS3StagingLocation())); if (emrHadoopJarStepAddRequest.getMainClass() != null) { step.setMainClass(emrHadoopJarStepAddRequest.getMainClass().trim()); } // Add the script arguments if (!CollectionUtils.isEmpty(emrHadoopJarStepAddRequest.getScriptArguments())) { List<String> scriptArguments = new ArrayList<>(); step.setScriptArguments(scriptArguments); for (String argument : emrHadoopJarStepAddRequest.getScriptArguments()) { scriptArguments.add(argument.trim()); } } step.setContinueOnError(emrHadoopJarStepAddRequest.isContinueOnError()); return step; }
@Override public void executeImpl(DelegateExecution execution) throws Exception { // Create the request. EmrHadoopJarStepAddRequest request = new EmrHadoopJarStepAddRequest(); populateCommonParams(request, execution); request.setJarLocation(getJarLocation(execution)); request.setMainClass(getMainClass(execution)); request.setScriptArguments(getScriptArguments(execution)); addEmrStepAndSetWorkflowVariables(request, execution); }
@Override public void setRequestNamespace(Object stepRequest, String namespace) { ((EmrHadoopJarStepAddRequest) stepRequest).setNamespace(namespace); }
@Override public void setRequestStepName(Object stepRequest, String stepName) { ((EmrHadoopJarStepAddRequest) stepRequest).setStepName(stepName); }
@Override public String getRequestEmrClusterDefinitionName(Object stepRequest) { return ((EmrHadoopJarStepAddRequest) stepRequest).getEmrClusterDefinitionName(); }
@Override public String getRequestAccountId(Object stepRequest) { return ((EmrHadoopJarStepAddRequest) stepRequest).getAccountId(); }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); if (draftCopy instanceof EmrHadoopJarStepAddRequest) { final EmrHadoopJarStepAddRequest copy = ((EmrHadoopJarStepAddRequest) draftCopy); if (namespaceShouldBeCopiedAndSet == Boolean.TRUE) { String sourceNamespace; sourceNamespace = this.getNamespace(); String copyNamespace = ((String) strategy.copy(LocatorUtils.property(locator, "namespace", sourceNamespace), sourceNamespace, (this.namespace!= null))); copy.setNamespace(copyNamespace); } else { if (namespaceShouldBeCopiedAndSet == Boolean.FALSE) { if (emrClusterDefinitionNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEmrClusterDefinitionName; sourceEmrClusterDefinitionName = this.getEmrClusterDefinitionName(); String copyEmrClusterDefinitionName = ((String) strategy.copy(LocatorUtils.property(locator, "emrClusterDefinitionName", sourceEmrClusterDefinitionName), sourceEmrClusterDefinitionName, (this.emrClusterDefinitionName!= null))); copy.setEmrClusterDefinitionName(copyEmrClusterDefinitionName); } else { if (emrClusterDefinitionNameShouldBeCopiedAndSet == Boolean.FALSE) { if (emrClusterNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEmrClusterName; sourceEmrClusterName = this.getEmrClusterName(); String copyEmrClusterName = ((String) strategy.copy(LocatorUtils.property(locator, "emrClusterName", sourceEmrClusterName), sourceEmrClusterName, (this.emrClusterName!= null))); copy.setEmrClusterName(copyEmrClusterName); } else { if (emrClusterNameShouldBeCopiedAndSet == Boolean.FALSE) { if (stepNameShouldBeCopiedAndSet == Boolean.TRUE) {
theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); theEmrClusterDefinitionName = this.getEmrClusterDefinitionName(); strategy.appendField(locator, this, "emrClusterDefinitionName", buffer, theEmrClusterDefinitionName, (this.emrClusterDefinitionName!= null)); theEmrClusterName = this.getEmrClusterName(); strategy.appendField(locator, this, "emrClusterName", buffer, theEmrClusterName, (this.emrClusterName!= null)); theStepName = this.getStepName(); strategy.appendField(locator, this, "stepName", buffer, theStepName, (this.stepName!= null)); theJarLocation = this.getJarLocation(); strategy.appendField(locator, this, "jarLocation", buffer, theJarLocation, (this.jarLocation!= null)); theMainClass = this.getMainClass(); strategy.appendField(locator, this, "mainClass", buffer, theMainClass, (this.mainClass!= null)); theScriptArguments = ((this.scriptArguments!= null)?this.getScriptArguments():null); strategy.appendField(locator, this, "scriptArguments", buffer, theScriptArguments, (this.scriptArguments!= null)); theContinueOnError = this.isContinueOnError(); strategy.appendField(locator, this, "continueOnError", buffer, theContinueOnError, (this.continueOnError!= null)); theEmrClusterId = this.getEmrClusterId(); strategy.appendField(locator, this, "emrClusterId", buffer, theEmrClusterId, (this.emrClusterId!= null)); theAccountId = this.getAccountId(); strategy.appendField(locator, this, "accountId", buffer, theAccountId, (this.accountId!= null));