mirror of https://github.com/apache/jclouds.git
Issue 450: fixed parsing of tags
This commit is contained in:
parent
3e408568e4
commit
c34b973af3
|
@ -64,7 +64,7 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
|
|||
}
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = UnsupportedOperationException.class)
|
||||
@Test(enabled = true, dependsOnMethods = "testReboot", expectedExceptions = UnsupportedOperationException.class)
|
||||
public void testSuspendResume() throws Exception {
|
||||
super.testSuspendResume();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ServerToNodeMetadataTest {
|
|||
|
||||
assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
|
||||
ImmutableSet.of("67.23.10.132", "67.23.10.131")).privateAddresses(ImmutableSet.of("10.176.42.16")).tag(
|
||||
"NOTAG-sample-server").imageId("2").id("1234").providerId("1234").name("sample-server").credentials(
|
||||
"NOTAG#sample-server").imageId("2").id("1234").providerId("1234").name("sample-server").credentials(
|
||||
creds).location(
|
||||
new LocationImpl(LocationScope.HOST, "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
"e4d909c290d0fb1ca068ffaddf22cbd0", new LocationImpl(LocationScope.ZONE, "dallas",
|
||||
|
@ -98,7 +98,7 @@ public class ServerToNodeMetadataTest {
|
|||
|
||||
assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
|
||||
ImmutableSet.of("67.23.10.132", "67.23.10.131")).privateAddresses(ImmutableSet.of("10.176.42.16")).tag(
|
||||
"NOTAG-sample-server").imageId("2").id("1234").providerId("1234").name("sample-server").location(
|
||||
"NOTAG#sample-server").imageId("2").id("1234").providerId("1234").name("sample-server").location(
|
||||
new LocationImpl(LocationScope.HOST, "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
"e4d909c290d0fb1ca068ffaddf22cbd0", new LocationImpl(LocationScope.ZONE, "dallas",
|
||||
"description", null))).userMetadata(
|
||||
|
@ -122,7 +122,7 @@ public class ServerToNodeMetadataTest {
|
|||
|
||||
assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
|
||||
ImmutableSet.of("67.23.10.132", "67.23.10.131")).privateAddresses(ImmutableSet.of("10.176.42.16")).tag(
|
||||
"NOTAG-sample-server").imageId("2").operatingSystem(
|
||||
"NOTAG#sample-server").imageId("2").operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2").is64Bit(
|
||||
true).build()).id("1234").providerId("1234").name("sample-server").location(
|
||||
new LocationImpl(LocationScope.HOST, "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
|
@ -147,7 +147,7 @@ public class ServerToNodeMetadataTest {
|
|||
|
||||
assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
|
||||
ImmutableSet.of("67.23.10.132", "67.23.10.131")).privateAddresses(ImmutableSet.of("10.176.42.16")).tag(
|
||||
"NOTAG-sample-server").imageId("2").hardware(
|
||||
"NOTAG#sample-server").imageId("2").hardware(
|
||||
new HardwareBuilder().ids("1").name("256 MB Server").processors(
|
||||
ImmutableList.of(new Processor(1.0, 1.0))).ram(256).volumes(
|
||||
ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(10.0f).durable(true)
|
||||
|
|
|
@ -158,7 +158,7 @@ public class RunningInstanceToNodeMetadata implements Function<RunningInstance,
|
|||
|
||||
@VisibleForTesting
|
||||
String getTagForInstance(final RunningInstance instance) {
|
||||
String tag = String.format("NOTAG-%s", instance.getId());// default
|
||||
String tag = String.format("NOTAG#%s", instance.getId());// default
|
||||
try {
|
||||
tag = Iterables.getOnlyElement(Iterables.filter(instance.getGroupIds(), new Predicate<String>() {
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class CredentialsForInstanceTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), null);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware().getId(), "m1.small");
|
||||
|
@ -186,7 +186,7 @@ public class CredentialsForInstanceTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), region);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware().getId(), "m1.small");
|
||||
|
@ -268,7 +268,7 @@ public class CredentialsForInstanceTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), region);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware(), null);
|
||||
|
@ -344,7 +344,7 @@ public class CredentialsForInstanceTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), region);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware().getId(), "m1.small");
|
||||
|
@ -418,7 +418,7 @@ public class CredentialsForInstanceTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(imageMap);
|
||||
|
@ -480,7 +480,7 @@ public class CredentialsForInstanceTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(imageMap);
|
||||
|
@ -546,7 +546,7 @@ public class CredentialsForInstanceTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), lateImage.getId());
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(lateImage);
|
||||
|
@ -609,7 +609,7 @@ public class CredentialsForInstanceTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(imageMap);
|
||||
|
@ -815,7 +815,7 @@ public class CredentialsForInstanceTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getLocation(), location);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
//
|
||||
|
|
|
@ -83,7 +83,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
RunningInstance server = firstInstanceFromResource("/describe_instances_nova.xml");
|
||||
|
||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.TERMINATED).publicAddresses(
|
||||
ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.128.207.5")).tag("NOTAG-i-9slweygo")
|
||||
ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.128.207.5")).tag("NOTAG#i-9slweygo")
|
||||
.credentials(creds).imageId("us-east-1/ami-25CB1213").id("us-east-1/i-9slweygo")
|
||||
.providerId("i-9slweygo").build());
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
RunningInstance server = firstInstanceFromResource("/describe_instances_nova.xml");
|
||||
|
||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.TERMINATED).publicAddresses(
|
||||
ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.128.207.5")).tag("NOTAG-i-9slweygo")
|
||||
ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.128.207.5")).tag("NOTAG#i-9slweygo")
|
||||
.imageId("us-east-1/ami-25CB1213").id("us-east-1/i-9slweygo").providerId("i-9slweygo").build());
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
RunningInstance server = firstInstanceFromResource("/describe_instances_nova.xml");
|
||||
|
||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.TERMINATED).privateAddresses(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG-i-9slweygo").imageId("us-east-1/ami-25CB1213").id(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG#i-9slweygo").imageId("us-east-1/ami-25CB1213").id(
|
||||
"us-east-1/i-9slweygo").providerId("i-9slweygo").location(provider).build());
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
RunningInstance server = firstInstanceFromResource("/describe_instances_nova.xml");
|
||||
|
||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.TERMINATED).privateAddresses(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG-i-9slweygo").imageId("us-east-1/ami-25CB1213")
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG#i-9slweygo").imageId("us-east-1/ami-25CB1213")
|
||||
.operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.UBUNTU).version("9.10").arch("paravirtual")
|
||||
.description("nebula/ubuntu-karmic").is64Bit(true).build()).id("us-east-1/i-9slweygo")
|
||||
|
@ -136,7 +136,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
RunningInstance server = firstInstanceFromResource("/describe_instances_nova.xml");
|
||||
|
||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.TERMINATED).privateAddresses(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG-i-9slweygo").imageId("us-east-1/ami-25CB1213").hardware(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG#i-9slweygo").imageId("us-east-1/ami-25CB1213").hardware(
|
||||
m1_small().build()).operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.UBUNTU).version("9.10").arch("paravirtual").description(
|
||||
"nebula/ubuntu-karmic").is64Bit(true).build()).id("us-east-1/i-9slweygo").providerId(
|
||||
|
@ -165,7 +165,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
RunningInstance server = firstInstanceFromResource("/describe_instances_nova.xml");
|
||||
|
||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.TERMINATED).privateAddresses(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG-i-9slweygo").imageId("us-east-1/ami-25CB1213").id(
|
||||
ImmutableSet.of("10.128.207.5")).tag("NOTAG#i-9slweygo").imageId("us-east-1/ami-25CB1213").id(
|
||||
"us-east-1/i-9slweygo").providerId("i-9slweygo").hardware(m1_small().build()).location(
|
||||
provider).build());
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), null);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware().getId(), "m1.small");
|
||||
|
@ -395,7 +395,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), region);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware().getId(), "m1.small");
|
||||
|
@ -486,7 +486,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), region);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware(), null);
|
||||
|
@ -570,7 +570,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-i-3d640055");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#i-3d640055");
|
||||
// assertEquals(metadata.getLocation(), region);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c");
|
||||
// assertEquals(metadata.getHardware().getId(), "m1.small");
|
||||
|
@ -651,7 +651,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(imageMap);
|
||||
|
@ -719,7 +719,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(imageMap);
|
||||
|
@ -792,7 +792,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), lateImage.getId());
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(lateImage);
|
||||
|
@ -861,7 +861,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
// NodeMetadata metadata = parser.apply(instance);
|
||||
// assertEquals(metadata.getLocation(), locations.get().iterator().next());
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getCredentials(), null);
|
||||
//
|
||||
// verify(imageMap);
|
||||
|
@ -1087,7 +1087,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
//
|
||||
// NodeMetadata metadata = parser.apply(instance);
|
||||
//
|
||||
// assertEquals(metadata.getTag(), "NOTAG-id");
|
||||
// assertEquals(metadata.getTag(), "NOTAG#id");
|
||||
// assertEquals(metadata.getLocation(), location);
|
||||
// assertEquals(metadata.getImageId(), "us-east-1/imageId");
|
||||
//
|
||||
|
|
|
@ -62,7 +62,7 @@ import com.google.common.collect.Iterables;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public class ComputeServiceUtils {
|
||||
public static final Pattern DELIMETED_BY_HYPHEN_ENDING_IN_HYPHEN_HEX = Pattern.compile("([^-]+)-[0-9a-f]+");
|
||||
public static final Pattern DELIMETED_BY_HYPHEN_ENDING_IN_HYPHEN_HEX = Pattern.compile("(.+)-[0-9a-f]+");
|
||||
|
||||
/**
|
||||
* build a shell script that invokes the contents of the http request in bash.
|
||||
|
@ -106,7 +106,7 @@ public class ComputeServiceUtils {
|
|||
|
||||
public static String parseTagFromName(String from) {
|
||||
Matcher matcher = DELIMETED_BY_HYPHEN_ENDING_IN_HYPHEN_HEX.matcher(from);
|
||||
return matcher.find() ? matcher.group(1) : "NOTAG-" + from;
|
||||
return matcher.find() ? matcher.group(1) : "NOTAG#" + from;
|
||||
}
|
||||
|
||||
public static double getCores(Hardware input) {
|
||||
|
|
Loading…
Reference in New Issue