package com.centurylink.cloud.sdk.servers.services.servers.create;

import com.centurylink.cloud.sdk.common.management.services.domain.queue.OperationFuture;
import com.centurylink.cloud.sdk.core.services.refs.ReferenceNotResolvedException;
import com.centurylink.cloud.sdk.servers.AbstractServersSdkTest;
import com.centurylink.cloud.sdk.servers.client.domain.server.metadata.ServerMetadata;
import com.centurylink.cloud.sdk.servers.services.ServerService;
import com.centurylink.cloud.sdk.servers.services.domain.ip.CreatePublicIpConfig;
import com.centurylink.cloud.sdk.servers.services.domain.server.refs.Server;
import com.centurylink.cloud.sdk.servers.services.domain.server.refs.ServerByIdRef;
import com.google.inject.Inject;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.List;

import static com.centurylink.cloud.sdk.tests.TestGroups.INTEGRATION;
import static com.centurylink.cloud.sdk.tests.TestGroups.LONG_RUNNING;

/**
 * @author ilya.drabenia
 */
@Test
public class ServerServiceTest extends AbstractServersSdkTest {

    @Inject
    ServerService serverService;

    @Test(groups = {INTEGRATION}, expectedExceptions = ReferenceNotResolvedException.class)
    public void testGetServer() {
        serverService.findByRef(Server.refById("randomString"));
    }

    @Test(groups = {INTEGRATION, LONG_RUNNING})
    public void testAddPublicIp() {
        ServerByIdRef serverRef = Server.refById("DE1ALTRATL101");
        Assert.assertNotNull(serverRef);
        OperationFuture<Server> future = serverService.addPublicIp(serverRef, new CreatePublicIpConfig().openPorts(22));
        Server serverWithIp = future.waitUntilComplete().getResult();
        Assert.assertNotNull(serverWithIp);
    }
}

@@ -65,98 +65,8 @@
 e;%0A%0A
-import com.centurylink.cloud.sdk.common.management.services.domain.queue.OperationFuture;%0A
 impo
@@ -254,360 +254,107 @@
 ers.
-client.domain.server.metadata.ServerMetadata;%0Aimport com.centurylink.cloud.sdk.servers.services.ServerService;%0Aimport com.centurylink.cloud.sdk.servers.services.domain.ip.CreatePublicIpConfig;%0Aimport com.centurylink.cloud.sdk.servers.services.domain.server.refs.Server;%0Aimport com.centurylink.cloud.sdk.servers.services.domain.server.refs.ServerByIdRef
+services.ServerService;%0Aimport com.centurylink.cloud.sdk.servers.services.domain.server.refs.Server
 ;%0Aim
@@ -388,34 +388,8 @@
 ct;%0A
-import org.testng.Assert;%0A
 impo
@@ -425,32 +425,8 @@
 t;%0A%0A
-import java.util.List;%0A%0A
 impo
@@ -494,79 +494,8 @@
 ION;
-%0Aimport static com.centurylink.cloud.sdk.tests.TestGroups.LONG_RUNNING;
 %0A%0A/*
@@ -844,439 +844,6 @@
  %7D%0A%0A
-    @Test(groups = %7BINTEGRATION, LONG_RUNNING%7D)%0A    public void testAddPublicIp() %7B%0A        ServerByIdRef serverRef = Server.refById(%22DE1ALTRATL101%22);%0A        Assert.assertNotNull(serverRef);%0A        OperationFuture%3CServer%3E future = serverService.addPublicIp(serverRef, new CreatePublicIpConfig().openPorts(22));%0A        Server serverWithIp = future.waitUntilComplete().getResult();%0A        Assert.assertNotNull(serverWithIp);%0A    %7D%0A
 %7D%0A

remove dublicated test.