added missing provider id field, default location to hardware/image, fixed packages

This commit is contained in:
Adrian Cole 2012-03-09 19:53:22 -08:00
parent 4cc5e03ae8
commit 4581b924cf
11 changed files with 116 additions and 88 deletions

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.openstack.nova.v1_1.compute.strategy; package org.jclouds.openstack.nova.v1_1.compute;
import java.util.Set; import java.util.Set;
@ -75,6 +75,8 @@ public class NovaComputeServiceAdapter implements ComputeServiceAdapter<Server,
public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String tag, String name, Template template) public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String tag, String name, Template template)
{ {
ServerClient serverClient = template.getLocation() != null ? novaClient.getServerClientForRegion(template.getLocation().getId()) : defaultLocationServerClient; ServerClient serverClient = template.getLocation() != null ? novaClient.getServerClientForRegion(template.getLocation().getId()) : defaultLocationServerClient;
// TODO: make NovaTemplateOptions with the following:
// security group, key pair, floating ip (attach post server-create?)
Server server = serverClient.createServer(name, template.getImage().getId(), template.getHardware().getId()); Server server = serverClient.createServer(name, template.getImage().getId(), template.getHardware().getId());
return new NodeAndInitialCredentials<Server>(server, server.getId() + "", LoginCredentials.builder().password(server.getAdminPass()).build()); return new NodeAndInitialCredentials<Server>(server, server.getId() + "", LoginCredentials.builder().password(server.getAdminPass()).build());
} }

View File

@ -28,11 +28,11 @@ import org.jclouds.domain.Location;
import org.jclouds.functions.IdentityFunction; import org.jclouds.functions.IdentityFunction;
import org.jclouds.openstack.nova.v1_1.NovaAsyncClient; import org.jclouds.openstack.nova.v1_1.NovaAsyncClient;
import org.jclouds.openstack.nova.v1_1.NovaClient; import org.jclouds.openstack.nova.v1_1.NovaClient;
import org.jclouds.openstack.nova.v1_1.compute.NovaComputeServiceAdapter;
import org.jclouds.openstack.nova.v1_1.compute.functions.FlavorToHardware; import org.jclouds.openstack.nova.v1_1.compute.functions.FlavorToHardware;
import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToImage; import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToImage;
import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToOperatingSystem; import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToOperatingSystem;
import org.jclouds.openstack.nova.v1_1.compute.functions.ServerToNodeMetadata; import org.jclouds.openstack.nova.v1_1.compute.functions.ServerToNodeMetadata;
import org.jclouds.openstack.nova.v1_1.compute.strategy.NovaComputeServiceAdapter;
import org.jclouds.openstack.nova.v1_1.domain.Flavor; import org.jclouds.openstack.nova.v1_1.domain.Flavor;
import org.jclouds.openstack.nova.v1_1.domain.Server; import org.jclouds.openstack.nova.v1_1.domain.Server;

View File

@ -18,13 +18,17 @@
*/ */
package org.jclouds.openstack.nova.v1_1.compute.functions; package org.jclouds.openstack.nova.v1_1.compute.functions;
import javax.inject.Inject;
import org.jclouds.compute.domain.Hardware; import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.HardwareBuilder; import org.jclouds.compute.domain.HardwareBuilder;
import org.jclouds.compute.domain.Processor; import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.internal.VolumeImpl; import org.jclouds.compute.domain.internal.VolumeImpl;
import org.jclouds.domain.Location;
import org.jclouds.openstack.nova.v1_1.domain.Flavor; import org.jclouds.openstack.nova.v1_1.domain.Flavor;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Supplier;
/** /**
* A function for transforming the nova specific Flavor object to the generic Hardware object. * A function for transforming the nova specific Flavor object to the generic Hardware object.
@ -33,15 +37,27 @@ import com.google.common.base.Function;
*/ */
public class FlavorToHardware implements Function<Flavor, Hardware> public class FlavorToHardware implements Function<Flavor, Hardware>
{ {
private final Supplier<Location> defaultLocation;
@Inject
public FlavorToHardware(Supplier<Location> defaultLocation)
{
this.defaultLocation = defaultLocation;
}
@Override @Override
public Hardware apply(Flavor flavor) public Hardware apply(Flavor flavor)
{ {
return new HardwareBuilder() return new HardwareBuilder()
// TODO: scope id to region, if there's a chance for conflict
.id(flavor.getId()) .id(flavor.getId())
.providerId(flavor.getId())
.name(flavor.getName()) .name(flavor.getName())
.ram(flavor.getRam()) .ram(flavor.getRam())
.processor(new Processor(flavor.getVcpus(), 1.0)) .processor(new Processor(flavor.getVcpus(), 1.0))
.volume(new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)) .volume(new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true))
.location(defaultLocation.get())
.build(); .build();
} }
} }

