jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds/jclouds-labs] JCLOUDS-1454 Implement ServerToServerWithExternalIp function for dimensiondata (#448)
Date Fri, 05 Oct 2018 10:27:52 GMT
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
Mime
View raw message