mirror of https://github.com/apache/jclouds.git
Fix location assignment in SoftLayer VirtualGuestToNodeMetadata
This commit is contained in:
parent
acd06b3024
commit
fa8b9e2332
|
@ -73,7 +73,7 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
|
||||||
builder.hostname(from.getHostname() + from.getDomain());
|
builder.hostname(from.getHostname() + from.getDomain());
|
||||||
if (from.getDatacenter() != null) {
|
if (from.getDatacenter() != null) {
|
||||||
builder.location(from(locations.get()).firstMatch(
|
builder.location(from(locations.get()).firstMatch(
|
||||||
LocationPredicates.idEquals(from.getDatacenter().getId() + "")).orNull());
|
LocationPredicates.idEquals(from.getDatacenter().getName())).orNull());
|
||||||
}
|
}
|
||||||
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getHostname()));
|
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getHostname()));
|
||||||
builder.hardware(virtualGuestToHardware.apply(from));
|
builder.hardware(virtualGuestToHardware.apply(from));
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class VirtualGuestToNodeMetadataTest {
|
||||||
VirtualGuestToHardware virtualGuestToHardware = Guice.createInjector().getInstance(VirtualGuestToHardware.class);
|
VirtualGuestToHardware virtualGuestToHardware = Guice.createInjector().getInstance(VirtualGuestToHardware.class);
|
||||||
GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
|
GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);
|
||||||
|
|
||||||
Location location = new LocationBuilder().id("123456789")
|
Location location = new LocationBuilder().id("test")
|
||||||
.description("example")
|
.description("example")
|
||||||
.scope(LocationScope.ZONE)
|
.scope(LocationScope.ZONE)
|
||||||
.build();
|
.build();
|
||||||
|
@ -65,6 +65,8 @@ public class VirtualGuestToNodeMetadataTest {
|
||||||
virtualGuestToImage, virtualGuestToHardware).apply(virtualGuest);
|
virtualGuestToImage, virtualGuestToHardware).apply(virtualGuest);
|
||||||
assertNotNull(nodeMetadata);
|
assertNotNull(nodeMetadata);
|
||||||
assertEquals(nodeMetadata.getName(), virtualGuest.getHostname());
|
assertEquals(nodeMetadata.getName(), virtualGuest.getHostname());
|
||||||
|
assertNotNull(nodeMetadata.getLocation());
|
||||||
|
assertEquals(nodeMetadata.getLocation().getId(), location.getId());
|
||||||
assertEquals(nodeMetadata.getHostname(), virtualGuest.getHostname() + virtualGuest.getDomain());
|
assertEquals(nodeMetadata.getHostname(), virtualGuest.getHostname() + virtualGuest.getDomain());
|
||||||
assertEquals(nodeMetadata.getHardware().getRam(), virtualGuest.getMaxMemory());
|
assertEquals(nodeMetadata.getHardware().getRam(), virtualGuest.getMaxMemory());
|
||||||
assertTrue(nodeMetadata.getHardware().getProcessors().size() == 1);
|
assertTrue(nodeMetadata.getHardware().getProcessors().size() == 1);
|
||||||
|
|
Loading…
Reference in New Issue