mirror of https://github.com/apache/jclouds.git
Issue 695: Added live test for VirtualMachineClient. Hardcodes exising vm for now
This commit is contained in:
parent
5c09b1befe
commit
7206ca1892
|
@ -20,6 +20,7 @@ package org.jclouds.tmrk.enterprisecloud;
|
||||||
|
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.tmrk.enterprisecloud.features.TaskAsyncClient;
|
import org.jclouds.tmrk.enterprisecloud.features.TaskAsyncClient;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.features.VirtualMachineAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to TerremarkEnterpriseCloud via their REST API.
|
* Provides asynchronous access to TerremarkEnterpriseCloud via their REST API.
|
||||||
|
@ -38,4 +39,10 @@ public interface TerremarkEnterpriseCloudAsyncClient {
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
TaskAsyncClient getTaskClient();
|
TaskAsyncClient getTaskClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides asynchronous access to VirtualMachine features.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
VirtualMachineAsyncClient getVirtualMachineClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.tmrk.enterprisecloud.features.TaskClient;
|
import org.jclouds.tmrk.enterprisecloud.features.TaskClient;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.features.VirtualMachineClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to TerremarkEnterpriseCloud.
|
* Provides synchronous access to TerremarkEnterpriseCloud.
|
||||||
|
@ -42,4 +43,10 @@ public interface TerremarkEnterpriseCloudClient {
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
TaskClient getTaskClient();
|
TaskClient getTaskClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to VirtualMachine features.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
VirtualMachineClient getVirtualMachineClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ import org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudAsyncClient;
|
||||||
import org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudClient;
|
import org.jclouds.tmrk.enterprisecloud.TerremarkEnterpriseCloudClient;
|
||||||
import org.jclouds.tmrk.enterprisecloud.features.TaskAsyncClient;
|
import org.jclouds.tmrk.enterprisecloud.features.TaskAsyncClient;
|
||||||
import org.jclouds.tmrk.enterprisecloud.features.TaskClient;
|
import org.jclouds.tmrk.enterprisecloud.features.TaskClient;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.features.VirtualMachineAsyncClient;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.features.VirtualMachineClient;
|
||||||
import org.jclouds.tmrk.enterprisecloud.handlers.TerremarkEnterpriseCloudErrorHandler;
|
import org.jclouds.tmrk.enterprisecloud.handlers.TerremarkEnterpriseCloudErrorHandler;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
@ -47,8 +49,9 @@ import com.google.common.collect.ImmutableMap;
|
||||||
public class TerremarkEnterpriseCloudRestClientModule extends
|
public class TerremarkEnterpriseCloudRestClientModule extends
|
||||||
RestClientModule<TerremarkEnterpriseCloudClient, TerremarkEnterpriseCloudAsyncClient> {
|
RestClientModule<TerremarkEnterpriseCloudClient, TerremarkEnterpriseCloudAsyncClient> {
|
||||||
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
||||||
.put(TaskClient.class, TaskAsyncClient.class)//
|
.put(TaskClient.class, TaskAsyncClient.class)
|
||||||
|
.put(VirtualMachineClient.class, VirtualMachineAsyncClient.class)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public TerremarkEnterpriseCloudRestClientModule() {
|
public TerremarkEnterpriseCloudRestClientModule() {
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds 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.tmrk.enterprisecloud.features;
|
||||||
|
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.VirtualMachine;
|
||||||
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of {@code VirtualMachineClient}
|
||||||
|
*
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
@Test(groups = "live", testName = "VirtualMachineClientLiveTest")
|
||||||
|
public class VirtualMachineClientLiveTest extends BaseTerremarkEnterpriseCloudClientLiveTest {
|
||||||
|
@BeforeGroups(groups = { "live" })
|
||||||
|
public void setupClient() {
|
||||||
|
super.setupClient();
|
||||||
|
client = context.getApi().getVirtualMachineClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
private VirtualMachineClient client;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetVirtualMachine() {
|
||||||
|
// TODO: don't hard-code id
|
||||||
|
VirtualMachine virtualMachine = client.getVirtualMachine(5504);
|
||||||
|
assert null != virtualMachine;
|
||||||
|
assertEquals(virtualMachine.getStatus(),VirtualMachine.VirtualMachineStatus.DEPLOYED);
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,7 +41,6 @@ import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.testng.collections.Sets;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
Loading…
Reference in New Issue