From 0968304fb419714a98419d3af22bd3b70501d887 Mon Sep 17 00:00:00 2001 From: Aliaksandr Krasitski Date: Wed, 21 Oct 2015 23:01:52 +0300 Subject: [PATCH] changed return type from ServerMetadata to Server --- .../main/java/sample/PoliciesSampleApp.java | 2 +- .../server/services/dsl/ServerService.java | 16 +++++++-------- .../dsl/groups/GetBillingStatsTest.java | 8 ++++---- .../dsl/servers/TestServerSupport.java | 2 +- .../dsl/servers/clone/CloneServerTest.java | 11 +++++----- .../CreateWithAntiAffinityPolicyTest.java | 9 ++++----- .../create/CreateWithAutoscalePolicyTest.java | 11 +++++----- .../create/CreateWithCustomFieldsTest.java | 12 +++++------ .../create/CreateWithManagedOsTest.java | 9 ++++----- .../create/CreateWithPublicIpTest.java | 9 ++++----- .../modify/ModifyCustomFieldsTest.java | 11 +++++----- .../dsl/servers/modify/ModifyServerTest.java | 13 +++++++----- .../modify/ModifyWithAutoscalePolicyTest.java | 20 +++++++++---------- ...ExecuteShellCommandOnRemoteServerTest.java | 3 +-- .../tests/fixtures/SingleServerFixture.java | 7 +++---- 15 files changed, 70 insertions(+), 73 deletions(-) diff --git a/sample/scripts/src/main/java/sample/PoliciesSampleApp.java b/sample/scripts/src/main/java/sample/PoliciesSampleApp.java index 62ed18f1..1dc0ef28 100644 --- a/sample/scripts/src/main/java/sample/PoliciesSampleApp.java +++ b/sample/scripts/src/main/java/sample/PoliciesSampleApp.java @@ -121,7 +121,7 @@ public void init() { ZonedDateTime.now().plusHours(2) ) ) - .waitUntilComplete().getResult().asRefById(); + .waitUntilComplete().getResult(); } @AfterClass(groups = {SAMPLES}) diff --git a/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java b/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java index 3a86a6ca..1064127f 100644 --- a/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java +++ b/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/ServerService.java @@ -106,9 +106,9 @@ public ServerService(ServerConverter serverConverter, ServerClient client, Queue * Create server * * @param config server config - * @return OperationFuture wrapper for ServerMetadata + * @return OperationFuture wrapper for Server */ - public OperationFuture create(CreateServerConfig config) { + public OperationFuture create(CreateServerConfig config) { BaseServerResponse response = client.create( serverConverter.buildCreateServerRequest( config, @@ -124,9 +124,9 @@ public OperationFuture create(CreateServerConfig config) { * Clone existing server * * @param config server config - * @return OperationFuture wrapper for ServerMetadata + * @return OperationFuture wrapper for Server */ - public OperationFuture clone(CloneServerConfig config) { + public OperationFuture clone(CloneServerConfig config) { BaseServerResponse response = client.clone( serverConverter.buildCloneServerRequest( config, @@ -145,9 +145,9 @@ public OperationFuture clone(CloneServerConfig config) { * Import server from ovf image * * @param config server config - * @return OperationFuture wrapper for ServerMetadata + * @return OperationFuture wrapper for Server */ - public OperationFuture importServer(ImportServerConfig config) { + public OperationFuture importServer(ImportServerConfig config) { BaseServerResponse response = client.importServer( serverConverter.buildImportServerRequest( config, @@ -160,7 +160,7 @@ public OperationFuture importServer(ImportServerConfig config) { return postProcessBuildServerResponse(response, config); } - private OperationFuture postProcessBuildServerResponse( + private OperationFuture postProcessBuildServerResponse( BaseServerResponse response, T config ) { @@ -168,7 +168,7 @@ private OperationFuture postProce return new OperationFuture<>( - serverInfo, + serverInfo.asRefById(), new SequentialJobsFuture( () -> new CreateServerJobFuture(response.findStatusId(), serverInfo.getId(), queueClient, client), () -> addPublicIpIfNeeded(config, serverInfo) diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/groups/GetBillingStatsTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/groups/GetBillingStatsTest.java index 36aa8857..c72818b1 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/groups/GetBillingStatsTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/groups/GetBillingStatsTest.java @@ -19,7 +19,6 @@ import com.centurylink.cloud.sdk.core.injector.Inject; import com.centurylink.cloud.sdk.server.services.AbstractServersSdkTest; import com.centurylink.cloud.sdk.server.services.client.domain.group.GroupMetadata; -import com.centurylink.cloud.sdk.server.services.client.domain.server.metadata.ServerMetadata; import com.centurylink.cloud.sdk.server.services.dsl.GroupService; import com.centurylink.cloud.sdk.server.services.dsl.ServerService; import com.centurylink.cloud.sdk.server.services.dsl.domain.group.BillingStats; @@ -27,6 +26,7 @@ import com.centurylink.cloud.sdk.server.services.dsl.domain.group.refs.Group; import com.centurylink.cloud.sdk.server.services.dsl.domain.group.refs.GroupByIdRef; import com.centurylink.cloud.sdk.server.services.dsl.domain.server.Machine; +import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server; import com.centurylink.cloud.sdk.server.services.dsl.servers.TestServerSupport; import com.centurylink.cloud.sdk.tests.recorded.WireMockFileSource; import com.centurylink.cloud.sdk.tests.recorded.WireMockMixin; @@ -48,7 +48,7 @@ public class GetBillingStatsTest extends AbstractServersSdkTest implements WireM @Inject GroupService groupService; - ServerMetadata serverMetadata; + Server server; GroupByIdRef group; GroupMetadata groupMetadata; @@ -62,7 +62,7 @@ public void setUp() { @AfterMethod public void tearDown() { serverService - .delete(serverMetadata.asRefById()); + .delete(server); groupService .delete(group); @@ -86,7 +86,7 @@ private void initGroup() { } private void initServer() { - serverMetadata = serverService.create( + server = serverService.create( TestServerSupport .anyServerConfig() .name("st-srv") diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/TestServerSupport.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/TestServerSupport.java index e258a294..069a7905 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/TestServerSupport.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/TestServerSupport.java @@ -86,7 +86,7 @@ public static CloneServerConfig getCloneServerConfig(Server server) { return config; } - public ServerMetadata createAnyServer() { + public Server createAnyServer() { return serverService.create(new CreateServerConfig() .name("ALTRS1") diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/clone/CloneServerTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/clone/CloneServerTest.java index 664e04a4..ab5e80b8 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/clone/CloneServerTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/clone/CloneServerTest.java @@ -35,18 +35,19 @@ public class CloneServerTest extends AbstractServersSdkTest implements WireMockM @Inject ServerService serverService; - ServerMetadata serverMetadata; + Server server; @Test public void testCloneSever() { - Server server = Server.refById("de1altdcln04"); - CloneServerConfig config = TestServerSupport.getCloneServerConfig(server); + CloneServerConfig config = TestServerSupport.getCloneServerConfig(Server.refById("de1altdcln04")); - serverMetadata = serverService.clone(config) + server = serverService.clone(config) .waitUntilComplete() .getResult(); + ServerMetadata serverMetadata = serverService.findByRef(server); + assertNotNull(serverMetadata); assertNotNull(serverMetadata.getId()); assertEquals(serverMetadata.getLocationId().toLowerCase(), DE_FRANKFURT.getId()); @@ -57,7 +58,7 @@ public void testCloneSever() { @AfterMethod public void deleteServer() { - serverService.delete(serverMetadata.asRefById().asFilter()); + serverService.delete(server.asFilter()); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAntiAffinityPolicyTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAntiAffinityPolicyTest.java index df18a8bf..0d150d7f 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAntiAffinityPolicyTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAntiAffinityPolicyTest.java @@ -35,7 +35,6 @@ import static com.centurylink.cloud.sdk.base.services.dsl.domain.datacenters.refs.DataCenter.CA_TORONTO_2; import static com.centurylink.cloud.sdk.tests.TestGroups.RECORDED; -import static com.centurylink.cloud.sdk.core.util.Strings.isNullOrEmpty; /** * @author Aliaksandr Krasitski @@ -46,7 +45,7 @@ public class CreateWithAntiAffinityPolicyTest extends AbstractServersSdkTest imp @Inject ServerService serverService; - ServerMetadata server; + Server server; @Test @WireMockFileSource("anti-affinity") @@ -78,16 +77,16 @@ public void testCreateWithAntiAffinityPolicy() { .waitUntilComplete() .getResult(); - assert !isNullOrEmpty(server.getId()); + assert server != null; - ServerMetadata metadata = serverService.findByRef(Server.refById(server.getId())); + ServerMetadata metadata = serverService.findByRef(server); assertEquals(metadata.getDetails().getAntiAffinityPolicy().getName(), "Policy CA3"); } @AfterMethod public void deleteServer() { - serverService.delete(server.asRefById()); + serverService.delete(server); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAutoscalePolicyTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAutoscalePolicyTest.java index af60956a..ed18f79a 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAutoscalePolicyTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithAutoscalePolicyTest.java @@ -35,7 +35,6 @@ import org.testng.annotations.Test; import static com.centurylink.cloud.sdk.base.services.dsl.domain.datacenters.refs.DataCenter.CA_TORONTO_2; -import static com.centurylink.cloud.sdk.core.util.Strings.isNullOrEmpty; import static com.centurylink.cloud.sdk.tests.TestGroups.RECORDED; /** @@ -50,7 +49,7 @@ public class CreateWithAutoscalePolicyTest extends AbstractServersSdkTest implem @Inject ServerService serverService; - ServerMetadata server; + Server server; @Test @WireMockFileSource("autoscale") @@ -80,13 +79,13 @@ public void testCreateWithAutoscalePolicy() { .waitUntilComplete() .getResult(); - assert !isNullOrEmpty(server.getId()); + assert server != null; - ServerMetadata metadata = serverService.findByRef(Server.refById(server.getId())); + ServerMetadata metadata = serverService.findByRef(server); assert metadata.getDetails().getAutoscalePolicy() != null; AutoscalePolicyMetadata autoscalePolicy = - autoscalePolicyService.getAutoscalePolicyOnServer(server.asRefById()); + autoscalePolicyService.getAutoscalePolicyOnServer(server); assert autoscalePolicy != null; assertEquals(metadata.getDetails().getAutoscalePolicy().getId(), autoscalePolicy.getId()); @@ -96,7 +95,7 @@ public void testCreateWithAutoscalePolicy() { @AfterMethod public void deleteServer() { - serverService.delete(server.asRefById()); + serverService.delete(server); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithCustomFieldsTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithCustomFieldsTest.java index de7934f7..ca332b34 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithCustomFieldsTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithCustomFieldsTest.java @@ -20,6 +20,7 @@ import com.centurylink.cloud.sdk.server.services.client.domain.server.CustomField; import com.centurylink.cloud.sdk.server.services.client.domain.server.metadata.ServerMetadata; import com.centurylink.cloud.sdk.server.services.dsl.ServerService; +import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server; import com.centurylink.cloud.sdk.server.services.dsl.servers.TestServerSupport; import com.centurylink.cloud.sdk.tests.recorded.WireMockFileSource; import com.centurylink.cloud.sdk.tests.recorded.WireMockMixin; @@ -29,7 +30,6 @@ import java.util.List; import static com.centurylink.cloud.sdk.tests.TestGroups.RECORDED; -import static com.centurylink.cloud.sdk.core.util.Strings.isNullOrEmpty; /** * @author Aliaksandr Krasitski @@ -40,7 +40,7 @@ public class CreateWithCustomFieldsTest extends AbstractServersSdkTest implement @Inject ServerService serverService; - ServerMetadata server; + Server server; @Test @WireMockFileSource("custom-fields") @@ -59,11 +59,11 @@ public void testCreateServer() throws Exception { .waitUntilComplete() .getResult(); - assert !isNullOrEmpty(server.getId()); + assert server != null; - server = serverService.findByRef(server.asRefById()); + ServerMetadata serverMetadata = serverService.findByRef(server); - List customFields = server.getDetails().getCustomFields(); + List customFields = serverMetadata.getDetails().getCustomFields(); assert customFields.size() == 2; customFields.forEach(field -> { @@ -78,7 +78,7 @@ public void testCreateServer() throws Exception { @AfterMethod public void deleteServer() { - serverService.delete(server.asRefById().asFilter()); + serverService.delete(server.asFilter()); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithManagedOsTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithManagedOsTest.java index fe5bcb09..95c1d60d 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithManagedOsTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithManagedOsTest.java @@ -17,16 +17,15 @@ import com.centurylink.cloud.sdk.core.injector.Inject; import com.centurylink.cloud.sdk.server.services.AbstractServersSdkTest; -import com.centurylink.cloud.sdk.server.services.client.domain.server.metadata.ServerMetadata; import com.centurylink.cloud.sdk.server.services.dsl.ServerService; import com.centurylink.cloud.sdk.server.services.dsl.domain.group.refs.Group; +import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server; import com.centurylink.cloud.sdk.server.services.dsl.domain.template.filters.os.CpuArchitecture; import com.centurylink.cloud.sdk.server.services.dsl.domain.template.filters.os.OsType; import com.centurylink.cloud.sdk.server.services.dsl.domain.template.refs.Template; import com.centurylink.cloud.sdk.server.services.dsl.servers.TestServerSupport; import static com.centurylink.cloud.sdk.base.services.dsl.domain.datacenters.refs.DataCenter.US_EAST_STERLING; -import static com.centurylink.cloud.sdk.core.util.Strings.isNullOrEmpty; /** * @author Ilya Drabenia @@ -37,7 +36,7 @@ public class CreateWithManagedOsTest extends AbstractServersSdkTest { @Inject ServerService serverService; - ServerMetadata server; + Server server; // @Test public void testCreateWithManagedOS() { @@ -59,12 +58,12 @@ public void testCreateWithManagedOS() { .waitUntilComplete() .getResult(); - assert !isNullOrEmpty(server.getId()); + assert server != null; } // @AfterMethod public void deleteServer() { - serverService.delete(server.asRefById()); + serverService.delete(server); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithPublicIpTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithPublicIpTest.java index a33f1ffa..7ac11332 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithPublicIpTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/create/CreateWithPublicIpTest.java @@ -17,10 +17,10 @@ import com.centurylink.cloud.sdk.core.injector.Inject; import com.centurylink.cloud.sdk.server.services.AbstractServersSdkTest; -import com.centurylink.cloud.sdk.server.services.client.domain.server.metadata.ServerMetadata; import com.centurylink.cloud.sdk.server.services.dsl.ServerService; import com.centurylink.cloud.sdk.server.services.dsl.domain.ip.CreatePublicIpConfig; import com.centurylink.cloud.sdk.server.services.dsl.domain.server.NetworkConfig; +import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server; import com.centurylink.cloud.sdk.server.services.dsl.servers.TestServerSupport; import com.centurylink.cloud.sdk.tests.recorded.WireMockFileSource; import com.centurylink.cloud.sdk.tests.recorded.WireMockMixin; @@ -28,7 +28,6 @@ import org.testng.annotations.Test; import static com.centurylink.cloud.sdk.tests.TestGroups.RECORDED; -import static com.centurylink.cloud.sdk.core.util.Strings.isNullOrEmpty; /** * @author Ilya Drabenia @@ -39,7 +38,7 @@ public class CreateWithPublicIpTest extends AbstractServersSdkTest implements Wi @Inject ServerService serverService; - ServerMetadata server; + Server server; @Test @WireMockFileSource("/ip") @@ -56,12 +55,12 @@ public void testCreateServerWithPublicIp() throws Exception { .waitUntilComplete() .getResult(); - assert !isNullOrEmpty(server.getId()); + assert server != null; } @AfterMethod public void deleteServer() { - serverService.delete(server.asRefById().asFilter()); + serverService.delete(server.asFilter()); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyCustomFieldsTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyCustomFieldsTest.java index ff5d916e..bd7e9746 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyCustomFieldsTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyCustomFieldsTest.java @@ -40,7 +40,7 @@ public class ModifyCustomFieldsTest extends AbstractServersSdkTest implements Wi @Inject ServerService serverService; - ServerMetadata server; + Server server; @Test @WireMockFileSource("custom-fields/create") @@ -60,18 +60,17 @@ public void createServer() { @Test @WireMockFileSource("custom-fields/modify") public void modifyServer() { - Server serverRef = server.asRefById(); - serverService.modify(serverRef, + serverService.modify(server, new ModifyServerConfig() .customFields(new CustomField().name("Type").value("1")) ) .waitUntilComplete() .getResult(); - server = serverService.findByRef(serverRef); + ServerMetadata serverMetadata = serverService.findByRef(server); - List customFields = server.getDetails().getCustomFields(); + List customFields = serverMetadata.getDetails().getCustomFields(); assert customFields.size() == 1; assert "1".equals(customFields.get(0).getValue()); @@ -80,7 +79,7 @@ public void modifyServer() { } private void deleteServer() { - serverService.delete(server.asRefById()); + serverService.delete(server); } } diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyServerTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyServerTest.java index fe837841..2e1a0ead 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyServerTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyServerTest.java @@ -23,6 +23,7 @@ import com.centurylink.cloud.sdk.server.services.dsl.domain.server.DiskConfig; import com.centurylink.cloud.sdk.server.services.dsl.domain.server.Machine; import com.centurylink.cloud.sdk.server.services.dsl.domain.server.ModifyServerConfig; +import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server; import com.centurylink.cloud.sdk.server.services.dsl.servers.TestServerSupport; import com.centurylink.cloud.sdk.tests.recorded.WireMockFileSource; import com.centurylink.cloud.sdk.tests.recorded.WireMockMixin; @@ -51,10 +52,12 @@ public class ModifyServerTest extends AbstractServersSdkTest implements WireMock @Inject ServerService serverService; + Server server; + ServerMetadata serverMetadata; private void createServer() { - serverMetadata = serverService.create( + server = serverService.create( TestServerSupport .anyServerConfig() .name("md-srv") @@ -69,11 +72,11 @@ private void createServer() { .getResult(); fetchLastServerMetadata(); - assertNotNull(serverMetadata); + assertNotNull(server); } private void deleteServer() { - serverService.delete(serverMetadata.asRefById()); + serverService.delete(server); } private void sendModifyRequest() { @@ -94,11 +97,11 @@ private void sendModifyRequest() { .machineConfig(machineConfig) .description(modifiedDescription); - serverService.modify(serverMetadata.asRefById(), modifyServerConfig).waitUntilComplete(); + serverService.modify(server, modifyServerConfig).waitUntilComplete(); } private void fetchLastServerMetadata() { - serverMetadata = serverService.findByRef(serverMetadata.asRefById()); + serverMetadata = serverService.findByRef(server); } private void checkInitialServerState() { diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyWithAutoscalePolicyTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyWithAutoscalePolicyTest.java index b8a10d83..3350cf1b 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyWithAutoscalePolicyTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/modify/ModifyWithAutoscalePolicyTest.java @@ -46,7 +46,7 @@ public class ModifyWithAutoscalePolicyTest extends AbstractServersSdkTest implem @Inject ServerService serverService; - ServerMetadata server; + Server server; @Test @WireMockFileSource("autoscale/create") @@ -56,19 +56,19 @@ public void testCreateServer() { serverService.create(TestServerSupport.anyServerConfig() .name("ASP") .machine(new Machine() - .cpuCount(1) - .ram(2) - .autoscalePolicy(AutoscalePolicy.refByName(policyName)) + .cpuCount(1) + .ram(2) + .autoscalePolicy(AutoscalePolicy.refByName(policyName)) ) .group(Group.refByName() - .name(Group.DEFAULT_GROUP) - .dataCenter(CA_TORONTO_2) + .name(Group.DEFAULT_GROUP) + .dataCenter(CA_TORONTO_2) ) ) .waitUntilComplete() .getResult(); - ServerMetadata metadata = serverService.findByRef(Server.refById(server.getId())); + ServerMetadata metadata = serverService.findByRef(server); assert metadata.getDetails().getAutoscalePolicy() != null; } @@ -78,7 +78,7 @@ public void testModifyWithAutoscalePolicy() { String newPolicyName = "Autoscale Policy 2"; serverService.modify( - server.asRefById(), + server, new ModifyServerConfig().machineConfig( new Machine() .autoscalePolicy(AutoscalePolicy.refByName(newPolicyName)) @@ -87,10 +87,10 @@ public void testModifyWithAutoscalePolicy() { ) .waitUntilComplete(); - ServerMetadata metadata = serverService.findByRef(server.asRefById()); + ServerMetadata metadata = serverService.findByRef(server); assert metadata.getDetails().getAutoscalePolicy() != null; - AutoscalePolicyMetadata autoscalePolicy = autoscalePolicyService.getAutoscalePolicyOnServer(server.asRefById()); + AutoscalePolicyMetadata autoscalePolicy = autoscalePolicyService.getAutoscalePolicyOnServer(server); assert autoscalePolicy != null; assertEquals(metadata.getDetails().getAutoscalePolicy().getId(), autoscalePolicy.getId()); diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/remote/ExecuteShellCommandOnRemoteServerTest.java b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/remote/ExecuteShellCommandOnRemoteServerTest.java index b0d736a6..f489c8ac 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/remote/ExecuteShellCommandOnRemoteServerTest.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/server/services/dsl/servers/remote/ExecuteShellCommandOnRemoteServerTest.java @@ -53,8 +53,7 @@ public void createServer() { .name(DEFAULT_GROUP) )) .waitUntilComplete() - .getResult() - .asRefById(); + .getResult(); } @DataProvider(name = "sshSamples") diff --git a/sdk/src/test/java/com/centurylink/cloud/sdk/tests/fixtures/SingleServerFixture.java b/sdk/src/test/java/com/centurylink/cloud/sdk/tests/fixtures/SingleServerFixture.java index 885fc761..fb058f5f 100644 --- a/sdk/src/test/java/com/centurylink/cloud/sdk/tests/fixtures/SingleServerFixture.java +++ b/sdk/src/test/java/com/centurylink/cloud/sdk/tests/fixtures/SingleServerFixture.java @@ -61,7 +61,7 @@ private Server getServer() { return server; } - @BeforeSuite(groups = LONG_RUNNING) + @BeforeSuite(groups = {LONG_RUNNING}) public void createServer() { instance = this; @@ -95,15 +95,14 @@ public void createServer() { ) ) .waitUntilComplete() - .getResult() - .asRefById(); + .getResult(); assertThatServerProperlyStarted( loadMetadataOf(server) ); } - @AfterSuite(groups = LONG_RUNNING) + @AfterSuite(groups = {LONG_RUNNING}) public void deleteServer() { ServerMetadata serverStateBeforeDelete = loadMetadataOf(server);