nacx commented on this pull request.
Just a couple minor comments. Thanks @btrishkin!
> +import org.jclouds.dimensiondata.cloudcontrol.domain.Server;
+import org.jclouds.dimensiondata.cloudcontrol.domain.internal.ServerWithExternalIp;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public class ServerToServerWithExternalIp implements Function<Server, ServerWithExternalIp>
{
+
+ private final DimensionDataCloudControlApi api;
+
+ @Inject
+ ServerToServerWithExternalIp(DimensionDataCloudControlApi api) {
+ this.api = checkNotNull(api, "api");
Remove the redundant null check. Injection already enforces it.
> + server = null;
+ ServerWithExternalIp result = new ServerToServerWithExternalIp(dimensionDataCloudControlApi).apply(server);
+ assertNull(result);
+ }
+
+ @Test(dependsOnMethods = "testServerToServerWithExternalIpApplyNotNull")
+ public void testServerToServerWithExternalIpApplyNetworkInfoNull() {
+ server = Server.builder().id("serverId").name("serverName").datacenterId("NA1").networkInfo(null).cpu(cpu)
+ .deployed(true).state(State.NORMAL).sourceImageId("imageId").started(false).createTime(new
Date())
+ .memoryGb(1024).guest(Guest.builder().osCustomization(false).operatingSystem(os).build()).build();
+
+ ServerWithExternalIp result = new ServerToServerWithExternalIp(dimensionDataCloudControlApi).apply(server);
+ assertNotNull(result);
+ assertEquals(result.server(), server);
+ assertNull(result.externalIp());
+ }
Add a test case to verify what happens when there is network info but no matching nat rule
is found.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/448#pullrequestreview-161974700
|