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:18 UTC

[03/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/features/VirtualMachineTemplateApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateApiTest.java
deleted file mode 100644
index 85b771e..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateApiTest.java
+++ /dev/null
@@ -1,208 +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.features;
-
-import static org.jclouds.abiquo.domain.DomainUtils.withHeader;
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.abiquo.domain.TemplateResources;
-import org.jclouds.abiquo.domain.cloud.options.ConversionOptions;
-import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull;
-import org.jclouds.http.functions.ParseXMLWithJAXB;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.abiquo.model.enumerator.ConversionState;
-import com.abiquo.model.enumerator.DiskFormatType;
-import com.abiquo.model.enumerator.HypervisorType;
-import com.abiquo.model.transport.AcceptedRequestDto;
-import com.abiquo.server.core.appslibrary.ConversionDto;
-import com.abiquo.server.core.appslibrary.ConversionsDto;
-import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto;
-import com.abiquo.server.core.appslibrary.VirtualMachineTemplatePersistentDto;
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-
-/**
- * Tests annotation parsing of {@code VirtualMachineTemplateApi}
- */
-@Test(groups = "unit", testName = "VirtualMachineTemplateApiTest")
-public class VirtualMachineTemplateApiTest extends BaseAbiquoApiTest<VirtualMachineTemplateApi> {
-   /*********************** Virtual Machine Template ***********************/
-
-   public void testGetVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "getVirtualMachineTemplate", Integer.class,
-            Integer.class, Integer.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1, 1, 1)));
-
-      assertRequestLineEquals(request,
-            "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplateDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-
-   public void testUpdateVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "updateVirtualMachineTemplate",
-            VirtualMachineTemplateDto.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
-            ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
-
-      assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
-            + "virtualmachinetemplates/1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplateDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, withHeader(TemplateResources.virtualMachineTemplatePutPayload()),
-            VirtualMachineTemplateDto.class, VirtualMachineTemplateDto.BASE_MEDIA_TYPE, false);
-
-      assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testDeleteVirtualMachineTemplate() throws SecurityException, NoSuchMethodException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "deleteVirtualMachineTemplate",
-            VirtualMachineTemplateDto.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
-            ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
-
-      assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
-            + "virtualmachinetemplates/1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testCreatePersistentVirtualMachineTemplate() throws SecurityException, NoSuchMethodException,
-         IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "createPersistentVirtualMachineTemplate",
-            Integer.class, Integer.class, VirtualMachineTemplatePersistentDto.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
-            ImmutableList.<Object> of(1, 1, TemplateResources.persistentData())));
-
-      assertRequestLineEquals(request,
-            "POST http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, withHeader(TemplateResources.persistentPayload()),
-            VirtualMachineTemplatePersistentDto.BASE_MEDIA_TYPE, false);
-
-      assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   /*********************** Conversions ***********************/
-
-   public void testRequestConversion() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "requestConversion",
-            VirtualMachineTemplateDto.class, DiskFormatType.class, ConversionDto.class);
-
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
-            TemplateResources.virtualMachineTemplatePut(), DiskFormatType.VMDK_STREAM_OPTIMIZED,
-            TemplateResources.conversionPut())));
-
-      assertRequestLineEquals(request,
-            "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/"
-                  + "1/conversions/VMDK_STREAM_OPTIMIZED HTTP/1.1");
-
-      assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, withHeader(TemplateResources.conversionPutPlayload()),
-            ConversionDto.BASE_MEDIA_TYPE, false);
-
-      assertResponseParserClassEquals(method, request, ReturnTaskReferenceOrNull.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testListConversions() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "listConversions",
-            VirtualMachineTemplateDto.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
-            ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
-
-      assertRequestLineEquals(request,
-            "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/"
-                  + "1/conversions HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testListConversionsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "listConversions",
-            VirtualMachineTemplateDto.class, ConversionOptions.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(
-            method,
-            ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(), ConversionOptions.builder()
-                  .hypervisorType(HypervisorType.XENSERVER).conversionState(ConversionState.FINISHED).build())));
-
-      assertRequestLineEquals(request,
-            "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/"
-                  + "1/conversions" + "?hypervisor=XENSERVER&state=FINISHED HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testGetConversion() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VirtualMachineTemplateApi.class, "getConversion",
-            VirtualMachineTemplateDto.class, DiskFormatType.class);
-      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
-            ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(), DiskFormatType.RAW)));
-
-      assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
-            + "virtualmachinetemplates/1/conversions/RAW HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: " + ConversionDto.BASE_MEDIA_TYPE + "\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/functions/ReturnTaskReferenceOrNullTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/functions/ReturnTaskReferenceOrNullTest.java b/abiquo/src/test/java/org/jclouds/abiquo/functions/ReturnTaskReferenceOrNullTest.java
deleted file mode 100644
index c2f07c8..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/functions/ReturnTaskReferenceOrNullTest.java
+++ /dev/null
@@ -1,90 +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.functions;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.easymock.EasyMock;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-import org.jclouds.xml.internal.JAXBParser;
-import org.testng.annotations.Test;
-
-import com.abiquo.model.transport.AcceptedRequestDto;
-import com.google.common.base.Function;
-import com.google.common.io.ByteSource;
-import com.google.inject.TypeLiteral;
-
-/**
- * Unit tests for the {@link ReturnTaskReferenceOrNull} function.
- */
-@Test(groups = "unit", testName = "ReturnTaskReferenceOrNullTest")
-public class ReturnTaskReferenceOrNullTest {
-   public void testReturnNullIfNoContent() {
-      Function<HttpResponse, AcceptedRequestDto<String>> function = new ReturnTaskReferenceOrNull(new JAXBParser(
-            "false"), createTypeLiteral());
-
-      HttpResponse response = EasyMock.createMock(HttpResponse.class);
-
-      expect(response.getStatusCode()).andReturn(Status.NO_CONTENT.getStatusCode());
-      expect(response.getPayload()).andReturn(null);
-
-      replay(response);
-
-      assertNull(function.apply(response));
-
-      verify(response);
-   }
-
-   public void testReturnTaskIfAccepted() throws IOException {
-      JAXBParser parser = new JAXBParser("false");
-      AcceptedRequestDto<?> task = new AcceptedRequestDto<String>();
-      Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(parser.toXML(task).getBytes()));
-
-      Function<HttpResponse, AcceptedRequestDto<String>> function = new ReturnTaskReferenceOrNull(parser,
-            createTypeLiteral());
-
-      HttpResponse response = EasyMock.createMock(HttpResponse.class);
-
-      expect(response.getStatusCode()).andReturn(Status.ACCEPTED.getStatusCode());
-      // Get payload is called three times: one to deserialize it, and twice to
-      // release it
-      expect(response.getPayload()).andReturn(payload);
-      expect(response.getPayload()).andReturn(payload);
-      expect(response.getPayload()).andReturn(payload);
-
-      replay(response);
-
-      assertTrue(function.apply(response) instanceof AcceptedRequestDto);
-
-      verify(response);
-   }
-
-   private static TypeLiteral<AcceptedRequestDto<String>> createTypeLiteral() {
-      return new TypeLiteral<AcceptedRequestDto<String>>() {
-      };
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/functions/auth/GetTokenFromApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/functions/auth/GetTokenFromApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/functions/auth/GetTokenFromApiTest.java
index d365db1..25c68ba 100644
--- a/abiquo/src/test/java/org/jclouds/abiquo/functions/auth/GetTokenFromApiTest.java
+++ b/abiquo/src/test/java/org/jclouds/abiquo/functions/auth/GetTokenFromApiTest.java
@@ -24,7 +24,7 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
-import javax.ws.rs.core.Cookie;
+import java.net.HttpCookie;
 
 import org.easymock.EasyMock;
 import org.jclouds.http.HttpResponse;
@@ -45,7 +45,7 @@ public class GetTokenFromApiTest {
       expect(response.getHeaders()).andReturn(ImmutableMultimap.<String, String> of());
       replay(response);
 
-      Optional<Cookie> token = readAuthenticationToken(response);
+      Optional<HttpCookie> token = readAuthenticationToken(response);
       assertFalse(token.isPresent());
 
       verify(response);
@@ -56,30 +56,30 @@ public class GetTokenFromApiTest {
       expect(response.getHeaders()).andReturn(ImmutableMultimap.<String, String> of("Accept", "application/xml"));
       replay(response);
 
-      Optional<Cookie> token = readAuthenticationToken(response);
+      Optional<HttpCookie> token = readAuthenticationToken(response);
       assertFalse(token.isPresent());
 
       verify(response);
    }
 
-   public void testGetTokenWithOtherCookie() {
+   public void testGetTokenWithOtherHttpCookie() {
       HttpResponse response = EasyMock.createMock(HttpResponse.class);
       expect(response.getHeaders()).andReturn(ImmutableMultimap.<String, String> of(HttpHeaders.SET_COOKIE, "foo=bar"));
       replay(response);
 
-      Optional<Cookie> token = readAuthenticationToken(response);
+      Optional<HttpCookie> token = readAuthenticationToken(response);
       assertFalse(token.isPresent());
 
       verify(response);
    }
 
-   public void testGetTokenWithAuthenticationCookie() {
+   public void testGetTokenWithAuthenticationHttpCookie() {
       HttpResponse response = EasyMock.createMock(HttpResponse.class);
       expect(response.getHeaders()).andReturn(
             ImmutableMultimap.<String, String> of(HttpHeaders.SET_COOKIE, "auth=the-token"));
       replay(response);
 
-      Optional<Cookie> token = readAuthenticationToken(response);
+      Optional<HttpCookie> token = readAuthenticationToken(response);
       assertTrue(token.isPresent());
       assertEquals(token.get().getName(), "auth");
       assertEquals(token.get().getValue(), "the-token");

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/functions/enterprise/ParseEnterpriseIdTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/functions/enterprise/ParseEnterpriseIdTest.java b/abiquo/src/test/java/org/jclouds/abiquo/functions/enterprise/ParseEnterpriseIdTest.java
deleted file mode 100644
index ab73725..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/functions/enterprise/ParseEnterpriseIdTest.java
+++ /dev/null
@@ -1,56 +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.functions.enterprise;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.enterprise.EnterpriseDto;
-import com.google.common.base.Function;
-
-/**
- * Unit tests for the {@link ParseEnterpriseId} function.
- */
-@Test(groups = "unit", testName = "ParseEnterpriseIdTest")
-public class ParseEnterpriseIdTest {
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidNullInput() {
-      Function<Object, String> parser = new ParseEnterpriseId();
-      parser.apply(null);
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testInvalidInputType() {
-      Function<Object, String> parser = new ParseEnterpriseId();
-      parser.apply(new Object());
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidId() {
-      Function<Object, String> parser = new ParseEnterpriseId();
-      parser.apply(new EnterpriseDto());
-   }
-
-   public void testValidId() {
-      Function<Object, String> parser = new ParseEnterpriseId();
-
-      EnterpriseDto enterprise = new EnterpriseDto();
-      enterprise.setId(5);
-      assertEquals(parser.apply(enterprise), "5");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseDatacenterIdTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseDatacenterIdTest.java b/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseDatacenterIdTest.java
deleted file mode 100644
index 4419418..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseDatacenterIdTest.java
+++ /dev/null
@@ -1,56 +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.functions.infrastructure;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.infrastructure.DatacenterDto;
-import com.google.common.base.Function;
-
-/**
- * Unit tests for the {@link ParseDatacenterId} function.
- */
-@Test(groups = "unit", testName = "ParseDatacenterIdTest")
-public class ParseDatacenterIdTest {
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidNullInput() {
-      Function<Object, String> parser = new ParseDatacenterId();
-      parser.apply(null);
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testInvalidInputType() {
-      Function<Object, String> parser = new ParseDatacenterId();
-      parser.apply(new Object());
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidId() {
-      Function<Object, String> parser = new ParseDatacenterId();
-      parser.apply(new DatacenterDto());
-   }
-
-   public void testValidId() {
-      Function<Object, String> parser = new ParseDatacenterId();
-
-      DatacenterDto datacenter = new DatacenterDto();
-      datacenter.setId(5);
-      assertEquals(parser.apply(datacenter), "5");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseMachineIdTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseMachineIdTest.java b/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseMachineIdTest.java
deleted file mode 100644
index f26d3e4..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseMachineIdTest.java
+++ /dev/null
@@ -1,56 +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.functions.infrastructure;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.infrastructure.MachineDto;
-import com.google.common.base.Function;
-
-/**
- * Unit tests for the {@link ParseMachineId} function.
- */
-@Test(groups = "unit", testName = "ParseMachineIdTest")
-public class ParseMachineIdTest {
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidNullInput() {
-      Function<Object, String> parser = new ParseMachineId();
-      parser.apply(null);
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testInvalidInputType() {
-      Function<Object, String> parser = new ParseMachineId();
-      parser.apply(new Object());
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidId() {
-      Function<Object, String> parser = new ParseMachineId();
-      parser.apply(new MachineDto());
-   }
-
-   public void testValidId() {
-      Function<Object, String> parser = new ParseMachineId();
-
-      MachineDto machine = new MachineDto();
-      machine.setId(5);
-      assertEquals(parser.apply(machine), "5");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseRemoteServiceTypeTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseRemoteServiceTypeTest.java b/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseRemoteServiceTypeTest.java
deleted file mode 100644
index 409be7c..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/functions/infrastructure/ParseRemoteServiceTypeTest.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.functions.infrastructure;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-import com.abiquo.model.enumerator.RemoteServiceType;
-import com.google.common.base.Function;
-
-/**
- * Unit tests for the {@link ParseRemoteServiceType} functions.
- */
-@Test(groups = "unit", testName = "ParseRemoteServiceTypeTest")
-public class ParseRemoteServiceTypeTest {
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidNullInput() {
-      Function<Object, String> parser = new ParseRemoteServiceType();
-      parser.apply(null);
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testInvalidInputType() {
-      Function<Object, String> parser = new ParseRemoteServiceType();
-      parser.apply(new Object());
-   }
-
-   public void testValidId() {
-      Function<Object, String> parser = new ParseRemoteServiceType();
-      assertEquals(parser.apply(RemoteServiceType.BPM_SERVICE), "bpmservice");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/http/filters/AppendApiVersionToMediaTypeTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/http/filters/AppendApiVersionToMediaTypeTest.java b/abiquo/src/test/java/org/jclouds/abiquo/http/filters/AppendApiVersionToMediaTypeTest.java
index 52402d5..3dbbaf3 100644
--- a/abiquo/src/test/java/org/jclouds/abiquo/http/filters/AppendApiVersionToMediaTypeTest.java
+++ b/abiquo/src/test/java/org/jclouds/abiquo/http/filters/AppendApiVersionToMediaTypeTest.java
@@ -23,17 +23,21 @@ import static org.testng.Assert.assertTrue;
 import java.net.URI;
 import java.util.Collection;
 
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.functions.AppendApiVersionToAbiquoMimeType;
+import org.jclouds.abiquo.AbiquoApiMetadata;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.io.Payload;
 import org.jclouds.io.Payloads;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import com.google.common.collect.LinkedHashMultimap;
 import com.google.common.collect.Multimap;
 import com.google.common.io.ByteSource;
 import com.google.common.net.HttpHeaders;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
 
 /**
  * Unit tests for the {@link AppendApiVersionToMediaType} filter.
@@ -41,12 +45,25 @@ import com.google.common.net.HttpHeaders;
 @Test(groups = "unit", testName = "AppendApiVersionToMediaTypeTest")
 public class AppendApiVersionToMediaTypeTest {
 
+   private AppendApiVersionToMediaType filter;
+
+   private AbiquoApiMetadata metadata;
+
+   @BeforeMethod
+   public void setup() {
+      metadata = new AbiquoApiMetadata();
+      Injector injector = Guice.createInjector(new AbstractModule() {
+         @Override
+         protected void configure() {
+            bind(String.class).annotatedWith(ApiVersion.class).toInstance(metadata.getVersion());
+         }
+      });
+      filter = injector.getInstance(AppendApiVersionToMediaType.class);
+   }
+
    public void testAppendVersionToNonPayloadHeadersWithoutHeaders() {
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);
 
       assertTrue(filtered.getHeaders().get(HttpHeaders.ACCEPT).isEmpty());
@@ -54,61 +71,50 @@ public class AppendApiVersionToMediaTypeTest {
 
    public void testAppendVersionToNonPayloadHeadersWithStandardMediaType() {
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/xml");
+      headers.put(HttpHeaders.ACCEPT, "application/json");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);
 
       Collection<String> contentType = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(contentType.size(), 1);
-      assertEquals(contentType.iterator().next(), "application/xml");
+      assertEquals(contentType.iterator().next(), "application/json");
    }
 
    public void testAppendVersionToNonPayloadHeadersWithVersionInMediaType() {
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");
+      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.virtualmachine+json;version=2.1-SNAPSHOT");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);
 
       Collection<String> contentType = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(contentType.size(), 1);
-      assertEquals(contentType.iterator().next(), "application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");
+      assertEquals(contentType.iterator().next(), "application/vnd.abiquo.virtualmachine+json;version=2.1-SNAPSHOT");
    }
 
    public void testAppendVersionToNonPayloadHeadersWithoutVersionInMediaType() {
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml");
+      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.virtualmachine+json");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);
 
       Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(accept.size(), 1);
-      assertEquals(accept.iterator().next(), "application/vnd.abiquo.racks+xml;version=" + AbiquoApi.API_VERSION);
+      assertEquals(accept.iterator().next(),
+            "application/vnd.abiquo.virtualmachine+json;version=" + metadata.getVersion());
    }
 
    public void testAppendVersionToPayloadHeadersWithoutPayload() {
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);
 
       assertNull(filtered.getPayload());
@@ -116,17 +122,14 @@ public class AppendApiVersionToMediaTypeTest {
 
    public void testAppendVersionToPayloadHeadersWithStandardPayload() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/xml");
+      payload.getContentMetadata().setContentType("application/json");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);
 
-      assertEquals(filtered.getPayload().getContentMetadata().getContentType(), "application/xml");
+      assertEquals(filtered.getPayload().getContentMetadata().getContentType(), "application/json");
    }
 
    public void testAppendVersionToPayloadHeadersWithDefaultPayload() {
@@ -135,9 +138,6 @@ public class AppendApiVersionToMediaTypeTest {
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(), "application/unknown");
@@ -145,125 +145,109 @@ public class AppendApiVersionToMediaTypeTest {
 
    public void testAppendVersionToPayloadHeadersWithVersionInPayload() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml;version=1.8.5");
+      payload.getContentMetadata().setContentType("application/vnd.abiquo.virtualmachine+json;version=1.8.5");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
-            "application/vnd.abiquo.racks+xml;version=1.8.5");
+            "application/vnd.abiquo.virtualmachine+json;version=1.8.5");
    }
 
    public void testAppendVersionToPayloadHeadersWithoutVersionInPayload() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml");
+      payload.getContentMetadata().setContentType("application/vnd.abiquo.virtualmachine+json");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
             .build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
-            "application/vnd.abiquo.racks+xml;version=" + AbiquoApi.API_VERSION);
+            "application/vnd.abiquo.virtualmachine+json;version=" + metadata.getVersion());
    }
 
    public void testFilterWithAcceptAndContentTypeWithVersion() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");
+      payload.getContentMetadata().setContentType("application/vnd.abiquo.virtualmachine+json;version=2.1-SNAPSHOT");
 
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");
+      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.virtualmachine+json;version=2.1-SNAPSHOT");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .payload(payload).build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.filter(request);
 
       Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(accept.size(), 1);
-      assertEquals(accept.iterator().next(), "application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");
+      assertEquals(accept.iterator().next(), "application/vnd.abiquo.virtualmachine+json;version=2.1-SNAPSHOT");
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
-            "application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");
+            "application/vnd.abiquo.virtualmachine+json;version=2.1-SNAPSHOT");
    }
 
    public void testFilterWithAcceptAndContentTypeWithoutVersion() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml");
+      payload.getContentMetadata().setContentType("application/vnd.abiquo.virtualmachine+json");
 
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml");
+      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.virtualmachine+json");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .payload(payload).build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.filter(request);
 
       Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(accept.size(), 1);
-      assertEquals(accept.iterator().next(), "application/vnd.abiquo.racks+xml;version=" + AbiquoApi.API_VERSION);
+      assertEquals(accept.iterator().next(),
+            "application/vnd.abiquo.virtualmachine+json;version=" + metadata.getVersion());
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
-            "application/vnd.abiquo.racks+xml;version=" + AbiquoApi.API_VERSION);
+            "application/vnd.abiquo.virtualmachine+json;version=" + metadata.getVersion());
    }
 
    public void testFilterWithversionInAccept() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml");
+      payload.getContentMetadata().setContentType("application/vnd.abiquo.virtualmachine+json");
 
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml;version=1.8.5");
+      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.virtualmachine+json;version=1.8.5");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .payload(payload).build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.filter(request);
 
       Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(accept.size(), 1);
-      assertEquals(accept.iterator().next(), "application/vnd.abiquo.racks+xml;version=1.8.5");
+      assertEquals(accept.iterator().next(), "application/vnd.abiquo.virtualmachine+json;version=1.8.5");
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
-            "application/vnd.abiquo.racks+xml;version=" + AbiquoApi.API_VERSION);
+            "application/vnd.abiquo.virtualmachine+json;version=" + metadata.getVersion());
    }
 
    public void testFilterWithversionInContentType() {
       Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[0]));
-      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml;version=1.8.5");
+      payload.getContentMetadata().setContentType("application/vnd.abiquo.virtualmachine+json;version=1.8.5");
 
       Multimap<String, String> headers = LinkedHashMultimap.<String, String> create();
-      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml");
+      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.virtualmachine+json");
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
             .payload(payload).build();
 
-      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
-            AbiquoApi.API_VERSION));
-
       HttpRequest filtered = filter.filter(request);
 
       Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
       assertEquals(accept.size(), 1);
-      assertEquals(accept.iterator().next(), "application/vnd.abiquo.racks+xml;version=" + AbiquoApi.API_VERSION);
+      assertEquals(accept.iterator().next(),
+            "application/vnd.abiquo.virtualmachine+json;version=" + metadata.getVersion());
 
       assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
-            "application/vnd.abiquo.racks+xml;version=1.8.5");
+            "application/vnd.abiquo.virtualmachine+json;version=1.8.5");
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java
deleted file mode 100644
index ace6707..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java
+++ /dev/null
@@ -1,533 +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.internal;
-
-import static org.easymock.EasyMock.anyLong;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-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.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import org.easymock.EasyMock;
-import org.jclouds.abiquo.internal.BaseMonitoringService.AsyncMonitor;
-import org.jclouds.abiquo.monitor.MonitorStatus;
-import org.jclouds.abiquo.monitor.events.MonitorEvent;
-import org.jclouds.rest.ApiContext;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-
-/**
- * Unit tests for the {@link AsyncMonitor} class.
- */
-@Test(groups = "unit", testName = "AsyncMonitorTest")
-public class AsyncMonitorTest {
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStartMonitoringWithoutTimeout() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "timeUnit must not be null when using timeouts")
-   public void testStartMonitoringWithNullTimeout() {
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      monitor.startMonitoring(100L, null);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStartMonitoringWithoutTimeoutAndNullTimeUnit() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      // If the maxWait parameter is null, timeUnit is not required
-      monitor.startMonitoring(null, null);
-
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStartMonitoringWithTimeout() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(100L, TimeUnit.MILLISECONDS);
-
-      assertNotNull(monitor.getFuture());
-      assertNotNull(monitor.getTimeout());
-      assertTrue(monitor.getTimeout() > 100L);
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStartMonitoringWithTimeoutInMinutes() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(1L, TimeUnit.MINUTES);
-
-      assertNotNull(monitor.getFuture());
-      assertNotNull(monitor.getTimeout());
-      assertTrue(monitor.getTimeout() > TimeUnit.MINUTES.toMillis(1));
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testIsTimeoutWhenNullTimeout() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-      assertFalse(monitor.isTimeout());
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testIsTimeoutReturnsFalseWhenNotFinished() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(60000L, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNotNull(monitor.getTimeout());
-      assertFalse(monitor.isTimeout());
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testIsTimeoutReturnsTrueWhenFinished() throws InterruptedException {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(1L, TimeUnit.MILLISECONDS);
-      Thread.sleep(2L);
-      assertNotNull(monitor.getFuture());
-      assertNotNull(monitor.getTimeout());
-      assertTrue(monitor.isTimeout());
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStopMonitoringWhenFutureIsCancelled() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      expect(mockFuture.isCancelled()).andReturn(true);
-
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.stopMonitoring();
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStopMonitoringWhenFutureIsDone() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      expect(mockFuture.isCancelled()).andReturn(false);
-      expect(mockFuture.isDone()).andReturn(true);
-
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.stopMonitoring();
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testStopMonitoringWhenFutureIsNotComplete() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      expect(mockFuture.isCancelled()).andReturn(false);
-      expect(mockFuture.isDone()).andReturn(false);
-      expect(mockFuture.cancel(false)).andReturn(true);
-
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            new EventBus());
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.stopMonitoring();
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testMonitorAndDone() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      expect(mockFuture.isCancelled()).andReturn(true);
-
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      CoutingEventHandler handler = new CoutingEventHandler();
-      EventBus eventBus = new EventBus();
-      eventBus.register(handler);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
-            eventBus);
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.run();
-      assertEquals(handler.numCompletes, 1);
-      assertEquals(handler.numFailures, 0);
-      assertEquals(handler.numTimeouts, 0);
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testMonitorAndFail() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      expect(mockFuture.isCancelled()).andReturn(true);
-
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      CoutingEventHandler handler = new CoutingEventHandler();
-      EventBus eventBus = new EventBus();
-      eventBus.register(handler);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.FAILED),
-            eventBus);
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.run();
-      assertEquals(handler.numCompletes, 0);
-      assertEquals(handler.numFailures, 1);
-      assertEquals(handler.numTimeouts, 0);
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testMonitorAndContinueWithoutTimeout() {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      CoutingEventHandler handler = new CoutingEventHandler();
-      EventBus eventBus = new EventBus();
-      eventBus.register(handler);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.CONTINUE),
-            eventBus);
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.run();
-      assertEquals(handler.numCompletes, 0);
-      assertEquals(handler.numFailures, 0);
-      assertEquals(handler.numTimeouts, 0);
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @SuppressWarnings({ "rawtypes", "unchecked" })
-   public void testMonitorAndContinueWithtTimeout() throws InterruptedException {
-      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
-      expect(mockFuture.isCancelled()).andReturn(true);
-
-      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
-      expect(
-            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
-                  anyObject(TimeUnit.class))).andReturn(mockFuture);
-
-      replay(mockFuture);
-      replay(schedulerMock);
-
-      CoutingEventHandler handler = new CoutingEventHandler();
-      EventBus eventBus = new EventBus();
-      eventBus.register(handler);
-
-      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.CONTINUE),
-            eventBus);
-
-      assertNull(monitor.getFuture());
-      assertNull(monitor.getTimeout());
-
-      monitor.startMonitoring(1L, TimeUnit.MILLISECONDS);
-      assertNotNull(monitor.getFuture());
-      assertNotNull(monitor.getTimeout());
-
-      Thread.sleep(2L);
-      monitor.run();
-      assertEquals(handler.numCompletes, 0);
-      assertEquals(handler.numFailures, 0);
-      assertEquals(handler.numTimeouts, 1);
-
-      verify(mockFuture);
-      verify(schedulerMock);
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testCreateMonitorWithNullObject() {
-      mockMonitor(null, null, new Function<Object, MonitorStatus>() {
-         @Override
-         public MonitorStatus apply(final Object input) {
-            return MonitorStatus.DONE;
-         }
-      }, new EventBus());
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testCreateMonitorWithNullFunction() {
-      mockMonitor(null, new Object(), null, new EventBus());
-   }
-
-   @SuppressWarnings("unchecked")
-   private AsyncMonitor<Object> mockMonitor(final ScheduledExecutorService scheduler, final Object object,
-         final Function<Object, MonitorStatus> function, final EventBus eventBus) {
-      BaseMonitoringService monitorService = new BaseMonitoringService(EasyMock.createMock(ApiContext.class),
-            scheduler, 100L, eventBus);
-
-      return monitorService.new AsyncMonitor<Object>(object, function);
-   }
-
-   private Function<Object, MonitorStatus> mockFunction(final MonitorStatus status) {
-      return new Function<Object, MonitorStatus>() {
-         @Override
-         public MonitorStatus apply(final Object input) {
-            return status;
-         }
-      };
-   }
-
-   static class CoutingEventHandler {
-      public int numCompletes = 0;
-
-      public int numFailures = 0;
-
-      public int numTimeouts = 0;
-
-      @Subscribe
-      public void handle(final MonitorEvent<?> event) {
-         switch (event.getType()) {
-            case COMPLETED:
-               numCompletes++;
-               break;
-            case FAILED:
-               numFailures++;
-               break;
-            case TIMEOUT:
-               numTimeouts++;
-               break;
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoApiLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoApiLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoApiLiveApiTest.java
deleted file mode 100644
index 43812f6..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoApiLiveApiTest.java
+++ /dev/null
@@ -1,77 +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.internal;
-
-import org.jclouds.abiquo.environment.CloudTestEnvironment;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-/**
- * Base class for live and domain tests.
- */
-@Test(groups = "api", testName = "BaseAbiquoApiLiveApiTest", singleThreaded = true)
-public abstract class BaseAbiquoApiLiveApiTest extends BaseAbiquoLiveApiTest {
-   /** The test environment. */
-   protected static CloudTestEnvironment env;
-
-   @Override
-   @BeforeSuite(groups = "api")
-   public void setupContext() {
-      super.setupContext();
-      setupEnvironment();
-   }
-
-   @Override
-   @AfterSuite(groups = "api")
-   protected void tearDownContext() {
-      try {
-         tearDownEnvironment();
-      } finally {
-         // Make sure we close the context
-         super.tearDownContext();
-      }
-   }
-
-   protected void setupEnvironment() {
-      if (env == null) {
-         try {
-            env = new CloudTestEnvironment(view);
-            env.setup();
-         } catch (Exception ex) {
-            super.tearDownContext(); // Make sure we close the context setup
-                                     // fails
-            throw new RuntimeException("Could not create environment", ex);
-         }
-      }
-   }
-
-   protected void tearDownEnvironment() {
-      if (env != null) {
-         try {
-            env.tearDown();
-
-            // Wait a bit before closing context, to avoid executor shutdown
-            // while
-            // there are still open threads
-            Thread.sleep(1000L);
-         } catch (Exception ex) {
-            throw new RuntimeException("Could not tear down environment", ex);
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoLiveApiTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoLiveApiTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoLiveApiTest.java
deleted file mode 100644
index 96700e2..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAbiquoLiveApiTest.java
+++ /dev/null
@@ -1,61 +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.internal;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.util.Properties;
-
-import org.jclouds.abiquo.AbiquoContext;
-import org.jclouds.apis.BaseViewLiveTest;
-import org.jclouds.logging.config.LoggingModule;
-import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
-
-import com.google.common.reflect.TypeToken;
-
-/**
- * Base class for Abiquo live tests.
- */
-public abstract class BaseAbiquoLiveApiTest extends BaseViewLiveTest<AbiquoContext> {
-   public BaseAbiquoLiveApiTest() {
-      provider = "abiquo";
-   }
-
-   @Override
-   protected Properties setupProperties() {
-      Properties overrides = super.setupProperties();
-      // Wait at most one minute in Machine discovery
-      overrides.put("jclouds.timeouts.InfrastructureApi.discoverSingleMachine", "60000");
-      overrides.put("jclouds.timeouts.InfrastructureApi.discoverMultipleMachines", "60000");
-      overrides.put("jclouds.timeouts.InfrastructureApi.createMachine", "60000");
-      overrides.put("jclouds.timeouts.InfrastructureApi.updateMachine", "60000");
-      overrides.put("jclouds.timeouts.InfrastructureApi.checkMachineState", "60000");
-      overrides.put("jclouds.timeouts.CloudApi.listVirtualMachines", "60000");
-      return overrides;
-   }
-
-   @Override
-   protected LoggingModule getLoggingModule() {
-      return new SLF4JLoggingModule();
-   }
-
-   @Override
-   protected TypeToken<AbiquoContext> viewType() {
-      return typeToken(AbiquoContext.class);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAdministrationServiceTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAdministrationServiceTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAdministrationServiceTest.java
deleted file mode 100644
index ac3e62c..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseAdministrationServiceTest.java
+++ /dev/null
@@ -1,38 +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.internal;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.abiquo.features.services.AdministrationService;
-import org.testng.annotations.Test;
-
-/**
- * Unit tests for the {@link BaseAdministrationService} class.
- */
-@Test(groups = "unit", testName = "BaseAdministrationServiceTest")
-public class BaseAdministrationServiceTest extends BaseInjectionTest {
-
-   public void testAllPropertiesInjected() {
-      BaseAdministrationService service = (BaseAdministrationService) injector.getInstance(AdministrationService.class);
-
-      assertNotNull(service.context);
-      assertNotNull(service.listMachines);
-      assertNotNull(service.currentUser);
-      assertNotNull(service.currentEnterprise);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseCloudServiceTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseCloudServiceTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseCloudServiceTest.java
deleted file mode 100644
index 82e3767..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseCloudServiceTest.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.internal;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.abiquo.features.services.CloudService;
-import org.testng.annotations.Test;
-
-/**
- * Unit tests for the {@link BaseCloudService} class.
- */
-@Test(groups = "unit", testName = "BaseCloudServiceTest")
-public class BaseCloudServiceTest extends BaseInjectionTest {
-
-   public void testAllPropertiesInjected() {
-      BaseCloudService service = (BaseCloudService) injector.getInstance(CloudService.class);
-
-      assertNotNull(service.context);
-      assertNotNull(service.listVirtualDatacenters);
-      assertNotNull(service.listVirtualAppliances);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseEventServiceTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseEventServiceTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseEventServiceTest.java
deleted file mode 100644
index ce4bd83..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseEventServiceTest.java
+++ /dev/null
@@ -1,34 +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.internal;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.abiquo.features.services.EventService;
-import org.testng.annotations.Test;
-
-/**
- * Unit tests for the {@link BaseEventService} class.
- */
-@Test(groups = "unit", testName = "BaseEventServiceTest")
-public class BaseEventServiceTest extends BaseInjectionTest {
-   public void testAllPropertiesInjected() {
-      BaseEventService service = (BaseEventService) injector.getInstance(EventService.class);
-
-      assertNotNull(service.context);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseInjectionTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseInjectionTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseInjectionTest.java
deleted file mode 100644
index 8664cee..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseInjectionTest.java
+++ /dev/null
@@ -1,61 +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.internal;
-
-import java.util.Properties;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.abiquo.AbiquoApiMetadata;
-import org.jclouds.abiquo.AbiquoContext;
-import org.jclouds.lifecycle.Closer;
-import org.jclouds.logging.config.NullLoggingModule;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * Unit tests for the {@link BaseCloudService} class.
- */
-@Test(groups = "unit", testName = "BaseEventServiceTest")
-public class BaseInjectionTest {
-   protected Injector injector;
-
-   @BeforeClass
-   public void setup() {
-      injector = ContextBuilder.newBuilder(new AbiquoApiMetadata()) //
-            .credentials("identity", "credential") //
-            .modules(ImmutableSet.<Module> of(new NullLoggingModule())) //
-            .overrides(buildProperties()) //
-            .build(AbiquoContext.class).utils().injector();
-   }
-
-   protected Properties buildProperties() {
-      return new Properties();
-   }
-
-   @AfterClass
-   public void tearDown() throws Exception {
-      if (injector != null) {
-         injector.getInstance(Closer.class).close();
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseMonitoringServiceTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseMonitoringServiceTest.java b/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseMonitoringServiceTest.java
deleted file mode 100644
index e60ceb5..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/internal/BaseMonitoringServiceTest.java
+++ /dev/null
@@ -1,90 +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.internal;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.abiquo.features.services.MonitoringService;
-import org.jclouds.abiquo.monitor.MonitorStatus;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-
-/**
- * Unit tests for the {@link BaseMonitoringService} class.
- */
-@Test(groups = "unit", testName = "BaseMonitoringServiceTest")
-public class BaseMonitoringServiceTest extends BaseInjectionTest {
-   public void testAllPropertiesInjected() {
-      BaseMonitoringService service = (BaseMonitoringService) injector.getInstance(MonitoringService.class);
-
-      assertNotNull(service.context);
-      assertNotNull(service.scheduler);
-      assertNotNull(service.pollingDelay);
-      assertNotNull(service.eventBus);
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testAwaitCompletionWithNullFunction() {
-      monitoringService().awaitCompletion(null, new Object[] {});
-   }
-
-   public void testAwaitCompletionWithoutTasks() {
-      BaseMonitoringService service = monitoringService();
-
-      service.awaitCompletion(new MockMonitor());
-      service.awaitCompletion(new MockMonitor(), (Object[]) null);
-      service.awaitCompletion(new MockMonitor(), new Object[] {});
-   }
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testMonitorWithNullCompleteCondition() {
-      monitoringService().monitor(null, (Object[]) null);
-   }
-
-   public void testMonitorWithoutTasks() {
-      monitoringService().monitor(new MockMonitor());
-   }
-
-   public void testDelegateToVirtualMachineMonitor() {
-      assertNotNull(monitoringService().getVirtualMachineMonitor());
-   }
-
-   public void testDelegateToVirtualApplianceMonitor() {
-      assertNotNull(monitoringService().getVirtualApplianceMonitor());
-   }
-
-   public void testDelegateToAsyncTaskMonitor() {
-      assertNotNull(monitoringService().getAsyncTaskMonitor());
-   }
-
-   public void testDelegateToConversioMonitor() {
-      assertNotNull(monitoringService().getConversionMonitor());
-   }
-
-   private BaseMonitoringService monitoringService() {
-      return injector.getInstance(BaseMonitoringService.class);
-   }
-
-   private static class MockMonitor implements Function<Object, MonitorStatus> {
-      @Override
-      public MonitorStatus apply(final Object object) {
-         return MonitorStatus.DONE;
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/test/java/org/jclouds/abiquo/monitor/functions/AsyncTaskStatusMonitorTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/monitor/functions/AsyncTaskStatusMonitorTest.java b/abiquo/src/test/java/org/jclouds/abiquo/monitor/functions/AsyncTaskStatusMonitorTest.java
deleted file mode 100644
index c313978..0000000
--- a/abiquo/src/test/java/org/jclouds/abiquo/monitor/functions/AsyncTaskStatusMonitorTest.java
+++ /dev/null
@@ -1,96 +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.monitor.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import org.easymock.EasyMock;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.abiquo.domain.task.VirtualMachineTask;
-import org.jclouds.abiquo.monitor.MonitorStatus;
-import org.jclouds.rest.ApiContext;
-import org.testng.annotations.Test;
-
-import com.abiquo.server.core.task.TaskDto;
-import com.abiquo.server.core.task.enums.TaskState;
-import com.google.common.base.Function;
-
-/**
- * Unit tests for the {@link AsyncTaskStatusMonitor} function.
- */
-@Test(groups = "unit", testName = "AsyncTaskStatusMonitorTest")
-public class AsyncTaskStatusMonitorTest {
-
-   @Test(expectedExceptions = NullPointerException.class)
-   public void testInvalidNullArgument() {
-      Function<AsyncTask<?, ?>, MonitorStatus> function = new AsyncTaskStatusMonitor();
-      function.apply(null);
-   }
-
-   public void testReturnDone() {
-      TaskState[] states = { TaskState.FINISHED_SUCCESSFULLY };
-
-      checkStatesReturn(new MockAsyncTask(), new AsyncTaskStatusMonitor(), states, MonitorStatus.DONE);
-   }
-
-   public void testReturnFail() {
-      TaskState[] states = { TaskState.ABORTED, TaskState.FINISHED_UNSUCCESSFULLY };
-
-      checkStatesReturn(new MockAsyncTask(), new AsyncTaskStatusMonitor(), states, MonitorStatus.FAILED);
-   }
-
-   public void testReturnContinue() {
-      TaskState[] states = { TaskState.STARTED, TaskState.PENDING };
-
-      checkStatesReturn(new MockAsyncTask(), new AsyncTaskStatusMonitor(), states, MonitorStatus.CONTINUE);
-
-      checkStatesReturn(new MockAsyncTaskFailing(), new AsyncTaskStatusMonitor(), states, MonitorStatus.CONTINUE);
-   }
-
-   private void checkStatesReturn(final MockAsyncTask task, final Function<AsyncTask<?, ?>, MonitorStatus> function,
-         final TaskState[] states, final MonitorStatus expectedStatus) {
-      for (TaskState state : states) {
-         task.setState(state);
-         assertEquals(function.apply(task), expectedStatus);
-      }
-   }
-
-   private static class MockAsyncTask extends VirtualMachineTask {
-      @SuppressWarnings("unchecked")
-      public MockAsyncTask() {
-         super(EasyMock.createMock(ApiContext.class), new TaskDto());
-      }
-
-      @Override
-      public void refresh() {
-         // Do not perform any API call
-      }
-
-      public void setState(final TaskState state) {
-         target.setState(state);
-      }
-   }
-
-   private static class MockAsyncTaskFailing extends MockAsyncTask {
-      @Override
-      public void refresh() {
-         throw new RuntimeException("This mock class always fails to refresh");
-      }
-
-   }
-
-}