/** * Create the tag list for the EMR nodes. * * @param emrClusterDefinition the EMR definition name value. * * @return list of all tag definitions for the given configuration. */ private List<Tag> getEmrTags(EmrClusterDefinition emrClusterDefinition) { List<Tag> tags = new ArrayList<>(); // Get the nodeTags from xml for (NodeTag thisTag : emrClusterDefinition.getNodeTags()) { // Create a AWS tag and add if (StringUtils.isNotBlank(thisTag.getTagName()) && StringUtils.isNotBlank(thisTag.getTagValue())) { tags.add(new Tag(thisTag.getTagName(), thisTag.getTagValue())); } } // Return the object return tags; }
/** * Create the tag list for the EMR nodes. * * @param emrClusterDefinition the EMR definition name value. * * @return list of all tag definitions for the given configuration. */ private List<Tag> getEmrTags(EmrClusterDefinition emrClusterDefinition) { List<Tag> tags = new ArrayList<>(); // Get the nodeTags from xml for (NodeTag thisTag : emrClusterDefinition.getNodeTags()) { // Create a AWS tag and add if (StringUtils.isNotBlank(thisTag.getTagName()) && StringUtils.isNotBlank(thisTag.getTagValue())) { tags.add(new Tag(thisTag.getTagName(), thisTag.getTagValue())); } } // Return the object return tags; }
Assert.notEmpty(emrClusterDefinition.getNodeTags(), "Node tags must be specified."); HashSet<String> nodeTagNameValidationSet = new HashSet<>(); for (NodeTag nodeTag : emrClusterDefinition.getNodeTags())
Assert.notEmpty(emrClusterDefinition.getNodeTags(), "Node tags must be specified."); HashSet<String> nodeTagNameValidationSet = new HashSet<>(); for (NodeTag nodeTag : emrClusterDefinition.getNodeTags())
@Test public void testCreateEmrClusterDefinitionDuplicateNodeTags() throws Exception { // Try to perform a create with duplicate node tag names. try { EmrClusterDefinition emrClusterDefinitionConfiguration = getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH); for (int i = 0; i < 2; i++) { NodeTag nodeTag = new NodeTag(); nodeTag.setTagName(ATTRIBUTE_NAME_1_MIXED_CASE); nodeTag.setTagValue(ATTRIBUTE_VALUE_1); emrClusterDefinitionConfiguration.getNodeTags().add(nodeTag); } emrClusterDefinitionService .createEmrClusterDefinition(createEmrClusterDefinitionCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, emrClusterDefinitionConfiguration)); fail("Should throw an IllegalArgumentException when duplicate node tag names are specified."); } catch (IllegalArgumentException e) { assertEquals(String.format("Duplicate node tag \"%s\" is found.", ATTRIBUTE_NAME_1_MIXED_CASE), e.getMessage()); } }
@Test public void testUpdateEmrClusterDefinitionDuplicateNodeTags() throws Exception { // Try to perform an update by passing duplicate node tag names. try { EmrClusterDefinition emrClusterDefinitionConfiguration = getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH); for (int i = 0; i < 2; i++) { NodeTag nodeTag = new NodeTag(); nodeTag.setTagName(ATTRIBUTE_NAME_1_MIXED_CASE); nodeTag.setTagValue(ATTRIBUTE_VALUE_1); emrClusterDefinitionConfiguration.getNodeTags().add(nodeTag); } emrClusterDefinitionService.updateEmrClusterDefinition(new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME), createEmrClusterDefinitionUpdateRequest(emrClusterDefinitionConfiguration)); fail("Should throw an IllegalArgumentException when duplicate node tag names are specified."); } catch (IllegalArgumentException e) { assertEquals(String.format("Duplicate node tag \"%s\" is found.", ATTRIBUTE_NAME_1_MIXED_CASE), e.getMessage()); } }
emrClusterDefinitionOverride.setAdditionalSlaveSecurityGroups(Collections.emptyList()); expectedEmrClusterDefinition.setAdditionalSlaveSecurityGroups(emrClusterDefinitionOverride.getAdditionalSlaveSecurityGroups()); List<NodeTag> nodeTags = expectedEmrClusterDefinition.getNodeTags(); nodeTags.add(new NodeTag("testTag", "test")); emrClusterDefinitionOverride.setNodeTags(nodeTags);
nodeTag.setTagName(BLANK_TEXT); nodeTag.setTagValue(ATTRIBUTE_VALUE_1); emrClusterDefinitionConfiguration.getNodeTags().add(nodeTag); emrClusterDefinitionService .createEmrClusterDefinition(createEmrClusterDefinitionCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, emrClusterDefinitionConfiguration)); nodeTag.setTagName(ATTRIBUTE_NAME_1_MIXED_CASE); nodeTag.setTagValue(BLANK_TEXT); emrClusterDefinitionConfiguration.getNodeTags().add(nodeTag); emrClusterDefinitionService .createEmrClusterDefinition(createEmrClusterDefinitionCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, emrClusterDefinitionConfiguration));
nodeTag.setTagName(BLANK_TEXT); nodeTag.setTagValue(ATTRIBUTE_VALUE_1); emrClusterDefinitionConfiguration.getNodeTags().add(nodeTag); emrClusterDefinitionService.updateEmrClusterDefinition(new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME), createEmrClusterDefinitionUpdateRequest(emrClusterDefinitionConfiguration)); nodeTag.setTagName(ATTRIBUTE_NAME_1_MIXED_CASE); nodeTag.setTagValue(BLANK_TEXT); emrClusterDefinitionConfiguration.getNodeTags().add(nodeTag); emrClusterDefinitionService.updateEmrClusterDefinition(new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME), createEmrClusterDefinitionUpdateRequest(emrClusterDefinitionConfiguration));
if (emrClusterDefinitionOverride.getNodeTags() != null) emrClusterDefinition.setNodeTags(emrClusterDefinitionOverride.getNodeTags());
if (emrClusterDefinitionOverride.getNodeTags() != null) emrClusterDefinition.setNodeTags(emrClusterDefinitionOverride.getNodeTags());
lhsNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); List<NodeTag> rhsNodeTags; rhsNodeTags = ((that.nodeTags!= null)?that.getNodeTags():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "nodeTags", lhsNodeTags), LocatorUtils.property(thatLocator, "nodeTags", rhsNodeTags), lhsNodeTags, rhsNodeTags, (this.nodeTags!= null), (that.nodeTags!= null))) { return false;
lhsNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); List<NodeTag> rhsNodeTags; rhsNodeTags = ((that.nodeTags!= null)?that.getNodeTags():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "nodeTags", lhsNodeTags), LocatorUtils.property(thatLocator, "nodeTags", rhsNodeTags), lhsNodeTags, rhsNodeTags, (this.nodeTags!= null), (that.nodeTags!= null))) { return false;
lhsNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); List<NodeTag> rhsNodeTags; rhsNodeTags = ((that.nodeTags!= null)?that.getNodeTags():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "nodeTags", lhsNodeTags), LocatorUtils.property(thatLocator, "nodeTags", rhsNodeTags), lhsNodeTags, rhsNodeTags, (this.nodeTags!= null), (that.nodeTags!= null))) { return false;
theNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); strategy.appendField(locator, this, "nodeTags", buffer, theNodeTags, (this.nodeTags!= null));
theNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); strategy.appendField(locator, this, "nodeTags", buffer, theNodeTags, (this.nodeTags!= null));
theNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); strategy.appendField(locator, this, "nodeTags", buffer, theNodeTags, (this.nodeTags!= null));
theNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "nodeTags", theNodeTags), currentHashCode, theNodeTags, (this.nodeTags!= null));
theNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "nodeTags", theNodeTags), currentHashCode, theNodeTags, (this.nodeTags!= null));
theNodeTags = ((this.nodeTags!= null)?this.getNodeTags():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "nodeTags", theNodeTags), currentHashCode, theNodeTags, (this.nodeTags!= null));