Repository: jclouds-labs Updated Branches: refs/heads/2.0.x eca63496f -> b151914f0
edit VirtualMachineApi.create to createOrUpdate - add live test for update vm - update virtual machine api docs - fix VirtualMachineApiMockTest Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/b151914f Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/b151914f Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/b151914f Branch: refs/heads/2.0.x Commit: b151914f0b8728ada93958d9d1074273df7a484f Parents: eca6349 Author: Andrea Turli <[email protected]> Authored: Thu Mar 2 22:22:42 2017 +0100 Committer: Andrea Turli <[email protected]> Committed: Fri Mar 3 15:30:02 2017 +0100 ---------------------------------------------------------------------- .../arm/AzureComputeProviderMetadata.java | 38 +++++++-------- .../arm/compute/AzureComputeServiceAdapter.java | 32 ++++++------- .../functions/VirtualMachineToNodeMetadata.java | 24 +++++----- .../arm/features/VirtualMachineApi.java | 40 ++++------------ .../arm/features/VirtualMachineApiLiveTest.java | 50 +++++++++++++++----- .../arm/features/VirtualMachineApiMockTest.java | 4 +- 6 files changed, 94 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b151914f/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java index a4c2bbe..08979b7 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java @@ -17,24 +17,6 @@ package org.jclouds.azurecompute.arm; -import static org.jclouds.Constants.PROPERTY_MAX_RATE_LIMIT_WAIT; -import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.API_VERSION_PREFIX; -import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.DEFAULT_SUBNET_ADDRESS_PREFIX; -import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.DEFAULT_VNET_ADDRESS_SPACE_PREFIX; -import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.IMAGE_PUBLISHERS; -import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.OPERATION_TIMEOUT; -import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_AUTHENTICATE_SUDO; -import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_LOGIN_USER; -import static org.jclouds.compute.config.ComputeServiceProperties.POLL_INITIAL_PERIOD; -import static org.jclouds.compute.config.ComputeServiceProperties.POLL_MAX_PERIOD; -import static org.jclouds.compute.config.ComputeServiceProperties.RESOURCENAME_DELIMITER; -import static org.jclouds.compute.config.ComputeServiceProperties.RESOURCENAME_PREFIX; -import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE; -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED; -import static org.jclouds.oauth.v2.config.CredentialType.CLIENT_CREDENTIALS_SECRET; -import static org.jclouds.oauth.v2.config.OAuthProperties.CREDENTIAL_TYPE; -import static org.jclouds.oauth.v2.config.OAuthProperties.RESOURCE; - import java.net.URI; import java.util.Properties; @@ -60,6 +42,24 @@ import org.jclouds.providers.internal.BaseProviderMetadata; import com.google.auto.service.AutoService; +import static org.jclouds.Constants.PROPERTY_MAX_RATE_LIMIT_WAIT; +import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.API_VERSION_PREFIX; +import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.DEFAULT_SUBNET_ADDRESS_PREFIX; +import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.DEFAULT_VNET_ADDRESS_SPACE_PREFIX; +import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.IMAGE_PUBLISHERS; +import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.OPERATION_TIMEOUT; +import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_AUTHENTICATE_SUDO; +import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_LOGIN_USER; +import static org.jclouds.compute.config.ComputeServiceProperties.POLL_INITIAL_PERIOD; +import static org.jclouds.compute.config.ComputeServiceProperties.POLL_MAX_PERIOD; +import static org.jclouds.compute.config.ComputeServiceProperties.RESOURCENAME_DELIMITER; +import static org.jclouds.compute.config.ComputeServiceProperties.RESOURCENAME_PREFIX; +import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE; +import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED; +import static org.jclouds.oauth.v2.config.CredentialType.CLIENT_CREDENTIALS_SECRET; +import static org.jclouds.oauth.v2.config.OAuthProperties.CREDENTIAL_TYPE; +import static org.jclouds.oauth.v2.config.OAuthProperties.RESOURCE; + @AutoService(ProviderMetadata.class) public class AzureComputeProviderMetadata extends BaseProviderMetadata { @@ -114,7 +114,7 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata { properties.put(API_VERSION_PREFIX + AvailabilitySetApi.class.getSimpleName(), "2016-03-30"); properties.put(API_VERSION_PREFIX + "GetVirtualMachine", "2016-03-30"); properties.put(API_VERSION_PREFIX + "GetVirtualMachineInstance", "2016-03-30"); - properties.put(API_VERSION_PREFIX + "CreateVirtualMachine", "2016-03-30"); + properties.put(API_VERSION_PREFIX + "CreateOrUpdateVirtualMachine", "2016-03-30"); properties.put(API_VERSION_PREFIX + "ListVirtualMachines", "2015-06-15"); properties.put(API_VERSION_PREFIX + "DeleteVirtualMachine", "2016-03-30"); http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b151914f/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java index a1204bf..f510109 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java @@ -16,20 +16,6 @@ */ package org.jclouds.azurecompute.arm.compute; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.collect.Iterables.contains; -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.find; -import static com.google.common.collect.Iterables.getOnlyElement; -import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CONTAINER_NAME; -import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CUSTOM_IMAGE_OFFER; -import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.decodeFieldsFromUniqueId; -import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.encodeFieldsToUniqueIdCustom; -import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.getMarketplacePlanFromImageMetadata; -import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.IMAGE_PUBLISHERS; -import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue; -import static org.jclouds.util.Closeables2.closeQuietly; - import java.util.List; import java.util.Map; import java.util.Set; @@ -98,6 +84,20 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.collect.Iterables.contains; +import static com.google.common.collect.Iterables.filter; +import static com.google.common.collect.Iterables.find; +import static com.google.common.collect.Iterables.getOnlyElement; +import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CONTAINER_NAME; +import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CUSTOM_IMAGE_OFFER; +import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.decodeFieldsFromUniqueId; +import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.encodeFieldsToUniqueIdCustom; +import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.getMarketplacePlanFromImageMetadata; +import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.IMAGE_PUBLISHERS; +import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue; +import static org.jclouds.util.Closeables2.closeQuietly; + /** * Defines the connection between the {@link AzureComputeApi} implementation and * the jclouds {@link org.jclouds.compute.ComputeService}. @@ -138,7 +138,7 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Virtual ResourceGroup resourceGroup = resourceGroupMap.getUnchecked(template.getLocation().getId()); // TODO ARM specific options - // TODO network ids => create one nic in each network + // TODO network ids => createOrUpdate one nic in each network IdReference availabilitySet = null; if (templateOptions.getAvailabilitySet() != null) { @@ -166,7 +166,7 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Virtual Map<String, String> metadataAndTags = metadataAndTagsAsCommaDelimitedValue(template.getOptions()); Plan plan = getMarketplacePlanFromImageMetadata(template.getImage()); - VirtualMachine virtualMachine = api.getVirtualMachineApi(resourceGroup.name()).create(name, template.getLocation().getId(), + VirtualMachine virtualMachine = api.getVirtualMachineApi(resourceGroup.name()).createOrUpdate(name, template.getLocation().getId(), virtualMachineProperties, metadataAndTags, plan); // Safe to pass null credentials here, as jclouds will default populate http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b151914f/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/VirtualMachineToNodeMetadata.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/VirtualMachineToNodeMetadata.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/VirtualMachineToNodeMetadata.java index 29a57e4..cb40a14 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/VirtualMachineToNodeMetadata.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/VirtualMachineToNodeMetadata.java @@ -16,18 +16,6 @@ */ package org.jclouds.azurecompute.arm.compute.functions; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Strings.nullToEmpty; -import static com.google.common.collect.Iterables.find; -import static com.google.common.collect.Iterables.tryFind; -import static org.jclouds.azurecompute.arm.compute.AzureComputeServiceAdapter.GROUP_KEY; -import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CONTAINER_NAME; -import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CUSTOM_IMAGE_OFFER; -import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.encodeFieldsToUniqueId; -import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue; -import static org.jclouds.location.predicates.LocationPredicates.idEquals; -import static org.jclouds.util.Closeables2.closeQuietly; - import java.util.List; import java.util.Map; import java.util.Set; @@ -71,6 +59,18 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.nullToEmpty; +import static com.google.common.collect.Iterables.find; +import static com.google.common.collect.Iterables.tryFind; +import static org.jclouds.azurecompute.arm.compute.AzureComputeServiceAdapter.GROUP_KEY; +import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CONTAINER_NAME; +import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CUSTOM_IMAGE_OFFER; +import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.encodeFieldsToUniqueId; +import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue; +import static org.jclouds.location.predicates.LocationPredicates.idEquals; +import static org.jclouds.util.Closeables2.closeQuietly; + public class VirtualMachineToNodeMetadata implements Function<VirtualMachine, NodeMetadata> { @Resource http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b151914f/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java index 805378b..c87390e 100644 --- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java +++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java @@ -53,16 +53,13 @@ import org.jclouds.rest.binders.BindToJsonPayload; /** * The Virtual Machine API includes operations for managing the virtual machines in your subscription. * - * @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163630.aspx">docs</a> + * @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-rest-api">docs</a> */ @Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines") @RequestFilters({ OAuthFilter.class, ApiVersionFilter.class }) @Consumes(MediaType.APPLICATION_JSON) public interface VirtualMachineApi { - /** - * The Get Virtual Machine details - */ @Named("GetVirtualMachine") @GET @Path("/{name}") @@ -70,7 +67,7 @@ public interface VirtualMachineApi { VirtualMachine get(@PathParam("name") String name); /** - * Get information about the model view and instance view of a virtual machine: + * Get information about the model view and instance view of a virtual machine */ @Named("GetVirtualMachineInstance") @GET @@ -78,34 +75,25 @@ public interface VirtualMachineApi { @Fallback(Fallbacks.NullOnNotFoundOr404.class) VirtualMachineInstance getInstanceDetails(@PathParam("name") String name); - /** - * The Create Virtual Machine - */ - @Named("CreateVirtualMachine") + @Named("CreateOrUpdateVirtualMachine") @PUT @Payload("%7B\"location\":\"{location}\",\"tags\":{tags},\"properties\":{properties},\"plan\":{plan}%7D") @MapBinder(BindToJsonPayload.class) @Path("/{vmname}") @QueryParams(keys = "validating", values = "false") @Produces(MediaType.APPLICATION_JSON) - VirtualMachine create(@PathParam("vmname") String vmname, - @PayloadParam("location") String location, - @PayloadParam("properties") VirtualMachineProperties properties, - @PayloadParam("tags") Map<String, String> tags, - @Nullable @PayloadParam("plan") Plan plan); + VirtualMachine createOrUpdate(@PathParam("vmname") String vmname, + @PayloadParam("location") String location, + @PayloadParam("properties") VirtualMachineProperties properties, + @PayloadParam("tags") Map<String, String> tags, + @Nullable @PayloadParam("plan") Plan plan); - /** - * The List Virtual Machines operation - */ @Named("ListVirtualMachines") @GET @SelectJson("value") @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class) List<VirtualMachine> list(); - /** - * The Delete Virtual Machine operation - */ @Named("DeleteVirtualMachine") @DELETE @Path("/{name}") @@ -113,33 +101,21 @@ public interface VirtualMachineApi { @Fallback(Fallbacks.NullOnNotFoundOr404.class) URI delete(@PathParam("name") String name); - /** - * The Restart Virtual Machine operation - */ @Named("RestartVirtualMachine") @POST @Path("/{name}/restart") void restart(@PathParam("name") String name); - /** - * The start Virtual Machine operation - */ @Named("StartVirtualMachine") @POST @Path("/{name}/start") void start(@PathParam("name") String name); - /** - * The stop Virtual Machine operation - */ @Named("StopVirtualMachine") @POST @Path("/{name}/powerOff") void stop(@PathParam("name") String name); - /** - * Generalize the virtual machine - */ @Named("generalize") @POST @Path("/{name}/generalize") http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b151914f/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java index 8bc25c2..6fe65e3 100644 --- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java +++ b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java @@ -16,11 +16,6 @@ */ package org.jclouds.azurecompute.arm.features; -import static org.assertj.core.api.Assertions.assertThat; -import static org.jclouds.util.Predicates2.retry; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; - import java.net.URI; import java.util.ArrayList; import java.util.Arrays; @@ -55,9 +50,16 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; +import static org.assertj.core.api.Assertions.assertThat; +import static org.jclouds.util.Predicates2.retry; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + @Test(groups = "live", testName = "VirtualMachineApiLiveTest") public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest { @@ -102,7 +104,7 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest { public void testCreate() { String blob = storageService.storageServiceProperties().primaryEndpoints().get("blob"); - VirtualMachine vm = api().create(vmName, LOCATION, getProperties(blob, nicName), + VirtualMachine vm = api().createOrUpdate(vmName, LOCATION, getProperties(blob, nicName), Collections.<String, String> emptyMap(), null); assertTrue(!vm.name().isEmpty()); @@ -113,7 +115,7 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest { return !api().get(name).properties().provisioningState().equals(VirtualMachineProperties.ProvisioningState.CREATING); } }, 60 * 20 * 1000).apply(vmName); - assertTrue(jobDone, "create operation did not complete in the configured timeout"); + assertTrue(jobDone, "createOrUpdate operation did not complete in the configured timeout"); VirtualMachineProperties.ProvisioningState status = api().get(vmName).properties().provisioningState(); // Cannot be creating anymore. Should be succeeded or running but not failed. @@ -133,18 +135,40 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest { assertTrue(!vmi.statuses().isEmpty()); } - @Test(dependsOnMethods = "testStart") - public void testStop() { - api().stop(vmName); - assertTrue(stateReached(PowerState.STOPPED), "stop operation did not complete in the configured timeout"); - } - @Test(dependsOnMethods = "testGet") public void testStart() { api().start(vmName); assertTrue(stateReached(PowerState.RUNNING), "start operation did not complete in the configured timeout"); } + @Test(dependsOnMethods = "testStart") + public void testUpdate() { + VirtualMachine vm = api().get(vmName); + VirtualMachineProperties oldProperties = vm.properties(); + StorageProfile oldStorageProfile = oldProperties.storageProfile(); + + String blob = storageService.storageServiceProperties().primaryEndpoints().get("blob"); + VHD vhd = VHD.create(blob + "vhds/" + vmName + "new-data-disk.vhd"); + DataDisk newDataDisk = DataDisk.create(vmName + "new-data-disk", "1", 1, vhd, "Empty"); + List<DataDisk> oldDataDisks = oldStorageProfile.dataDisks(); + assertEquals(oldDataDisks.size(), 1); + + ImmutableList<DataDisk> newDataDisks = ImmutableList.<DataDisk> builder().addAll(oldDataDisks).add(newDataDisk).build(); + StorageProfile newStorageProfile = oldStorageProfile.toBuilder().dataDisks(newDataDisks).build(); + VirtualMachineProperties newProperties = oldProperties.toBuilder().storageProfile(newStorageProfile).build(); + + VirtualMachine newVm = vm.toBuilder().properties(newProperties).build(); + vm = api().createOrUpdate(vmName, newVm.location(), newVm.properties(), newVm.tags(), newVm.plan()); + + assertEquals(vm.properties().storageProfile().dataDisks().size(), oldDataDisks.size() + 1); + } + + @Test(dependsOnMethods = "testUpdate") + public void testStop() { + api().stop(vmName); + assertTrue(stateReached(PowerState.STOPPED), "stop operation did not complete in the configured timeout"); + } + @Test(dependsOnMethods = "testStop") public void testRestart() { api().start(vmName); http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/b151914f/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiMockTest.java ---------------------------------------------------------------------- diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiMockTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiMockTest.java index 65bdeb3..0c03fb1 100644 --- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiMockTest.java +++ b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiMockTest.java @@ -115,7 +115,7 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest { Plan plan = Plan.create("thinkboxsoftware", "deadline-slave-7-2", "deadline7-2"); final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname"); VirtualMachine vm = vmAPI - .create("windowsmachine", "westus", getProperties(), ImmutableMap.of("foo", "bar"), plan); + .createOrUpdate("windowsmachine", "westus", getProperties(), ImmutableMap.of("foo", "bar"), plan); assertEquals(vm, getVM(plan)); assertSent( server, @@ -138,7 +138,7 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest { server.enqueue(jsonResponse("/createvirtualmachineresponse.json")); final VirtualMachineApi vmAPI = api.getVirtualMachineApi("groupname"); - VirtualMachine vm = vmAPI.create("windowsmachine", "westus", getProperties(), ImmutableMap.of("foo", "bar"), null); + VirtualMachine vm = vmAPI.createOrUpdate("windowsmachine", "westus", getProperties(), ImmutableMap.of("foo", "bar"), null); assertEquals(vm, getVM()); assertSent( server,
