You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2014/11/27 15:32:24 UTC
[09/24] jclouds-labs git commit: JCLOUDS-785: Leave only Abiquo
skeleton to start coding Abiquo 3 provider
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/admin/RoleLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/admin/RoleLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/admin/RoleLiveApiTest.java
deleted file mode 100644
index 2383be0..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/admin/RoleLiveApiTest.java
+++ /dev/null
@@ -1,102 +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.abiquo.domain.admin;
-
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-import java.util.List;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.DomainWrapper;
-import org.jclouds.abiquo.domain.config.Privilege;
-import org.jclouds.abiquo.domain.enterprise.Role;
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.enterprise.PrivilegeDto;
-import com.abiquo.server.core.enterprise.RoleDto;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Lists;
-
-/**
- * Live integration tests for the {@link Role} domain class.
- */
-@Test(groups = "api", testName = "RoleLiveApiTest")
-public class RoleLiveApiTest extends BaseAbiquoApiLiveApiTest {
-
- public void testUpdate() {
- Role role = Role.builder(env.context.getApiContext()).name("dummyRoleUpdateRole").blocked(false).build();
- role.save();
-
- role.setName("UPDATED_ROLE");
- role.update();
-
- // Recover the updated role
- RoleDto updated = env.adminApi.getRole(role.getId());
-
- assertEquals(updated.getName(), "UPDATED_ROLE");
-
- role.delete();
- }
-
- public void testCreateRepeated() {
- Role repeated = Role.Builder.fromRole(env.role).build();
-
- try {
- repeated.save();
- fail("Should not be able to create roles with the same name");
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "ROLE-7");
- }
- }
-
- public void testCreateEnterpriseRole() {
- final Role entRole = Role.Builder.fromRole(env.role).build();
- entRole.setName(entRole.getName() + "enterprise");
- entRole.setEnterprise(env.enterprise);
- entRole.save();
-
- find(env.enterprise.listRoles(), new Predicate<Role>() {
- @Override
- public boolean apply(Role input) {
- return input.getName().equals(entRole.getName());
- }
- });
- }
-
- public void testAddPrivilege() {
- PrivilegeDto dto = env.configApi.getPrivilege(8);
- final Privilege privilege = DomainWrapper.wrap(env.context.getApiContext(), Privilege.class, dto);
- List<Privilege> privileges = Lists.newArrayList(env.role.listPrivileges());
- privileges.add(privilege);
-
- env.role.setPrivileges(privileges);
- env.role.update();
-
- find(env.role.listPrivileges(), new Predicate<Privilege>() {
- @Override
- public boolean apply(Privilege input) {
- return input.getName().equals(privilege.getName());
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/AccountLiveTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/AccountLiveTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/AccountLiveTest.java
deleted file mode 100644
index c18201a..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/AccountLiveTest.java
+++ /dev/null
@@ -1,55 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.size;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.internal.BaseAbiquoLiveApiTest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * Live integration tests
- */
-@Test(groups = "live", testName = "AccountLiveTest")
-public class AccountLiveTest extends BaseAbiquoLiveApiTest {
-
- private Enterprise enterprise;
-
- @BeforeClass(groups = { "integration", "live" })
- @Override
- public void setupContext() {
- super.setupContext();
- enterprise = view.getAdministrationService().getCurrentEnterprise();
- }
-
- public void testGetCurrentUser() {
- assertEquals(view.getAdministrationService().getCurrentUser().getNick(), view.getApiContext().getIdentity());
- }
-
- public void testAllowedDatacenters() {
- assertTrue(size(enterprise.listAllowedDatacenters()) > 0);
- }
-
- public void testAvailableTemplates() {
- assertTrue(size(enterprise.listTemplates()) > 0);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/HardDiskLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/HardDiskLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/HardDiskLiveApiTest.java
deleted file mode 100644
index d23b60b..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/HardDiskLiveApiTest.java
+++ /dev/null
@@ -1,65 +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.abiquo.domain.cloud;
-
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.SkipException;
-import org.testng.annotations.Test;
-
-import com.abiquo.model.enumerator.HypervisorType;
-
-/**
- * Live integration tests for the {@link HardDisk} domain class.
- */
-@Test(groups = "api", testName = "HardDiskLiveApiTest")
-public class HardDiskLiveApiTest extends BaseAbiquoApiLiveApiTest {
- private HardDisk hardDisk;
-
- public void createHardDisk() {
- skipIfUnsupported();
-
- hardDisk = HardDisk.builder(env.context.getApiContext(), env.virtualDatacenter).sizeInMb(64L).build();
- hardDisk.save();
-
- assertNotNull(hardDisk.getId());
- assertNotNull(hardDisk.getSequence());
-
- assertNotNull(env.virtualDatacenter.getHardDisk(hardDisk.getId()));
- }
-
- @Test(dependsOnMethods = "createHardDisk")
- public void deleteHardDisk() {
- skipIfUnsupported();
-
- HardDisk hd = env.virtualDatacenter.getHardDisk(hardDisk.getId());
- assertNotNull(hd);
-
- Integer id = hd.getId();
- hardDisk.delete();
- assertNull(env.virtualDatacenter.getHardDisk(id));
- }
-
- protected static void skipIfUnsupported() {
- if (!env.machine.getType().equals(HypervisorType.VMX_04)) {
- throw new SkipException(
- "Cannot perform this test because hard disk actions are not available for this hypervisor");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java
deleted file mode 100644
index 666ec6c..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveApiTest.java
+++ /dev/null
@@ -1,91 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.size;
-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.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.cloud.VirtualApplianceDto;
-import com.abiquo.server.core.cloud.VirtualApplianceState;
-import com.google.common.collect.Lists;
-
-/**
- * Live integration tests for the {@link VirtualAppliance} domain class.
- */
-@Test(groups = "api", testName = "VirtualApplianceLiveApiTest")
-public class VirtualApplianceLiveApiTest extends BaseAbiquoApiLiveApiTest {
-
- public void testUpdate() {
- env.virtualAppliance.setName("Virtual AppAloha updated");
- env.virtualAppliance.update();
-
- // Recover the updated virtual appliance
- VirtualApplianceDto updated = env.cloudApi.getVirtualAppliance(env.virtualDatacenter.unwrap(),
- env.virtualAppliance.getId());
-
- assertEquals(updated.getName(), "Virtual AppAloha updated");
- }
-
- public void testCreateRepeated() {
- VirtualAppliance repeated = VirtualAppliance.Builder.fromVirtualAppliance(env.virtualAppliance).build();
-
- repeated.save();
-
- List<VirtualApplianceDto> virtualAppliances = env.cloudApi.listVirtualAppliances(env.virtualDatacenter.unwrap())
- .getCollection();
-
- assertEquals(virtualAppliances.size(), 2);
- repeated.delete();
- }
-
- public void testGetState() {
- assertEquals(env.virtualAppliance.getState(), VirtualApplianceState.NOT_DEPLOYED);
- }
-
- public void testListVirtualMachinesReturnsAll() {
- List<VirtualMachine> vms = Lists.newArrayList();
-
- // Pagination by default is set to 25 items per page, so create a few more
- // to verify that
- // all are returned when listing
- int numVms = 30;
-
- for (int i = 0; i < numVms; i++) {
- VirtualMachine vm = VirtualMachine.Builder.fromVirtualMachine(env.virtualMachine).build();
- vm.save();
- vms.add(vm);
- }
-
- try {
- Iterable<VirtualMachine> all = env.virtualAppliance.listVirtualMachines();
-
- assertNotNull(all);
- assertTrue(size(all) >= numVms);
- } finally {
- for (VirtualMachine vm : vms) {
- vm.delete();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveTest.java
deleted file mode 100644
index bb833e1..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualApplianceLiveTest.java
+++ /dev/null
@@ -1,130 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.getLast;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.features.services.MonitoringService;
-import org.jclouds.abiquo.internal.BaseAbiquoLiveApiTest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.cloud.VirtualApplianceState;
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Ordering;
-import com.google.common.primitives.Longs;
-
-/**
- * Live integration tests for the {@link VirtualAppliance} domain class.
- */
-@Test(groups = "live", testName = "VirtualApplianceLiveTest")
-public class VirtualApplianceLiveTest extends BaseAbiquoLiveApiTest {
- private static final long MAX_WAIT = 2;
-
- private VirtualDatacenter vdc;
-
- private VirtualAppliance vapp;
-
- private VirtualMachine vm;
-
- private VirtualMachineTemplate vmt;
-
- private MonitoringService monitoringService;
-
- @BeforeClass(groups = { "integration", "live" })
- @Override
- public void setupContext() {
- super.setupContext();
- monitoringService = view.getMonitoringService();
- vdc = getLast(view.getCloudService().listVirtualDatacenters());
- vmt = templateBySize().min(vdc.listAvailableTemplates());
- }
-
- public void testCreateVirtualAppliance() {
- vapp = VirtualAppliance.builder(view.getApiContext(), vdc).name(PREFIX + "Virtual Appliance Ohana").build();
- vapp.save();
-
- assertNotNull(vapp.getId());
- }
-
- @Test(dependsOnMethods = "testCreateVirtualAppliance")
- public void testUpdateVirtualAppliance() {
- vapp.setName(PREFIX + "Virtual Appliance Updated");
- vapp.update();
-
- // Reload the appliance to check the updated name
- VirtualAppliance updated = vdc.getVirtualAppliance(vapp.getId());
- assertEquals(updated.getName(), PREFIX + "Virtual Appliance Updated");
- }
-
- @Test(dependsOnMethods = "testUpdateVirtualAppliance")
- public void testDeployVirtualAppliance() {
- vm = VirtualMachine.builder(view.getApiContext(), vapp, vmt).cpu(1).nameLabel(PREFIX + "VM Makua").ram(128)
- .build();
-
- vm.save();
- assertNotNull(vm.getId());
-
- VirtualMachineTask[] tasks = vapp.deploy();
- assertEquals(tasks.length, 1); // One task for each VM in the VAPP
-
- monitoringService.getVirtualApplianceMonitor().awaitCompletionDeploy(MAX_WAIT, TimeUnit.MINUTES, vapp);
- assertEquals(vapp.getState(), VirtualApplianceState.DEPLOYED);
- assertEquals(vm.getState(), VirtualMachineState.ON);
- }
-
- @Test(dependsOnMethods = "testDeployVirtualAppliance")
- public void testUndeployVirtualAppliance() {
- VirtualMachineTask[] tasks = vapp.undeploy();
- assertEquals(tasks.length, 1); // One task for each VM in the VAPP
-
- monitoringService.getVirtualApplianceMonitor().awaitCompletionUndeploy(MAX_WAIT, TimeUnit.MINUTES, vapp);
- assertEquals(vapp.getState(), VirtualApplianceState.NOT_DEPLOYED);
- assertEquals(vm.getState(), VirtualMachineState.NOT_ALLOCATED);
- }
-
- @Test(dependsOnMethods = "testUndeployVirtualAppliance")
- public void testDeleteVirtualAppliance() {
- final String name = vapp.getName();
- vapp.delete();
-
- assertNull(find(view.getCloudService().listVirtualAppliances(), new Predicate<VirtualAppliance>() {
- @Override
- public boolean apply(VirtualAppliance input) {
- return input.getName().equals(name);
- }
- }, null));
- }
-
- private static Ordering<VirtualMachineTemplate> templateBySize() {
- return new Ordering<VirtualMachineTemplate>() {
- @Override
- public int compare(final VirtualMachineTemplate left, final VirtualMachineTemplate right) {
- return Longs.compare(left.getDiskFileSize(), right.getDiskFileSize());
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenterLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenterLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenterLiveApiTest.java
deleted file mode 100644
index 88b9aac..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenterLiveApiTest.java
+++ /dev/null
@@ -1,177 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.get;
-import static com.google.common.collect.Iterables.size;
-import static com.google.common.collect.Lists.newArrayList;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-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 org.jclouds.abiquo.domain.cloud.VirtualDatacenter.Builder;
-import org.jclouds.abiquo.domain.cloud.options.VirtualDatacenterOptions;
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.domain.network.PrivateNetwork;
-import org.jclouds.abiquo.domain.network.PublicIp;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.abiquo.model.enumerator.HypervisorType;
-import com.abiquo.server.core.cloud.VirtualDatacenterDto;
-import com.google.common.base.Predicate;
-
-/**
- * Live integration tests for the {@link VirtualDatacenter} domain class.
- */
-@Test(groups = "api", testName = "VirtualDatacenterLiveApiTest")
-public class VirtualDatacenterLiveApiTest extends BaseAbiquoApiLiveApiTest {
- private VirtualMachineTemplate template;
-
- public void testUpdate() {
- env.virtualDatacenter.setName("Aloha updated");
- env.virtualDatacenter.update();
-
- // Recover the updated virtual datacenter
- VirtualDatacenterDto updated = env.cloudApi.getVirtualDatacenter(env.virtualDatacenter.getId());
-
- assertEquals(updated.getName(), "Aloha updated");
- }
-
- public void testCreateRepeated() {
- PrivateNetwork newnet = PrivateNetwork.builder(env.context.getApiContext()).name("Newnet").gateway("10.0.0.1")
- .address("10.0.0.0").mask(24).build();
-
- VirtualDatacenter repeated = Builder.fromVirtualDatacenter(env.virtualDatacenter).network(newnet).build();
-
- repeated.save();
-
- List<VirtualDatacenterDto> virtualDatacenters = env.cloudApi.listVirtualDatacenters(
- VirtualDatacenterOptions.builder().build()).getCollection();
-
- assertEquals(virtualDatacenters.size(), 2);
- assertEquals(virtualDatacenters.get(0).getName(), virtualDatacenters.get(1).getName());
- repeated.delete();
- }
-
- public void testCreateFromEnterprise() {
- Enterprise enterprise = env.enterpriseAdminContext.getAdministrationService().getCurrentUser().getEnterprise();
- assertNotNull(enterprise);
-
- List<Datacenter> datacenters = newArrayList(enterprise.listAllowedDatacenters());
- assertNotNull(datacenters);
- assertTrue(size(datacenters) > 0);
-
- Datacenter datacenter = datacenters.get(0);
-
- List<HypervisorType> hypervisors = newArrayList(datacenter.listAvailableHypervisors());
- assertNotNull(datacenters);
- assertTrue(size(datacenters) > 0);
-
- HypervisorType hypervisor = hypervisors.get(0);
-
- PrivateNetwork network = PrivateNetwork.builder(env.enterpriseAdminContext.getApiContext())
- .name("DefaultNetwork").gateway("192.168.1.1").address("192.168.1.0").mask(24).build();
-
- VirtualDatacenter virtualDatacenter = VirtualDatacenter
- .builder(env.enterpriseAdminContext.getApiContext(), datacenters.get(0), enterprise)
- .name(PREFIX + "Plain Virtual Aloha from ENT").cpuCountLimits(18, 20).hdLimitsInMb(279172872, 279172872)
- .publicIpsLimits(2, 2).ramLimits(19456, 20480).storageLimits(289910292, 322122547).vlansLimits(1, 2)
- .hypervisorType(hypervisor).network(network).build();
-
- virtualDatacenter.save();
- assertNotNull(virtualDatacenter.getId());
-
- virtualDatacenter.delete();
- }
-
- public void testCreateFromVirtualDatacenter() {
- HypervisorType hypervisor = env.virtualDatacenter.getHypervisorType();
-
- Enterprise enterprise = env.user.getEnterprise();
- assertNotNull(enterprise);
-
- Datacenter datacenter = env.virtualDatacenter.getDatacenter();
- assertNotNull(datacenter);
-
- PrivateNetwork network = PrivateNetwork.builder(env.plainUserContext.getApiContext()).name("DefaultNetwork")
- .gateway("192.168.1.1").address("192.168.1.0").mask(24).build();
-
- VirtualDatacenter virtualDatacenter = VirtualDatacenter
- .builder(env.context.getApiContext(), datacenter, enterprise).name(PREFIX + "Plain Virtual Aloha from VDC")
- .cpuCountLimits(18, 20).hdLimitsInMb(279172872, 279172872).publicIpsLimits(2, 2).ramLimits(19456, 20480)
- .storageLimits(289910292, 322122547).vlansLimits(1, 2).hypervisorType(hypervisor).network(network).build();
-
- virtualDatacenter.save();
- assertNotNull(virtualDatacenter.getId());
-
- virtualDatacenter.delete();
- }
-
- public void testPurchaseIp() {
- final PublicIp publicIp = get(env.virtualDatacenter.listAvailablePublicIps(), 0);
- assertNotNull(publicIp);
- env.virtualDatacenter.purchasePublicIp(publicIp);
-
- PublicIp apiIp = find(env.virtualDatacenter.listPurchasedPublicIps(), new Predicate<PublicIp>() {
- @Override
- public boolean apply(PublicIp input) {
- return input.getIp().equals(publicIp.getIp());
- }
- });
-
- env.virtualDatacenter.releasePublicIp(apiIp);
- apiIp = find(env.virtualDatacenter.listPurchasedPublicIps(), new Predicate<PublicIp>() {
- @Override
- public boolean apply(PublicIp input) {
- return input.getIp().equals(publicIp.getIp());
- }
- }, null);
- assertNull(apiIp);
- }
-
- public void testGetDefaultNetwork() {
- PrivateNetwork network = env.virtualDatacenter.getDefaultNetwork().toPrivateNetwork();
-
- assertNotNull(network);
- assertEquals(network.getName(), env.privateNetwork.getName());
- assertEquals(network.getType(), env.privateNetwork.getType());
- }
-
- public void testGetAvailableTemplates() {
- List<VirtualMachineTemplate> templates = newArrayList(env.virtualDatacenter.listAvailableTemplates());
- assertNotNull(templates);
- assertFalse(templates.isEmpty());
-
- template = templates.get(0);
- }
-
- @Test(dependsOnMethods = "testGetAvailableTemplates")
- public void testGetAvailableTemplate() {
- VirtualMachineTemplate templateFound = env.virtualDatacenter.getAvailableTemplate(template.getId());
- assertNotNull(templateFound);
- assertEquals(templateFound.getId(), template.getId());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveApiTest.java
deleted file mode 100644
index a9b18ea..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveApiTest.java
+++ /dev/null
@@ -1,137 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.size;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-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 javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.cloud.VirtualMachineDto;
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.google.common.base.Predicate;
-
-/**
- * Live integration tests for the {@link VirtualMachine} domain class.
- */
-@Test(groups = "api", testName = "VirtualMachineLiveApiTest")
-public class VirtualMachineLiveApiTest extends BaseAbiquoApiLiveApiTest {
- public void testListAllVirtualMachines() {
- Iterable<VirtualMachine> vms = env.context.getCloudService().listVirtualMachines();
- assertTrue(size(vms) > 1);
-
- // Verify that the VM created in the setup exists. This call will throw
- // a NoSuchElementException if no macthing VM is found
- find(vms, new Predicate<VirtualMachine>() {
- @Override
- public boolean apply(VirtualMachine input) {
- return input.getId().equals(env.virtualMachine.getId());
- }
- });
- }
-
- public void testHasDataFromNode() {
- assertNotNull(env.virtualMachine.getNameLabel());
- assertNotNull(env.virtualMachine.getInternalName());
- assertNotNull(env.virtualMachine.getOwnerName());
- }
-
- public void testUpdateInfoFromNode() {
- env.virtualMachine.setNameLabel(PREFIX + "-label-updated");
- env.virtualMachine.update();
- env.virtualMachine.refresh();
-
- assertEquals(env.virtualMachine.getNameLabel(), PREFIX + "-label-updated");
- }
-
- public void testGetTasks() {
- Iterable<AsyncTask<?, ?>> tasks = env.virtualMachine.listTasks();
- assertNotNull(tasks);
- }
-
- public void testGetState() {
- VirtualMachineState state = env.virtualMachine.getState();
- assertEquals(state, VirtualMachineState.NOT_ALLOCATED);
- }
-
- public void testIsPersistent() {
- assertFalse(env.virtualMachine.isPersistent());
- }
-
- public void testGetVirtualAppliance() {
- VirtualAppliance vapp = env.virtualMachine.getVirtualAppliance();
- assertNotNull(vapp);
- assertEquals(vapp.getId(), env.virtualAppliance.getId());
- }
-
- public void testRebootVirtualMachineFailsWhenNotAllocated() {
- // Since the virtual machine is not deployed, this should not generate a
- // task
-
- try {
- env.virtualMachine.reboot();
- fail("Reboot should have failed for the NOT_ALLOCATED virtual machine");
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "VM-11");
- }
- }
-
- public void testUpdateForcingLimits() {
- int originalHard = env.virtualDatacenter.getCpuCountHardLimit();
- int originalSoft = env.virtualDatacenter.getCpuCountSoftLimit();
-
- env.virtualDatacenter.setCpuCountHardLimit(10);
- env.virtualDatacenter.setCpuCountSoftLimit(5);
- env.virtualDatacenter.update();
-
- try {
- VirtualMachine vm = env.virtualAppliance.getVirtualMachine(env.virtualMachine.getId());
- vm.setCpu(7);
- VirtualMachineTask task = vm.update(true);
-
- assertNull(task);
- assertEquals(vm.getCpu().intValue(), 7);
- } finally {
- env.virtualDatacenter.setCpuCountHardLimit(originalHard);
- env.virtualDatacenter.setCpuCountSoftLimit(originalSoft);
- env.virtualDatacenter.update();
- }
- }
-
- public void testAttachDvd() {
- VirtualMachine vm = VirtualMachine.Builder.fromVirtualMachine(env.virtualMachine).dvd(true).build();
- vm.save();
-
- VirtualMachineDto updated = env.cloudApi.getVirtualMachine(env.virtualAppliance.unwrap(), vm.getId());
-
- assertNotNull(updated.getDvd());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveTest.java
deleted file mode 100644
index 8e9b76c..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineLiveTest.java
+++ /dev/null
@@ -1,179 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.getLast;
-import static org.jclouds.abiquo.environment.CloudTestEnvironment.templateBySize;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.fail;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.domain.network.Ip;
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.features.services.MonitoringService;
-import org.jclouds.abiquo.internal.BaseAbiquoLiveApiTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Lists;
-
-/**
- * Live integration tests for the {@link VirtualMachine} domain class.
- */
-@Test(groups = "live", testName = "VirtualMachineLiveTest")
-public class VirtualMachineLiveTest extends BaseAbiquoLiveApiTest {
- private static final long MAX_WAIT = 2;
-
- private VirtualDatacenter vdc;
-
- private VirtualAppliance vapp;
-
- private VirtualMachine vm;
-
- private VirtualMachineTemplate vmt;
-
- private MonitoringService monitoringService;
-
- @BeforeClass(groups = { "integration", "live" })
- @Override
- public void setupContext() {
- super.setupContext();
- monitoringService = view.getMonitoringService();
- vdc = getLast(view.getCloudService().listVirtualDatacenters());
- vmt = templateBySize().min(vdc.listAvailableTemplates());
-
- vapp = VirtualAppliance.builder(view.getApiContext(), vdc).name(PREFIX + "Virtual Appliance Wahine").build();
- vapp.save();
- assertNotNull(vapp.getId());
- }
-
- @AfterClass(groups = { "integration", "live" })
- @Override
- protected void tearDownContext() {
- vapp.delete();
- super.tearDownContext();
- }
-
- @Test
- public void testCreateVirtualMachine() {
- vm = VirtualMachine.builder(view.getApiContext(), vapp, vmt).cpu(1).nameLabel(PREFIX + "VM Kane").ram(128)
- .build();
-
- vm.save();
- assertNotNull(vm.getId());
- }
-
- @Test(dependsOnMethods = "testCreateVirtualMachine")
- public void testUpdateVirtualMachineWhenNotDeployed() {
- vm.setNameLabel(PREFIX + "VM Kane Updated");
- VirtualMachineTask task = vm.update();
- assertNull(task);
-
- find(vapp.listVirtualMachines(), new Predicate<VirtualMachine>() {
- @Override
- public boolean apply(VirtualMachine input) {
- return input.getNameLabel().equals(PREFIX + "VM Kane Updated");
- }
- });
- }
-
- @Test(dependsOnMethods = "testUpdateVirtualMachineWhenNotDeployed")
- public void testDeployVirtualMachine() {
- VirtualMachineTask task = vm.deploy(true);
- assertNotNull(task);
-
- monitoringService.getVirtualMachineMonitor().awaitCompletionDeploy(MAX_WAIT, TimeUnit.MINUTES, vm);
- assertEquals(vm.getState(), VirtualMachineState.ON);
- }
-
- @Test(dependsOnMethods = "testDeployVirtualMachine")
- public void testChangeVirtualMachineState() {
- VirtualMachineTask task = vm.changeState(VirtualMachineState.OFF);
- assertNotNull(task);
-
- monitoringService.getVirtualMachineMonitor().awaitState(MAX_WAIT, TimeUnit.MINUTES, VirtualMachineState.OFF, vm);
- assertEquals(vm.getState(), VirtualMachineState.OFF);
- }
-
- @Test(dependsOnMethods = "testChangeVirtualMachineState")
- public void testReconfigure() {
- final Ip<?, ?> ip = getLast(vdc.getDefaultNetwork().listUnusedIps());
-
- VirtualMachineTask task = vm.setNics(Lists.<Ip<?, ?>> newArrayList(ip));
- assertNotNull(task);
-
- monitoringService.getVirtualMachineMonitor().awaitState(MAX_WAIT, TimeUnit.MINUTES, VirtualMachineState.OFF, vm);
-
- find(vm.listAttachedNics(), new Predicate<Ip<?, ?>>() {
- @Override
- public boolean apply(Ip<?, ?> input) {
- return input.getIp().equals(ip.getIp());
- }
- });
- }
-
- @Test(dependsOnMethods = "testReconfigure")
- public void testUndeployVirtualMachine() {
- VirtualMachineTask task = vm.undeploy();
- assertNotNull(task);
-
- monitoringService.getVirtualMachineMonitor().awaitCompletionUndeploy(MAX_WAIT, TimeUnit.MINUTES, vm);
- assertEquals(vm.getState(), VirtualMachineState.NOT_ALLOCATED);
- }
-
- @Test(dependsOnMethods = "testUndeployVirtualMachine")
- public void testDeployFailsWhenHardLimitsAreExceeded() {
- Enterprise ent = view.getAdministrationService().getCurrentEnterprise();
-
- if (vdc.getCpuCountHardLimit() != 0) {
- vm.setCpu(vdc.getCpuCountHardLimit() + 1);
- } else if (ent.getCpuCountHardLimit() != 0) {
- vm.setCpu(ent.getCpuCountHardLimit() + 1);
- }
-
- VirtualMachineTask task = vm.update();
- assertNull(task);
-
- try {
- vm.deploy(true);
- fail("Deployments over the hard limits should not be allowed");
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "LIMIT_EXCEEDED");
- }
- }
-
- @Test(dependsOnMethods = "testDeployFailsWhenHardLimitsAreExceeded")
- public void tesDeleteVirtualMachine() {
- Integer vmId = vm.getId();
- vm.delete();
- assertNull(vapp.getVirtualMachine(vmId));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineNetworkingLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineNetworkingLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineNetworkingLiveApiTest.java
deleted file mode 100644
index cd4580d..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineNetworkingLiveApiTest.java
+++ /dev/null
@@ -1,223 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.get;
-import static com.google.common.collect.Iterables.getLast;
-import static com.google.common.collect.Iterables.size;
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.fail;
-
-import java.util.List;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.domain.network.ExternalIp;
-import org.jclouds.abiquo.domain.network.Ip;
-import org.jclouds.abiquo.domain.network.PrivateIp;
-import org.jclouds.abiquo.domain.network.PublicIp;
-import org.jclouds.abiquo.domain.network.PublicNetwork;
-import org.jclouds.abiquo.domain.network.UnmanagedIp;
-import org.jclouds.abiquo.domain.network.UnmanagedNetwork;
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Lists;
-
-/**
- * Live integration tests for the {@link VirtualMachine} networking operations.
- */
-@Test(groups = "api", testName = "VirtualMachineNetworkingLiveApiTest")
-public class VirtualMachineNetworkingLiveApiTest extends BaseAbiquoApiLiveApiTest {
- private PrivateIp privateIp;
-
- private ExternalIp externalIp;
-
- private PublicIp publicIpInfrastructure;
-
- private PublicIp publicIpCloud;
-
- private UnmanagedIp unmanagedIp1;
-
- private UnmanagedIp unmanagedIp2;
-
- @BeforeClass
- public void setupIps() {
- privateIp = getLast(env.privateNetwork.listUnusedIps());
- externalIp = getLast(env.externalNetwork.listUnusedIps());
-
- publicIpInfrastructure = getLast(env.virtualDatacenter.listAvailablePublicIps());
- env.virtualDatacenter.purchasePublicIp(publicIpInfrastructure);
-
- publicIpCloud = find(env.virtualDatacenter.listPurchasedPublicIps(), new Predicate<PublicIp>() {
- @Override
- public boolean apply(PublicIp input) {
- return input.getIp().equals(publicIpInfrastructure.getIp());
- }
- });
- }
-
- @AfterClass
- public void restorePrivateIp() {
- VirtualMachineTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>> newArrayList(privateIp));
- assertNull(task);
-
- Iterable<Ip<?, ?>> nics = env.virtualMachine.listAttachedNics();
- assertEquals(size(nics), 1);
- assertEquals(get(nics, 0).getId(), privateIp.getId());
-
- final String address = publicIpCloud.getIp();
- env.virtualDatacenter.releasePublicIp(publicIpCloud);
-
- assertNull(find(env.virtualDatacenter.listPurchasedPublicIps(), new Predicate<PublicIp>() {
- @Override
- public boolean apply(PublicIp input) {
- return input.getIp().equals(address);
- }
- }, null));
- }
-
- // TODO: Infrastructure edit link for public ips can not be used to attach
- @Test(enabled = false)
- public void testAttachInfrastructurePublicIp() {
- VirtualMachineTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>> newArrayList(publicIpInfrastructure));
- assertNull(task);
-
- Iterable<Ip<?, ?>> nics = env.virtualMachine.listAttachedNics();
- assertEquals(size(nics), 1);
- assertEquals(get(nics, 0).getId(), publicIpInfrastructure.getId());
- }
-
- public void testAttachPublicIp() {
- VirtualMachineTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>> newArrayList(publicIpCloud));
- assertNull(task);
-
- Iterable<Ip<?, ?>> nics = env.virtualMachine.listAttachedNics();
- assertEquals(size(nics), 1);
- assertEquals(get(nics, 0).getId(), publicIpCloud.getId());
- }
-
- @Test(dependsOnMethods = "testAttachPublicIp")
- public void testAttachPrivateIp() {
- List<Ip<?, ?>> nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
- nics.add(privateIp);
-
- VirtualMachineTask task = env.virtualMachine.setNics(nics);
- assertNull(task);
-
- nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
- assertEquals(nics.size(), 2);
- assertEquals(nics.get(0).getId(), publicIpCloud.getId());
- assertEquals(nics.get(1).getId(), privateIp.getId());
- }
-
- @Test(dependsOnMethods = "testAttachPrivateIp")
- public void testAttachExternalIp() {
- List<Ip<?, ?>> nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
- nics.add(externalIp);
-
- VirtualMachineTask task = env.virtualMachine.setNics(nics);
- assertNull(task);
-
- nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
- assertEquals(nics.size(), 3);
- assertEquals(nics.get(0).getId(), publicIpCloud.getId());
- assertEquals(nics.get(1).getId(), privateIp.getId());
- assertEquals(nics.get(2).getId(), externalIp.getId());
- }
-
- @Test(dependsOnMethods = "testAttachExternalIp")
- public void testAddUnmanagedNics() {
- Iterable<Ip<?, ?>> nics = env.virtualMachine.listAttachedNics();
-
- VirtualMachineTask task = env.virtualMachine.setNics(Lists.newArrayList(nics),
- Lists.<UnmanagedNetwork> newArrayList(env.unmanagedNetwork, env.unmanagedNetwork));
- assertNull(task);
-
- nics = env.virtualMachine.listAttachedNics();
- assertEquals(size(nics), 5);
- assertEquals(get(nics, 0).getId(), publicIpCloud.getId());
- assertEquals(get(nics, 1).getId(), privateIp.getId());
- assertEquals(get(nics, 2).getId(), externalIp.getId());
- // Unmanaged ips are created during the attach.
- assertEquals(get(nics, 3).getNetworkName(), env.unmanagedNetwork.getName());
- assertEquals(get(nics, 4).getNetworkName(), env.unmanagedNetwork.getName());
-
- unmanagedIp1 = (UnmanagedIp) get(nics, 3);
- unmanagedIp2 = (UnmanagedIp) get(nics, 4);
- }
-
- @Test(dependsOnMethods = "testAddUnmanagedNics")
- public void testReorderNics() {
- List<Ip<?, ?>> nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
-
- VirtualMachineTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>> newArrayList(nics.get(2), nics.get(1),
- nics.get(0), nics.get(4), nics.get(3)));
- assertNull(task);
-
- nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
- assertEquals(nics.size(), 5);
- assertEquals(nics.get(0).getId(), externalIp.getId());
- assertEquals(nics.get(1).getId(), privateIp.getId());
- assertEquals(nics.get(2).getId(), publicIpCloud.getId());
- assertEquals(nics.get(3).getId(), unmanagedIp2.getId());
- assertEquals(nics.get(4).getId(), unmanagedIp1.getId());
- }
-
- @Test(dependsOnMethods = "testReorderNics")
- public void testDetachNics() {
- List<Ip<?, ?>> nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
-
- VirtualMachineTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>> newArrayList(nics.get(1), nics.get(2)));
- assertNull(task);
-
- nics = Lists.newArrayList(env.virtualMachine.listAttachedNics());
- assertEquals(nics.size(), 2);
- assertEquals(nics.get(0).getId(), privateIp.getId());
- assertEquals(nics.get(1).getId(), publicIpCloud.getId());
- }
-
- @Test(dependsOnMethods = "testDetachNics")
- public void testSetDefaultGateway() {
- PublicNetwork network = publicIpCloud.getNetwork();
- env.virtualMachine.setGatewayNetwork(network);
-
- Integer configId = env.virtualMachine.unwrap().getIdFromLink("network_configuration");
- assertEquals(configId, network.getId());
- }
-
- // TODO: Review this functionality
- @Test(dependsOnMethods = "testSetDefaultGateway", enabled = false)
- public void testDetachAllNics() {
- try {
- env.virtualMachine.setNics(null);
-
- fail("It should not be allowed to remove all nics from a vm");
- } catch (AbiquoException ex) {
- // At least one nic must be configured
- assertHasError(ex, Status.BAD_REQUEST, "VM-46");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineStorageLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineStorageLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineStorageLiveApiTest.java
deleted file mode 100644
index dafc3eb..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineStorageLiveApiTest.java
+++ /dev/null
@@ -1,152 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.get;
-import static com.google.common.collect.Iterables.isEmpty;
-import static com.google.common.collect.Iterables.size;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-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.jclouds.abiquo.domain.infrastructure.Tier;
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-
-/**
- * Live integration tests for the {@link VirtualMachine} storage operations.
- */
-@Test(groups = "api", testName = "VirtualMachineStorageLiveApiTest")
-public class VirtualMachineStorageLiveApiTest extends BaseAbiquoApiLiveApiTest {
- private Volume volume;
-
- private HardDisk hardDisk;
-
- public void testAttachVolumes() {
- volume = createVolume();
-
- // Since the virtual machine is not deployed, this should not generate a
- // task
- VirtualMachineTask task = env.virtualMachine.attachVolumes(volume);
- assertNull(task);
-
- Iterable<Volume> attached = env.virtualMachine.listAttachedVolumes();
- assertEquals(size(attached), 1);
- assertEquals(get(attached, 0).getId(), volume.getId());
- }
-
- @Test(dependsOnMethods = "testAttachVolumes")
- public void detachVolume() {
- env.virtualMachine.detachVolumes(volume);
- Iterable<Volume> attached = env.virtualMachine.listAttachedVolumes();
- assertTrue(isEmpty(attached));
- }
-
- @Test(dependsOnMethods = "detachVolume")
- public void detachAllVolumes() {
- // Since the virtual machine is not deployed, this should not generate a
- // task
- VirtualMachineTask task = env.virtualMachine.attachVolumes(volume);
- assertNull(task);
-
- env.virtualMachine.detachAllVolumes();
- Iterable<Volume> attached = env.virtualMachine.listAttachedVolumes();
- assertTrue(isEmpty(attached));
-
- deleteVolume(volume);
- }
-
- public void testAttachHardDisks() {
- hardDisk = createHardDisk();
-
- // Since the virtual machine is not deployed, this should not generate a
- // task
- VirtualMachineTask task = env.virtualMachine.attachHardDisks(hardDisk);
- assertNull(task);
-
- Iterable<HardDisk> attached = env.virtualMachine.listAttachedHardDisks();
- assertEquals(size(attached), 1);
- assertEquals(get(attached, 0).getId(), hardDisk.getId());
- }
-
- @Test(dependsOnMethods = "testAttachHardDisks")
- public void detachHardDisk() {
- env.virtualMachine.detachHardDisks(hardDisk);
- Iterable<HardDisk> attached = env.virtualMachine.listAttachedHardDisks();
- assertTrue(isEmpty(attached));
- }
-
- @Test(dependsOnMethods = "detachHardDisk")
- public void detachAllHardDisks() {
- // Since the virtual machine is not deployed, this should not generate a
- // task
- VirtualMachineTask task = env.virtualMachine.attachHardDisks(hardDisk);
- assertNull(task);
-
- env.virtualMachine.detachAllHardDisks();
- Iterable<HardDisk> attached = env.virtualMachine.listAttachedHardDisks();
- assertTrue(isEmpty(attached));
-
- deleteHardDisk(hardDisk);
- }
-
- private Volume createVolume() {
- Tier tier = find(env.virtualDatacenter.listStorageTiers(), new Predicate<Tier>() {
- @Override
- public boolean apply(Tier input) {
- return input.getName().equals(env.tier.getName());
- }
- });
-
- Volume volume = Volume.builder(env.context.getApiContext(), env.virtualDatacenter, tier)
- .name(PREFIX + "Hawaian volume").sizeInMb(32).build();
- volume.save();
-
- assertNotNull(volume.getId());
- assertNotNull(env.virtualDatacenter.getVolume(volume.getId()));
-
- return volume;
- }
-
- private void deleteVolume(final Volume volume) {
- Integer id = volume.getId();
- volume.delete();
- assertNull(env.virtualDatacenter.getVolume(id));
- }
-
- private HardDisk createHardDisk() {
- HardDisk hardDisk = HardDisk.builder(env.context.getApiContext(), env.virtualDatacenter).sizeInMb(64L).build();
- hardDisk.save();
-
- assertNotNull(hardDisk.getId());
- assertNotNull(hardDisk.getSequence());
-
- return hardDisk;
- }
-
- private void deleteHardDisk(final HardDisk hardDisk) {
- Integer id = hardDisk.getId();
- hardDisk.delete();
- assertNull(env.virtualDatacenter.getHardDisk(id));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTemplateLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTemplateLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTemplateLiveApiTest.java
deleted file mode 100644
index 01ea54e..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTemplateLiveApiTest.java
+++ /dev/null
@@ -1,58 +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.abiquo.domain.cloud;
-
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.fail;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.config.Category;
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-/**
- * Live integration tests for the {@link VirtualMachineTemplate} domain class.
- */
-@Test(groups = "api", testName = "VirtualMachineTemplateLiveApiTest")
-public class VirtualMachineTemplateLiveApiTest extends BaseAbiquoApiLiveApiTest {
-
- public void testGetParent() {
- Datacenter datacenter = env.virtualMachine.getTemplate().getDatacenter();
- assertNotNull(datacenter);
- assertEquals(datacenter.getId(), env.datacenter.getId());
- }
-
- public void testGetCategory() {
- Category category = env.virtualMachine.getTemplate().getCategory();
- assertNotNull(category);
- }
-
- public void testRequestConversionToSameFormat() {
- try {
- env.virtualMachine.getTemplate().requestConversion(env.virtualMachine.getTemplate().getDiskFormatType());
- fail("Should not be able to create create a conversion to the base format");
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "CONVERSION-3");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTest.java
deleted file mode 100644
index 2d83116..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VirtualMachineTest.java
+++ /dev/null
@@ -1,37 +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.abiquo.domain.cloud;
-
-import org.easymock.EasyMock;
-import org.jclouds.abiquo.AbiquoContext;
-import org.testng.annotations.Test;
-
-/**
- * Unit tests for the {@link VirtualMachine} class.
- */
-@Test(groups = "unit", testName = "VirtualMachineTest")
-public class VirtualMachineTest {
-
- @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "Missing required field nameLabel")
- public void testNameLabelIsMandatory() {
- AbiquoContext context = EasyMock.createMock(AbiquoContext.class);
- VirtualAppliance vapp = EasyMock.createMock(VirtualAppliance.class);
- VirtualMachineTemplate template = EasyMock.createMock(VirtualMachineTemplate.class);
-
- VirtualMachine.builder(context.getApiContext(), vapp, template).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VolumeLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VolumeLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VolumeLiveApiTest.java
deleted file mode 100644
index e7e84fe..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/cloud/VolumeLiveApiTest.java
+++ /dev/null
@@ -1,131 +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.abiquo.domain.cloud;
-
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.isEmpty;
-import static com.google.common.collect.Iterables.size;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-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.jclouds.abiquo.domain.cloud.options.VolumeOptions;
-import org.jclouds.abiquo.domain.infrastructure.Tier;
-import org.jclouds.abiquo.domain.network.PrivateNetwork;
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-
-/**
- * Live integration tests for the {@link Volume} domain class.
- */
-@Test(groups = "api", testName = "VolumeLiveApiTest")
-public class VolumeLiveApiTest extends BaseAbiquoApiLiveApiTest {
- public void testCreateVolume() {
- // We need the vdc-relative tier
- Tier tier = find(env.virtualDatacenter.listStorageTiers(), new Predicate<Tier>() {
- @Override
- public boolean apply(Tier input) {
- return input.getName().equals(env.tier.getName());
- }
- });
-
- Volume volume = Volume.builder(env.context.getApiContext(), env.virtualDatacenter, tier)
- .name(PREFIX + "Hawaian volume").sizeInMb(32).build();
- volume.save();
-
- assertNotNull(volume.getId());
- assertNotNull(env.virtualDatacenter.getVolume(volume.getId()));
- }
-
- @Test(dependsOnMethods = "testCreateVolume")
- public void testFilterVolumes() {
- VolumeOptions validOptions = VolumeOptions.builder().has("hawa").build();
- VolumeOptions invalidOptions = VolumeOptions.builder().has("cacatua").build();
-
- Iterable<Volume> volumes = env.virtualDatacenter.listVolumes(validOptions);
- assertEquals(size(volumes), 1);
-
- volumes = env.virtualDatacenter.listVolumes(invalidOptions);
- assertTrue(isEmpty(volumes));
- }
-
- @Test(dependsOnMethods = "testFilterVolumes")
- public void testUpdateVolume() {
- Volume volume = find(env.virtualDatacenter.listVolumes(), volumeName(PREFIX + "Hawaian volume"));
-
- volume.setName("Hawaian volume updated");
- VirtualMachineTask task = volume.update();
- assertNull(task);
-
- // Reload the volume to check
- Volume updated = env.virtualDatacenter.getVolume(volume.getId());
- assertEquals(updated.getName(), "Hawaian volume updated");
- }
-
- @Test(dependsOnMethods = "testUpdateVolume")
- public void testMoveVolume() {
- // Create the new virtual datacenter
- PrivateNetwork network = PrivateNetwork.builder(env.context.getApiContext()).name("DefaultNetwork")
- .gateway("192.168.1.1").address("192.168.1.0").mask(24).build();
-
- VirtualDatacenter newVdc = VirtualDatacenter.builder(env.context.getApiContext(), env.datacenter, env.enterprise)
- .name("New VDC").network(network).hypervisorType(env.machine.getType()).build();
- newVdc.save();
- assertNotNull(newVdc.getId());
-
- Volume volume = find(env.virtualDatacenter.listVolumes(), volumeName("Hawaian volume updated"));
- volume.moveTo(newVdc);
-
- // Check that the underlying Dto has been updated to the new VDC
- assertTrue(volume.unwrap().getEditLink().getHref().startsWith(newVdc.unwrap().getEditLink().getHref()));
-
- // Move it back to the original VDC
- volume.moveTo(env.virtualDatacenter);
-
- // Check that the underlying Dto has been updated to the new VDC
- assertTrue(volume.unwrap().getEditLink().getHref()
- .startsWith(env.virtualDatacenter.unwrap().getEditLink().getHref()));
-
- // Tear down the virtual datacenter
- newVdc.delete();
- }
-
- @Test(dependsOnMethods = "testMoveVolume")
- public void testDeleteVolume() {
- Volume volume = find(env.virtualDatacenter.listVolumes(), volumeName("Hawaian volume updated"));
-
- Integer id = volume.getId();
- volume.delete();
-
- assertNull(env.virtualDatacenter.getVolume(id));
- }
-
- private static Predicate<Volume> volumeName(final String name) {
- return new Predicate<Volume>() {
- @Override
- public boolean apply(Volume input) {
- return input.getName().equals(name);
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CategoryLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CategoryLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CategoryLiveApiTest.java
deleted file mode 100644
index 89eae02..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/config/CategoryLiveApiTest.java
+++ /dev/null
@@ -1,68 +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.abiquo.domain.config;
-
-import static com.google.common.collect.Iterables.find;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-
-/**
- * Live integration tests for the {@link Category} domain class.
- */
-@Test(groups = "api", testName = "CategoryLiveApiTest")
-public class CategoryLiveApiTest extends BaseAbiquoApiLiveApiTest {
- public void testCreateAndGet() {
- Category category = Category.builder(env.context.getApiContext()).name(PREFIX + "-test-category").build();
- category.save();
-
- Category apiCategory = find(env.context.getAdministrationService().listCategories(), new Predicate<Category>() {
- @Override
- public boolean apply(Category input) {
- return input.getName().equals(PREFIX + "-test-category");
- }
- });
-
- apiCategory.delete();
- }
-
- @Test(dependsOnMethods = "testCreateAndGet")
- public void testUpdate() {
- Iterable<Category> categories = env.context.getAdministrationService().listCategories();
- assertNotNull(categories);
-
- Category category = categories.iterator().next();
- String name = category.getName();
-
- category.setName(PREFIX + "-test-category-updated");
- category.update();
-
- find(env.context.getAdministrationService().listCategories(), new Predicate<Category>() {
- @Override
- public boolean apply(Category input) {
- return input.getName().equals(PREFIX + "-test-category-updated");
- }
- });
-
- category.setName(name);
- category.update();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/config/LicenseLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/config/LicenseLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/config/LicenseLiveApiTest.java
deleted file mode 100644
index 724f87f..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/config/LicenseLiveApiTest.java
+++ /dev/null
@@ -1,44 +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.abiquo.domain.config;
-
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-import static org.testng.Assert.fail;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-/**
- * Live integration tests for the {@link User} domain class.
- */
-@Test(groups = "api", testName = "LicenseLiveApiTest")
-public class LicenseLiveApiTest extends BaseAbiquoApiLiveApiTest {
-
- public void testCreateRepeated() {
- License repeated = License.Builder.fromLicense(env.license).build();
-
- try {
- repeated.add();
- fail("Should not be able to create licenses with the same code");
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "LICENSE-5");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/config/SystemPropertiesLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/config/SystemPropertiesLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/config/SystemPropertiesLiveApiTest.java
deleted file mode 100644
index 8efde3c..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/config/SystemPropertiesLiveApiTest.java
+++ /dev/null
@@ -1,44 +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.abiquo.domain.config;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-/**
- * Live integration tests for the {@link User} domain class.
- */
-@Test(groups = "api", testName = "SystemPropertiesLiveApiTest")
-public class SystemPropertiesLiveApiTest extends BaseAbiquoApiLiveApiTest {
- public void testUpdate() {
- SystemProperty prop = env.administrationService.getSystemProperty("client.dashboard.showStartUpAlert");
-
- String value = prop.getValue();
- prop.setValue("0");
- prop.update();
-
- // Recover the updated datacenter
- SystemProperty updated = env.administrationService.getSystemProperty("client.dashboard.showStartUpAlert");
-
- assertEquals(updated.getValue(), "0");
-
- prop.setValue(value);
- prop.update();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterpriseLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterpriseLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterpriseLiveApiTest.java
deleted file mode 100644
index af1602b..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterpriseLiveApiTest.java
+++ /dev/null
@@ -1,164 +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.abiquo.domain.enterprise;
-
-import static com.google.common.collect.Iterables.get;
-import static com.google.common.collect.Iterables.isEmpty;
-import static com.google.common.collect.Iterables.size;
-import static org.jclouds.abiquo.reference.AbiquoTestConstants.PREFIX;
-import static org.jclouds.abiquo.util.Assert.assertHasError;
-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 static org.testng.Assert.fail;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.abiquo.domain.cloud.VirtualAppliance;
-import org.jclouds.abiquo.domain.cloud.VirtualMachine;
-import org.jclouds.abiquo.domain.enterprise.Enterprise.Builder;
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.enterprise.DatacentersLimitsDto;
-import com.abiquo.server.core.enterprise.EnterpriseDto;
-
-/**
- * Live integration tests for the {@link Enterprise} domain class.
- */
-@Test(groups = "api", testName = "EnterpriseLiveApiTest")
-public class EnterpriseLiveApiTest extends BaseAbiquoApiLiveApiTest {
- private Enterprise enterprise;
-
- private Limits limits;
-
- @BeforeClass
- public void setupEnterprise() {
- enterprise = Enterprise.Builder.fromEnterprise(env.enterprise).build();
- enterprise.setName(PREFIX + "-enterprise-test");
- enterprise.save();
-
- limits = enterprise.allowDatacenter(env.datacenter);
- assertNotNull(limits);
-
- DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
- assertNotNull(limitsDto);
- assertEquals(limitsDto.getCollection().size(), 1);
- }
-
- @AfterClass
- public void tearDownEnterprise() {
- enterprise.prohibitDatacenter(env.datacenter);
-
- try {
- // If a datacenter is not allowed, the limits for it can not be
- // retrieved
- env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "ENTERPRISE-10");
- }
-
- Iterable<Datacenter> allowed = enterprise.listAllowedDatacenters();
- assertNotNull(allowed);
- assertTrue(isEmpty(allowed));
-
- enterprise.delete();
- }
-
- public void testUpdate() {
- enterprise.setName("Updated Enterprise");
- enterprise.update();
-
- // Recover the updated enterprise
- EnterpriseDto updated = env.enterpriseApi.getEnterprise(enterprise.getId());
-
- assertEquals(updated.getName(), "Updated Enterprise");
- }
-
- public void testCreateRepeated() {
- Enterprise repeated = Builder.fromEnterprise(enterprise).build();
-
- try {
- repeated.save();
- fail("Should not be able to create enterprises with the same name");
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.CONFLICT, "ENTERPRISE-4");
- }
- }
-
- public void testAllowTwiceWorks() {
- // Allow the datacenter again and check that the configuration has not
- // changed
- Limits limits = enterprise.allowDatacenter(env.datacenter);
- assertNotNull(limits);
-
- DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
- assertNotNull(limitsDto);
- assertEquals(limitsDto.getCollection().size(), 1);
- }
-
- public void testListLimits() {
- Iterable<Limits> allLimits = enterprise.listLimits();
- assertNotNull(allLimits);
- assertEquals(size(allLimits), 1);
- }
-
- public void testUpdateInvalidLimits() {
- // CPU soft remains to 0 => conflict because hard is smaller
- limits.setCpuCountHardLimit(2);
-
- try {
- limits.update();
- } catch (AbiquoException ex) {
- assertHasError(ex, Status.BAD_REQUEST, "CONSTR-LIMITRANGE");
- }
- }
-
- public void testUpdateLimits() {
- limits.setCpuCountLimits(4, 5);
- limits.update();
-
- DatacentersLimitsDto limitsDto = env.enterpriseApi.getLimits(enterprise.unwrap(), env.datacenter.unwrap());
- assertNotNull(limitsDto);
- assertEquals(limitsDto.getCollection().size(), 1);
- assertEquals(limitsDto.getCollection().get(0).getCpuCountHardLimit(), 5);
- assertEquals(limitsDto.getCollection().get(0).getCpuCountSoftLimit(), 4);
- }
-
- public void testListAllowedDatacenters() {
- Iterable<Datacenter> allowed = enterprise.listAllowedDatacenters();
-
- assertNotNull(allowed);
- assertFalse(isEmpty(allowed));
- assertEquals(get(allowed, 0).getId(), env.datacenter.getId());
- }
-
- public void testListVirtualMachines() {
- Iterable<VirtualMachine> machines = env.defaultEnterprise.listVirtualMachines();
- assertTrue(size(machines) > 0);
- }
-
- public void testListVirtualAppliances() {
- Iterable<VirtualAppliance> vapps = env.defaultEnterprise.listVirtualAppliances();
- assertTrue(size(vapps) > 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterprisePropertiesLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterprisePropertiesLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterprisePropertiesLiveApiTest.java
deleted file mode 100644
index 5eebf8d..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/EnterprisePropertiesLiveApiTest.java
+++ /dev/null
@@ -1,47 +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.abiquo.domain.enterprise;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.enterprise.EnterprisePropertiesDto;
-
-/**
- * Live integration tests for the {@link Enterprise} domain class.
- */
-@Test(groups = "api", testName = "EnterprisePropertiesLiveApiTest")
-public class EnterprisePropertiesLiveApiTest extends BaseAbiquoApiLiveApiTest {
-
- public void testUpdate() {
- EnterpriseProperties properties = env.administrationService.getEnterpriseProperties(env.enterprise);
-
- Integer size = properties.getProperties().size();
- properties.getProperties().put("Prop", "Value");
- properties.update();
-
- // Recover the updated properties
- EnterprisePropertiesDto updated = env.enterpriseApi.getEnterpriseProperties(env.enterprise.unwrap());
-
- assertEquals(updated.getProperties().size(), size + 1);
- assertTrue(updated.getProperties().containsKey("Prop"));
- assertTrue(updated.getProperties().containsValue("Value"));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/TemplateDefinitionListLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/TemplateDefinitionListLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/TemplateDefinitionListLiveApiTest.java
deleted file mode 100644
index 9452367..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/domain/enterprise/TemplateDefinitionListLiveApiTest.java
+++ /dev/null
@@ -1,75 +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.abiquo.domain.enterprise;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.size;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.abiquo.internal.BaseAbiquoApiLiveApiTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-
-/**
- * Live integration tests for the {@link TemplateDefinitionList} domain class.
- */
-@Test(groups = "api", testName = "TemplateDefinitionListLiveApiTest")
-public class TemplateDefinitionListLiveApiTest extends BaseAbiquoApiLiveApiTest {
- private TemplateDefinitionList list;
-
- public void testUpdate() {
- list.setName(list.getName() + "Updated");
- list.update();
-
- Iterable<TemplateDefinitionList> lists = filter(env.enterprise.listTemplateDefinitionLists(),
- new Predicate<TemplateDefinitionList>() {
- @Override
- public boolean apply(TemplateDefinitionList input) {
- return input.getName().equals("myListUpdated");
- }
- });
-
- assertEquals(size(lists), 1);
- }
-
- public void testListStates() {
- Iterable<TemplateState> states = list.listStatus(env.datacenter);
- assertNotNull(states);
- }
-
- @BeforeClass
- public void setup() {
- list = TemplateDefinitionList.builder(env.context.getApiContext(), env.enterprise).name("myList")
- .url("http://virtualapp-repository.com/vapp1.ovf").build();
-
- list.save();
-
- assertNotNull(list.getId());
- }
-
- @AfterClass
- public void tearDown() {
- Integer idTemplateList = list.getId();
- list.delete();
- assertNull(env.enterprise.getTemplateDefinitionList(idTemplateList));
- }
-}