private void addCustomBootstrapActionConfig(EmrClusterDefinition emrClusterDefinition, ArrayList<BootstrapActionConfig> bootstrapActions) { // Add Custom bootstrap script support if needed if (!CollectionUtils.isEmpty(emrClusterDefinition.getCustomBootstrapActionAll())) { for (ScriptDefinition scriptDefinition : emrClusterDefinition.getCustomBootstrapActionAll()) { BootstrapActionConfig customActionConfigAll = getBootstrapActionConfig(scriptDefinition.getScriptName(), scriptDefinition.getScriptLocation()); ArrayList<String> argList = new ArrayList<>(); if (!CollectionUtils.isEmpty(scriptDefinition.getScriptArguments())) { for (String argument : scriptDefinition.getScriptArguments()) { // Trim the argument argList.add(argument.trim()); } } // Set arguments to bootstrap action customActionConfigAll.getScriptBootstrapAction().setArgs(argList); bootstrapActions.add(customActionConfigAll); } } }
private void addCustomBootstrapActionConfig(EmrClusterDefinition emrClusterDefinition, ArrayList<BootstrapActionConfig> bootstrapActions) { // Add Custom bootstrap script support if needed if (!CollectionUtils.isEmpty(emrClusterDefinition.getCustomBootstrapActionAll())) { for (ScriptDefinition scriptDefinition : emrClusterDefinition.getCustomBootstrapActionAll()) { BootstrapActionConfig customActionConfigAll = getBootstrapActionConfig(scriptDefinition.getScriptName(), scriptDefinition.getScriptLocation()); ArrayList<String> argList = new ArrayList<>(); if (!CollectionUtils.isEmpty(scriptDefinition.getScriptArguments())) { for (String argument : scriptDefinition.getScriptArguments()) { // Trim the argument argList.add(argument.trim()); } } // Set arguments to bootstrap action customActionConfigAll.getScriptBootstrapAction().setArgs(argList); bootstrapActions.add(customActionConfigAll); } } }
/** * This method tests the blank values for various parameters */ @Test public void testCreateEmrClusterBlankParams() throws Exception { // Create the namespace entity. NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE); String configXml = IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()); EmrClusterDefinition emrClusterDefinition = xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class, configXml); List<ScriptDefinition> scriptDefinitions = emrClusterDefinition.getCustomBootstrapActionAll(); scriptDefinitions.get(0).setScriptArguments(null); emrClusterDefinition.setCustomBootstrapActionAll(scriptDefinitions); scriptDefinitions = emrClusterDefinition.getCustomBootstrapActionMaster(); scriptDefinitions.get(0).setScriptArguments(null); emrClusterDefinition.setCustomBootstrapActionMaster(scriptDefinitions); emrClusterDefinition.setVisibleToAll(null); emrClusterDefinition.setServiceIamRole(null); emrClusterDefinition.setAmiVersion(null); emrClusterDefinition.setServiceIamRole(emrClusterDefinition.getEc2NodeIamProfileName()); emrClusterDefinition.setScaleDownBehavior(null); emrClusterDefinition.setKerberosAttributes(null); configXml = xmlHelper.objectToXml(emrClusterDefinition); emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, configXml); // Create a new EMR cluster create request EmrClusterCreateRequest request = getNewEmrClusterCreateRequest(); emrService.createCluster(request); }
EmrClusterDefinition emrClusterDefinition = xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class, configXml); ScriptDefinition allScript = emrClusterDefinition.getCustomBootstrapActionAll().get(0); ScriptDefinition secondAllScript = new ScriptDefinition(); secondAllScript.setScriptName(allScript.getScriptName() + "_second"); secondAllScript.setScriptLocation(allScript.getScriptLocation()); secondAllScript.setScriptArguments(allScript.getScriptArguments()); emrClusterDefinition.getCustomBootstrapActionAll().add(secondAllScript);
expectedEmrClusterDefinition.setConfigurations(emrClusterDefinitionOverride.getConfigurations()); emrClusterDefinitionOverride.setCustomBootstrapActionAll(Collections.<ScriptDefinition>emptyList()); expectedEmrClusterDefinition.setCustomBootstrapActionAll(emrClusterDefinitionOverride.getCustomBootstrapActionAll()); emrClusterDefinitionOverride.setCustomBootstrapActionMaster(Collections.<ScriptDefinition>emptyList()); expectedEmrClusterDefinition.setCustomBootstrapActionMaster(emrClusterDefinitionOverride.getCustomBootstrapActionMaster());
scriptDefinitionAll.setScriptLocation("scriptDefinitionAllLocation1"); scriptDefinitionAll.setScriptArguments(Arrays.asList("scriptDefinitionAllArg1")); emrClusterDefinition.getCustomBootstrapActionAll().add(scriptDefinitionAll); scriptDefinitionAll.setScriptName("scriptDefinitionAllName2"); scriptDefinitionAll.setScriptLocation("scriptDefinitionAllLocation2"); emrClusterDefinition.getCustomBootstrapActionAll().add(scriptDefinitionAll);
if (emrClusterDefinitionOverride.getCustomBootstrapActionAll() != null) emrClusterDefinition.setCustomBootstrapActionAll(emrClusterDefinitionOverride.getCustomBootstrapActionAll());
if (emrClusterDefinitionOverride.getCustomBootstrapActionAll() != null) emrClusterDefinition.setCustomBootstrapActionAll(emrClusterDefinitionOverride.getCustomBootstrapActionAll());
lhsCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); List<ScriptDefinition> rhsCustomBootstrapActionAll; rhsCustomBootstrapActionAll = ((that.customBootstrapActionAll!= null)?that.getCustomBootstrapActionAll():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "customBootstrapActionAll", lhsCustomBootstrapActionAll), LocatorUtils.property(thatLocator, "customBootstrapActionAll", rhsCustomBootstrapActionAll), lhsCustomBootstrapActionAll, rhsCustomBootstrapActionAll, (this.customBootstrapActionAll!= null), (that.customBootstrapActionAll!= null))) { return false;
lhsCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); List<ScriptDefinition> rhsCustomBootstrapActionAll; rhsCustomBootstrapActionAll = ((that.customBootstrapActionAll!= null)?that.getCustomBootstrapActionAll():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "customBootstrapActionAll", lhsCustomBootstrapActionAll), LocatorUtils.property(thatLocator, "customBootstrapActionAll", rhsCustomBootstrapActionAll), lhsCustomBootstrapActionAll, rhsCustomBootstrapActionAll, (this.customBootstrapActionAll!= null), (that.customBootstrapActionAll!= null))) { return false;
lhsCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); List<ScriptDefinition> rhsCustomBootstrapActionAll; rhsCustomBootstrapActionAll = ((that.customBootstrapActionAll!= null)?that.getCustomBootstrapActionAll():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "customBootstrapActionAll", lhsCustomBootstrapActionAll), LocatorUtils.property(thatLocator, "customBootstrapActionAll", rhsCustomBootstrapActionAll), lhsCustomBootstrapActionAll, rhsCustomBootstrapActionAll, (this.customBootstrapActionAll!= null), (that.customBootstrapActionAll!= null))) { return false;
theCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); strategy.appendField(locator, this, "customBootstrapActionAll", buffer, theCustomBootstrapActionAll, (this.customBootstrapActionAll!= null));
theCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); strategy.appendField(locator, this, "customBootstrapActionAll", buffer, theCustomBootstrapActionAll, (this.customBootstrapActionAll!= null));
theCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); strategy.appendField(locator, this, "customBootstrapActionAll", buffer, theCustomBootstrapActionAll, (this.customBootstrapActionAll!= null));
theCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "customBootstrapActionAll", theCustomBootstrapActionAll), currentHashCode, theCustomBootstrapActionAll, (this.customBootstrapActionAll!= null));
theCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "customBootstrapActionAll", theCustomBootstrapActionAll), currentHashCode, theCustomBootstrapActionAll, (this.customBootstrapActionAll!= null));
theCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "customBootstrapActionAll", theCustomBootstrapActionAll), currentHashCode, theCustomBootstrapActionAll, (this.customBootstrapActionAll!= null));
if (customBootstrapActionAllShouldBeCopiedAndSet == Boolean.TRUE) { List<ScriptDefinition> sourceCustomBootstrapActionAll; sourceCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); @SuppressWarnings("unchecked") List<ScriptDefinition> copyCustomBootstrapActionAll = ((List<ScriptDefinition> ) strategy.copy(LocatorUtils.property(locator, "customBootstrapActionAll", sourceCustomBootstrapActionAll), sourceCustomBootstrapActionAll, (this.customBootstrapActionAll!= null)));
if (customBootstrapActionAllShouldBeCopiedAndSet == Boolean.TRUE) { List<ScriptDefinition> sourceCustomBootstrapActionAll; sourceCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); @SuppressWarnings("unchecked") List<ScriptDefinition> copyCustomBootstrapActionAll = ((List<ScriptDefinition> ) strategy.copy(LocatorUtils.property(locator, "customBootstrapActionAll", sourceCustomBootstrapActionAll), sourceCustomBootstrapActionAll, (this.customBootstrapActionAll!= null)));
if (customBootstrapActionAllShouldBeCopiedAndSet == Boolean.TRUE) { List<ScriptDefinition> sourceCustomBootstrapActionAll; sourceCustomBootstrapActionAll = ((this.customBootstrapActionAll!= null)?this.getCustomBootstrapActionAll():null); @SuppressWarnings("unchecked") List<ScriptDefinition> copyCustomBootstrapActionAll = ((List<ScriptDefinition> ) strategy.copy(LocatorUtils.property(locator, "customBootstrapActionAll", sourceCustomBootstrapActionAll), sourceCustomBootstrapActionAll, (this.customBootstrapActionAll!= null)));