compiler warnings and imports

This commit is contained in:
Adrian Cole 2012-01-29 23:38:06 +08:00
parent 6cac7ff6e6
commit 7c49d058b4
13 changed files with 99 additions and 94 deletions

View File

@ -33,7 +33,7 @@ import com.google.inject.Module;
*
* @author Mattias Holmqvist, Andrea Turli
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public class VirtualBoxContextBuilder extends StandaloneComputeServiceContextBuilder<Supplier> {
public VirtualBoxContextBuilder(Properties properties) {

View File

@ -19,22 +19,28 @@
package org.jclouds.virtualbox.config;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.*;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
import java.io.InputStream;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import javax.inject.Named;
import javax.inject.Singleton;
import org.eclipse.jetty.server.Server;
import org.jclouds.byon.Node;
import org.jclouds.byon.functions.NodeToNodeMetadata;
import org.jclouds.byon.suppliers.SupplyFromProviderURIOrNodesProperty;
import org.jclouds.compute.ComputeServiceAdapter;
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
import org.jclouds.compute.domain.*;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.domain.Location;
import org.jclouds.functions.IdentityFunction;
@ -57,19 +63,24 @@ import org.virtualbox_4_1.LockType;
import org.virtualbox_4_1.MachineState;
import org.virtualbox_4_1.VirtualBoxManager;
import javax.inject.Named;
import javax.inject.Singleton;
import java.io.InputStream;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
/**
* @author Mattias Holmqvist, Andrea Turli
*/
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public class VirtualBoxComputeServiceContextModule extends
ComputeServiceAdapterContextModule<Supplier, Supplier, IMachine, IMachine, Image, Location> {
@ -77,7 +88,6 @@ public class VirtualBoxComputeServiceContextModule extends
super(Supplier.class, Supplier.class);
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
protected void configure() {
super.configure();

View File

@ -19,15 +19,10 @@
package org.jclouds.virtualbox.domain;
import com.google.common.base.Objects;
import com.google.common.base.Supplier;
import com.google.common.cache.CacheLoader;
import org.jclouds.virtualbox.Preconfiguration;
import java.net.URI;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
/**
* The information needed to create a machine from a .iso file.
*/
@ -48,7 +43,6 @@ public class IsoSpec {
public static class Builder {
private String installationSequence;
private Supplier<URI> preConfigurationUri;
private String sourcePath;
public Builder installationScript(String installationSequence) {

View File

@ -18,26 +18,19 @@
*/
package org.jclouds.virtualbox.domain;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Image;
import org.jclouds.javax.annotation.Nullable;
import org.virtualbox_4_1.DeviceType;
import org.virtualbox_4_1.IMachine;
import org.virtualbox_4_1.StorageBus;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter;
import java.util.HashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.transform;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
import static org.jclouds.virtualbox.domain.HardDisk.DEFAULT_DISK_FORMAT;
import org.jclouds.javax.annotation.Nullable;
import org.virtualbox_4_1.DeviceType;
import org.virtualbox_4_1.StorageBus;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
/**
* Represents a storage controller in a VirtualBox VM.

View File

@ -36,9 +36,9 @@ import org.yaml.snakeyaml.constructor.Constructor;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.cache.LoadingCache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;

View File

@ -19,8 +19,16 @@
package org.jclouds.virtualbox.functions.admin;
import com.google.common.cache.CacheLoader;
import com.google.inject.Singleton;
import static com.google.common.base.Throwables.propagate;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
import java.net.URI;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
@ -30,15 +38,8 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger;
import org.jclouds.virtualbox.domain.IsoSpec;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import java.net.URI;
import static com.google.common.base.Throwables.propagate;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
import com.google.common.cache.CacheLoader;
import com.google.inject.Singleton;
/**
* @author Andrea Turli

View File

@ -18,7 +18,6 @@
*/
package org.jclouds.virtualbox.statements;
import org.jclouds.scriptbuilder.domain.AppendFile;
import org.jclouds.scriptbuilder.domain.Call;
import org.jclouds.scriptbuilder.domain.Statement;

View File

@ -29,7 +29,7 @@ import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.net.IPSocket;
import org.jclouds.ssh.SshClient;
import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
@ -77,7 +77,7 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien
}
protected void doConnectViaSsh(IMachine machine, Credentials creds) {
protected void doConnectViaSsh(IMachine machine, LoginCredentials creds) {
SshClient ssh = context.utils().sshFactory().create(new IPSocket("//TODO", 22), creds);
try {
ssh.connect();

View File

@ -19,11 +19,12 @@
package org.jclouds.virtualbox.functions;
import static org.easymock.EasyMock.*;
import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.createNiceMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.virtualbox_4_1.NATProtocol.TCP;
import static org.virtualbox_4_1.NetworkAttachmentType.NAT;

View File

@ -18,25 +18,33 @@
*/
package org.jclouds.virtualbox.functions;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.LoadingCache;
import org.easymock.EasyMock;
import org.jclouds.virtualbox.domain.*;
import org.jclouds.virtualbox.util.MachineUtils;
import org.testng.annotations.Test;
import org.virtualbox_4_1.*;
import java.net.URI;
import static org.easymock.EasyMock.anyBoolean;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.createNiceMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import org.easymock.EasyMock;
import org.jclouds.virtualbox.domain.IsoSpec;
import org.jclouds.virtualbox.domain.MasterSpec;
import org.jclouds.virtualbox.domain.NetworkSpec;
import org.jclouds.virtualbox.domain.StorageController;
import org.jclouds.virtualbox.domain.VmSpec;
import org.jclouds.virtualbox.util.MachineUtils;
import org.testng.annotations.Test;
import org.virtualbox_4_1.CleanupMode;
import org.virtualbox_4_1.IMachine;
import org.virtualbox_4_1.ISession;
import org.virtualbox_4_1.IVirtualBox;
import org.virtualbox_4_1.LockType;
import org.virtualbox_4_1.StorageBus;
import org.virtualbox_4_1.VBoxException;
import org.virtualbox_4_1.VirtualBoxManager;
import com.google.common.base.Suppliers;
/**
* @author Mattias Holmqvist
@ -50,7 +58,6 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest {
MachineUtils machineUtils = createMock(MachineUtils.class);
VirtualBoxManager manager = createMock(VirtualBoxManager.class);
IVirtualBox vBox = createMock(IVirtualBox.class);
LoadingCache<IsoSpec, URI> preconfiguration = createNiceMock(LoadingCache.class);
String vmName = "jclouds-image-my-ubuntu-image";
StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE).build();
VmSpec vmSpec = VmSpec.builder().id(vmName).name(vmName).osTypeId("").memoryMB(1024).controller(ideController).cleanUpMode(
@ -101,7 +108,6 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest {
VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
IVirtualBox vBox = createNiceMock(IVirtualBox.class);
Supplier<URI> preconfiguration = createNiceMock(Supplier.class);
String vmName = "jclouds-image-my-ubuntu-image";
IMachine registeredMachine = createMock(IMachine.class);
@ -130,7 +136,6 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest {
VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
IVirtualBox vBox = createNiceMock(IVirtualBox.class);
Supplier<URI> preconfiguration = createNiceMock(Supplier.class);
String vmName = "jclouds-image-my-ubuntu-image";
String errorMessage = "VirtualBox error: Soem other VBox error";

View File

@ -20,15 +20,14 @@
package org.jclouds.virtualbox.functions;
import static org.easymock.EasyMock.anyLong;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.createNiceMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.testng.Assert.assertNotSame;
import org.easymock.EasyMock;
import org.jclouds.virtualbox.domain.HardDisk;
import org.jclouds.virtualbox.util.MachineUtils;
import org.testng.annotations.BeforeMethod;

View File

@ -47,7 +47,7 @@ import com.google.common.base.Suppliers;
@Test(groups = "unit", singleThreaded = true, testName = "StartVBoxIfNotAlreadyRunningTest")
public class StartVBoxIfNotAlreadyRunningTest {
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testStartVboxConnectsToManagerWhenPortAlreadyListening() throws Exception {
VirtualBoxManager manager = createMock(VirtualBoxManager.class);
@ -71,7 +71,7 @@ public class StartVBoxIfNotAlreadyRunningTest {
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testStartVboxDisablesPasswordAccessOnWebsrvauthlibraryStartsVboxwebsrvInBackgroundAndConnectsManagerWhenPortIsNotListening()
throws Exception {

View File

@ -19,12 +19,15 @@
package org.jclouds.virtualbox.predicates;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import com.google.inject.Injector;
import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
import org.jclouds.virtualbox.domain.*;
import org.jclouds.virtualbox.domain.HardDisk;
import org.jclouds.virtualbox.domain.IsoSpec;
import org.jclouds.virtualbox.domain.MasterSpec;
import org.jclouds.virtualbox.domain.NetworkSpec;
import org.jclouds.virtualbox.domain.StorageController;
import org.jclouds.virtualbox.domain.VmSpec;
import org.jclouds.virtualbox.functions.CloneAndRegisterMachineFromIMachineIfNotAlreadyExists;
import org.jclouds.virtualbox.functions.CreateAndRegisterMachineFromIsoIfNotAlreadyExists;
import org.testng.annotations.AfterMethod;
@ -37,6 +40,7 @@ import org.virtualbox_4_1.StorageBus;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Injector;
/**
*
@ -46,7 +50,6 @@ import com.google.common.collect.ImmutableSet;
public class IsLinkedClonesLiveTest extends BaseVirtualBoxClientLiveTest {
private static final boolean IS_LINKED_CLONE = true;
private String vmId = "jclouds-image-iso-1";
private String osTypeId = "";
private String ideControllerName = "IDE Controller";
private String cloneName;