You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by de...@apache.org on 2016/02/22 13:20:17 UTC

[04/11] jclouds-labs git commit: Remove ProfitBricks

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
deleted file mode 100644
index 12670cd..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import com.google.common.collect.Iterables;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Nic;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "IpBlockApiLiveTest")
-public class IpBlockApiLiveTest extends BaseProfitBricksLiveTest {
-
-   private DataCenter dataCenter;
-   private Nic nic;
-
-   private IpBlock newIpBlock;
-
-   @BeforeClass
-   public void setupTest() {
-      dataCenter = findOrCreateDataCenter("ipBlockApiLiveTest" + System.currentTimeMillis());
-      nic = findOrCreateNic(dataCenter);
-   }
-
-   @Test
-   public void testReservePublicIpBlock() {
-      assertDataCenterAvailable(dataCenter);
-      newIpBlock = api.ipBlockApi().reservePublicIpBlock(1, testLocation);
-
-      assertNotNull(newIpBlock);
-      assertFalse(newIpBlock.ips().isEmpty());
-   }
-
-   @Test(dependsOnMethods = "testReservePublicIpBlock")
-   public void testGetAllIpBlocks() {
-      List<IpBlock> ipBlocks = api.ipBlockApi().getAllIpBlock();
-
-      assertNotNull(ipBlocks);
-      assertFalse(ipBlocks.isEmpty());
-   }
-
-   @Test(dependsOnMethods = "testReservePublicIpBlock")
-   public void testGetOneIpBlock() {
-      IpBlock ipBlock = api.ipBlockApi().getIpBlock(newIpBlock.id());
-
-      assertNotNull(ipBlock);
-   }
-
-   @Test(dependsOnMethods = "testReservePublicIpBlock")
-   public void testAddPublicIpToNic() {
-      assertDataCenterAvailable(dataCenter);
-      String ipToAdd = Iterables.getFirst(newIpBlock.ips(), null);
-      String requestId = api.ipBlockApi().addPublicIpToNic(
-              ipToAdd, nic.id());
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-      List<String> ips = api.nicApi().getNic(nic.id()).ips();
-      assertTrue(ips.contains(ipToAdd), "NIC didn't contain added public ip");
-   }
-
-   @Test(dependsOnMethods = "testAddPublicIpToNic")
-   public void testRemovePublicIpFromNic() {
-      assertDataCenterAvailable(dataCenter);
-      String ipToRemove = Iterables.getFirst(newIpBlock.ips(), null);
-      String requestId = api.ipBlockApi().removePublicIpFromNic(
-              ipToRemove, nic.id());
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-      List<String> ips = api.nicApi().getNic(nic.id()).ips();
-      assertFalse(ips.contains(ipToRemove), "NIC still contains removed public ip");
-   }
-
-   @Test(dependsOnMethods = "testRemovePublicIpFromNic")
-   public void testReleasePublicIpBlock() {
-      assertDataCenterAvailable(dataCenter);
-      String requestId = api.ipBlockApi().releasePublicIpBlock(newIpBlock.id());
-
-      assertNotNull(requestId);
-   }
-
-   @AfterClass(alwaysRun = true)
-   public void cleanUp() {
-      destroyDataCenter(dataCenter);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
deleted file mode 100644
index 234f163..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import java.util.List;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.IpBlock;
-import org.jclouds.profitbricks.domain.Location;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "IpBlockApiMockTest")
-public class IpBlockApiMockTest extends BaseProfitBricksMockTest {
-
-   @Test
-   public void testGetOneIpBlock() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:getPublicIpBlock><blockId>" + id + "</blockId></ws:getPublicIpBlock>";
-
-      try {
-         IpBlock ipBlock = api.getIpBlock(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(ipBlock);
-         assertEquals(ipBlock.id(), id);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetNonExisingIpBlock() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      try {
-         IpBlock ipBlock = api.getIpBlock(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertNull(ipBlock);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetAllIpBlock() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblocks.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      try {
-         List<IpBlock> ipBlocks = api.getAllIpBlock();
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertNotNull(ipBlocks);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetAllIpBlockReturning404() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      try {
-         List<IpBlock> ipBlocks = api.getAllIpBlock();
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertTrue(ipBlocks.isEmpty());
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testReservePublicIpBlock() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-reserve.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      int blockSize = 2;
-      Location location = Location.US_LAS;
-
-      String content = "<ws:reservePublicIpBlock><request><blockSize>" + blockSize + "</blockSize><location>" + location.getId() + "</location></request></ws:reservePublicIpBlock>";
-      try {
-         IpBlock ipBlock = api.reservePublicIpBlock(blockSize, location);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(ipBlock);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testAddPublicIpToNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-addtonic.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      String ip = "2";
-      String nicid = "nicid";
-
-      String content = "<ws:addPublicIpToNic><ip>" + ip + "</ip><nicId>" + nicid + "</nicId></ws:addPublicIpToNic>";
-      try {
-         String requestId = api.addPublicIpToNic(ip, nicid);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(requestId);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testRemovePublicIpFromNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-removefromnic.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      String ip = "2";
-      String nicid = "nicid";
-
-      String content = "<ws:removePublicIpFromNic><ip>" + ip + "</ip><nicId>" + nicid + "</nicId></ws:removePublicIpFromNic>";
-      try {
-         String requestId = api.removePublicIpFromNic(ip, nicid);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(requestId);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testReleasePublicIpBlock() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-release.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      IpBlockApi api = pbApi.ipBlockApi();
-
-      String blockid = "2";
-
-      String content = "<ws:releasePublicIpBlock><blockId>" + blockid + "</blockId></ws:releasePublicIpBlock>";
-      try {
-         String requestId = api.releasePublicIpBlock(blockid);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(requestId);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiLiveTest.java
deleted file mode 100644
index 0780f78..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiLiveTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Objects;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.LoadBalancer;
-import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
-import org.jclouds.profitbricks.domain.Server;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "LoadBalancerApiLiveTest")
-public class LoadBalancerApiLiveTest extends BaseProfitBricksLiveTest {
-
-   private DataCenter dataCenter;
-   private Server server;
-
-   private String loadBalancerId;
-
-   @BeforeClass
-   public void setupTest() {
-      dataCenter = findOrCreateDataCenter("loadBalancerApiLiveTest" + System.currentTimeMillis());
-      server = findOrCreateServer(dataCenter);
-   }
-
-   @Test
-   public void testCreateLoadBalancer() {
-      assertDataCenterAvailable(dataCenter);
-      String createdId = api.loadBalancerApi().createLoadBalancer(
-              LoadBalancer.Request.creatingBuilder()
-              .dataCenterId(dataCenter.id())
-              .name("testName")
-              .algorithm(Algorithm.ROUND_ROBIN)
-              .ip("192.168.0.200")
-              .lanId(1)
-              .build()
-      );
-
-      assertNotNull(createdId);
-      assertDataCenterAvailable(dataCenter);
-      this.loadBalancerId = createdId;
-   }
-
-   @Test(dependsOnMethods = "testCreateLoadBalancer")
-   public void testGetAllLoadBalancers() {
-      List<LoadBalancer> loadBalancers = api.loadBalancerApi().getAllLoadBalancers();
-
-      assertFalse(loadBalancers.isEmpty());
-   }
-
-   @Test(dependsOnMethods = "testCreateLoadBalancer")
-   public void testGetLoadBalancer() {
-      LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerId);
-
-      assertNotNull(loadBalancer);
-      assertEquals(loadBalancer.id(), loadBalancerId);
-   }
-
-   @Test(dependsOnMethods = "testGetLoadBalancer")
-   public void testRegisterLoadBalancer() {
-      assertDataCenterAvailable(dataCenter);
-      LoadBalancer loadBalancer = api.loadBalancerApi().registerLoadBalancer(
-              LoadBalancer.Request
-              .createRegisteringPaylod(loadBalancerId, ImmutableList.of(server.id()))
-      );
-
-      assertNotNull(loadBalancer);
-      assertDataCenterAvailable(dataCenter);
-      Optional<Server> balancedServer = Iterables.tryFind(loadBalancer.balancedServers(), new Predicate<Server>() {
-
-         @Override
-         public boolean apply(Server t) {
-            return Objects.equals(t.id(), server.id());
-         }
-      });
-      assertTrue(balancedServer.isPresent(), "Server input wasn't registered to loadbalancer");
-   }
-
-   @Test(dependsOnMethods = "testRegisterLoadBalancer")
-   public void testDeregisterLoadBalancer() {
-      assertDataCenterAvailable(dataCenter);
-      String requestId = api.loadBalancerApi().deregisterLoadBalancer(
-              LoadBalancer.Request
-              .createDeregisteringPayload(loadBalancerId, ImmutableList.of(server.id()))
-      );
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-      LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerId);
-      Optional<Server> balancedServer = Iterables.tryFind(loadBalancer.balancedServers(), new Predicate<Server>() {
-
-         @Override
-         public boolean apply(Server t) {
-            return Objects.equals(t.id(), loadBalancerId);
-         }
-      });
-      assertFalse(balancedServer.isPresent(), "Server input wasn't deregistered from loadbalancer");
-   }
-
-   @Test(dependsOnMethods = "testDeregisterLoadBalancer")
-   public void testUpdateLoadBalancer() {
-      assertDataCenterAvailable(dataCenter);
-      String newName = "whatever";
-      String requestId = api.loadBalancerApi().updateLoadBalancer(
-              LoadBalancer.Request.updatingBuilder()
-              .id(loadBalancerId)
-              .name(newName)
-              .build()
-      );
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-      LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerId);
-      assertEquals(loadBalancer.name(), newName);
-   }
-
-   @Test(dependsOnMethods = "testUpdateLoadBalancer")
-   public void testDeleteLoadBalancer() {
-      assertDataCenterAvailable(dataCenter);
-      boolean result = api.loadBalancerApi().deleteLoadBalancer(loadBalancerId);
-      assertTrue(result, "Test load balancer wasn't deleted");
-   }
-
-   @AfterClass(alwaysRun = true)
-   public void cleanUp() {
-      destroyDataCenter(dataCenter);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiMockTest.java
deleted file mode 100644
index e4e8fd7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadBalancerApiMockTest.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.LoadBalancer;
-import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "LoadBalancerApiMockTest")
-public class LoadBalancerApiMockTest extends BaseProfitBricksMockTest {
-
-   @Test
-   public void testGetAllLoadBalancers() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancers.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      try {
-         List<LoadBalancer> loadBalancerList = api.getAllLoadBalancers();
-
-         assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllLoadBalancers/>");
-         assertNotNull(loadBalancerList);
-         assertTrue(loadBalancerList.size() == 2);
-
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetAllLoadBalancersReturning404() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      try {
-         List<LoadBalancer> loadBalancerList = api.getAllLoadBalancers();
-
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertTrue(loadBalancerList.isEmpty());
-
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
-      String content = "<ws:getLoadBalancer><loadBalancerId>" + id + "</loadBalancerId></ws:getLoadBalancer>";
-      try {
-         LoadBalancer loadBalancer = api.getLoadBalancer(id);
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(loadBalancer);
-         assertEquals(loadBalancer.id(), id);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetNonExistingLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String id = "random-non-existing-id";
-
-      try {
-         LoadBalancer loadBalancer = api.getLoadBalancer(id);
-
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertNull(loadBalancer);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testCreateLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-create.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String content = "<ws:createLoadBalancer>"
-              + "<request>"
-              + "<dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee</dataCenterId>"
-              + "<loadBalancerName>load-balancer-name</loadBalancerName>"
-              + "<loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>"
-              + "<ip>192.168.0.1</ip>"
-              + "<lanId>3</lanId>"
-              + "<serverIds>server-ids</serverIds>"
-              + "</request>"
-              + "</ws:createLoadBalancer>";
-
-      try {
-         List<String> serverIds = Lists.newArrayList();
-         serverIds.add("server-ids");
-         String loadBalancerId = api.createLoadBalancer(LoadBalancer.Request.creatingBuilder()
-                 .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee")
-                 .name("load-balancer-name")
-                 .algorithm(Algorithm.ROUND_ROBIN)
-                 .ip("192.168.0.1")
-                 .lanId(3)
-                 .serverIds(serverIds)
-                 .build());
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(loadBalancerId, "1234-1234-1234-1234");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testUpdateLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-update.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-      String newName = "Apache";
-
-      String content = "<ws:updateLoadBalancer>"
-              + "<request>"
-              + "<loadBalancerId>" + id + "</loadBalancerId>"
-              + "<loadBalancerName>load-balancer-name</loadBalancerName>"
-              + "<loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>"
-              + "<ip>192.168.0.1</ip>"
-              + "</request>"
-              + "</ws:updateLoadBalancer>";
-
-      try {
-         LoadBalancer.Request.UpdatePayload toUpdate = LoadBalancer.Request.updatingBuilder()
-                 .id(id)
-                 .name("load-balancer-name")
-                 .algorithm(Algorithm.ROUND_ROBIN)
-                 .ip("192.168.0.1")
-                 .build();
-
-         String requestId = api.updateLoadBalancer(toUpdate);
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "request-id");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-
-   }
-
-   @Test
-   public void testRegisterLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-register.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String content = "<ws:registerServersOnLoadBalancer>"
-              + "<loadBalancerId>1234</loadBalancerId>"
-              + "<serverIds>1</serverIds>"
-              + "<serverIds>2</serverIds>"
-              + "</ws:registerServersOnLoadBalancer>";
-
-      try {
-         List<String> serverIds = Lists.newArrayList();
-         serverIds.add("1");
-         serverIds.add("2");
-         LoadBalancer.Request.RegisterPayload payload = LoadBalancer.Request
-                 .createRegisteringPaylod("1234", serverIds);
-
-         LoadBalancer loadBalancer = api.registerLoadBalancer(payload);
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(loadBalancer);
-         assertEquals(loadBalancer.id(), "load-balancer-id");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeregisterLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-deregister.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String content = "<ws:deregisterServersOnLoadBalancer>"
-              + "<serverIds>1</serverIds>"
-              + "<serverIds>2</serverIds>"
-              + "<loadBalancerId>load-balancer-id</loadBalancerId>"
-              + "</ws:deregisterServersOnLoadBalancer>";
-
-      try {
-         LoadBalancer.Request.DeregisterPayload payload = LoadBalancer.Request
-                 .createDeregisteringPayload("load-balancer-id", ImmutableList.of("1", "2"));
-
-         String requestId = api.deregisterLoadBalancer(payload);
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "request-id");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeleteLoadBalancer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-delete.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      LoadBalancerApi api = pbApi.loadBalancerApi();
-
-      String loadBalancerId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:deleteLoadBalancer><loadBalancerId>" + loadBalancerId + "</loadBalancerId></ws:deleteLoadBalancer>";
-
-      try {
-         boolean done = api.deleteLoadBalancer(loadBalancerId);
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertTrue(done);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
deleted file mode 100644
index 5253d1f..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiLiveTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.domain.Server;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
-
-@Test(groups = "live", testName = "NicApiLiveTest")
-public class NicApiLiveTest extends BaseProfitBricksLiveTest {
-
-   private DataCenter dataCenter;
-   private Server server;
-
-   private String createdNicId;
-
-   @BeforeClass
-   public void setupTest() {
-      dataCenter = findOrCreateDataCenter("nicApiLiveTest-" + System.currentTimeMillis());
-      server = findOrCreateServer(dataCenter);
-   }
-
-   @Test
-   public void testCreateNic() {
-      assertDataCenterAvailable(dataCenter);
-      String nicId = api.nicApi().createNic(Nic.Request.creatingBuilder()
-              .name("name nr1")
-              .dhcpActive(true)
-              .serverId(server.id())
-              .lanId(1)
-              .build());
-
-      assertNotNull(nicId);
-      assertDataCenterAvailable(dataCenter);
-
-      this.createdNicId = nicId;
-   }
-
-   @Test(dependsOnMethods = "testCreateNic")
-   public void testGetAllNics() {
-      List<Nic> nics = api.nicApi().getAllNics();
-
-      assertNotNull(nics);
-   }
-
-   @Test(dependsOnMethods = "testCreateNic")
-   public void testGetNic() {
-      Nic nic = api.nicApi().getNic(createdNicId);
-
-      assertNotNull(nic);
-      assertEquals(nic.id(), createdNicId);
-   }
-
-   @Test(dependsOnMethods = "testGetNic")
-   public void testUpdateNic() {
-      assertDataCenterAvailable(dataCenter);
-      String newName = "name nr2";
-      String requestId = api.nicApi().updateNic(
-              Nic.Request.updatingBuilder()
-              .name("name nr2")
-              .id(createdNicId)
-              .build()
-      );
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-
-      Nic nic = api.nicApi().getNic(createdNicId);
-      assertEquals(nic.name(), newName);
-   }
-
-   @Test(dependsOnMethods = "testUpdateNic")
-   public void testSetInternetAccess() {
-      assertDataCenterAvailable(dataCenter);
-
-      String requestId = api.nicApi().setInternetAccess(Nic.Request.setInternetAccessBuilder()
-              .dataCenterId(dataCenter.id())
-              .lanId(1)
-              .internetAccess(true)
-              .build()
-      );
-      assertDataCenterAvailable(dataCenter);
-      assertNotNull(requestId);
-
-      Nic nic = api.nicApi().getNic(createdNicId);
-      assertTrue(nic.internetAccess(), "Expected nic to have internet access");
-   }
-
-   @Test(dependsOnMethods = "testSetInternetAccess")
-   public void testDeleteNic() {
-      assertDataCenterAvailable(dataCenter);
-      boolean result = api.nicApi().deleteNic(createdNicId);
-      assertTrue(result, "Created test NIC was not deleted.");
-   }
-
-   @AfterClass(alwaysRun = true)
-   public void cleanUp() {
-      destroyDataCenter(dataCenter);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
deleted file mode 100644
index 940efa7..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/NicApiMockTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.Nic;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "NicApiMockTest")
-
-public class NicApiMockTest extends BaseProfitBricksMockTest {
-
-   @Test
-   public void testGetNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String id = "12345678-abcd-efgh-ijkl-987654321000";
-
-      String content = "<ws:getNic><nicId>" + id + "</nicId></ws:getNic>";
-      try {
-         Nic nic = api.getNic(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(nic);
-         assertEquals(nic.id(), id);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetNonExistingNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String id = "nonexisting-nic-id";
-
-      try {
-         Nic nic = api.getNic(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertNull(nic);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetAllNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nics.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-      try {
-         List<Nic> nics = api.getAllNics();
-         assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllNic/>");
-         assertNotNull(nics);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testCreateNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-create.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String content = "<ws:createNic>"
-              + "<request>"
-              + "<ip>192.168.0.1</ip>"
-              + "<nicName>nic-name</nicName>"
-              + "<dhcpActive>true</dhcpActive>"
-              + "<serverId>server-id</serverId>"
-              + "<lanId>1</lanId>"
-              + "</request>"
-              + "</ws:createNic>";
-
-      try {
-         String nicId = api.createNic(
-                 Nic.Request.creatingBuilder()
-                 .ip("192.168.0.1")
-                 .name("nic-name")
-                 .dhcpActive(true)
-                 .lanId(1)
-                 .serverId("server-id")
-                 .build());
-
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(nicId);
-
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testUpdateNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-update.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String content = "<ws:updateNic>"
-              + "<request>"
-              + "<nicId>nic-id</nicId>"
-              + "<ip>10.0.0.1</ip>"
-              + "<nicName>nic-name</nicName>"
-              + "<dhcpActive>true</dhcpActive>"
-              + "<lanId>1</lanId>"
-              + "</request>"
-              + "</ws:updateNic>";
-      try {
-         String requestId = api.updateNic(Nic.Request.updatingBuilder()
-                 .id("nic-id")
-                 .ip("10.0.0.1")
-                 .name("nic-name")
-                 .dhcpActive(true)
-                 .lanId(1)
-                 .build());
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "request-id");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testSetInternetAccess() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-internetaccess.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String content = "<ws:setInternetAccess>"
-              + "<dataCenterId>datacenter-id</dataCenterId>"
-              + "<lanId>1</lanId>"
-              + "<internetAccess>true</internetAccess>"
-              + "</ws:setInternetAccess>";
-      try {
-         String requestId = api.setInternetAccess(Nic.Request.setInternetAccessBuilder()
-                 .dataCenterId("datacenter-id")
-                 .lanId(1)
-                 .internetAccess(true)
-                 .build());
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "request-id");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeleteNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/nic/nic-delete.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
-      String content = "<ws:deleteNic><nicId>" + id + "</nicId></ws:deleteNic>";
-
-      try {
-         boolean result = api.deleteNic(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertTrue(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeleteNonExistingNic() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      NicApi api = pbApi.nicApi();
-
-      String id = "nonexisting-nic-id";
-
-      try {
-         boolean result = api.deleteNic(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertFalse(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
deleted file mode 100644
index be1a60c..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiLiveTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.jclouds.profitbricks.domain.Server;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "ServerApiLiveTest")
-public class ServerApiLiveTest extends BaseProfitBricksLiveTest {
-
-   private DataCenter dataCenter;
-   private String createdServerId;
-
-   @BeforeClass
-   public void setupTest() {
-      dataCenter = findOrCreateDataCenter("serverApiLiveTest-" + System.currentTimeMillis());
-   }
-
-   @Test
-   public void testCreateServer() {
-      assertDataCenterAvailable(dataCenter);
-      String serverId = api.serverApi().createServer(
-              Server.Request.creatingBuilder()
-              .dataCenterId(dataCenter.id())
-              .name("jclouds-node")
-              .cores(1)
-              .ram(1024)
-              .build());
-
-      assertNotNull(serverId);
-      assertDataCenterAvailable(dataCenter);
-      assertNodeRunning(serverId);
-
-      this.createdServerId = serverId;
-   }
-
-   @Test(dependsOnMethods = "testCreateServer")
-   public void testGetServer() {
-      Server server = api.serverApi().getServer(createdServerId);
-
-      assertNotNull(server);
-      assertEquals(server.id(), createdServerId);
-   }
-
-   @Test(dependsOnMethods = "testCreateServer")
-   public void testGetAllServers() {
-      List<Server> servers = api.serverApi().getAllServers();
-
-      assertNotNull(servers);
-      assertFalse(servers.isEmpty());
-   }
-
-   @Test(dependsOnMethods = "testGetServer")
-   public void testUpdateServer() {
-      assertDataCenterAvailable(dataCenter);
-      String requestId = api.serverApi().updateServer(
-              Server.Request.updatingBuilder()
-              .id(createdServerId)
-              .name("apache-node")
-              .cores(2)
-              .ram(2 * 1024)
-              .build());
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-
-      Server server = api.serverApi().getServer(createdServerId);
-      assertEquals(server.state(), ProvisioningState.AVAILABLE);
-   }
-
-   @Test(dependsOnMethods = "testUpdateServer")
-   public void testStopServer() {
-      String requestId = api.serverApi().stopServer(createdServerId);
-      assertNotNull(requestId);
-      assertNodeSuspended(createdServerId);
-
-      Server server = api.serverApi().getServer(createdServerId);
-      assertEquals(server.status(), Server.Status.SHUTOFF);
-   }
-
-   @Test(dependsOnMethods = "testStopServer")
-   public void testStartServer() {
-      String requestId = api.serverApi().startServer(createdServerId);
-      assertNotNull(requestId);
-      assertNodeRunning(createdServerId);
-
-      Server server = api.serverApi().getServer(createdServerId);
-      assertEquals(server.status(), Server.Status.RUNNING);
-   }
-
-   @Test(dependsOnMethods = "testStartServer")
-   public void testDeleteServer() {
-      assertDataCenterAvailable(dataCenter);
-      boolean result = api.serverApi().deleteServer(createdServerId);
-      assertTrue(result, "Created test server was not deleted.");
-   }
-
-   @AfterClass(alwaysRun = true)
-   public void cleanUp() {
-      destroyDataCenter(dataCenter);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java
deleted file mode 100644
index 47738b8..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/ServerApiMockTest.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.AvailabilityZone;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.jclouds.rest.ResourceNotFoundException;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ServerApiMockTest")
-public class ServerApiMockTest extends BaseProfitBricksMockTest {
-
-   @Test
-   public void testGetAllServers() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/servers.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      try {
-         List<Server> servers = api.getAllServers();
-         assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllServers/>");
-         assertNotNull(servers);
-         assertTrue(servers.size() == 2);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetAllServersReturning404() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      try {
-         List<Server> servers = api.getAllServers();
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertTrue(servers.isEmpty());
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:getServer><serverId>" + id + "</serverId></ws:getServer>";
-      try {
-         Server svr = api.getServer(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(svr);
-         assertEquals(svr.id(), id);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetNonExistingServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "random-non-existing-id";
-      try {
-         Server srvr = api.getServer(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertNull(srvr);
-
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testStartServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-start.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:startServer><serverId>" + id + "</serverId></ws:startServer>";
-      try {
-         String requestId = api.startServer(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "123456");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testStartNonExistingServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/fault-404.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "random-non-existing-id";
-      try {
-         String requestId = api.startServer(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         fail("Should've failed.");
-      } catch (ResourceNotFoundException ex) {
-         // expected exception
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testStopServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-stop.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:stopServer><serverId>" + id + "</serverId></ws:stopServer>";
-      try {
-         String requestId = api.stopServer(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "123456");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testResetServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-reset.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:resetServer><serverId>" + id + "</serverId></ws:resetServer>";
-      try {
-         String requestId = api.resetServer(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertEquals(requestId, "123456");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testCreateServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-create.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String dataCenterId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-      String name = "jclouds-node";
-      String imageId = "some-random-image-id";
-
-      String content = "<ws:createServer>"
-              + "<request>"
-              + "<dataCenterId>" + dataCenterId + "</dataCenterId>"
-              + "<cores>4</cores>"
-              + "<ram>4096</ram>"
-              + "<serverName>" + name + "</serverName>"
-              //              + "<bootFromStorageId></bootFromStorageId>"
-              + "<bootFromImageId>" + imageId + "</bootFromImageId>"
-              + "<internetAccess>true</internetAccess>"
-              + "<lanId>2</lanId>"
-              + "<osType>LINUX</osType>"
-              + "<availabilityZone>ZONE_1</availabilityZone>"
-              + "<cpuHotPlug>true</cpuHotPlug>"
-              + "<ramHotPlug>false</ramHotPlug>"
-              + "<nicHotPlug>true</nicHotPlug>"
-              + "<nicHotUnPlug>false</nicHotUnPlug>"
-              + "<discVirtioHotPlug>true</discVirtioHotPlug>"
-              + "<discVirtioHotUnPlug>false</discVirtioHotUnPlug>"
-              + "</request>"
-              + "</ws:createServer>";
-
-      try {
-         String serverId = api.createServer(Server.Request.creatingBuilder()
-                 .dataCenterId(dataCenterId)
-                 .name(name)
-                 .cores(4)
-                 .ram(4 * 1024)
-                 .bootFromImageId(imageId)
-                 .hasInternetAccess(Boolean.TRUE)
-                 .lanId(2)
-                 .osType(OsType.LINUX)
-                 .availabilityZone(AvailabilityZone.ZONE_1)
-                 .isCpuHotPlug(Boolean.TRUE)
-                 .isRamHotPlug(Boolean.FALSE)
-                 .isNicHotPlug(Boolean.TRUE)
-                 .isNicHotUnPlug(Boolean.FALSE)
-                 .isDiscVirtioHotPlug(Boolean.TRUE)
-                 .isDiscVirtioHotUnPlug(Boolean.FALSE)
-                 .build());
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(serverId);
-         assertEquals(serverId, "qwertyui-qwer-qwer-qwer-qwertyyuiiop");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testUpdateServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-update.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String serverId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-      String newName = "apache-node";
-      String storageId = "some-random-storage-id";
-
-      String content = "<ws:updateServer>"
-              + "<request>"
-              + "<serverId>" + serverId + "</serverId>"
-              + "<cores>8</cores>"
-              + "<ram>8192</ram>"
-              + "<serverName>" + newName + "</serverName>"
-              + "<bootFromStorageId>" + storageId + "</bootFromStorageId>"
-              //              + "<bootFromImageId>?</bootFromImageId>"
-              + "<osType>OTHER</osType>"
-              + "<availabilityZone>AUTO</availabilityZone>"
-              + "<cpuHotPlug>false</cpuHotPlug>"
-              + "<ramHotPlug>true</ramHotPlug>"
-              + "<nicHotPlug>false</nicHotPlug>"
-              + "<nicHotUnPlug>true</nicHotUnPlug>"
-              + "<discVirtioHotPlug>false</discVirtioHotPlug>"
-              + "<discVirtioHotUnPlug>true</discVirtioHotUnPlug>"
-              + "</request>"
-              + "</ws:updateServer>";
-      try {
-         String requestId = api.updateServer(Server.Request.updatingBuilder()
-                 .id(serverId)
-                 .name(newName)
-                 .cores(8)
-                 .ram(8 * 1024)
-                 .bootFromStorageId(storageId)
-                 .osType(OsType.OTHER)
-                 .availabilityZone(AvailabilityZone.AUTO)
-                 .isCpuHotPlug(false)
-                 .isRamHotPlug(true)
-                 .isNicHotPlug(false)
-                 .isNicHotUnPlug(true)
-                 .isDiscVirtioHotPlug(false)
-                 .isDiscVirtioHotUnPlug(true)
-                 .build());
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(requestId);
-         assertEquals(requestId, "102458");
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeleteServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/server/server-delete.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String serverId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
-
-      String content = "<ws:deleteServer><serverId>" + serverId + "</serverId></ws:deleteServer>";
-      try {
-         boolean result = api.deleteServer(serverId);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertTrue(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-
-   }
-
-   @Test
-   public void testDeleteNonExistingServer() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      ServerApi api = pbApi.serverApi();
-
-      String id = "random-non-existing-id";
-      try {
-         boolean result = api.deleteServer(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertFalse(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
deleted file mode 100644
index fa7eea0..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiLiveTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.domain.Storage;
-import org.testng.annotations.Test;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.ProvisioningState;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.FluentIterable;
-
-import org.jclouds.util.Predicates2;
-
-@Test(groups = "live", testName = "SnapshotApiLiveTest")
-public class SnapshotApiLiveTest extends BaseProfitBricksLiveTest {
-
-   private DataCenter dataCenter;
-   private Storage storage;
-
-   private String createdSnapshotId;
-
-   @BeforeClass
-   public void setupTest() {
-      dataCenter = findOrCreateDataCenter("snapshotApiLiveTest-" + System.currentTimeMillis());
-      storage = FluentIterable.from(dataCenter.storages()).firstMatch(new Predicate<Storage>() {
-
-         @Override
-         public boolean apply(Storage input) {
-            return input.state() == ProvisioningState.AVAILABLE
-                    && input.size() <= 10f;
-         }
-      }).or(new Supplier<Storage>() {
-
-         @Override
-         public Storage get() {
-            StorageApi storageApi = api.storageApi();
-            String name = String.format("server-%d", dataCenter.servers().size());
-            String createdStorageId = storageApi.createStorage(
-                    Storage.Request.creatingBuilder()
-                    .dataCenterId(dataCenter.id())
-                    .name(name)
-                    .size(2f)
-                    .build()
-            );
-            assertDataCenterAvailable(dataCenter);
-
-            return storageApi.getStorage(createdStorageId);
-         }
-      });
-   }
-
-   @Test
-   public void testCreateSnapshot() {
-      assertDataCenterAvailable(dataCenter);
-      Snapshot snapshot = api.snapshotApi().createSnapshot(
-              Snapshot.Request.creatingBuilder()
-              .storageId(storage.id())
-              .description("my description")
-              .name("test snapshot")
-              .build());
-
-      assertNotNull(snapshot);
-      assertSnapshotAvailable(snapshot.id());
-
-      createdSnapshotId = snapshot.id();
-   }
-
-   @Test(dependsOnMethods = "testCreateSnapshot")
-   public void testGetAllSnapshots() {
-      List<Snapshot> snapshots = api.snapshotApi().getAllSnapshots();
-
-      assertNotNull(snapshots);
-      assertTrue(snapshots.size() > 0);
-   }
-
-   @Test(dependsOnMethods = "testCreateSnapshot")
-   public void testGetSnapshot() {
-      Snapshot snapshot = api.snapshotApi().getSnapshot(createdSnapshotId);
-
-      assertNotNull(snapshot);
-      assertEquals(snapshot.id(), createdSnapshotId);
-   }
-
-   @Test(dependsOnMethods = "testGetSnapshot")
-   public void testUpdateSnapshot() {
-      assertSnapshotAvailable(createdSnapshotId);
-      String newName = "new name";
-      String newDescription = "new description";
-
-      String requestId = api.snapshotApi().updateSnapshot(
-              Snapshot.Request.updatingBuilder()
-              .id(createdSnapshotId)
-              .description(newDescription)
-              .name(newName)
-              .bootable(true)
-              .osType(OsType.LINUX)
-              .isCpuHotPlug(true)
-              .isCpuHotUnPlug(true)
-              .isDiscVirtioHotPlug(true)
-              .isDiscVirtioHotUnPlug(true)
-              .isNicHotPlug(true)
-              .isNicHotUnPlug(true)
-              .isRamHotPlug(true)
-              .isRamHotUnPlug(true)
-              .build());
-      assertNotNull(requestId);
-   }
-
-   @Test(dependsOnMethods = "testUpdateSnapshot")
-   public void testRollbackSnapshot() {
-      assertSnapshotAvailable(createdSnapshotId);
-      String requestid = api.snapshotApi().rollbackSnapshot(
-              Snapshot.Request.createRollbackPayload(createdSnapshotId, storage.id()));
-      assertNotNull(requestid);
-   }
-
-   @Test(dependsOnMethods = "testRollbackSnapshot", alwaysRun = true)
-   public void testDeleteSnapshot() {
-      assertSnapshotAvailable(createdSnapshotId);
-      // Newly created snapshots doesn't seem to reflect in the API right away,
-      // so we need to persistently try to delete (to clean up resources as well)
-      Predicate<String> persistentDelete = Predicates2.retry(new Predicate<String>() {
-
-         @Override
-         public boolean apply(String input) {
-            try {
-               return api.snapshotApi().deleteSnapshot(input);
-            } catch (Exception ex) {
-               return false;
-            }
-         }
-      }, 120L, 5L, 10L, TimeUnit.SECONDS);
-      assertTrue(persistentDelete.apply(createdSnapshotId), "Created snapshot wasn't deleted");
-   }
-
-   @AfterClass(alwaysRun = true)
-   public void cleanUp() {
-      destroyDataCenter(dataCenter);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java
deleted file mode 100644
index 9574e76..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/SnapshotApiMockTest.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import org.jclouds.profitbricks.ProfitBricksApi;
-import org.jclouds.profitbricks.domain.OsType;
-import org.jclouds.profitbricks.domain.Snapshot;
-import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
-import org.testng.annotations.Test;
-
-import java.util.List;
-import static org.jclouds.profitbricks.internal.BaseProfitBricksMockTest.mockWebServer;
-import org.testng.Assert;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-/**
- * Mock tests for the {@link org.jclouds.profitbricks.features.DataCenterApi} class
- */
-@Test(groups = "unit", testName = "SnapshotApiMockTest")
-public class SnapshotApiMockTest extends BaseProfitBricksMockTest {
-
-   @Test
-   public void testGetAllSnapshots() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshots.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      try {
-         List<Snapshot> snapshots = api.getAllSnapshots();
-         assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllSnapshots/>");
-         assertNotNull(snapshots);
-         assertEquals(snapshots.size(), 2);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetAllSnapshotsReturning404() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      try {
-         List<Snapshot> snapshots = api.getAllSnapshots();
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertTrue(snapshots.isEmpty());
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String id = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
-
-      String content = "<ws:getSnapshot><snapshotId>" + id + "</snapshotId></ws:getSnapshot>";
-
-      try {
-         Snapshot snapshot = api.getSnapshot(id);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(snapshot);
-         assertEquals(snapshot.id(), id);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testGetNonExistingSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String id = "random-non-existing-id";
-      try {
-         Snapshot snapshot = api.getSnapshot(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         assertNull(snapshot);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testCreateSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-create.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String storageId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
-      String content = "<ws:createSnapshot>"
-              + "<request>"
-              + "<storageId>" + storageId + "</storageId>"
-              + "<description>description</description>"
-              + "<snapshotName>snapshot-name</snapshotName>"
-              + "</request>"
-              + "</ws:createSnapshot>";
-
-      try {
-         Snapshot snapshot = api.createSnapshot(
-                 Snapshot.Request.creatingBuilder()
-                 .storageId(storageId)
-                 .description("description")
-                 .name("snapshot-name")
-                 .build());
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(snapshot.id());
-         assertEquals(snapshot.id(), "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
-
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testUpdateSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-update.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String snapshotId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
-      String content = "<ws:updateSnapshot>"
-              + "<request>"
-              + "<snapshotId>" + snapshotId + "</snapshotId>"
-              + "<description>description</description>"
-              + "<snapshotName>snapshot-name</snapshotName>"
-              + "<bootable>false</bootable>"
-              + "<osType>LINUX</osType>"
-              + "<cpuHotPlug>false</cpuHotPlug>"
-              + "<cpuHotUnPlug>false</cpuHotUnPlug>"
-              + "<ramHotPlug>false</ramHotPlug>"
-              + "<ramHotUnPlug>false</ramHotUnPlug>"
-              + "<nicHotPlug>false</nicHotPlug>"
-              + "<nicHotUnPlug>false</nicHotUnPlug>"
-              + "<discVirtioHotPlug>false</discVirtioHotPlug>"
-              + "<discVirtioHotUnPlug>false</discVirtioHotUnPlug>"
-              + "</request>"
-              + "</ws:updateSnapshot>";
-
-      try {
-         String requestId = api.updateSnapshot(Snapshot.Request.updatingBuilder()
-                 .id(snapshotId)
-                 .description("description")
-                 .name("snapshot-name")
-                 .bootable(false)
-                 .osType(OsType.LINUX)
-                 .isCpuHotPlug(false)
-                 .isCpuHotUnPlug(false)
-                 .isDiscVirtioHotPlug(false)
-                 .isDiscVirtioHotUnPlug(false)
-                 .isNicHotPlug(false)
-                 .isNicHotUnPlug(false)
-                 .isRamHotPlug(false)
-                 .isRamHotUnPlug(false)
-                 .build());
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(requestId);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeleteSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-delete.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String snapshotId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
-      String content = "<ws:deleteSnapshot><snapshotId>" + snapshotId + "</snapshotId></ws:deleteSnapshot>";
-
-      try {
-         boolean result = api.deleteSnapshot(snapshotId);
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertTrue(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testDeleteNonExistingSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setResponseCode(404));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String id = "random-non-existing-id";
-      try {
-         boolean result = api.deleteSnapshot(id);
-         assertRequestHasCommonProperties(server.takeRequest());
-         Assert.assertFalse(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-
-   @Test
-   public void testRollbackSnapshot() throws Exception {
-      MockWebServer server = mockWebServer();
-      server.enqueue(new MockResponse().setBody(payloadFromResource("/snapshot/snapshot-rollback.xml")));
-
-      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
-      SnapshotApi api = pbApi.snapshotApi();
-
-      String snapshotId = "qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh";
-      String storageId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
-
-      String content = "<ws:rollbackSnapshot><request><snapshotId>" + snapshotId + "</snapshotId><storageId>" + storageId + "</storageId></request></ws:rollbackSnapshot>";
-      try {
-         String result = api.rollbackSnapshot(Snapshot.Request.createRollbackPayload(snapshotId, storageId));
-         assertRequestHasCommonProperties(server.takeRequest(), content);
-         assertNotNull(result);
-      } finally {
-         pbApi.close();
-         server.shutdown();
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/93aff921/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
deleted file mode 100644
index cdaac80..0000000
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/features/StorageApiLiveTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.profitbricks.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
-import org.jclouds.profitbricks.domain.DataCenter;
-import org.jclouds.profitbricks.domain.Server;
-import org.jclouds.profitbricks.domain.Storage;
-import org.jclouds.rest.InsufficientResourcesException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
-
-@Test(groups = "live", testName = "StorageApiLiveTest")
-public class StorageApiLiveTest extends BaseProfitBricksLiveTest {
-
-   private DataCenter dataCenter;
-   private Server server;
-
-   private String createdStorageId;
-
-   @BeforeClass
-   public void setupTest() {
-      dataCenter = findOrCreateDataCenter("storageApiLiveTest" + System.currentTimeMillis());
-      server = findOrCreateServer(dataCenter);
-   }
-
-   @Test(expectedExceptions = InsufficientResourcesException.class)
-   public void testUberStorage() {
-      api.storageApi().createStorage(
-              Storage.Request.creatingBuilder()
-              .dataCenterId(dataCenter.id())
-              .name("Uber Storage")
-              .size(9999999f)
-              .build());
-   }
-
-   @Test
-   public void testCreateStorage() {
-      assertDataCenterAvailable(dataCenter);
-      String storageId = api.storageApi().createStorage(
-              Storage.Request.creatingBuilder()
-              .dataCenterId(dataCenter.id())
-              .name("hdd-1")
-              .size(2f)
-              .build());
-
-      assertNotNull(storageId);
-      assertDataCenterAvailable(dataCenter);
-
-      createdStorageId = storageId;
-   }
-
-   @Test(dependsOnMethods = "testCreateStorage")
-   public void testGetStorage() {
-      Storage storage = api.storageApi().getStorage(createdStorageId);
-
-      assertNotNull(storage);
-      assertEquals(storage.id(), createdStorageId);
-   }
-
-   @Test(dependsOnMethods = "testCreateStorage")
-   public void testGetAllStorages() {
-      List<Storage> storages = api.storageApi().getAllStorages();
-
-      assertNotNull(storages);
-      assertFalse(storages.isEmpty());
-   }
-
-   @Test(dependsOnMethods = "testCreateStorage")
-   public void testUpdateStorage() {
-      assertDataCenterAvailable(dataCenter);
-      String requestId = api.storageApi().updateStorage(
-              Storage.Request.updatingBuilder()
-              .id(createdStorageId)
-              .name("hdd-2")
-              .size(5f)
-              .build());
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-
-      Storage storage = api.storageApi().getStorage(createdStorageId);
-      assertEquals(storage.size(), 5f);
-      assertEquals(storage.name(), "hdd-2");
-   }
-
-   @Test(dependsOnMethods = "testUpdateStorage")
-   public void testConnectStorage() {
-      assertDataCenterAvailable(dataCenter);
-      String requestId = api.storageApi().connectStorageToServer(
-              Storage.Request.connectingBuilder()
-              .storageId(createdStorageId)
-              .serverId(server.id())
-              .build()
-      );
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-
-      Storage storage = api.storageApi().getStorage(createdStorageId);
-      assertTrue(storage.serverIds().contains(server.id()));
-   }
-
-   @Test(dependsOnMethods = "testConnectStorage")
-   public void testDisconnectStorage() {
-      assertDataCenterAvailable(dataCenter);
-      String requestId = api.storageApi()
-              .disconnectStorageFromServer(createdStorageId, server.id());
-
-      assertNotNull(requestId);
-      assertDataCenterAvailable(dataCenter);
-
-      Storage storage = api.storageApi().getStorage(createdStorageId);
-      assertFalse(storage.serverIds().contains(server.id()));
-   }
-
-   @Test(dependsOnMethods = "testDisconnectStorage")
-   public void testDeleteStorage() {
-      assertDataCenterAvailable(dataCenter);
-      boolean result = api.storageApi().deleteStorage(createdStorageId);
-      assertTrue(result, "Created test storage was not deleted");
-   }
-
-   @AfterClass(alwaysRun = true)
-   public void cleanUp() {
-      destroyDataCenter(dataCenter);
-   }
-}