Issue 254: distinguish between id and providerId

This commit is contained in:
Adrian Cole 2010-05-20 19:36:25 -07:00
parent b7f1e06cf5
commit efc47969d9
52 changed files with 122 additions and 121 deletions

View File

@ -46,7 +46,7 @@ public class ResourceMetadataListToDirectoryEntryList
public DirectoryEntry apply(StorageMetadata from) { public DirectoryEntry apply(StorageMetadata from) {
FileType type = (from.getType() == StorageType.FOLDER || from.getType() == StorageType.RELATIVE_PATH) ? FileType.DIRECTORY FileType type = (from.getType() == StorageType.FOLDER || from.getType() == StorageType.RELATIVE_PATH) ? FileType.DIRECTORY
: FileType.REGULAR; : FileType.REGULAR;
return new DirectoryEntry(from.getId(), type, from.getName()); return new DirectoryEntry(from.getProviderId(), type, from.getName());
} }
}), from.getNextMarker()); }), from.getNextMarker());

View File

@ -127,7 +127,7 @@ public class EC2ComputeService extends BaseComputeService {
Map<String, String> regionTags = Maps.newHashMap(); Map<String, String> regionTags = Maps.newHashMap();
for (NodeMetadata nodeMetadata : deadOnes) { for (NodeMetadata nodeMetadata : deadOnes) {
if (nodeMetadata.getTag() != null) if (nodeMetadata.getTag() != null)
regionTags.put(parseHandle(nodeMetadata.getHandle())[0], nodeMetadata.getTag()); regionTags.put(parseHandle(nodeMetadata.getId())[0], nodeMetadata.getTag());
} }
for (Entry<String, String> regionTag : regionTags.entrySet()) { for (Entry<String, String> regionTag : regionTags.entrySet()) {
deleteKeyPair(regionTag.getKey(), regionTag.getValue()); deleteKeyPair(regionTag.getKey(), regionTag.getValue());
@ -157,7 +157,7 @@ public class EC2ComputeService extends BaseComputeService {
for (NodeMetadata node : Iterables.filter(super for (NodeMetadata node : Iterables.filter(super
.listNodesDetailsMatching(NodePredicates.all()), Predicates.and(filter, Predicates .listNodesDetailsMatching(NodePredicates.all()), Predicates.and(filter, Predicates
.not(NodePredicates.TERMINATED)))) { .not(NodePredicates.TERMINATED)))) {
ids.add(node.getId()); ids.add(node.getProviderId());
location = node.getLocation(); location = node.getLocation();
} }
logger.debug(">> creating load balancer (%s)", loadBalancerName); logger.debug(">> creating load balancer (%s)", loadBalancerName);
@ -171,7 +171,7 @@ public class EC2ComputeService extends BaseComputeService {
public void deleteLoadBalancer(String loadBalancerName, Predicate<NodeMetadata> filter) { public void deleteLoadBalancer(String loadBalancerName, Predicate<NodeMetadata> filter) {
String region = parseHandle(Iterables.get( String region = parseHandle(Iterables.get(
Iterables.filter(super.listNodesDetailsMatching(NodePredicates.all()), Predicates Iterables.filter(super.listNodesDetailsMatching(NodePredicates.all()), Predicates
.and(filter, Predicates.not(NodePredicates.TERMINATED))), 0).getHandle())[0]; .and(filter, Predicates.not(NodePredicates.TERMINATED))), 0).getId())[0];
ec2Client.getElasticLoadBalancerServices().deleteLoadBalancerInRegion(region, ec2Client.getElasticLoadBalancerServices().deleteLoadBalancerInRegion(region,
loadBalancerName); loadBalancerName);
} }

View File

@ -297,7 +297,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
return new Function<ComputeMetadata, String>() { return new Function<ComputeMetadata, String>() {
@Override @Override
public String apply(ComputeMetadata from) { public String apply(ComputeMetadata from) {
return from.getId(); return from.getProviderId();
} }
}; };
} }
@ -389,7 +389,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
.describeImagesInRegion(region, ownedBy(amiOwners))) { .describeImagesInRegion(region, ownedBy(amiOwners))) {
Image image = parser.apply(from); Image image = parser.apply(from);
if (image != null) if (image != null)
images.put(new RegionAndName(region, image.getId()), image); images.put(new RegionAndName(region, image.getProviderId()), image);
else if (from.getImageType() == ImageType.MACHINE) else if (from.getImageType() == ImageType.MACHINE)
holder.logger.trace("<< image(%s) didn't parse", from.getId()); holder.logger.trace("<< image(%s) didn't parse", from.getId());
} }

View File

@ -77,7 +77,7 @@ public class RunningInstanceToNodeMetadata implements Function<RunningInstance,
@Override @Override
public boolean apply(Image input) { public boolean apply(Image input) {
return input.getId().equals(instance.getImageId()) return input.getProviderId().equals(instance.getImageId())
&& (input.getLocation() == null || input.getLocation().equals(location) || input && (input.getLocation() == null || input.getLocation().equals(location) || input
.getLocation().equals(location.getParent())); .getLocation().equals(location.getParent()));
} }

View File

@ -129,9 +129,9 @@ public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrate
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug(">> running %d instance region(%s) zone(%s) ami(%s) params(%s)", count, logger.debug(">> running %d instance region(%s) zone(%s) ami(%s) params(%s)", count,
region, zone, template.getImage().getId(), instanceOptions.buildFormParameters()); region, zone, template.getImage().getProviderId(), instanceOptions.buildFormParameters());
return instanceClient.runInstancesInRegion(region, zone, template.getImage().getId(), 1, return instanceClient.runInstancesInRegion(region, zone, template.getImage().getProviderId(), 1,
count, instanceOptions); count, instanceOptions);
} }

View File

@ -99,7 +99,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
assert first.getCredentials() != null : first; assert first.getCredentials() != null : first;
assert first.getCredentials().account != null : first; assert first.getCredentials().account != null : first;
startedId = Iterables.getOnlyElement(nodes).getId(); startedId = Iterables.getOnlyElement(nodes).getProviderId();
RunningInstance instance = getInstance(instanceClient, startedId); RunningInstance instance = getInstance(instanceClient, startedId);
@ -155,7 +155,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
Credentials creds = nodes.iterator().next().getCredentials(); Credentials creds = nodes.iterator().next().getCredentials();
assert creds == null; assert creds == null;
startedId = Iterables.getOnlyElement(nodes).getId(); startedId = Iterables.getOnlyElement(nodes).getProviderId();
RunningInstance instance = getInstance(instanceClient, startedId); RunningInstance instance = getInstance(instanceClient, startedId);
@ -191,7 +191,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
Set<? extends NodeMetadata> nodes = client.runNodesWithTag(tag, 2, template); Set<? extends NodeMetadata> nodes = client.runNodesWithTag(tag, 2, template);
Set<String> instanceIds = new HashSet<String>(); Set<String> instanceIds = new HashSet<String>();
for (NodeMetadata node : nodes) { for (NodeMetadata node : nodes) {
instanceIds.add(node.getId()); instanceIds.add(node.getProviderId());
} }
// create load balancer // create load balancer

View File

@ -141,7 +141,7 @@ public class EC2ComputeServiceTest {
return new Function<ComputeMetadata, String>() { return new Function<ComputeMetadata, String>() {
@Override @Override
public String apply(ComputeMetadata from) { public String apply(ComputeMetadata from) {
return from.getId(); return from.getProviderId();
} }
}; };
} }

View File