View File

@ -23,8 +23,10 @@ import javax.inject.Inject;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.domain.Location;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Supplier;
/** /**
* A function for transforming a nova-specific Image into a generic Image object. * A function for transforming a nova-specific Image into a generic Image object.
@ -34,21 +36,26 @@ import com.google.common.base.Function;
public class NovaImageToImage implements Function<org.jclouds.openstack.nova.v1_1.domain.Image, Image> public class NovaImageToImage implements Function<org.jclouds.openstack.nova.v1_1.domain.Image, Image>
{ {
private final Function<org.jclouds.openstack.nova.v1_1.domain.Image, OperatingSystem> imageToOs; private final Function<org.jclouds.openstack.nova.v1_1.domain.Image, OperatingSystem> imageToOs;
private final Supplier<Location> defaultLocation;
@Inject @Inject
public NovaImageToImage(Function<org.jclouds.openstack.nova.v1_1.domain.Image, OperatingSystem> imageToOs) public NovaImageToImage(Function<org.jclouds.openstack.nova.v1_1.domain.Image, OperatingSystem> imageToOs, Supplier<Location> defaultLocation)
{ {
this.imageToOs = imageToOs; this.imageToOs = imageToOs;
this.defaultLocation = defaultLocation;
} }
@Override @Override
public Image apply(org.jclouds.openstack.nova.v1_1.domain.Image image) public Image apply(org.jclouds.openstack.nova.v1_1.domain.Image image)
{ {
return new ImageBuilder() return new ImageBuilder()
// TODO: scope id to region, if there's a chance for conflict
.id(image.getId()) .id(image.getId())
.providerId(image.getId())
.name(image.getName()) .name(image.getName())
.operatingSystem(imageToOs.apply(image)) .operatingSystem(imageToOs.apply(image))
.description(image.getName()) .description(image.getName())
.location(defaultLocation.get())
.build(); .build();
} }
} }

View File

@ -59,7 +59,9 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata>
public NodeMetadata apply(Server server) public NodeMetadata apply(Server server)
{ {
return new NodeMetadataBuilder() return new NodeMetadataBuilder()
// TODO: scope id to region, if there's a chance for conflict
.id(server.getId()) .id(server.getId())
.providerId(server.getId())
.name(server.getName()) .name(server.getName())
.publicAddresses(Iterables.transform(server.getPublicAddresses(), new AddressToStringTransformationFunction())) .publicAddresses(Iterables.transform(server.getPublicAddresses(), new AddressToStringTransformationFunction()))
.privateAddresses(Iterables.transform(server.getPrivateAddresses(), new AddressToStringTransformationFunction())) .privateAddresses(Iterables.transform(server.getPrivateAddresses(), new AddressToStringTransformationFunction()))

View File

@ -43,9 +43,10 @@ import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
/** /**
* A server is a virtual machine instance in the compute system. Flavor and * A server is a virtual machine instance in the compute system. Flavor and image are requisite
* image are requisite elements when creating a server. * elements when creating a server.
* *
* @author Adrian Cole * @author Adrian Cole
* @see <a href= * @see <a href=
@ -178,8 +179,7 @@ public class Server extends Resource {
* @see Server#getAddresses() * @see Server#getAddresses()
*/ */
public Builder addresses(Multimap<Address.Type, Address> addresses) { public Builder addresses(Multimap<Address.Type, Address> addresses) {
this.addresses = ImmutableMultimap.copyOf(checkNotNull(addresses, this.addresses = ImmutableMultimap.copyOf(checkNotNull(addresses, "addresses"));
"addresses"));
return this; return this;
} }
@ -187,16 +187,15 @@ public class Server extends Resource {
* @see Server#getPrivateAddresses() * @see Server#getPrivateAddresses()
*/ */
public Builder privateAddresses(Address... privateAddresses) { public Builder privateAddresses(Address... privateAddresses) {
return privateAddresses(ImmutableSet.copyOf(checkNotNull( return privateAddresses(ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses")));
privateAddresses, "privateAddresses")));
} }
/** /**
* @see Server#getPrivateAddresses() * @see Server#getPrivateAddresses()
*/ */
public Builder privateAddresses(Set<Address> privateAddresses) { public Builder privateAddresses(Set<Address> privateAddresses) {
this.addresses.replaceValues(Address.Type.PRIVATE, ImmutableSet this.addresses.replaceValues(Address.Type.PRIVATE, ImmutableSet.copyOf(checkNotNull(privateAddresses,
.copyOf(checkNotNull(privateAddresses, "privateAddresses"))); "privateAddresses")));
return this; return this;
} }
@ -204,16 +203,15 @@ public class Server extends Resource {
* @see Server#getPublicAddresses() * @see Server#getPublicAddresses()
*/ */
public Builder publicAddresses(Address... publicAddresses) { public Builder publicAddresses(Address... publicAddresses) {
return publicAddresses(ImmutableSet.copyOf(checkNotNull( return publicAddresses(ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses")));
publicAddresses, "publicAddresses")));
} }
/** /**
* @see Server#getPublicAddresses() * @see Server#getPublicAddresses()
*/ */
public Builder publicAddresses(Set<Address> publicAddresses) { public Builder publicAddresses(Set<Address> publicAddresses) {
this.addresses.replaceValues(Address.Type.PUBLIC, ImmutableSet this.addresses.replaceValues(Address.Type.PUBLIC, ImmutableSet.copyOf(checkNotNull(publicAddresses,
.copyOf(checkNotNull(publicAddresses, "publicAddresses"))); "publicAddresses")));
return this; return this;
} }
@ -227,9 +225,8 @@ public class Server extends Resource {
public Server build() { public Server build() {
// return new Server(id, name, links, addresses); // return new Server(id, name, links, addresses);
return new Server(id, name, links, tenantId, userId, updated, return new Server(id, name, links, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status,
created, hostId, accessIPv4, accessIPv6, status, progress, progress, image, flavor, adminPass, addresses, metadata);
image, flavor, adminPass, addresses, metadata);
} }
public Builder fromServer(Server in) { public Builder fromServer(Server in) {
@ -287,11 +284,10 @@ public class Server extends Resource {
protected final Map<Address.Type, Set<Address>> addresses; protected final Map<Address.Type, Set<Address>> addresses;
protected Map<String, String> metadata; protected Map<String, String> metadata;
protected Server(String id, String name, Set<Link> links, String tenantId, protected Server(String id, String name, Set<Link> links, String tenantId, String userId, Date updated,
String userId, Date updated, Date created, String hostId, Date created, String hostId, String accessIPv4, String accessIPv6, ServerStatus status, int progress,
String accessIPv4, String accessIPv6, ServerStatus status, Resource image, Resource flavor, String adminPass, Multimap<Address.Type, Address> addresses,
int progress, Resource image, Resource flavor, String adminPass, Map<String, String> metadata) {
Multimap<Address.Type, Address> addresses, Map<String, String> metadata) {
super(id, name, links); super(id, name, links);
this.tenantId = tenantId; this.tenantId = tenantId;
this.userId = userId; this.userId = userId;
@ -305,8 +301,7 @@ public class Server extends Resource {
this.image = image; this.image = image;
this.flavor = flavor; this.flavor = flavor;
this.metadata = Maps.newHashMap(metadata); this.metadata = Maps.newHashMap(metadata);
this.addresses = Multimaps2.toOldSchool(ImmutableMultimap this.addresses = Multimaps2.toOldSchool(ImmutableMultimap.copyOf(checkNotNull(addresses, "addresses")));
.copyOf(checkNotNull(addresses, "addresses")));
this.adminPass = adminPass; this.adminPass = adminPass;
} }
@ -386,27 +381,27 @@ public class Server extends Resource {
* @return the ip addresses assigned to the server * @return the ip addresses assigned to the server
*/ */
public Multimap<Type, Address> getAddresses() { public Multimap<Type, Address> getAddresses() {
ImmutableSetMultimap.Builder returnMapBuilder = new ImmutableSetMultimap.Builder<Type, Address>(); ImmutableSetMultimap.Builder<Type, Address> returnMapBuilder = new ImmutableSetMultimap.Builder<Type, Address>();
Set<Address> publicAddresses = addresses.get(Address.Type.PUBLIC); Set<Address> publicAddresses = addresses.get(Address.Type.PUBLIC);
Set<Address> privateAddresses = addresses.get(Address.Type.PRIVATE); Set<Address> privateAddresses = addresses.get(Address.Type.PRIVATE);
if (privateAddresses.size() > 1) {
if (publicAddresses != null) { if (publicAddresses != null) {
returnMapBuilder.putAll(Address.Type.PUBLIC, Iterables.filter(publicAddresses, Predicates.not(IsPrivateAddress.INSTANCE))); returnMapBuilder.putAll(Address.Type.PUBLIC, Iterables.filter(publicAddresses, Predicates
.not(IsPrivateAddress.INSTANCE)));
} }
if (privateAddresses != null) {
returnMapBuilder.putAll(Address.Type.PRIVATE, Iterables.filter(privateAddresses, IsPrivateAddress.INSTANCE)); returnMapBuilder.putAll(Address.Type.PRIVATE, Iterables.filter(privateAddresses, IsPrivateAddress.INSTANCE));
returnMapBuilder.putAll(Address.Type.PUBLIC, Iterables.filter(privateAddresses, Predicates.not(IsPrivateAddress.INSTANCE))); returnMapBuilder.putAll(Address.Type.PUBLIC, Iterables.filter(privateAddresses, Predicates
} else { .not(IsPrivateAddress.INSTANCE)));
return Multimaps2.fromOldSchool(addresses);
} }
ImmutableSetMultimap<Type, Address> returnMap = returnMapBuilder.build();
return returnMapBuilder.build(); return returnMap.size() > 0 ? returnMap : Multimaps2.fromOldSchool(addresses);
} }
private static enum IsPrivateAddress implements Predicate<Address> { private static enum IsPrivateAddress implements Predicate<Address> {
INSTANCE; INSTANCE;
public boolean apply (Address in) { public boolean apply(Address in) {
return InetAddresses2.IsPrivateIPAddress.INSTANCE.apply(in.getAddr()); return InetAddresses2.IsPrivateIPAddress.INSTANCE.apply(in.getAddr());
} }
} }
@ -420,14 +415,10 @@ public class Server extends Resource {
@Override @Override
public String toString() { public String toString() {
return toStringHelper("").add("id", id).add("name", name) return toStringHelper("").add("id", id).add("name", name).add("tenantId", tenantId).add("userId", userId).add(
.add("tenantId", tenantId).add("userId", userId).add("hostId", hostId) "hostId", hostId).add("updated", updated).add("created", created).add("accessIPv4", accessIPv4).add(
.add("updated", updated).add("created", created) "accessIPv6", accessIPv6).add("status", status).add("progress", progress).add("image", image).add(
.add("accessIPv4", accessIPv4).add("accessIPv6", accessIPv6) "flavor", flavor).add("metadata", metadata).add("links", links).add("addresses", addresses).add(
.add("status", status).add("progress", progress) "adminPass", adminPass).toString();
.add("image", image).add("flavor", flavor)
.add("metadata", metadata)
.add("links", links).add("addresses", addresses)
.add("adminPass",adminPass).toString();
} }
} }

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.openstack.nova.v1_1.features; package org.jclouds.openstack.nova.v1_1.compute;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.openstack.nova.v1_1.functions; package org.jclouds.openstack.nova.v1_1.compute.functions;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
@ -25,10 +25,13 @@ import static org.testng.Assert.assertNotNull;
import java.util.UUID; import java.util.UUID;
import org.jclouds.compute.domain.Hardware; import org.jclouds.compute.domain.Hardware;
import org.jclouds.domain.Location;
import org.jclouds.openstack.nova.v1_1.compute.functions.FlavorToHardware; import org.jclouds.openstack.nova.v1_1.compute.functions.FlavorToHardware;
import org.jclouds.openstack.nova.v1_1.domain.Flavor; import org.jclouds.openstack.nova.v1_1.domain.Flavor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Suppliers;
/** /**
* Tests the function used to transform Flavor objects into Hardware objects * Tests the function used to transform Flavor objects into Hardware objects
* *
@ -48,10 +51,11 @@ public class FlavorToHardwareTest
.vcpus(16) .vcpus(16)
.build(); .build();
Hardware converted = new FlavorToHardware().apply(flavorToConvert); Hardware converted = new FlavorToHardware(Suppliers.<Location>ofInstance(null)).apply(flavorToConvert);
assertEquals(converted.getName(), flavorToConvert.getName()); assertEquals(converted.getName(), flavorToConvert.getName());
assertEquals(converted.getId(), flavorToConvert.getId()); assertEquals(converted.getId(), flavorToConvert.getId());
assertEquals(converted.getProviderId(), flavorToConvert.getId());
assertEquals(converted.getRam(), flavorToConvert.getRam()); assertEquals(converted.getRam(), flavorToConvert.getRam());
assertNotNull(converted.getProcessors()); assertNotNull(converted.getProcessors());
@ -61,5 +65,6 @@ public class FlavorToHardwareTest
assertNotNull(converted.getVolumes()); assertNotNull(converted.getVolumes());
assertFalse(converted.getVolumes().isEmpty()); assertFalse(converted.getVolumes().isEmpty());
assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk())); assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk()));
} }
} }

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.openstack.nova.v1_1.functions; package org.jclouds.openstack.nova.v1_1.compute.functions;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -26,11 +26,13 @@ import javax.annotation.Nullable;
import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.domain.Location;
import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToImage; import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToImage;
import org.jclouds.openstack.nova.v1_1.domain.Image; import org.jclouds.openstack.nova.v1_1.domain.Image;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Suppliers;
/** /**
* Tests the function that transforms nova-specific images to generic images. * Tests the function that transforms nova-specific images to generic images.
@ -45,10 +47,12 @@ public class NovaImageToImageTest
UUID id = UUID.randomUUID(); UUID id = UUID.randomUUID();
Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).build(); Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).build();
OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86", "My Test OS", true); OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86", "My Test OS", true);
NovaImageToImage converter = new NovaImageToImage(new MockImageToOsConverter(operatingSystem)); NovaImageToImage converter = new NovaImageToImage(new MockImageToOsConverter(operatingSystem),Suppliers.<Location>ofInstance(null));
org.jclouds.compute.domain.Image convertedImage = converter.apply(novaImageToConvert); org.jclouds.compute.domain.Image convertedImage = converter.apply(novaImageToConvert);
assertEquals(convertedImage.getId(), novaImageToConvert.getId()); assertEquals(convertedImage.getId(), novaImageToConvert.getId());
assertEquals(convertedImage.getProviderId(), novaImageToConvert.getId());
assertEquals(convertedImage.getName(), novaImageToConvert.getName()); assertEquals(convertedImage.getName(), novaImageToConvert.getName());
assertEquals(convertedImage.getOperatingSystem(), operatingSystem); assertEquals(convertedImage.getOperatingSystem(), operatingSystem);
} }

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.openstack.nova.v1_1.functions; package org.jclouds.openstack.nova.v1_1.compute.functions;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.openstack.nova.v1_1.functions; package org.jclouds.openstack.nova.v1_1.compute.functions;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -45,7 +45,7 @@ public class ServerToNodeMetadataTest
.id(id.toString()) .id(id.toString())
.name("Test Server " + id) .name("Test Server " + id)
.privateAddresses(Address.createV4("10.0.0.1")) .privateAddresses(Address.createV4("10.0.0.1"))
.publicAddresses(Address.createV4("10.0.1.1")) .publicAddresses(Address.createV4("1.0.1.1"))
.status(ServerStatus.ACTIVE) .status(ServerStatus.ACTIVE)
.build(); .build();
@ -54,6 +54,7 @@ public class ServerToNodeMetadataTest
NodeMetadata convertedNodeMetadata = converter.apply(serverToConvert); NodeMetadata convertedNodeMetadata = converter.apply(serverToConvert);
assertEquals(serverToConvert.getId(), convertedNodeMetadata.getId()); assertEquals(serverToConvert.getId(), convertedNodeMetadata.getId());
assertEquals(serverToConvert.getId(), convertedNodeMetadata.getProviderId());
assertEquals(serverToConvert.getName(), convertedNodeMetadata.getName()); assertEquals(serverToConvert.getName(), convertedNodeMetadata.getName());
assertEquals(serverToConvert.getStatus().getNodeState(), convertedNodeMetadata.getState()); assertEquals(serverToConvert.getStatus().getNodeState(), convertedNodeMetadata.getState());
@ -63,6 +64,6 @@ public class ServerToNodeMetadataTest
assertNotNull(convertedNodeMetadata.getPublicAddresses()); assertNotNull(convertedNodeMetadata.getPublicAddresses());
assertEquals(convertedNodeMetadata.getPublicAddresses().size(), 1); assertEquals(convertedNodeMetadata.getPublicAddresses().size(), 1);
assertEquals(convertedNodeMetadata.getPublicAddresses().iterator().next(), "10.0.1.1"); assertEquals(convertedNodeMetadata.getPublicAddresses().iterator().next(), "1.0.1.1");
} }
} }