From d742d53f6b062e01ecaeca083fdbee40b50d8342 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 21 Mar 2012 21:55:42 +0000 Subject: [PATCH] reverted formatting changes --- .../VirtualBoxPropertiesBuilder.java | 2 +- .../BaseVirtualBoxClientLiveTest.java | 19 ++++++++++++------- .../functions/CreateAndInstallVmLiveTest.java | 1 - 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java index 89776388c2..4f6c728155 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java @@ -19,7 +19,7 @@ package org.jclouds.virtualbox; -import static org.jclouds.Constants.*; +import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_BUILD_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_IMAGE_AUTHENTICATE_SUDO; diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java index 1342ba9816..ab3ece2872 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java @@ -70,9 +70,9 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { public BaseVirtualBoxClientLiveTest() { provider = "virtualbox"; } - + protected ComputeServiceContext context; - + @Inject protected MachineController machineController; @@ -106,8 +106,8 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { protected PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate; @Inject protected LoadingCache mastersCache; - - private final ExecutorService singleThreadExec = MoreExecutors.sameThreadExecutor(); + + private final ExecutorService singleThreadExec = MoreExecutors.sameThreadExecutor(); @Override protected void setupCredentials() { @@ -119,8 +119,10 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { } protected void ensureIdentityPropertyIsSpecifiedOrTakeFromDefaults() { + Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder().build(); if (!System.getProperties().containsKey("test." + provider + ".identity")) - System.setProperty("test." + provider + ".identity", "administrator"); + System.setProperty("test." + provider + ".identity", + defaultVBoxProperties.getProperty(Constants.PROPERTY_IDENTITY)); } @BeforeClass(groups = "live") @@ -131,7 +133,7 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet . of(new SLF4JLoggingModule(), new SshjSshClientModule(), new ExecutorServiceModule( singleThreadExec, singleThreadExec)), overrides); - + context.utils().injector().injectMembers(this); imageId = "ubuntu-11.04-server-i386"; @@ -140,18 +142,21 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { hostVersion = Iterables.get(Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0); operatingSystemIso = String.format("%s/%s.iso", isosDir, imageId); guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion); - + // try and get a master from the cache, this will initialize the config/download isos and // prepare everything IF a master is not available, subsequent calls should be pretty fast Template template = context.getComputeService().templateBuilder().build(); checkNotNull(mastersCache.apply(template.getImage())); } + protected void undoVm(VmSpec vmSpecification) { machineUtils.unlockMachineAndApplyOrReturnNullIfNotRegistered(vmSpecification.getVmId(), new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpecification)); } + + public String adminDisk(String vmName) { return workingDir + File.separator + vmName + ".vdi"; } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index 0d2c3ad939..4396848ac2 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -133,7 +133,6 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { machineUtils.applyForMachine(machine.getName(), new LaunchMachineIfNotAlreadyRunning(manager.get(), ExecutionType.GUI, "")); - sshClientForIMachine = injector.getInstance(IMachineToSshClient.class); SshClient client = sshClientForIMachine.apply(machine);