@ -67,14 +67,14 @@ public class EC2TemplateBuilderLiveTest {
ImmutableSet.of(new Log4JLoggingModule())); ImmutableSet.of(new Log4JLoggingModule()));
Template defaultTemplate = newContext.getComputeService().templateBuilder().build(); Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
assert (defaultTemplate.getImage().getId().startsWith("ami-")) : defaultTemplate; assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
assertEquals(defaultTemplate.getImage().getName(), "9.10"); assertEquals(defaultTemplate.getImage().getName(), "9.10");
assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_32); assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_32);
assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1"); assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
assertEquals(defaultTemplate.getSize().getCores(), 1.0d); assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
newContext.getComputeService().templateBuilder().imageId( newContext.getComputeService().templateBuilder().imageId(
Iterables.get(newContext.getComputeService().listImages(), 0).getId()).build(); Iterables.get(newContext.getComputeService().listImages(), 0).getProviderId()).build();
newContext.getComputeService().templateBuilder().osFamily(OsFamily.UBUNTU).smallest() newContext.getComputeService().templateBuilder().osFamily(OsFamily.UBUNTU).smallest()
.architecture(Architecture.X86_32).imageId("ami-7e28ca17").build(); .architecture(Architecture.X86_32).imageId("ami-7e28ca17").build();
newContext.getComputeService().templateBuilder().osFamily(OsFamily.UBUNTU).smallest() newContext.getComputeService().templateBuilder().osFamily(OsFamily.UBUNTU).smallest()
@ -101,7 +101,7 @@ public class EC2TemplateBuilderLiveTest {
Template template = newContext.getComputeService().templateBuilder().imageId( Template template = newContext.getComputeService().templateBuilder().imageId(
"ami-ccb35ea5").build(); "ami-ccb35ea5").build();
System.out.println(template.getImage()); System.out.println(template.getImage());
assert (template.getImage().getId().startsWith("ami-")) : template; assert (template.getImage().getProviderId().startsWith("ami-")) : template;
assertEquals(template.getImage().getName(), "5.4"); assertEquals(template.getImage().getName(), "5.4");
assertEquals(template.getImage().getArchitecture(), Architecture.X86_64); assertEquals(template.getImage().getArchitecture(), Architecture.X86_64);
assertEquals(template.getImage().getOsFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getOsFamily(), OsFamily.CENTOS);

View File

@ -62,7 +62,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(ubuntuHardy.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32); assertEquals(ubuntuHardy.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
assertEquals(ubuntuHardy.getDescription(), assertEquals(ubuntuHardy.getDescription(),
"ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml"); "ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml");
assertEquals(ubuntuHardy.getId(), "ami-7e28ca17"); assertEquals(ubuntuHardy.getProviderId(), "ami-7e28ca17");
assertEquals(ubuntuHardy.getLocation(), defaultLocation); assertEquals(ubuntuHardy.getLocation(), defaultLocation);
assertEquals(ubuntuHardy.getName(), "8.04"); assertEquals(ubuntuHardy.getName(), "8.04");
assertEquals(ubuntuHardy.getOsDescription(), assertEquals(ubuntuHardy.getOsDescription(),
@ -77,7 +77,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(alesticKarmic.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32); assertEquals(alesticKarmic.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
assertEquals(alesticKarmic.getDescription(), assertEquals(alesticKarmic.getDescription(),
"alestic/ubuntu-9.10-karmic-base-20090623.manifest.xml"); "alestic/ubuntu-9.10-karmic-base-20090623.manifest.xml");
assertEquals(alesticKarmic.getId(), "ami-19a34270"); assertEquals(alesticKarmic.getProviderId(), "ami-19a34270");
assertEquals(alesticKarmic.getLocation(), defaultLocation); assertEquals(alesticKarmic.getLocation(), defaultLocation);
assertEquals(alesticKarmic.getName(), "9.10"); assertEquals(alesticKarmic.getName(), "9.10");
assertEquals(alesticKarmic.getOsDescription(), assertEquals(alesticKarmic.getOsDescription(),
@ -92,7 +92,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(ubuntuKarmic.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32); assertEquals(ubuntuKarmic.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
assertEquals(ubuntuKarmic.getDescription(), assertEquals(ubuntuKarmic.getDescription(),
"ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20100121.manifest.xml"); "ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20100121.manifest.xml");
assertEquals(ubuntuKarmic.getId(), "ami-bb709dd2"); assertEquals(ubuntuKarmic.getProviderId(), "ami-bb709dd2");
assertEquals(ubuntuKarmic.getLocation(), defaultLocation); assertEquals(ubuntuKarmic.getLocation(), defaultLocation);
assertEquals(ubuntuKarmic.getName(), "9.10"); assertEquals(ubuntuKarmic.getName(), "9.10");
assertEquals(ubuntuKarmic.getOsDescription(), assertEquals(ubuntuKarmic.getOsDescription(),
@ -110,7 +110,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(alesticHardy.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32); assertEquals(alesticHardy.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
assertEquals(alesticHardy.getDescription(), assertEquals(alesticHardy.getDescription(),
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml"); "alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml");
assertEquals(alesticHardy.getId(), "ami-c0fa1ea9"); assertEquals(alesticHardy.getProviderId(), "ami-c0fa1ea9");
assertEquals(alesticHardy.getLocation(), defaultLocation); assertEquals(alesticHardy.getLocation(), defaultLocation);
assertEquals(alesticHardy.getName(), "8.04"); assertEquals(alesticHardy.getName(), "8.04");
assertEquals(alesticHardy.getOsDescription(), assertEquals(alesticHardy.getOsDescription(),
@ -141,7 +141,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32); assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
assertEquals(image.getDescription(), assertEquals(image.getDescription(),
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml"); "vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml");
assertEquals(image.getId(), "ami-870de2ee"); assertEquals(image.getProviderId(), "ami-870de2ee");
assertEquals(image.getLocation(), defaultLocation); assertEquals(image.getLocation(), defaultLocation);
assertEquals(image.getName(), ""); assertEquals(image.getName(), "");
assertEquals(image.getOsDescription(), assertEquals(image.getOsDescription(),
@ -166,7 +166,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_64); assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_64);
assertEquals(image.getDescription(), "rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml"); assertEquals(image.getDescription(), "rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml");
assertEquals(image.getId(), "ami-ccb35ea5"); assertEquals(image.getProviderId(), "ami-ccb35ea5");
assertEquals(image.getLocation(), defaultLocation); assertEquals(image.getLocation(), defaultLocation);
assertEquals(image.getName(), "5.4"); assertEquals(image.getName(), "5.4");
assertEquals(image.getOsDescription(), assertEquals(image.getOsDescription(),
@ -180,7 +180,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_64); assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_64);
assertEquals(image.getDescription(), "RightImage_Ubuntu_9.10_x64_v4.5.3_EBS_Alpha"); assertEquals(image.getDescription(), "RightImage_Ubuntu_9.10_x64_v4.5.3_EBS_Alpha");
assertEquals(image.getId(), "ami-c19db6b5"); assertEquals(image.getProviderId(), "ami-c19db6b5");
assertEquals(image.getLocation(), defaultLocation); assertEquals(image.getLocation(), defaultLocation);
assertEquals(image.getName(), "9.10"); assertEquals(image.getName(), "9.10");
assertEquals(image.getOsDescription(), assertEquals(image.getOsDescription(),

View File

@ -99,7 +99,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("notImageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("notImageId").atLeastOnce();
expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce(); expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce();
expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andReturn(null); expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andReturn(null);
@ -158,7 +158,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("notImageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("notImageId").atLeastOnce();
expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce(); expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce();
expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andThrow( expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andThrow(
@ -218,7 +218,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("notImageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("notImageId").atLeastOnce();
expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce(); expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce();
org.jclouds.compute.domain.Image lateImage = createMock(org.jclouds.compute.domain.Image.class); org.jclouds.compute.domain.Image lateImage = createMock(org.jclouds.compute.domain.Image.class);
@ -284,7 +284,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("imageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getLocation()).andReturn(location).atLeastOnce(); expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce(); expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce();
@ -342,7 +342,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("imageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getLocation()).andReturn(location).atLeastOnce(); expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce(); expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce();
@ -401,7 +401,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce(); expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("imageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getLocation()).andReturn(location).atLeastOnce(); expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn( expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn(
@ -472,7 +472,7 @@ public class RunningInstanceToNodeMetadataTest {
expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce(); expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce();
expect(instance.getImageId()).andReturn("imageId").atLeastOnce(); expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getId()).andReturn("imageId").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
expect(jcImage.getLocation()).andReturn(location).atLeastOnce(); expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn( expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn(

View File

@ -88,7 +88,7 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest {
RunInstancesOptions runOptions = strategy.execute(region, tag, template); RunInstancesOptions runOptions = strategy.execute(region, tag, template);
assertEquals(runOptions.buildQueryParameters(), ImmutableMultimap.<String, String> of()); assertEquals(runOptions.buildQueryParameters(), ImmutableMultimap.<String, String> of());
assertEquals(runOptions.buildFormParameters().entries(), ImmutableMultimap assertEquals(runOptions.buildFormParameters().entries(), ImmutableMultimap
.<String, String> of("InstanceType", size.getId(), "SecurityGroup.1", .<String, String> of("InstanceType", size.getProviderId(), "SecurityGroup.1",
generatedGroup, "AdditionalInfo", tag, "KeyName", generatedGroup, "AdditionalInfo", tag, "KeyName",
systemGeneratedKeyPairName).entries()); systemGeneratedKeyPairName).entries());
assertEquals(runOptions.buildMatrixParameters(), ImmutableMultimap.<String, String> of()); assertEquals(runOptions.buildMatrixParameters(), ImmutableMultimap.<String, String> of());

View File

@ -107,7 +107,7 @@ public class EC2RunNodesAndAddToSetStrategyTest {
input.tag, input.template)).andReturn(ec2Options); input.tag, input.template)).andReturn(ec2Options);
expect(input.template.getLocation()).andReturn(input.location).atLeastOnce(); expect(input.template.getLocation()).andReturn(input.location).atLeastOnce();
expect(input.template.getImage()).andReturn(input.image).atLeastOnce(); expect(input.template.getImage()).andReturn(input.image).atLeastOnce();
expect(input.image.getId()).andReturn(imageId).atLeastOnce(); expect(input.image.getProviderId()).andReturn(imageId).atLeastOnce();
expect( expect(
strategy.instanceClient.runInstancesInRegion(region, zone, imageId, 1, input.count, strategy.instanceClient.runInstancesInRegion(region, zone, imageId, 1, input.count,
ec2Options)).andReturn(reservation); ec2Options)).andReturn(reservation);

View File

@ -51,7 +51,7 @@ public class ComputeServiceContextToStatusResult implements Function<String, Sta
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Set<? extends ComputeMetadata> nodes = context.getComputeService().listNodes(); Set<? extends ComputeMetadata> nodes = context.getComputeService().listNodes();
if (nodes.size() > 0) if (nodes.size() > 0)
name = Iterables.get(nodes, 0).getId(); name = Iterables.get(nodes, 0).getProviderId();
status = ((System.currentTimeMillis() - start) + "ms"); status = ((System.currentTimeMillis() - start) + "ms");
} catch (Exception e) { } catch (Exception e) {
logger.error(e, "Error listing service %s", contextName); logger.error(e, "Error listing service %s", contextName);

View File

@ -49,7 +49,7 @@ public interface StorageMetadata extends ResourceMetadata<StorageType> {
* @see org.jclouds.blobstore.attr.ContainerCapability#CONTAINER_METADATA * @see org.jclouds.blobstore.attr.ContainerCapability#CONTAINER_METADATA
*/ */
@Override @Override
String getId(); String getProviderId();
/** /**
* Name of this resource. Names are dictated by the user. For files, this may be the filename, * Name of this resource. Names are dictated by the user. For files, this may be the filename,

View File

@ -37,7 +37,7 @@ public class ResourceMetadataToRelativePathResourceMetadata implements
if (name.endsWith(suffix)) if (name.endsWith(suffix))
name = name.substring(0, name.length() - suffix.length()); name = name.substring(0, name.length() - suffix.length());
} }
return new StorageMetadataImpl(StorageType.RELATIVE_PATH, md.getId(), name, md return new StorageMetadataImpl(StorageType.RELATIVE_PATH, md.getProviderId(), name, md
.getLocation(), md.getUri(), md.getETag(), md.getSize(), md.getLastModified(), md .getLocation(), md.getUri(), md.getETag(), md.getSize(), md.getLastModified(), md
.getUserMetadata()); .getUserMetadata());
} }

View File

@ -109,7 +109,7 @@ public class BlobStoreUtilsImpl implements BlobStoreUtils {
blob.getMetadata().setContentType(((BlobMetadata) blobMeta).getContentType()); blob.getMetadata().setContentType(((BlobMetadata) blobMeta).getContentType());
} }
blob.getMetadata().setETag(blobMeta.getETag()); blob.getMetadata().setETag(blobMeta.getETag());
blob.getMetadata().setId(blobMeta.getId()); blob.getMetadata().setId(blobMeta.getProviderId());
blob.getMetadata().setLastModified(blobMeta.getLastModified()); blob.getMetadata().setLastModified(blobMeta.getLastModified());
blob.getMetadata().setLocation(blobMeta.getLocation()); blob.getMetadata().setLocation(blobMeta.getLocation());
blob.getMetadata().setUri(blobMeta.getUri()); blob.getMetadata().setUri(blobMeta.getUri());

View File

@ -47,7 +47,7 @@ public class BlobMetadataToRelativePathResourceMetadataTest {
md.setId("dir/"); md.setId("dir/");
StorageMetadata rd = parser.apply(md); StorageMetadata rd = parser.apply(md);
assertEquals(rd.getName(), "dir"); assertEquals(rd.getName(), "dir");
assertEquals(rd.getId(), "dir/"); assertEquals(rd.getProviderId(), "dir/");
assertEquals(rd.getType(), StorageType.RELATIVE_PATH); assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
} }
@ -58,7 +58,7 @@ public class BlobMetadataToRelativePathResourceMetadataTest {
md.setId("dir_$folder$"); md.setId("dir_$folder$");
StorageMetadata rd = parser.apply(md); StorageMetadata rd = parser.apply(md);
assertEquals(rd.getName(), "dir"); assertEquals(rd.getName(), "dir");
assertEquals(rd.getId(), "dir_$folder$"); assertEquals(rd.getProviderId(), "dir_$folder$");
assertEquals(rd.getType(), StorageType.RELATIVE_PATH); assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
} }
@ -69,7 +69,7 @@ public class BlobMetadataToRelativePathResourceMetadataTest {
md.setId("dir"); md.setId("dir");
StorageMetadata rd = parser.apply(md); StorageMetadata rd = parser.apply(md);
assertEquals(rd.getName(), "dir"); assertEquals(rd.getName(), "dir");
assertEquals(rd.getId(), "dir"); assertEquals(rd.getProviderId(), "dir");
assertEquals(rd.getType(), StorageType.RELATIVE_PATH); assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
} }
} }

View File

@ -207,10 +207,10 @@ See http://code.google.com/p/jclouds for details."
(first (run-nodes tag 1 template compute)))) (first (run-nodes tag 1 template compute))))
(defn #^NodeMetadata node-details (defn #^NodeMetadata node-details
"Retrieve the node metadata, given its handle." "Retrieve the node metadata, given its id."
([handle] (node-details handle *compute*)) ([id] (node-details id *compute*))
([handle #^ComputeService compute] ([id #^ComputeService compute]
(.getNodeMetadata compute handle))) (.getNodeMetadata compute id)))
(defn reboot-nodes-with-tag (defn reboot-nodes-with-tag
"Reboot all the nodes with the given tag." "Reboot all the nodes with the given tag."
@ -219,10 +219,10 @@ See http://code.google.com/p/jclouds for details."
(.rebootNodesMatching compute (NodePredicates/withTag tag)))) (.rebootNodesMatching compute (NodePredicates/withTag tag))))
(defn reboot-node (defn reboot-node
"Reboot a node, given its handle." "Reboot a node, given its id."
([handle] (reboot-node handle *compute*)) ([id] (reboot-node id *compute*))
([handle #^ComputeService compute] ([id #^ComputeService compute]
(.rebootNode compute handle))) (.rebootNode compute id)))
(defn destroy-nodes-with-tag (defn destroy-nodes-with-tag
"Destroy all the nodes with the given tag." "Destroy all the nodes with the given tag."
@ -231,10 +231,10 @@ See http://code.google.com/p/jclouds for details."
(.destroyNodesMatching compute (NodePredicates/withTag tag)))) (.destroyNodesMatching compute (NodePredicates/withTag tag))))
(defn destroy-node (defn destroy-node
"Destroy a node, given its handle." "Destroy a node, given its id."
([handle] (destroy-node handle *compute*)) ([id] (destroy-node id *compute*))
([handle #^ComputeService compute] ([id #^ComputeService compute]
(.destroyNode compute handle))) (.destroyNode compute id)))
(defmacro state-predicate [node state] (defmacro state-predicate [node state]
`(= (.getState ~node) `(= (.getState ~node)
@ -295,10 +295,10 @@ See http://code.google.com/p/jclouds for details."
[#^ComputeMetadata node] [#^ComputeMetadata node]
(-?> node .getLocation .getId)) (-?> node .getLocation .getId))
(defn handle (defn id
"Returns the compute node's handle" "Returns the compute node's id"
[#^ComputeMetadata node] [#^ComputeMetadata node]
(.getHandle node)) (.getId node))
(define-accessors Template image size location options) (define-accessors Template image size location options)
(define-accessors Image version os-family os-description architecture) (define-accessors Image version os-family os-description architecture)

View File

@ -48,7 +48,7 @@ public class RunNodesException extends Exception {
.format( .format(
"error running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)%n%s%n%s", "error running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)%n%s%n%s",
count, count > 1 ? "s" : "", tag, template.getLocation().getId(), count, count > 1 ? "s" : "", tag, template.getLocation().getId(),
template.getImage().getId(), template.getSize().getId(), template template.getImage().getProviderId(), template.getSize().getProviderId(), template
.getOptions(), ComputeUtils .getOptions(), ComputeUtils
.createExecutionErrorMessage(executionExceptions), .createExecutionErrorMessage(executionExceptions),
ComputeUtils.createNodeErrorMessage(failedNodes))); ComputeUtils.createNodeErrorMessage(failedNodes)));

View File

@ -37,11 +37,11 @@ public interface ComputeMetadata extends ResourceMetadata<ComputeType> {
public ComputeType getType(); public ComputeType getType();
/** /**
* unique id of the server. potentially generated by the service. * id of the server within the naming scope it was created. potentially generated by the service.
* *
*/ */
@Override @Override
public String getId(); public String getProviderId();
/** /**
* user defined name of the server. * user defined name of the server.
@ -51,11 +51,12 @@ public interface ComputeMetadata extends ResourceMetadata<ComputeType> {
public String getName(); public String getName();
/** /**
*
* A means to uniquely address this resource within a provider. For example, if the namespace of * A means to uniquely address this resource within a provider. For example, if the namespace of
* a node or image is region based, the handle will likely include both the region and the id * a node or image is region based, the id will likely include both the region and the
* encoded to avoid collisions. * provider-supplied id encoded to avoid collisions.
* *
*/ */
public String getHandle(); public String getId();
} }

View File

@ -49,7 +49,7 @@ public class ComputeMetadataImpl extends ResourceMetadataImpl<ComputeType> imple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public String getHandle() { public String getId() {
return handle; return handle;
} }

View File

@ -115,7 +115,7 @@ public class ImageImpl extends ComputeMetadataImpl implements Image {
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", name=" + getName() + ", locationId=" + getLocation() return "[id=" + getProviderId() + ", name=" + getName() + ", locationId=" + getLocation()
+ ", architecture=" + architecture + ", osDescription=" + osDescription + ", architecture=" + architecture + ", osDescription=" + osDescription
+ ", osFamily=" + osFamily + ", version=" + version + "]"; + ", osFamily=" + osFamily + ", version=" + version + "]";
} }

View File

@ -128,7 +128,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", tag=" + getTag() + ", name=" + getName() + ", location=" return "[id=" + getProviderId() + ", tag=" + getTag() + ", name=" + getName() + ", location="
+ getLocation() + ", uri=" + getUri() + ", image=" + getImage() + ", userMetadata=" + getLocation() + ", uri=" + getUri() + ", image=" + getImage() + ", userMetadata="
+ getUserMetadata() + ", state=" + getState() + ", privateAddresses=" + getUserMetadata() + ", state=" + getState() + ", privateAddresses="
+ privateAddresses + ", publicAddresses=" + publicAddresses + "]"; + privateAddresses + ", publicAddresses=" + publicAddresses + "]";

View File

@ -103,7 +103,7 @@ public class SizeImpl extends ComputeMetadataImpl implements Size {
*/ */
@Override @Override
public String toString() { public String toString() {
return "[id=" + getId() + ", cores=" + cores + ", ram=" + ram + ", disk=" + disk return "[id=" + getProviderId() + ", cores=" + cores + ", ram=" + ram + ", disk=" + disk
+ ", supportedArchitectures=" + supportedArchitectures + "]"; + ", supportedArchitectures=" + supportedArchitectures + "]";
} }

View File

@ -147,7 +147,7 @@ public class BaseComputeService implements ComputeService {
checkNotNull(template.getLocation(), "location"); checkNotNull(template.getLocation(), "location");
logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)", logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)",
count, count > 1 ? "s" : "", tag, template.getLocation().getId(), template count, count > 1 ? "s" : "", tag, template.getLocation().getId(), template
.getImage().getId(), template.getSize().getId(), template.getOptions()); .getImage().getProviderId(), template.getSize().getProviderId(), template.getOptions());
Set<NodeMetadata> nodes = Sets.newHashSet(); Set<NodeMetadata> nodes = Sets.newHashSet();
Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap(); Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap();
Map<?, ListenableFuture<Void>> responses = runNodesAndAddToSetStrategy.execute(tag, count, Map<?, ListenableFuture<Void>> responses = runNodesAndAddToSetStrategy.execute(tag, count,
@ -201,7 +201,7 @@ public class BaseComputeService implements ComputeService {
responses.put(node, makeListenable(executor.submit(new Callable<Void>() { responses.put(node, makeListenable(executor.submit(new Callable<Void>() {
@Override @Override
public Void call() throws Exception { public Void call() throws Exception {
destroyNode(node.getHandle()); destroyNode(node.getId());
destroyedNodes.add(node); destroyedNodes.add(node);
return null; return null;
} }
@ -306,7 +306,7 @@ public class BaseComputeService implements ComputeService {
responses.put(node, makeListenable(executor.submit(new Callable<Void>() { responses.put(node, makeListenable(executor.submit(new Callable<Void>() {
@Override @Override
public Void call() throws Exception { public Void call() throws Exception {
rebootNode(node.getHandle()); rebootNode(node.getId());
return null; return null;
} }
}), executor)); }), executor));

View File

@ -125,7 +125,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
public boolean apply(Image input) { public boolean apply(Image input) {
boolean returnVal = true; boolean returnVal = true;
if (imageId != null) { if (imageId != null) {
returnVal = imageId.equals(input.getId()); returnVal = imageId.equals(input.getProviderId());
// match our input params so that the later predicates pass. // match our input params so that the later predicates pass.
if (returnVal) { if (returnVal) {
fromImage(input); fromImage(input);
@ -228,7 +228,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
public boolean apply(Size input) { public boolean apply(Size input) {
boolean returnVal = true; boolean returnVal = true;
if (sizeId != null) { if (sizeId != null) {
returnVal = sizeId.equals(input.getId()); returnVal = sizeId.equals(input.getProviderId());
// match our input params so that the later predicates pass. // match our input params so that the later predicates pass.
if (returnVal) { if (returnVal) {
fromSize(input); fromSize(input);

View File

@ -56,7 +56,7 @@ public class NodePredicates {
return new Predicate<ComputeMetadata>() { return new Predicate<ComputeMetadata>() {
@Override @Override
public boolean apply(@Nullable ComputeMetadata nodeMetadata) { public boolean apply(@Nullable ComputeMetadata nodeMetadata) {
return search.contains(nodeMetadata.getId()); return search.contains(nodeMetadata.getProviderId());
} }
@Override @Override

View File

@ -93,14 +93,14 @@ public class EncodeTagIntoNameRunNodesAndAddToSetStrategy implements RunNodesAnd
NodeMetadata node = null; NodeMetadata node = null;
logger.debug(">> starting node(%s) tag(%s)", name, tag); logger.debug(">> starting node(%s) tag(%s)", name, tag);
node = addNodeWithTagStrategy.execute(tag, name, template); node = addNodeWithTagStrategy.execute(tag, name, template);
logger.debug("<< running node(%s)", node.getId()); logger.debug("<< running node(%s)", node.getProviderId());
try { try {
utils.runOptionsOnNode(node, template.getOptions()); utils.runOptionsOnNode(node, template.getOptions());
logger.debug("<< options applied node(%s)", node.getId()); logger.debug("<< options applied node(%s)", node.getProviderId());
nodes.add(node); nodes.add(node);
} catch (Exception e) { } catch (Exception e) {
logger.error(e, "<< error applying options (%s) on node (%s)", template logger.error(e, "<< error applying options (%s) on node (%s)", template
.getOptions(), node.getId()); .getOptions(), node.getProviderId());
badNodes.put(node, e); badNodes.put(node, e);
} }
return null; return null;

View File

@ -126,10 +126,10 @@ public class ComputeUtils {
public Void call() throws Exception { public Void call() throws Exception {
try { try {
runOptionsOnNode(node, options); runOptionsOnNode(node, options);
logger.debug("<< options applied node(%s)", node.getId()); logger.debug("<< options applied node(%s)", node.getProviderId());
goodNodes.add(node); goodNodes.add(node);
} catch (Exception e) { } catch (Exception e) {
logger.error(e, "<< problem applying options to node(%s): ", node.getId(), logger.error(e, "<< problem applying options to node(%s): ", node.getProviderId(),
Throwables.getRootCause(e).getMessage()); Throwables.getRootCause(e).getMessage());
badNodes.put(node, e); badNodes.put(node, e);
} }
@ -144,7 +144,7 @@ public class ComputeUtils {
int index = 1; int index = 1;
for (Entry<? extends NodeMetadata, ? extends Throwable> errorMessage : failedNodes.entrySet()) { for (Entry<? extends NodeMetadata, ? extends Throwable> errorMessage : failedNodes.entrySet()) {
fmt.format("%s) %s on node %s:%n%s%n%n", index++, errorMessage.getValue().getClass() fmt.format("%s) %s on node %s:%n%s%n%n", index++, errorMessage.getValue().getClass()
.getSimpleName(), errorMessage.getKey().getId(), Throwables .getSimpleName(), errorMessage.getKey().getProviderId(), Throwables
.getStackTraceAsString(errorMessage.getValue())); .getStackTraceAsString(errorMessage.getValue()));
} }
return fmt.format("%s error[s]", failedNodes.size()).toString(); return fmt.format("%s error[s]", failedNodes.size()).toString();
@ -222,7 +222,7 @@ public class ComputeUtils {
public Map<SshCallable<?>, ?> runCallablesOnNode(NodeMetadata node, public Map<SshCallable<?>, ?> runCallablesOnNode(NodeMetadata node,
Iterable<? extends SshCallable<?>> parallel, @Nullable SshCallable<?> last) { Iterable<? extends SshCallable<?>> parallel, @Nullable SshCallable<?> last) {
checkState(this.sshFactory != null, "runScript requested, but no SshModule configured"); checkState(this.sshFactory != null, "runScript requested, but no SshModule configured");
checkNotNull(node.getCredentials().key, "credentials.key for node " + node.getId()); checkNotNull(node.getCredentials().key, "credentials.key for node " + node.getProviderId());
SshClient ssh = createSshClientOncePortIsListeningOnNode(node); SshClient ssh = createSshClientOncePortIsListeningOnNode(node);
try { try {
ssh.connect(); ssh.connect();
@ -465,7 +465,7 @@ public class ComputeUtils {
* returns a new instance of {@link NodeMetadata} that has new credentials * returns a new instance of {@link NodeMetadata} that has new credentials
*/ */
public static NodeMetadata installNewCredentials(NodeMetadata node, Credentials newCredentials) { public static NodeMetadata installNewCredentials(NodeMetadata node, Credentials newCredentials) {
return new NodeMetadataImpl(node.getId(), node.getName(), node.getHandle(), node return new NodeMetadataImpl(node.getProviderId(), node.getName(), node.getId(), node
.getLocation(), node.getUri(), node.getUserMetadata(), node.getTag(), node .getLocation(), node.getUri(), node.getUserMetadata(), node.getTag(), node
.getImage(), node.getState(), node.getPublicAddresses(), node.getPrivateAddresses(), .getImage(), node.getState(), node.getPublicAddresses(), node.getPrivateAddresses(),
node.getExtra(), newCredentials); node.getExtra(), newCredentials);

View File

@ -163,7 +163,7 @@ public abstract class BaseComputeServiceLiveTest {
@Test(enabled = true, dependsOnMethods = "testImagesCache") @Test(enabled = true, dependsOnMethods = "testImagesCache")
public void testTemplateMatch() throws Exception { public void testTemplateMatch() throws Exception {
template = buildTemplate(client.templateBuilder()); template = buildTemplate(client.templateBuilder());
Template toMatch = client.templateBuilder().imageId(template.getImage().getId()).build(); Template toMatch = client.templateBuilder().imageId(template.getImage().getProviderId()).build();
assertEquals(toMatch, template); assertEquals(toMatch, template);
} }
@ -267,7 +267,7 @@ public abstract class BaseComputeServiceLiveTest {
protected void checkNodes(Iterable<? extends NodeMetadata> nodes, String tag) throws IOException { protected void checkNodes(Iterable<? extends NodeMetadata> nodes, String tag) throws IOException {
for (NodeMetadata node : nodes) { for (NodeMetadata node : nodes) {
assertNotNull(node.getId()); assertNotNull(node.getProviderId());
assertNotNull(node.getTag()); assertNotNull(node.getTag());
assertEquals(node.getTag(), tag); assertEquals(node.getTag(), tag);
assertEquals(node.getState(), NodeState.RUNNING); assertEquals(node.getState(), NodeState.RUNNING);
@ -324,8 +324,8 @@ public abstract class BaseComputeServiceLiveTest {
.withTag(tag), Predicates.not(NodePredicates.TERMINATED)))); .withTag(tag), Predicates.not(NodePredicates.TERMINATED))));
for (NodeMetadata node : nodes) { for (NodeMetadata node : nodes) {
metadataSet.remove(node); metadataSet.remove(node);
NodeMetadata metadata = client.getNodeMetadata(node.getHandle()); NodeMetadata metadata = client.getNodeMetadata(node.getId());
assertEquals(metadata.getId(), node.getId()); assertEquals(metadata.getProviderId(), node.getProviderId());
assertEquals(metadata.getTag(), node.getTag()); assertEquals(metadata.getTag(), node.getTag());
assertLocationSameOrChild(metadata.getLocation(), template.getLocation()); assertLocationSameOrChild(metadata.getLocation(), template.getLocation());
assertEquals(metadata.getImage(), template.getImage()); assertEquals(metadata.getImage(), template.getImage());
@ -353,7 +353,7 @@ public abstract class BaseComputeServiceLiveTest {
public void testListNodes() throws Exception { public void testListNodes() throws Exception {
for (ComputeMetadata node : client.listNodes()) { for (ComputeMetadata node : client.listNodes()) {
assert node.getId() != null; assert node.getProviderId() != null;
assert node.getLocation() != null; assert node.getLocation() != null;
assertEquals(node.getType(), ComputeType.NODE); assertEquals(node.getType(), ComputeType.NODE);
} }
@ -361,12 +361,12 @@ public abstract class BaseComputeServiceLiveTest {
public void testGetNodesWithDetails() throws Exception { public void testGetNodesWithDetails() throws Exception {
for (NodeMetadata node : client.listNodesDetailsMatching(NodePredicates.all())) { for (NodeMetadata node : client.listNodesDetailsMatching(NodePredicates.all())) {
assert node.getId() != null : node; assert node.getProviderId() != null : node;
assert node.getLocation() != null : node; assert node.getLocation() != null : node;
assertEquals(node.getType(), ComputeType.NODE); assertEquals(node.getType(), ComputeType.NODE);
assert node instanceof NodeMetadata; assert node instanceof NodeMetadata;
NodeMetadata nodeMetadata = (NodeMetadata) node; NodeMetadata nodeMetadata = (NodeMetadata) node;
assert nodeMetadata.getId() != null : nodeMetadata; assert nodeMetadata.getProviderId() != null : nodeMetadata;
// nullable // nullable
// assert nodeMetadata.getImage() != null : node; // assert nodeMetadata.getImage() != null : node;
// user specified name is not always supported // user specified name is not always supported
@ -382,7 +382,7 @@ public abstract class BaseComputeServiceLiveTest {
public void testListImages() throws Exception { public void testListImages() throws Exception {
for (Image image : client.listImages()) { for (Image image : client.listImages()) {
assert image.getId() != null : image; assert image.getProviderId() != null : image;
// image.getLocationId() can be null, if it is a location-free image // image.getLocationId() can be null, if it is a location-free image
assertEquals(image.getType(), ComputeType.IMAGE); assertEquals(image.getType(), ComputeType.IMAGE);
} }
@ -427,7 +427,7 @@ public abstract class BaseComputeServiceLiveTest {
public void testListSizes() throws Exception { public void testListSizes() throws Exception {
for (Size size : client.listSizes()) { for (Size size : client.listSizes()) {
assert size.getId() != null; assert size.getProviderId() != null;
assert size.getCores() > 0; assert size.getCores() > 0;
assert size.getDisk() > 0; assert size.getDisk() > 0;
assert size.getRam() > 0; assert size.getRam() > 0;

View File

@ -44,7 +44,7 @@ public interface ResourceMetadata<T extends Enum<T>> extends Comparable<Resource
* the resource. ex. /path/to/file.txt * the resource. ex. /path/to/file.txt
* *
*/ */
String getId(); String getProviderId();
/** /**
* Name of this resource. Names are dictated by the user. For files, this may be the filename, * Name of this resource. Names are dictated by the user. For files, this may be the filename,

View File

@ -52,7 +52,7 @@ public class MutableResourceMetadataImpl<T extends Enum<T>> implements MutableRe
public MutableResourceMetadataImpl(ResourceMetadata<T> from) { public MutableResourceMetadataImpl(ResourceMetadata<T> from) {
this.type = from.getType(); this.type = from.getType();
this.id = from.getId(); this.id = from.getProviderId();
this.name = from.getName(); this.name = from.getName();
this.location = from.getLocation(); this.location = from.getLocation();
this.uri = from.getUri(); this.uri = from.getUri();
@ -89,7 +89,7 @@ public class MutableResourceMetadataImpl<T extends Enum<T>> implements MutableRe
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public String getId() { public String getProviderId() {
return id; return id;
} }

View File

@ -83,7 +83,7 @@ public class ResourceMetadataImpl<T extends Enum<T>> implements ResourceMetadata
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public String getId() { public String getProviderId() {
return id; return id;
} }

View File

@ -316,7 +316,7 @@ public class GoGridComputeServiceContextModule extends GoGridContextModule {
return new Function<ComputeMetadata, String>() { return new Function<ComputeMetadata, String>() {
@Override @Override
public String apply(ComputeMetadata from) { public String apply(ComputeMetadata from) {
return from.getId(); return from.getProviderId();
} }
}; };
} }

View File

@ -73,7 +73,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
@Override @Override
public boolean apply(Image input) { public boolean apply(Image input) {
return input.getId().equals(instance.getImage().getId() + "") return input.getProviderId().equals(instance.getImage().getId() + "")
&& (input.getLocation() == null || input.getLocation().equals(location) || input && (input.getLocation() == null || input.getLocation().equals(location) || input
.getLocation().equals(location.getParent())); .getLocation().equals(location.getParent()));
} }

View File

@ -103,7 +103,7 @@ public class GoGridAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
private Server addServer(String name, Template template, Ip availableIp) { private Server addServer(String name, Template template, Ip availableIp) {
Server addedServer; Server addedServer;
addedServer = client.getServerServices().addServer(name, addedServer = client.getServerServices().addServer(name,
checkNotNull(template.getImage().getId()), checkNotNull(template.getImage().getProviderId()),
sizeToRam.apply(template.getSize()), availableIp.getIp()); sizeToRam.apply(template.getSize()), availableIp.getIp());
return addedServer; return addedServer;
} }

View File

@ -59,7 +59,7 @@ public class ServerToNodeMetadataTest {
ServerImage image = createMock(ServerImage.class); ServerImage image = createMock(ServerImage.class);
expect(server.getImage()).andReturn(image).atLeastOnce(); expect(server.getImage()).andReturn(image).atLeastOnce();
expect(image.getId()).andReturn(2000l).atLeastOnce(); expect(image.getId()).andReturn(2000l).atLeastOnce();
expect(jcImage.getId()).andReturn("2000").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("2000").atLeastOnce();
expect(jcImage.getLocation()).andReturn(location).atLeastOnce(); expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
replay(client); replay(client);

View File

@ -50,7 +50,7 @@ public class ContainerToResourceList implements
object2blobMd), new Function<BlobMetadata, StorageMetadata>() { object2blobMd), new Function<BlobMetadata, StorageMetadata>() {
public StorageMetadata apply(BlobMetadata input) { public StorageMetadata apply(BlobMetadata input) {
if (input.getContentType().equals("application/directory")) { if (input.getContentType().equals("application/directory")) {
return new StorageMetadataImpl(StorageType.RELATIVE_PATH, input.getId(), input return new StorageMetadataImpl(StorageType.RELATIVE_PATH, input.getProviderId(), input
.getName(), input.getLocation(), input.getUri(), input.getETag(), input .getName(), input.getLocation(), input.getUri(), input.getETag(), input
.getSize(), input.getLastModified(), input.getUserMetadata()); .getSize(), input.getLastModified(), input.getUserMetadata());
} }

View File

@ -190,8 +190,8 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext
@Override @Override
public NodeMetadata execute(String tag, String name, Template template) { public NodeMetadata execute(String tag, String name, Template template) {
Server server = client.createServer(name, Integer.parseInt(template.getImage().getId()), Server server = client.createServer(name, Integer.parseInt(template.getImage().getProviderId()),
Integer.parseInt(template.getSize().getId())); Integer.parseInt(template.getSize().getProviderId()));
serverActive.apply(server); serverActive.apply(server);
return new NodeMetadataImpl(server.getId() + "", name, server.getId() + "", return new NodeMetadataImpl(server.getId() + "", name, server.getId() + "",
new LocationImpl(LocationScope.HOST, server.getHostId(), server.getHostId(), new LocationImpl(LocationScope.HOST, server.getHostId(), server.getHostId(),
@ -301,7 +301,7 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext
return new Function<ComputeMetadata, String>() { return new Function<ComputeMetadata, String>() {
@Override @Override
public String apply(ComputeMetadata from) { public String apply(ComputeMetadata from) {
return from.getId(); return from.getProviderId();
} }
}; };
} }

View File

@ -69,7 +69,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
@Override @Override
public boolean apply(Image input) { public boolean apply(Image input) {
return input.getId().equals(instance.getImageId() + "") return input.getProviderId().equals(instance.getImageId() + "")
&& (input.getLocation() == null || input.getLocation().equals( && (input.getLocation() == null || input.getLocation().equals(
location.getParent())); location.getParent()));
} }

View File

@ -62,7 +62,7 @@ public class ServerToNodeMetadataTest {
expect(addresses.getPrivateAddresses()).andReturn(privateAddresses); expect(addresses.getPrivateAddresses()).andReturn(privateAddresses);
expect(server.getImageId()).andReturn(2000).atLeastOnce(); expect(server.getImageId()).andReturn(2000).atLeastOnce();
expect(jcImage.getId()).andReturn("2000").atLeastOnce(); expect(jcImage.getProviderId()).andReturn("2000").atLeastOnce();
expect(jcImage.getLocation()).andReturn(provider).atLeastOnce(); expect(jcImage.getLocation()).andReturn(provider).atLeastOnce();
replay(addresses); replay(addresses);

View File

@ -190,7 +190,7 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo
@Override @Override
public NodeMetadata execute(String tag, String name, Template template) { public NodeMetadata execute(String tag, String name, Template template) {
NewServerResponse serverResponse = client.createServer(name, checkNotNull(template NewServerResponse serverResponse = client.createServer(name, checkNotNull(template
.getImage().getId(), "imageId"), checkNotNull(template.getSize().getId(), .getImage().getProviderId(), "imageId"), checkNotNull(template.getSize().getProviderId(),
"sizeId")); "sizeId"));
serverRunning.apply(serverResponse.getServer()); serverRunning.apply(serverResponse.getServer());
Server server = client.getServer(serverResponse.getServer().getId()); Server server = client.getServer(serverResponse.getServer().getId());
@ -287,7 +287,7 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo
@Override @Override
public boolean apply(Image input) { public boolean apply(Image input) {
return input.getId().equals(instance.getImageId()) return input.getProviderId().equals(instance.getImageId())
&& (input.getLocation() == null || input.getLocation().equals(location) || input && (input.getLocation() == null || input.getLocation().equals(location) || input
.getLocation().equals(location.getParent())); .getLocation().equals(location.getParent()));
} }
@ -406,7 +406,7 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo
return new Function<ComputeMetadata, String>() { return new Function<ComputeMetadata, String>() {
@Override @Override
public String apply(ComputeMetadata from) { public String apply(ComputeMetadata from) {
return from.getId(); return from.getProviderId();
} }
}; };
} }

View File

@ -46,7 +46,7 @@ public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTes
assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_64); assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_64);
assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS"); assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS");
assertEquals(defaultTemplate.getSize().getId(), "MIRO1B"); assertEquals(defaultTemplate.getSize().getProviderId(), "MIRO1B");
assertEquals(defaultTemplate.getSize().getCores(), 1.0d); assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
} }

View File

@ -160,7 +160,7 @@ public class ComputeTask extends Task {
log(String log(String
.format( .format(
" image location=%s, id=%s, name=%s, version=%s, arch=%s, osfam=%s, osdesc=%s, desc=%s", " image location=%s, id=%s, name=%s, version=%s, arch=%s, osfam=%s, osdesc=%s, desc=%s",
image.getLocation(), image.getId(), image.getName(), image.getVersion(), image.getLocation(), image.getProviderId(), image.getName(), image.getVersion(),
image.getArchitecture(), image.getOsFamily(), image.getOsDescription(), image.getArchitecture(), image.getOsFamily(), image.getOsDescription(),
image.getDescription())); image.getDescription()));
} }
@ -169,7 +169,7 @@ public class ComputeTask extends Task {
private void listSizes(ComputeService computeService) { private void listSizes(ComputeService computeService) {
log("list sizes"); log("list sizes");
for (Size size : computeService.listSizes()) {// TODO for (Size size : computeService.listSizes()) {// TODO
log(String.format(" size id=%s, cores=%s, ram=%s, disk=%s", size.getId(), size log(String.format(" size id=%s, cores=%s, ram=%s, disk=%s", size.getProviderId(), size
.getCores(), size.getRam(), size.getDisk())); .getCores(), size.getRam(), size.getDisk()));
} }
} }
@ -185,7 +185,7 @@ public class ComputeTask extends Task {
private void list(ComputeService computeService) { private void list(ComputeService computeService) {
log("list"); log("list");
for (ComputeMetadata node : computeService.listNodes()) { for (ComputeMetadata node : computeService.listNodes()) {
log(String.format(" location=%s, id=%s, tag=%s", node.getLocation(), node.getId(), node log(String.format(" location=%s, id=%s, tag=%s", node.getLocation(), node.getProviderId(), node
.getName())); .getName()));
} }
} }
@ -207,7 +207,7 @@ public class ComputeTask extends Task {
private void addNodeDetailsAsProjectProperties(NodeMetadata createdNode) { private void addNodeDetailsAsProjectProperties(NodeMetadata createdNode) {
if (nodeElement.getIdproperty() != null) if (nodeElement.getIdproperty() != null)
getProject().setProperty(nodeElement.getIdproperty(), createdNode.getId()); getProject().setProperty(nodeElement.getIdproperty(), createdNode.getProviderId());
if (nodeElement.getHostproperty() != null) if (nodeElement.getHostproperty() != null)
getProject().setProperty(nodeElement.getHostproperty(), getProject().setProperty(nodeElement.getHostproperty(),
ipOrEmptyString(createdNode.getPublicAddresses())); ipOrEmptyString(createdNode.getPublicAddresses()));
@ -235,11 +235,11 @@ public class ComputeTask extends Task {
private void logDetails(ComputeService computeService, ComputeMetadata node) { private void logDetails(ComputeService computeService, ComputeMetadata node) {
NodeMetadata metadata = node instanceof NodeMetadata ? NodeMetadata.class.cast(node) NodeMetadata metadata = node instanceof NodeMetadata ? NodeMetadata.class.cast(node)
: computeService.getNodeMetadata(node.getHandle()); : computeService.getNodeMetadata(node.getId());
log(String log(String
.format( .format(
" node id=%s, name=%s, tag=%s, location=%s, state=%s, publicIp=%s, privateIp=%s, extra=%s", " node id=%s, name=%s, tag=%s, location=%s, state=%s, publicIp=%s, privateIp=%s, extra=%s",
metadata.getId(), metadata.getName(), metadata.getTag(), metadata metadata.getProviderId(), metadata.getName(), metadata.getTag(), metadata
.getLocation(), metadata.getState(), ComputeTaskUtils .getLocation(), metadata.getState(), ComputeTaskUtils
.ipOrEmptyString(metadata.getPublicAddresses()), .ipOrEmptyString(metadata.getPublicAddresses()),
ipOrEmptyString(metadata.getPrivateAddresses()), metadata.getExtra())); ipOrEmptyString(metadata.getPrivateAddresses()), metadata.getExtra()));

View File

@ -223,7 +223,7 @@ public class BlobStoreFileObject extends AbstractFileObject {
private void deleteBasedOnType() { private void deleteBasedOnType() {
if (metadata.getType() != StorageType.CONTAINER) { if (metadata.getType() != StorageType.CONTAINER) {
deleteBlob(metadata.getId()); deleteBlob(metadata.getProviderId());
} else { } else {
getBlobStore().deleteContainer(getContainer()); getBlobStore().deleteContainer(getContainer());
logger.info(String.format("<< deleted container: %s", getContainer())); logger.info(String.format("<< deleted container: %s", getContainer()));

View File

@ -207,7 +207,7 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
Double.valueOf(template.getSize().getCores()).intValue()).memory( Double.valueOf(template.getSize().getCores()).intValue()).memory(
template.getSize().getRam()).disk(template.getSize().getDisk() * 1024 * 1024l); template.getSize().getRam()).disk(template.getSize().getDisk() * 1024 * 1024l);
Map<String, String> metaMap = computeClient.start(template.getLocation().getId(), name, Map<String, String> metaMap = computeClient.start(template.getLocation().getId(), name,
template.getImage().getId(), options, template.getOptions().getInboundPorts()); template.getImage().getProviderId(), options, template.getOptions().getInboundPorts());
VApp vApp = client.getVApp(metaMap.get("id")); VApp vApp = client.getVApp(metaMap.get("id"));
return newCreateNodeResponse(tag, template, metaMap, vApp); return newCreateNodeResponse(tag, template, metaMap, vApp);
} }
@ -387,7 +387,7 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
return new Function<ComputeMetadata, String>() { return new Function<ComputeMetadata, String>() {
@Override @Override
public String apply(ComputeMetadata from) { public String apply(ComputeMetadata from) {
return from.getId(); return from.getProviderId();
} }
}; };
} }

View File

@ -104,7 +104,7 @@ public class VCloudGetNodeMetadata {
@Override @Override
public boolean apply(Image input) { public boolean apply(Image input) {
return input.getId().equals(templateId) && input.getLocation().equals(location); return input.getProviderId().equals(templateId) && input.getLocation().equals(location);
} }
}); });

View File

@ -61,7 +61,7 @@ public class EncodeTemplateIdIntoNameRunNodesAndAddToSetStrategy extends
@Override @Override
protected String getNextName(final String tag, final Template template) { protected String getNextName(final String tag, final Template template) {
return String.format(nodeNamingConvention, tag, Strings.padStart(Integer.toHexString(Integer return String.format(nodeNamingConvention, tag, Strings.padStart(Integer.toHexString(Integer
.parseInt(template.getImage().getId())), 3, '0'), Strings.padStart(Integer .parseInt(template.getImage().getProviderId())), 3, '0'), Strings.padStart(Integer
.toHexString(random.nextInt(255)), 2, '0')); .toHexString(random.nextInt(255)), 2, '0'));
} }
} }

View File

@ -45,10 +45,10 @@ public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Override @Override
public void testListNodes() throws Exception { public void testListNodes() throws Exception {
for (ComputeMetadata node : client.listNodes()) { for (ComputeMetadata node : client.listNodes()) {
assert node.getId() != null; assert node.getProviderId() != null;
assert node.getLocation() != null; assert node.getLocation() != null;
assertEquals(node.getType(), ComputeType.NODE); assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getHandle()); NodeMetadata allData = client.getNodeMetadata(node.getId());
assert allData.getExtra().get("processor/count") != null; assert allData.getExtra().get("processor/count") != null;
assert allData.getExtra().get("disk_drive/1/kb") != null; assert allData.getExtra().get("disk_drive/1/kb") != null;
assert allData.getExtra().get("memory/mb") != null; assert allData.getExtra().get("memory/mb") != null;

View File

@ -52,7 +52,7 @@ public class EncodeTemplateIdIntoNameRunNodesAndAddToSetStrategyTest {
Template template = createMock(Template.class); Template template = createMock(Template.class);
Image image = createMock(Image.class); Image image = createMock(Image.class);
expect(template.getImage()).andReturn(image); expect(template.getImage()).andReturn(image);
expect(image.getId()).andReturn("233"); expect(image.getProviderId()).andReturn("233");
replay(template); replay(template);
replay(image); replay(image);

View File

@ -172,7 +172,7 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
Image anyImage = Iterables.get(images, 0); Image anyImage = Iterables.get(images, 0);
holder.logger.debug(">> providing sizes"); holder.logger.debug(">> providing sizes");
SortedSet<Size> sizes = Sets.newTreeSet(Iterables.transform(TerremarkVCloudClient.class.cast( SortedSet<Size> sizes = Sets.newTreeSet(Iterables.transform(TerremarkVCloudClient.class.cast(
client).getComputeOptionsOfCatalogItem(anyImage.getId()), sizeConverter)); client).getComputeOptionsOfCatalogItem(anyImage.getProviderId()), sizeConverter));
holder.logger.debug("<< sizes(%d)", sizes.size()); holder.logger.debug("<< sizes(%d)", sizes.size());
return sizes; return sizes;
} }

View File

@ -77,7 +77,7 @@ public class TerremarkVCloudComputeServiceLiveTest extends VCloudComputeServiceL
@Override @Override
public void testListImages() throws Exception { public void testListImages() throws Exception {
for (Image image : client.listImages()) { for (Image image : client.listImages()) {
assert image.getId() != null : image; assert image.getProviderId() != null : image;
// image.getLocationId() can be null, if it is a location-free image // image.getLocationId() can be null, if it is a location-free image
assertEquals(image.getType(), ComputeType.IMAGE); assertEquals(image.getType(), ComputeType.IMAGE);
assert image.getDefaultCredentials().account != null : image; assert image.getDefaultCredentials().account != null : image;