@Test public void testMetadataAndTagsAsValuesOfEmptyStringNoTags() { TemplateOptions options = TemplateOptions.Builder.userMetadata(ImmutableMap.<String, String>of("foo", "bar")); assertEquals(metadataAndTagsAsValuesOfEmptyString(options), ImmutableMap.<String, String>of("foo", "bar")); }
@Test public void testMetadataAndTagsAsValuesOfEmptyStringNoTags() { TemplateOptions options = TemplateOptions.Builder.userMetadata(ImmutableMap.<String, String>of("foo", "bar")); assertEquals(metadataAndTagsAsValuesOfEmptyString(options), ImmutableMap.<String, String>of("foo", "bar")); }
@Test public void testMetadataAndTagsAsValuesOfEmptyString() { TemplateOptions options = TemplateOptions.Builder.tags(ImmutableSet.of("tag")).userMetadata(ImmutableMap.<String, String>of("foo", "bar")); assertEquals(metadataAndTagsAsValuesOfEmptyString(options), ImmutableMap.<String, String>of("foo", "bar", "tag", "")); }
@Override public Set<? extends NodeMetadata> createNodesInGroup(String group, int count, final Template template) throws RunNodesException { Set<? extends NodeMetadata> nodes = super.createNodesInGroup(group, count, template); String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); if (client.getTagApiForRegion(region).isPresent()) { Map<String, String> common = metadataAndTagsAsValuesOfEmptyString(template.getOptions()); if (common.size() > 0 || generateInstanceNames) { return addTagsToInstancesInRegion(common, nodes, region, group); } } return nodes; }
@Override public Set<? extends NodeMetadata> createNodesInGroup(String group, int count, final Template template) throws RunNodesException { Set<? extends NodeMetadata> nodes = super.createNodesInGroup(group, count, template); String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); if (client.getTagApiForRegion(region).isPresent()) { Map<String, String> common = metadataAndTagsAsValuesOfEmptyString(template.getOptions()); if (common.size() > 0 || generateInstanceNames) { return addTagsToInstancesInRegion(common, nodes, region, group); } } return nodes; }
@Test public void testMetadataAndTagsAsValuesOfEmptyString() { TemplateOptions options = TemplateOptions.Builder.tags(ImmutableSet.of("tag")).userMetadata(ImmutableMap.<String, String>of("foo", "bar")); assertEquals(metadataAndTagsAsValuesOfEmptyString(options), ImmutableMap.<String, String>of("foo", "bar", "tag", "")); }
@Override public Set<? extends NodeMetadata> createNodesInGroup(String group, int count, final Template template) throws RunNodesException { Set<? extends NodeMetadata> nodes = super.createNodesInGroup(group, count, template); String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); if (client.getTagApiForRegion(region).isPresent()) { Map<String, String> common = metadataAndTagsAsValuesOfEmptyString(template.getOptions()); if (generateInstanceNames || !common.isEmpty() || !template.getOptions().getNodeNames().isEmpty()) { return addTagsAndNamesToInstancesInRegion(common, template.getOptions().getNodeNames(), nodes, region, group); } } return nodes; }
@Override public Set<? extends NodeMetadata> createNodesInGroup(String group, int count, final Template template) throws RunNodesException { Set<? extends NodeMetadata> nodes = super.createNodesInGroup(group, count, template); String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); if (client.getTagApiForRegion(region).isPresent()) { Map<String, String> common = metadataAndTagsAsValuesOfEmptyString(template.getOptions()); if (generateInstanceNames || !common.isEmpty() || !template.getOptions().getNodeNames().isEmpty()) { return addTagsAndNamesToInstancesInRegion(common, template.getOptions().getNodeNames(), nodes, region, group); } } return nodes; }
@Override public Set<? extends NodeMetadata> createNodesInGroup(String group, int count, final Template template) throws RunNodesException { Set<? extends NodeMetadata> nodes = super.createNodesInGroup(group, count, template); String region = AWSUtils.getRegionFromLocationOrNull(template.getLocation()); if (client.getTagApiForRegion(region).isPresent()) { Map<String, String> common = metadataAndTagsAsValuesOfEmptyString(template.getOptions()); if (generateInstanceNames || !common.isEmpty() || !template.getOptions().getNodeNames().isEmpty()) { return addTagsAndNamesToInstancesInRegion(common, template.getOptions().getNodeNames(), nodes, region, group); } } return nodes; }