You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/27 17:36:37 UTC

[1/9] JCLOUDS-758 Drop VirtualBox labs provider.

Repository: jclouds-labs
Updated Branches:
  refs/heads/master eea1bdb45 -> 75178c770


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly b/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly
deleted file mode 100644
index ac4d33b..0000000
--- a/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly
+++ /dev/null
@@ -1,26 +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.
-#
-#!/bin/bash
-sudo ip link set eth1 name eth0
-# configure eth0
-MAC_ETH0=`ifconfig -a | grep eth0 | awk '{ print $5}'`; sed "s/HWADDR.*/HWADDR\=\"$MAC_ETH0\"/g" /etc/sysconfig/network-scripts/ifcfg-eth0 > /tmp/ifcfg-eth0; 
-sudo cp /tmp/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0;
-# restart network
-sudo rm /etc/udev/rules.d/70-persistent-net.rules
-sudo /etc/init.d/network restart

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/redHatAndDerivatives/nat
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/redHatAndDerivatives/nat b/virtualbox/src/test/resources/redHatAndDerivatives/nat
deleted file mode 100644
index a51482c..0000000
--- a/virtualbox/src/test/resources/redHatAndDerivatives/nat
+++ /dev/null
@@ -1,30 +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.
-#
-#!/bin/bash
-sudo ip link set eth2 name eth1
-sudo cp /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp/ifcfg-eth1
-sudo chown toor.toor /tmp/ifcfg-eth1
-# configure eth1
-MAC_ETH1=`ifconfig -a | grep eth1 | awk '{ print $5}'`; sed "s/HWADDR.*/HWADDR\=\"$MAC_ETH1\"/g" /tmp/ifcfg-eth1 > /tmp/ifcfg-eth12;
-sed "/UUID/d" /tmp/ifcfg-eth12 > /tmp/ifcfg-eth13;
-sed "s/DEVICE.*/DEVICE\=\"eth1\"/g" /tmp/ifcfg-eth13 > /tmp/ifcfg-eth14; 
-sudo cp /tmp/ifcfg-eth14 /etc/sysconfig/network-scripts/ifcfg-eth1;
-# restart network
-sudo rm /etc/udev/rules.d/70-persistent-net.rules
-sudo /etc/init.d/network restart

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh b/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh
deleted file mode 100644
index 52fd3b9..0000000
--- a/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-set +u
-shopt -s xpg_echo
-shopt -s expand_aliases
-unset PATH JAVA_HOME LD_LIBRARY_PATH
-function abort {
-   echo "aborting: $@" 1>&2
-   exit 1
-}
-function exportIpAddressFromVmNamed {
-   unset FOUND_IP_ADDRESS;
-   [ $# -eq 1 ] || {
-      abort "exportIpAddressFromVmNamed requires virtual machine name parameter"
-      return 1
-   }
-   local VMNAME="$0"; shift
-   local _FOUND=`VBoxManage guestproperty enumerate "$VMNAME" --patterns "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $4 }' | cut -c 1-14`
-   [ -n "$_FOUND" ] && {
-      export FOUND_IP_ADDRESS=$_FOUND
-      echo [$FOUND_IP_ADDRESS]
-      return 0
-   } || {
-      return 1
-   }
-}
-export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
-exportIpAddressFromVmNamed $@ || exit 1
-echo $FOUND_IP_ADDRESS
-exit $?

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_get_ip_address.cmd
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/test_get_ip_address.cmd b/virtualbox/src/test/resources/test_get_ip_address.cmd
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_get_ip_address.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/test_get_ip_address.sh b/virtualbox/src/test/resources/test_get_ip_address.sh
deleted file mode 100644
index 41d46af..0000000
--- a/virtualbox/src/test/resources/test_get_ip_address.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-set +u
-shopt -s xpg_echo
-shopt -s expand_aliases
-unset PATH JAVA_HOME LD_LIBRARY_PATH
-function abort {
-   echo "aborting: $@" 1>&2
-   exit 1
-}
-function getIpAddress {
-   unset FOUND_IP_ADDRESS;
-   [ $# -eq 1 ] || {
-      abort "installGuestAdditions requires virtual machine name parameter"
-      return 1
-   }
-   local VMNAME="$0"; shift
-   local _FOUND=`VBoxManage guestproperty enumerate "$VMNAME" --patterns "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $4 }' | cut -c 1-14`
-   [ -n "$_FOUND" ] && {
-      export FOUND_IP_ADDRESS=$_FOUND
-      echo [$FOUND_IP_ADDRESS]
-      return 0
-   } || {
-      return 1
-   }
-}
-export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
-getIpAddress $@ || exit 1
-echo $FOUND_IP_ADDRESS
-exit 0

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_guest_additions_installer.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/test_guest_additions_installer.sh b/virtualbox/src/test/resources/test_guest_additions_installer.sh
deleted file mode 100644
index 493a1df..0000000
--- a/virtualbox/src/test/resources/test_guest_additions_installer.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-setupPublicCurl || return 1
-(mkdir -p /tmp/ && cd /tmp/ && [ ! -f VBoxGuestAdditions_4.1.6.iso ] && curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -C - -X GET  http://download.virtualbox.org/virtualbox/4.1.6/VBoxGuestAdditions_4.1.6.iso >VBoxGuestAdditions_4.1.6.iso)
-mount -o loop /tmp/VBoxGuestAdditions_4.1.6.iso /mnt
-installModuleAssistantIfNeeded || return 1
-/mnt/VBoxLinuxAdditions.run
-umount /mnt

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_guest_additions_installer_init.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/test_guest_additions_installer_init.sh b/virtualbox/src/test/resources/test_guest_additions_installer_init.sh
deleted file mode 100644
index ac192e6..0000000
--- a/virtualbox/src/test/resources/test_guest_additions_installer_init.sh
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/bin/bash
-set +u
-shopt -s xpg_echo
-shopt -s expand_aliases
-unset PATH JAVA_HOME LD_LIBRARY_PATH
-function abort {
-   echo "aborting: $@" 1>&2
-   exit 1
-}
-function default {
-   export INSTANCE_NAME="install_guest_additions"
-export INSTANCE_HOME="/tmp/$INSTANCE_NAME"
-export LOG_DIR="$INSTANCE_HOME"
-   return $?
-}
-function install_guest_additions {
-      return $?
-}
-function findPid {
-   unset FOUND_PID;
-   [ $# -eq 1 ] || {
-      abort "findPid requires a parameter of pattern to match"
-      return 1
-   }
-   local PATTERN="$1"; shift
-   local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|grep -v $$|awk '{print $2}'`
-   [ -n "$_FOUND" ] && {
-      export FOUND_PID=$_FOUND
-      return 0
-   } || {
-      return 1
-   }
-}
-function forget {
-   unset FOUND_PID;
-   [ $# -eq 3 ] || {
-      abort "forget requires parameters INSTANCE_NAME SCRIPT LOG_DIR"
-      return 1
-   }
-   local INSTANCE_NAME="$1"; shift
-   local SCRIPT="$1"; shift
-   local LOG_DIR="$1"; shift
-   mkdir -p $LOG_DIR
-   findPid $INSTANCE_NAME
-   [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && {
-      echo $INSTANCE_NAME already running pid $FOUND_PID
-      return 1;
-   } || {
-      nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log &
-      RETURN=$?
-      # this is generally followed by findPid, so we shouldn't exit 
-      # immediately as the proc may not have registered in ps, yet
-      test $RETURN && sleep 1
-      return $RETURN;
-   }
-}
-export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
-case $1 in
-init)
-   default || exit 1
-   install_guest_additions || exit 1
-   mkdir -p $INSTANCE_HOME
-   
-   # create runscript header
-   cat > $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT'
-	#!/bin/bash
-	set +u
-	shopt -s xpg_echo
-	shopt -s expand_aliases
-	
-	PROMPT_COMMAND='echo -ne \"\033]0;install_guest_additions\007\"'
-	export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin
-
-	export INSTANCE_NAME='install_guest_additions'
-END_OF_JCLOUDS_SCRIPT
-   cat >> $INSTANCE_HOME/install_guest_additions.sh <<-END_OF_JCLOUDS_SCRIPT
-	export INSTANCE_NAME='$INSTANCE_NAME'
-	export INSTANCE_HOME='$INSTANCE_HOME'
-	export LOG_DIR='$LOG_DIR'
-END_OF_JCLOUDS_SCRIPT
-   cat >> $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT'
-	function abort {
-   echo "aborting: $@" 1>&2
-   exit 1
-}
-alias apt-get-install="apt-get install -f -y -qq --force-yes"
-alias apt-get-update="apt-get update -qq"
-
-function ensure_cmd_or_install_package_apt(){
-  local cmd=$1
-  local pkg=$2
-  
-  hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
-}
-
-function ensure_cmd_or_install_package_yum(){
-  local cmd=$1
-  local pkg=$2
-  hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg
-}
-
-function ensure_netutils_apt() {
-  ensure_cmd_or_install_package_apt nslookup dnsutils
-  ensure_cmd_or_install_package_apt curl curl
-}
-
-function ensure_netutils_yum() {
-  ensure_cmd_or_install_package_yum nslookup bind-utils
-  ensure_cmd_or_install_package_yum curl curl
-}
-
-# most network services require that the hostname is in
-# the /etc/hosts file, or they won't operate
-function ensure_hostname_in_hosts() {
-  [ -n "$SSH_CONNECTION" ] && {
-    local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
-  } || {
-    local ipaddr=`hostname -i`
-  }
-  # NOTE: we blindly trust existing hostname settings in /etc/hosts
-  egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
-}
-
-# download locations for many services are at public dns
-function ensure_can_resolve_public_dns() {
-  nslookup yahoo.com | grep yahoo.com > /dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf
-}
-
-function setupPublicCurl() {
-  ensure_hostname_in_hosts
-  if which dpkg &> /dev/null; then
-    ensure_netutils_apt
-  elif which rpm &> /dev/null; then
-    ensure_netutils_yum
-  else
-    abort "we only support apt-get and yum right now... please contribute!"
-    return 1
-  fi
-  ensure_can_resolve_public_dns
-  return 0  
-}
-function installModuleAssistantIfNeeded {
-   unset OSNAME;
-   local OSNAME=`lsb_release -d -s | cut -d ' ' -f 1`; shift
-   if [ $OSNAME = 'Ubuntu' ]
-   then
-      echo "OS is Ubuntu"
-      apt-get -f -y -qq --force-yes install build-essential module-assistant;
-      m-a prepare -i
-   fi
-}
-
-END_OF_JCLOUDS_SCRIPT
-   
-   # add desired commands from the user
-   cat >> $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT'
-	cd $INSTANCE_HOME
-	rm -f $INSTANCE_HOME/rc
-	trap 'echo $?>$INSTANCE_HOME/rc' 0 1 2 3 15
-	setupPublicCurl || exit 1
-	
-	(mkdir -p /tmp/ && cd /tmp/ && [ ! -f VBoxGuestAdditions_4.1.6.iso ] && curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -C - -X GET  http://download.virtualbox.org/virtualbox/4.1.6/VBoxGuestAdditions_4.1.6.iso >VBoxGuestAdditions_4.1.6.iso)
-	
-	mount -o loop /tmp/VBoxGuestAdditions_4.1.6.iso /mnt
-	
-	installModuleAssistantIfNeeded || exit 1
-	
-	/mnt/VBoxLinuxAdditions.run
-	
-	umount /mnt
-	
-END_OF_JCLOUDS_SCRIPT
-   
-   # add runscript footer
-   cat >> $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT'
-	exit $?
-	
-END_OF_JCLOUDS_SCRIPT
-   
-   chmod u+x $INSTANCE_HOME/install_guest_additions.sh
-   ;;
-status)
-   default || exit 1
-   findPid $INSTANCE_NAME || exit 1
-   echo $FOUND_PID
-   ;;
-stop)
-   default || exit 1
-   findPid $INSTANCE_NAME || exit 1
-   [ -n "$FOUND_PID" ]  && {
-      echo stopping $FOUND_PID
-      kill -9 $FOUND_PID
-   }
-   ;;
-start)
-   default || exit 1
-   forget $INSTANCE_NAME $INSTANCE_HOME/$INSTANCE_NAME.sh $LOG_DIR || exit 1
-   ;;
-stdout)
-   default || exit 1
-   cat $LOG_DIR/stdout.log
-   ;;
-stderr)
-   default || exit 1
-   cat $LOG_DIR/stderr.log
-   ;;
-exitstatus)
-   default || exit 1
-   [ -f $LOG_DIR/rc ] && cat $LOG_DIR/rc;;
-tail)
-   default || exit 1
-   tail $LOG_DIR/stdout.log
-   ;;
-tailerr)
-   default || exit 1
-   tail $LOG_DIR/stderr.log
-   ;;
-run)
-   default || exit 1
-   $INSTANCE_HOME/$INSTANCE_NAME.sh
-   ;;
-esac
-exit $?


[4/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/util/NetworkUtils.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/util/NetworkUtils.java b/virtualbox/src/main/java/org/jclouds/virtualbox/util/NetworkUtils.java
deleted file mode 100644
index 70e46db..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/util/NetworkUtils.java
+++ /dev/null
@@ -1,305 +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.virtualbox.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
-
-import java.net.URI;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import com.google.common.util.concurrent.Uninterruptibles;
-import org.jclouds.compute.callables.RunScriptOnNode;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.options.RunScriptOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.location.Provider;
-import org.jclouds.logging.Logger;
-import org.jclouds.scriptbuilder.domain.Statements;
-import org.jclouds.virtualbox.domain.BridgedIf;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.functions.IpAddressesLoadingCache;
-import org.jclouds.virtualbox.functions.RetrieveActiveBridgedInterfaces;
-import org.jclouds.virtualbox.statements.EnableNetworkInterface;
-import org.jclouds.virtualbox.statements.GetIPAddressFromMAC;
-import org.jclouds.virtualbox.statements.ScanNetworkWithPing;
-import org.virtualbox_4_2.HostNetworkInterfaceType;
-import org.virtualbox_4_2.IDHCPServer;
-import org.virtualbox_4_2.IHostNetworkInterface;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Inject;
-
-/**
- * Utilities to manage VirtualBox networks on guests
- */
-
-@Singleton
-public class NetworkUtils {
-
-   // TODO parameterize
-   public static final int MASTER_PORT = 2222;
-   private static final String VIRTUALBOX_HOST_GATEWAY = "10.0.2.15";
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final MachineUtils machineUtils;
-   private final Supplier<NodeMetadata> host;
-   private final Supplier<URI> providerSupplier;
-   private final IpAddressesLoadingCache ipAddressesLoadingCache;
-   private final RunScriptOnNode.Factory scriptRunnerFactory;
-   private final Supplier<NodeMetadata> hostSupplier;
-
-   @Inject
-   public NetworkUtils(Supplier<VirtualBoxManager> manager, MachineUtils machineUtils, Supplier<NodeMetadata> host,
-                       @Provider Supplier<URI> providerSupplier, IpAddressesLoadingCache ipAddressesLoadingCache,
-                       Supplier<NodeMetadata> hostSupplier, RunScriptOnNode.Factory scriptRunnerFactory) {
-      this.manager = manager;
-      this.machineUtils = machineUtils;
-      this.host = checkNotNull(host, "host can't be null");
-      this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox web server can't be null");
-      this.ipAddressesLoadingCache = ipAddressesLoadingCache;
-      this.scriptRunnerFactory = scriptRunnerFactory;
-      this.hostSupplier = hostSupplier;
-   }
-
-   public NetworkSpec createNetworkSpecWhenVboxIsLocalhost() {
-      NetworkAdapter natAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT).build();
-
-      NetworkInterfaceCard natIfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(natAdapter).slot(1L).build();
-      NetworkAdapter hostOnlyAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.HostOnly)
-            .build();
-      // create new hostOnly interface if needed, otherwise use the one already
-      // there with dhcp enabled ...
-      String hostOnlyIfName = getHostOnlyIfOrCreate();
-      NetworkInterfaceCard hostOnlyIfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(hostOnlyAdapter)
-            .addHostInterfaceName(hostOnlyIfName).slot(0L).build();
-      return createNetworkSpecForHostOnlyNATNICs(natIfaceCard, hostOnlyIfaceCard);
-   }
-
-   public NetworkInterfaceCard createHostOnlyNIC(long port) {
-      NetworkAdapter hostOnlyAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.HostOnly)
-            .build();
-      // create new hostOnly interface if needed, otherwise use the one already
-      // there with dhcp enabled ...
-      String hostOnlyIfName = getHostOnlyIfOrCreate();
-      return NetworkInterfaceCard.builder().addNetworkAdapter(hostOnlyAdapter).addHostInterfaceName(hostOnlyIfName)
-            .slot(port).build();
-   }
-
-   public boolean enableNetworkInterface(NodeMetadata nodeMetadata, NetworkInterfaceCard networkInterfaceCard) {
-      ListenableFuture<ExecResponse> execEnableNetworkInterface = machineUtils.runScriptOnNode(nodeMetadata,
-              new EnableNetworkInterface(networkInterfaceCard), RunScriptOptions.NONE);
-      ExecResponse execEnableNetworkInterfaceResponse = Futures.getUnchecked(execEnableNetworkInterface);
-      return execEnableNetworkInterfaceResponse.getExitStatus() == 0;
-   }
-
-   private NetworkSpec createNetworkSpecForHostOnlyNATNICs(NetworkInterfaceCard natIfaceCard,
-         NetworkInterfaceCard hostOnlyIfaceCard) {
-      return NetworkSpec.builder().addNIC(hostOnlyIfaceCard).addNIC(natIfaceCard).build();
-   }
-
-   public String getHostOnlyIfOrCreate() {
-      IHostNetworkInterface availableHostInterfaceIf = returnExistingHostNetworkInterfaceWithDHCPenabledOrNull(manager
-            .get().getVBox().getHost().getNetworkInterfaces());
-      if (availableHostInterfaceIf == null) {
-         final String hostOnlyIfName = createHostOnlyIf();
-         assignDHCPtoHostOnlyInterface(hostOnlyIfName);
-         return hostOnlyIfName;
-      } else {
-         return availableHostInterfaceIf.getName();
-      }
-   }
-
-   private void assignDHCPtoHostOnlyInterface(final String hostOnlyIfName) {
-      List<IHostNetworkInterface> availableNetworkInterfaces = manager.get().getVBox().getHost().getNetworkInterfaces();
-
-      IHostNetworkInterface iHostNetworkInterfaceWithHostOnlyIfName = Iterables.getOnlyElement(Iterables.filter(
-            availableNetworkInterfaces, new Predicate<IHostNetworkInterface>() {
-
-               @Override
-               public boolean apply(IHostNetworkInterface iHostNetworkInterface) {
-                  return iHostNetworkInterface.getName().equals(hostOnlyIfName);
-               }
-            }));
-
-      String hostOnlyIfIpAddress = iHostNetworkInterfaceWithHostOnlyIfName.getIPAddress();
-      String dhcpIpAddress = hostOnlyIfIpAddress.substring(0, hostOnlyIfIpAddress.lastIndexOf(".")) + ".254";
-      String dhcpNetmask = "255.255.255.0";
-      String dhcpLowerIp = hostOnlyIfIpAddress.substring(0, hostOnlyIfIpAddress.lastIndexOf(".")) + ".2";
-      String dhcpUpperIp = hostOnlyIfIpAddress.substring(0, hostOnlyIfIpAddress.lastIndexOf(".")) + ".253";
-      NodeMetadata hostNodeMetadata = getHostNodeMetadata();
-
-      ExecResponse response = scriptRunnerFactory
-            .create(
-                  hostNodeMetadata,
-                  Statements.exec(String
-                        .format(
-                              "VBoxManage dhcpserver add --ifname %s --ip %s --netmask %s --lowerip %s --upperip %s --enable",
-                              hostOnlyIfName, dhcpIpAddress, dhcpNetmask, dhcpLowerIp, dhcpUpperIp)),
-                  runAsRoot(false).wrapInInitScript(false)).init().call();
-      checkState(response.getExitStatus() == 0);
-   }
-
-   private String createHostOnlyIf() {
-      NodeMetadata hostNodeMetadata = getHostNodeMetadata();
-      ExecResponse createHostOnlyResponse = scriptRunnerFactory
-            .create(hostNodeMetadata, Statements.exec("VBoxManage hostonlyif create"),
-                  runAsRoot(false).wrapInInitScript(false)).init().call();
-      String output = createHostOnlyResponse.getOutput();
-      checkState(createHostOnlyResponse.getExitStatus() == 0, "cannot create hostonly interface ");
-      checkState(output.contains("'"), "cannot create hostonly interface");
-      return output.substring(output.indexOf("'") + 1, output.lastIndexOf("'"));
-   }
-
-   private NodeMetadata getHostNodeMetadata() {
-      return NodeMetadataBuilder.fromNodeMetadata(host.get())
-            .publicAddresses(ImmutableList.of(providerSupplier.get().getHost())).build();
-   }
-
-   private IHostNetworkInterface returnExistingHostNetworkInterfaceWithDHCPenabledOrNull(
-         Iterable<IHostNetworkInterface> availableNetworkInterfaces) {
-      checkNotNull(availableNetworkInterfaces);
-      return Iterables.getFirst(filterAvailableNetworkInterfaceByHostOnlyAndDHCPenabled(availableNetworkInterfaces),
-            null);
-   }
-
-   private Iterable<IHostNetworkInterface> filterAvailableNetworkInterfaceByHostOnlyAndDHCPenabled(
-         Iterable<IHostNetworkInterface> availableNetworkInterfaces) {
-      return Iterables.filter(availableNetworkInterfaces,
-            new Predicate<IHostNetworkInterface>() {
-               @Override
-               public boolean apply(IHostNetworkInterface iHostNetworkInterface) {
-                  // this is an horrible workaround cause
-                  // iHostNetworkInterface.getDhcpEnabled is working only for
-                  // windows host
-                  boolean match = false;
-                  List<IDHCPServer> availableDHCPservers = manager.get().getVBox().getDHCPServers();
-                  for (IDHCPServer idhcpServer : availableDHCPservers) {
-                     if (idhcpServer.getEnabled()
-                           && idhcpServer.getNetworkName().equals(iHostNetworkInterface.getNetworkName()))
-                        match = true;
-                  }
-                  return iHostNetworkInterface.getInterfaceType().equals(HostNetworkInterfaceType.HostOnly) && match;
-               }
-            });
-   }
-
-   public String getValidHostOnlyIpFromVm(String machineNameOrId) {
-      long nicSlot = 0;
-      int count = 0;
-      String ipAddress = "";
-      while (nicSlot < 4 && ipAddress.isEmpty()) {
-         MachineNameOrIdAndNicSlot machineNameOrIdAndNicSlot =
-                 MachineNameOrIdAndNicSlot.fromParts(machineNameOrId, nicSlot);
-         while (count < 10 && ipAddress.isEmpty()) {
-            Uninterruptibles.sleepUninterruptibly(3, TimeUnit.SECONDS);
-            ipAddress = getIpAddressFromNicSlot(machineNameOrIdAndNicSlot);
-            if (!isValidIpForHostOnly(ipAddress)) {
-               ipAddressesLoadingCache.invalidate(machineNameOrIdAndNicSlot);
-               ipAddress = "";
-            }
-            count++;
-         }
-         nicSlot++;
-      }
-      return checkNotNull(Strings.emptyToNull(ipAddress),
-              String.format("Cannot find a valid IP address for the %s's HostOnly NIC", machineNameOrId));
-   }
-
-   public String getIpAddressFromNicSlot(String machineNameOrId, long nicSlot) {
-      MachineNameOrIdAndNicSlot machineNameOrIdAndNicSlot = MachineNameOrIdAndNicSlot.fromParts(machineNameOrId,
-            nicSlot);
-      return getIpAddressFromNicSlot(machineNameOrIdAndNicSlot);
-   }
-
-   public String getIpAddressFromNicSlot(MachineNameOrIdAndNicSlot machineNameOrIdAndNicSlot) {
-      try {
-         return ipAddressesLoadingCache.get(machineNameOrIdAndNicSlot);
-      } catch (ExecutionException e) {
-         logger.error("Problem in using the ipAddressCache", e.getCause());
-         throw Throwables.propagate(e);
-      }
-   }
-
-   public boolean isValidIpForHostOnly(String ip) {
-      return !ip.isEmpty() && isIpv4(ip) && !ipBelongsToNatRange(ip) && !ipEqualsToNatGateway(ip);
-   }
-
-   public static boolean isIpv4(String s) {
-      String IP_V4_ADDRESS_PATTERN = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
-            + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
-      Pattern pattern = Pattern.compile(IP_V4_ADDRESS_PATTERN);
-      Matcher matcher = pattern.matcher(s);
-      return matcher.matches();
-   }
-
-   private static boolean ipEqualsToNatGateway(String ip) {
-      return ip.equals(VIRTUALBOX_HOST_GATEWAY);
-   }
-
-   private static boolean ipBelongsToNatRange(String ip) {
-      return ip.startsWith("10.0.3");
-   }
-
-   protected String getIpAddressFromBridgedNIC(INetworkAdapter networkAdapter) {
-      // RetrieveActiveBridgedInterfaces
-      List<BridgedIf> activeBridgedInterfaces = new RetrieveActiveBridgedInterfaces(scriptRunnerFactory)
-            .apply(hostSupplier.get());
-      BridgedIf activeBridgedIf = checkNotNull(Iterables.get(activeBridgedInterfaces, 0), "activeBridgedInterfaces");
-      String network = activeBridgedIf.getIpAddress();
-
-      // scan ip
-      RunScriptOnNode ipScanRunScript = scriptRunnerFactory.create(hostSupplier.get(),
-            new ScanNetworkWithPing(network), RunScriptOptions.NONE);
-      ExecResponse execResponse = ipScanRunScript.init().call();
-      checkState(execResponse.getExitStatus() == 0);
-
-      // retrieve ip from mac
-      RunScriptOnNode getIpFromMACAddressRunScript = scriptRunnerFactory.create(hostSupplier.get(),
-            new GetIPAddressFromMAC(networkAdapter.getMACAddress()), RunScriptOptions.NONE);
-      ExecResponse ipExecResponse = getIpFromMACAddressRunScript.init().call();
-      checkState(ipExecResponse.getExitStatus() == 0);
-      return checkNotNull(ipExecResponse.getOutput(), "ipAddress");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/virtualbox/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
deleted file mode 100644
index 6eeabb6..0000000
--- a/virtualbox/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.virtualbox.VirtualBoxApiMetadata
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/default-images.yaml
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/default-images.yaml b/virtualbox/src/main/resources/default-images.yaml
deleted file mode 100644
index ff50c2b..0000000
--- a/virtualbox/src/main/resources/default-images.yaml
+++ /dev/null
@@ -1,149 +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.
-#
-images:
-    - id: ubuntu-12.04.1-amd64
-      name: ubuntu-12.04.1-server-amd64
-      description: ubuntu 12.04.1 server (amd64)
-      os_arch: amd64
-      os_family: ubuntu
-      os_description: ubuntu
-      os_version: 12.04.1
-      os_64bit: true
-      iso: http://releases.ubuntu.com/12.04.1/ubuntu-12.04.1-server-amd64.iso
-      iso_md5: a8c667e871f48f3a662f3fbf1c3ddb17
-      username: toor
-      credential: password
-      keystroke_sequence: <Esc><Esc><Enter> /install/vmlinuz noapic preseed/url=PRECONFIGURATION_URL debian-installer=en_US auto locale=en_US kbd-chooser/method=us hostname=HOSTNAME fb=false debconf/frontend=noninteractive console-setup/ask_detect=false keyboard-configuration/layoutcode=us initrd=/install/initrd.gz -- <Enter>
-      preseed_cfg: |
-                      ## Options to set on the command line
-                      d-i debian-installer/locale string en_US.utf8
-                      d-i console-setup/ask_detect boolean false
-                      d-i console-setup/layout string USA
-                      d-i netcfg/get_hostname string unassigned-hostname
-                      d-i netcfg/get_domain string unassigned-domain
-                      # Continue without a default route
-                      # Not working , specify a dummy in the DHCP
-                      #d-i netcfg/no_default_route boolean
-                      d-i time/zone string UTC
-                      d-i clock-setup/utc-auto boolean true
-                      d-i clock-setup/utc boolean true
-                      d-i kbd-chooser/method select American English
-                      d-i netcfg/wireless_wep string
-                      d-i base-installer/kernel/override-image string linux-server
-                      #d-i base-installer/kernel/override-image string linux-image-2.6.32-21-generic
-                      # Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
-                      d-i debconf debconf/frontend select Noninteractive
-                      d-i pkgsel/install-language-support boolean false
-                      tasksel tasksel/first multiselect standard, ubuntu-server
-                      #d-i partman-auto/method string regular
-                      d-i partman-auto/method string lvm
-                      #d-i partman-auto/purge_lvm_from_device boolean true
-                      d-i partman-lvm/confirm boolean true
-                      d-i partman-lvm/device_remove_lvm boolean true
-                      d-i partman-auto/choose_recipe select atomic
-                      d-i partman/confirm_write_new_label boolean true
-                      d-i partman/confirm_nooverwrite boolean true
-                      d-i partman/choose_partition select finish
-                      d-i partman/confirm boolean true
-                      #http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9626883
-                      #Message: "write the changes to disk and configure lvm preseed"
-                      #http://serverfault.com/questions/189328/ubuntu-kickstart-installation-using-lvm-waits-for-input
-                      #preseed partman-lvm/confirm_nooverwrite boolean true
-                      # Write the changes to disks and configure LVM?
-                      d-i partman-lvm/confirm boolean true
-                      d-i partman-lvm/confirm_nooverwrite boolean true
-                      d-i partman-auto-lvm/guided_size string max
-                      ## Default user, we can get away with a recipe to change this
-                      d-i passwd/user-fullname string toor
-                      d-i passwd/username string toor
-                      d-i passwd/user-password password password
-                      d-i passwd/user-password-again password password
-                      d-i user-setup/encrypt-home boolean false
-                      d-i user-setup/allow-password-weak boolean true
-                      ## minimum is ssh and ntp
-                      # Individual additional packages to install
-                      d-i pkgsel/include string openssh-server ntp
-                      # Whether to upgrade packages after debootstrap.
-                      # Allowed values: none, safe-upgrade, full-upgrade
-                      d-i pkgsel/upgrade select full-upgrade
-                      d-i grub-installer/only_debian boolean true
-                      d-i grub-installer/with_other_os boolean true
-                      d-i finish-install/reboot_in_progress note
-                      #For the update
-                      d-i pkgsel/update-policy select none
-                      # debconf-get-selections --install
-                      #Use mirror
-                      #d-i apt-setup/use_mirror boolean true
-                      #d-i mirror/country string manual
-                      #choose-mirror-bin mirror/protocol string http
-                      #choose-mirror-bin mirror/http/hostname string 192.168.4.150
-                      #choose-mirror-bin mirror/http/directory string /ubuntu
-                      #choose-mirror-bin mirror/suite select maverick
-                      #d-i debian-installer/allow_unauthenticated string true
-                      choose-mirror-bin mirror/http/proxy string
-    - id: centos-6.3-amd64
-      name: centos-6.3-amd64
-      description: centos-6.3 (amd64)
-      os_arch: amd64
-      os_family: RedHat
-      os_description: RedHat
-      os_version: 6.3
-      os_64bit: true
-      iso: http://www.mirrorservice.org/sites/mirror.centos.org/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso
-      iso_md5: 087713752fa88c03a5e8471c661ad1a2
-      username: toor
-      credential: password
-      keystroke_sequence: <Tab> <Spacebar> text ks=PRECONFIGURATION_URL <Enter>
-      preseed_cfg: |
-                      ## Options to set on the command line
-                      install
-                      cdrom
-                      lang en_US.UTF-8
-                      keyboard us
-                      network --bootproto=dhcp
-                      rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
-                      firewall --enabled --service=ssh
-                      authconfig --enableshadow --passalgo=sha512
-                      selinux --disabled
-                      timezone UTC
-                      bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
-                      zerombr yes
-
-                      clearpart --all --drives=sda --initlabel
-                      autopart
-                      auth  --useshadow  --enablemd5
-                      #skip answers to the First Boot process
-                      firstboot --disable
-                      #reboot machine
-                      reboot
-
-                      %packages --ignoremissing
-                      @core
-                      %end
-
-                      %post
-                      /usr/bin/yum -y install sudo gcc make kernel kernel-devel openssl-devel perl wget dkms acpid
-                      /etc/init.d/haldaemon stop
-                      /etc/init.d/acpid start
-                      /etc/init.d/haldaemon start
-                      /usr/sbin/groupadd toor
-                      /usr/sbin/useradd toor -g toor -G wheel
-                      echo "password"|passwd --stdin toor
-                      echo "toor        ALL=(ALL)       NOPASSWD: ALL" > /etc/sudoers.d/toor
-                      chmod 0440 /etc/sudoers.d/toor
-                      sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
-                      %end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/functions/checkVBoxService.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/functions/checkVBoxService.sh b/virtualbox/src/main/resources/functions/checkVBoxService.sh
deleted file mode 100644
index 85ab94b..0000000
--- a/virtualbox/src/main/resources/functions/checkVBoxService.sh
+++ /dev/null
@@ -1,24 +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.
-#
-function checkVBoxService {
-   local _FOUND=`ps aux | grep '[V]BoxService'`
-   [ -n "$_FOUND" ] && {
-         return 0
-      } || {
-         return 1
-      }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/functions/cleanupUdevIfNeeded.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/functions/cleanupUdevIfNeeded.sh b/virtualbox/src/main/resources/functions/cleanupUdevIfNeeded.sh
deleted file mode 100644
index 921cb48..0000000
--- a/virtualbox/src/main/resources/functions/cleanupUdevIfNeeded.sh
+++ /dev/null
@@ -1,23 +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.
-#
-function cleanupUdevIfNeeded {
-   if [ -f '/etc/udev/rules.d/70-persistent-net.rules' ]
-   then
-      rm /etc/udev/rules.d/70-persistent-net.rules
-   fi
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/functions/exportIpAddressFromVmNamed.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/functions/exportIpAddressFromVmNamed.sh b/virtualbox/src/main/resources/functions/exportIpAddressFromVmNamed.sh
deleted file mode 100644
index aeb941b..0000000
--- a/virtualbox/src/main/resources/functions/exportIpAddressFromVmNamed.sh
+++ /dev/null
@@ -1,32 +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.
-#
-function exportIpAddressFromVmNamed {
-   unset FOUND_IP_ADDRESS;
-   [ $# -eq 1 ] || {
-      abort "exportIpAddressFromVmNamed requires virtual machine name parameter"
-      return 1
-   }
-   local VMNAME="$0"; shift
-   local _FOUND=`VBoxManage guestproperty enumerate "$VMNAME" --patterns "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $4 }' | cut -c 1-14`
-   [ -n "$_FOUND" ] && {
-      export FOUND_IP_ADDRESS=$_FOUND
-      echo [$FOUND_IP_ADDRESS]
-      return 0
-   } || {
-      return 1
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/functions/getIpAddress.cmd
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/functions/getIpAddress.cmd b/virtualbox/src/main/resources/functions/getIpAddress.cmd
deleted file mode 100644
index 460afbf..0000000
--- a/virtualbox/src/main/resources/functions/getIpAddress.cmd
+++ /dev/null
@@ -1,16 +0,0 @@
-REM
-REM Licensed to the Apache Software Foundation (ASF) under one or more
-REM contributor license agreements.  See the NOTICE file distributed with
-REM this work for additional information regarding copyright ownership.
-REM The ASF licenses this file to You under the Apache License, Version 2.0
-REM (the "License"); you may not use this file except in compliance with
-REM the License.  You may obtain a copy of the License at
-REM
-REM     http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing, software
-REM distributed under the License is distributed on an "AS IS" BASIS,
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-REM See the License for the specific language governing permissions and
-REM limitations under the License.
-REM

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/functions/getIpAddress.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/functions/getIpAddress.sh b/virtualbox/src/main/resources/functions/getIpAddress.sh
deleted file mode 100644
index f4e28ad..0000000
--- a/virtualbox/src/main/resources/functions/getIpAddress.sh
+++ /dev/null
@@ -1,32 +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.
-#
-function getIpAddress {
-   unset FOUND_IP_ADDRESS;
-   [ $# -eq 1 ] || {
-      abort "installGuestAdditions requires virtual machine name parameter"
-      return 1
-   }
-   local VMNAME="$0"; shift
-   local _FOUND=`VBoxManage guestproperty enumerate "$VMNAME" --patterns "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $4 }' | cut -c 1-14`
-   [ -n "$_FOUND" ] && {
-      export FOUND_IP_ADDRESS=$_FOUND
-      echo [$FOUND_IP_ADDRESS]
-      return 0
-   } || {
-      return 1
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/resources/functions/installModuleAssistantIfNeeded.sh
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/resources/functions/installModuleAssistantIfNeeded.sh b/virtualbox/src/main/resources/functions/installModuleAssistantIfNeeded.sh
deleted file mode 100644
index 5a392e1..0000000
--- a/virtualbox/src/main/resources/functions/installModuleAssistantIfNeeded.sh
+++ /dev/null
@@ -1,27 +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.
-#
-function installModuleAssistantIfNeeded {
-   unset OSNAME;
-   local OSNAME=`lsb_release -d -s | cut -d ' ' -f 1`; shift
-   if [ $OSNAME = 'Ubuntu' ]
-   then
-      echo "OS is Ubuntu"
-      apt-get -f -y -qq --force-yes install dkms build-essential linux-headers-`uname -r` module-assistant acpid;
-      m-a prepare -i
-      return 0
-   fi
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java
deleted file mode 100644
index 362b985..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java
+++ /dev/null
@@ -1,211 +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.virtualbox;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
-import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
-import org.jclouds.concurrent.config.ExecutorServiceModule;
-import org.jclouds.rest.annotations.BuildVersion;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.jclouds.util.Strings2;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.Master;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.functions.IMachineToVmSpec;
-import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
-import org.jclouds.virtualbox.util.MachineController;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.Uninterruptibles;
-import com.google.inject.Key;
-import com.google.inject.Module;
-
-/**
- * Tests behavior of {@code VirtualBoxClient}
- */
-@Test(groups = "live", singleThreaded = true, testName = "BaseVirtualBoxClientLiveTest")
-public class BaseVirtualBoxClientLiveTest extends BaseComputeServiceContextLiveTest {
-
-   public static final String DESTROY_MASTER = "jclouds.virtualbox.destroy-test-master";
-
-   public BaseVirtualBoxClientLiveTest() {
-      provider = "virtualbox";
-   }
-
-   @Inject
-   protected MachineController machineController;
-
-   @Inject
-   protected Supplier<VirtualBoxManager> manager;
-
-   @Inject
-   void eagerlyStartManager(Supplier<VirtualBoxManager> manager) {
-      this.manager = manager;
-      manager.get();
-   }
-
-   @Inject
-   protected MachineUtils machineUtils;
-   
-   @Inject
-   protected NetworkUtils networkUtils;
-
-   protected String hostVersion;
-   protected String operatingSystemIso;
-   protected String guestAdditionsIso;
-   @Inject
-   @Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR)
-   protected String workingDir;
-   protected String isosDir;
-   protected String keystrokeSequence;
-   @Inject protected Supplier<NodeMetadata> host;
-   @Inject
-   protected PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate;
-   @Inject
-   protected LoadingCache<Image, Master> mastersCache;
-   private String masterName;   
-
-   @Override
-   protected Iterable<Module> setupModules() {
-      return ImmutableSet.<Module> of(getLoggingModule(), credentialStoreModule, getSshModule(),  new ExecutorServiceModule(
-            sameThreadExecutor(), sameThreadExecutor()));
-   }
-   
-   @Override
-   @BeforeClass(groups = { "integration", "live" })
-   public void setupContext() {
-      super.setupContext();
-      view.utils().injector().injectMembers(this);
-      
-      // 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 = view.getComputeService().templateBuilder().build();
-      checkNotNull(mastersCache.getUnchecked(template.getImage()));
-
-      masterName = VIRTUALBOX_IMAGE_PREFIX + template.getImage().getId();
-      isosDir = workingDir + File.separator + "isos";
-
-      hostVersion = Iterables.get(Splitter.on('-').split(view.utils().injector().getInstance(Key.get(String.class, BuildVersion.class))), 0);
-      operatingSystemIso = String.format("%s/%s.iso", isosDir, template.getImage().getName());
-      guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion);
-      keystrokeSequence = "";
-      try {
-         keystrokeSequence = Strings2.toStringAndClose(getClass().getResourceAsStream("/default-keystroke-sequence"));
-      } catch (IOException e) {
-         throw new RuntimeException("error reading default-keystroke-sequence file");
-      }
-   }
-
-   protected void undoVm(String vmNameOrId) {
-      IMachine vm = null;
-      try {
-         vm = manager.get().getVBox().findMachine(vmNameOrId);
-         VmSpec vmSpec = new IMachineToVmSpec().apply(vm);
-         int attempts = 0;
-         while (attempts < 10 && !vm.getSessionState().equals(SessionState.Unlocked)) {
-            attempts++;
-            Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
-         }
-         machineUtils.applyForMachine(vmNameOrId, new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpec));
-
-      } catch (VBoxException e) {
-         if (e.getMessage().contains("Could not find a registered machine named"))
-            return;
-      }
-   }
-
-   public String adminDisk(String vmName) {
-      return workingDir + File.separator + vmName + ".vdi";
-   }
-
-   public MasterSpec getMasterSpecForTest() {
-      StorageController ideController = StorageController
-               .builder()
-               .name("IDE Controller")
-               .bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(
-                        HardDisk.builder().diskpath(adminDisk(masterName)).controllerPort(0).deviceSlot(1)
-                                 .autoDelete(true).build()).attachISO(1, 0, guestAdditionsIso).build();
-
-      VmSpec sourceVmSpec = VmSpec.builder().id(masterName).name(masterName).osTypeId("").memoryMB(512)
-               .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      IsoSpec isoSpec = IsoSpec
-               .builder()
-               .sourcePath(operatingSystemIso)
-               .installationScript(keystrokeSequence).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
-               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-               .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-      return MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec).network(networkSpec).build();
-   }
-
-   @Override
-   protected Module getSshModule() {
-      return new SshjSshClientModule();
-   }
-
-   @AfterSuite
-   protected void destroyMaster() {
-      if (System.getProperty(DESTROY_MASTER) != null
-               || Boolean.parseBoolean(System.getProperty(DESTROY_MASTER))) {
-         undoVm(masterName);
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/PreseedCfgServerTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/PreseedCfgServerTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/PreseedCfgServerTest.java
deleted file mode 100644
index 249d6de..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/PreseedCfgServerTest.java
+++ /dev/null
@@ -1,70 +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.virtualbox;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.util.Strings2;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.jclouds.virtualbox.domain.YamlImage;
-import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig;
-import org.jclouds.virtualbox.functions.admin.ImagesToYamlImagesFromYamlDescriptor;
-import org.jclouds.virtualbox.functions.admin.PreseedCfgServer;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-/**
- * Tests that jetty is able to serve the preseed.cfg from the provided yaml
- * image. This test is here to have access to the defaultProperties() method in
- * {@link VirtualBoxPropertiesBuilder}.
- */
-@Test(groups = "live", singleThreaded = true, testName = "PreseedCfgServerTest")
-public class PreseedCfgServerTest {
-   private static final String lineSeparator = System.getProperty("line.separator");
-
-   @Test
-   public void testJettyServerServesPreseedFile() throws Exception {
-      Properties props = VirtualBoxApiMetadata.defaultProperties();
-
-      String preconfigurationUrl = props.getProperty(VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL);
-
-      int port = URI.create(preconfigurationUrl).getPort();
-
-      PreseedCfgServer starter = new PreseedCfgServer();
-
-      starter.start(preconfigurationUrl, getDefaultImage().preseed_cfg);
-
-      String preseedFileFromJetty = Strings2.toStringAndClose(new URL("http://127.0.0.1:" + port + "/preseed.cfg").openStream());
-      String preseedFileFromFile = getDefaultImage().preseed_cfg + lineSeparator;
-      assertEquals(preseedFileFromFile, preseedFileFromJetty);
-
-      starter.stop();
-   }
-
-   public static YamlImage getDefaultImage() {
-      Map<Image, YamlImage> images = new ImagesToYamlImagesFromYamlDescriptor(new YamlImagesFromFileConfig(
-            "/default-images.yaml")).get();
-      return Iterables.get(images.values(), 0);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/VirtualBoxApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/VirtualBoxApiMetadataTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/VirtualBoxApiMetadataTest.java
deleted file mode 100644
index 45b73e1..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/VirtualBoxApiMetadataTest.java
+++ /dev/null
@@ -1,28 +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.virtualbox;
-
-import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "VirtualBoxApiMetadataTest")
-public class VirtualBoxApiMetadataTest extends BaseComputeServiceApiMetadataTest {
-
-   public VirtualBoxApiMetadataTest() {
-      super(new VirtualBoxApiMetadata());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java
deleted file mode 100644
index cac53b9..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java
+++ /dev/null
@@ -1,115 +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.virtualbox.compute;
-
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Random;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.functions.IMachineToSshClient;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-
-import com.google.common.collect.Iterables;
-
-@Test(groups = "live", singleThreaded = true, testName = "VirtualBoxComputeServiceAdapterLiveTest")
-public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private NodeAndInitialCredentials<IMachine> ubuntu;
-   private NodeAndInitialCredentials<IMachine> centos;
-
-   @Inject
-   protected VirtualBoxComputeServiceAdapter adapter;
-
-
-   @Test
-   public void testCreatedNodeHasExpectedNameAndWeCanConnectViaSsh() {
-      String group = "foo";
-      String name = "foo-ef9";
-      Template template = view.getComputeService().templateBuilder().build();
-      ubuntu = adapter.createNodeWithGroupEncodedIntoName(group, name, template);
-      assertTrue(ubuntu.getNode().getName().contains(group));
-      assertTrue(ubuntu.getNode().getName().contains(name));
-      assertTrue(ubuntu.getNode().getName().startsWith(VIRTUALBOX_NODE_PREFIX));
-      doConnectViaSsh(ubuntu.getNode(), prioritizeCredentialsFromTemplate.apply(template, ubuntu.getCredentials()));
-   }
-
-   @Test
-   public void testCreatedCentosNodeHasExpectedNameAndWeCanConnectViaSsh() {
-      String group = "foo";
-      String name = "centos6-" + new Random(100).nextInt();
-      Template template = view.getComputeService().templateBuilder()
-            .imageId("centos-6.3-amd64")
-            .build();
-      centos = adapter.createNodeWithGroupEncodedIntoName(group, name, template);
-      assertTrue(centos.getNode().getName().contains(group));
-      assertTrue(centos.getNode().getName().contains(name));
-      assertTrue(centos.getNode().getName().startsWith(VIRTUALBOX_NODE_PREFIX));
-      doConnectViaSsh(centos.getNode(), prioritizeCredentialsFromTemplate.apply(template, centos.getCredentials()));
-   }
-
-   protected void doConnectViaSsh(IMachine machine, LoginCredentials creds) {
-      SshClient ssh = view.utils().injector().getInstance(IMachineToSshClient.class).apply(machine);
-      try {
-         ssh.connect();
-         ExecResponse hello = ssh.exec("echo hello");
-         assertEquals(hello.getOutput().trim(), "hello");
-         System.err.println(ssh.exec("df -k").getOutput());
-         System.err.println(ssh.exec("mount").getOutput());
-         System.err.println(ssh.exec("uname -a").getOutput());
-      } finally {
-         if (ssh != null)
-            ssh.disconnect();
-      }
-   }
-
-   @Test
-   public void testListHardwareProfiles() {
-      Iterable<Hardware> profiles = adapter.listHardwareProfiles();
-      assertFalse(Iterables.isEmpty(profiles));
-   }
-
-   @Test
-   public void testListImages() {
-      Iterable<Image> iMageIterable = adapter.listImages();
-      assertFalse(Iterables.isEmpty(iMageIterable));
-   }
-
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      if (ubuntu != null)
-         adapter.destroyNode(ubuntu.getNodeId() + "");
-      if (centos != null)
-         adapter.destroyNode(centos.getNodeId() + "");
-      super.tearDownContext();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java
deleted file mode 100644
index afa8c83..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterTest.java
+++ /dev/null
@@ -1,84 +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.virtualbox.compute;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-
-import java.util.List;
-import java.util.Map;
-
-import org.easymock.EasyMock;
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
-import org.jclouds.virtualbox.functions.IMachineToImage;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.beust.jcommander.internal.Lists;
-import com.google.common.base.Function;
-import com.google.common.base.Suppliers;
-import com.google.inject.Guice;
-
-@Test(groups = "unit")
-public class VirtualBoxComputeServiceAdapterTest {
-
-   Map<OsFamily, Map<String, String>> osMap = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-         .getInstance(Json.class));
-
-   @Test
-   public void testListImages() throws Exception {
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IGuestOSType osType = createNiceMock(IGuestOSType.class);
-
-      List<IMachine> machines = Lists.newArrayList();
-      IMachine imageMachine = createNiceMock(IMachine.class);
-      IMachine clonedMachine = createNiceMock(IMachine.class);
-      machines.add(imageMachine);
-      machines.add(clonedMachine);
-
-      expect(clonedMachine.getName()).andReturn("My Linux Node");
-      expect(clonedMachine.getDescription()).andReturn("My Linux Node");
-      expect(imageMachine.getName()).andReturn(VIRTUALBOX_IMAGE_PREFIX + "ubuntu-10.04");
-      expect(imageMachine.getDescription()).andReturn(VIRTUALBOX_IMAGE_PREFIX + "ubuntu-10.04");
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.getMachines()).andReturn(machines).anyTimes();
-      expect(vBox.getGuestOSType(EasyMock.<String> anyObject())).andReturn(osType).anyTimes();
-      expect(osType.getDescription()).andReturn("Ubuntu 10.04").anyTimes();
-      expect(osType.getIs64Bit()).andReturn(true).anyTimes();
-
-      replay(manager, vBox, clonedMachine, imageMachine, osType);
-
-      Function<IMachine, Image> iMachineToImage = new IMachineToImage(
-               VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers.ofInstance(manager), osMap);
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java
deleted file mode 100644
index 389f439..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java
+++ /dev/null
@@ -1,85 +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.virtualbox.compute;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.RunNodesException;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-@Test(groups = "live", testName = "VirtualBoxExperimentLiveTest")
-public class VirtualBoxExperimentLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   ComputeServiceContext context;
-
-   @BeforeClass
-   public void setUp() {
-      context = ContextBuilder.newBuilder("virtualbox").modules(
-               ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule())).build(
-               ComputeServiceContext.class);
-   }
-
-   @Test
-   public void testLaunchCluster() throws RunNodesException {
-      int numNodes = 3;
-      final String clusterName = "test-launch-cluster";
-      Set<? extends NodeMetadata> nodes = context.getComputeService().createNodesInGroup(clusterName, numNodes,
-               TemplateOptions.Builder.overrideLoginUser("toor"));
-      assertEquals(numNodes, nodes.size(), "wrong number of nodes");
-      for (NodeMetadata node : nodes) {
-         assertTrue(node.getGroup().equals("test-launch-cluster"));
-         logger.debug("Created Node: %s", node);
-         SshClient client = context.utils().sshForNode().apply(node);
-         client.connect();
-         ExecResponse hello = client.exec("echo hello");
-         assertEquals(hello.getOutput().trim(), "hello");
-      }
-      context.getComputeService().destroyNodesMatching(new Predicate<NodeMetadata>() {
-         @Override
-         public boolean apply(NodeMetadata input) {
-            return input.getId().contains(clusterName);
-         }
-      });
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtensionLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtensionLiveTest.java
deleted file mode 100644
index 3318d4a..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtensionLiveTest.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.virtualbox.compute.extensions;
-
-import java.util.concurrent.ExecutionException;
-
-import org.jclouds.compute.RunNodesException;
-import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
-
-import com.google.inject.Module;
-
-@Test(groups = "live", singleThreaded = true, testName = "VirtualBoxImageExtensionLiveTest")
-public class VirtualBoxImageExtensionLiveTest extends BaseImageExtensionLiveTest {
-
-   @Override
-   public void testDeleteImage() {
-      // TODO
-   }
-
-   @Override
-   public void testCreateImage() throws RunNodesException,
-         InterruptedException, ExecutionException {
-      // TODO
-   }
-
-   @Override
-   public void testSpawnNodeFromImage() throws RunNodesException {
-      // TODO
-   }
-
-   public VirtualBoxImageExtensionLiveTest() {
-      provider = "virtualbox";
-   }
-
-   @Override
-   protected Module getSshModule() {
-      return new SshjSshClientModule();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ExportIpAddressForVMNamedTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ExportIpAddressForVMNamedTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ExportIpAddressForVMNamedTest.java
deleted file mode 100644
index 1ea1af4..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ExportIpAddressForVMNamedTest.java
+++ /dev/null
@@ -1,44 +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.virtualbox.domain;
-
-import static org.jclouds.scriptbuilder.domain.Statements.interpret;
-import static org.jclouds.virtualbox.statements.Statements.exportIpAddressFromVmNamed;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.jclouds.scriptbuilder.ScriptBuilder;
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.ShellToken;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
-
-@Test(groups = "unit")
-public class ExportIpAddressForVMNamedTest {
-   
-   ScriptBuilder exportIpAddressForVMNamedBuilder = new ScriptBuilder()
-	.addStatement(exportIpAddressFromVmNamed("{args}"))
-	.addStatement(interpret("echo {varl}FOUND_IP_ADDRESS{varr}{lf}"));
-   	
-   public void testUNIX() throws IOException {  	
-      assertEquals(exportIpAddressForVMNamedBuilder.render(OsFamily.UNIX), Resources.toString(Resources.getResource(
-               "test_export_ip_address_from_vm_named." + ShellToken.SH.to(OsFamily.UNIX)), Charsets.UTF_8));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ScanNetworkWithPingTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ScanNetworkWithPingTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ScanNetworkWithPingTest.java
deleted file mode 100644
index 08552fd..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/domain/ScanNetworkWithPingTest.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.virtualbox.domain;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.virtualbox.statements.ScanNetworkWithPing;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit")
-public class ScanNetworkWithPingTest {
-
-   private static final String network = "192.168.1.1";
-   private static final String networkWithoutLastNumber = "192.168.1";
-
-   public void testGetIPAdressFromMacAddressUnix() {
-      ScanNetworkWithPing statement = new ScanNetworkWithPing(network);
-      assertEquals(statement.render(OsFamily.UNIX), "for i in {1..254} ; do ping -c 1 -t 1 " + networkWithoutLastNumber + ".$i & done");
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java
deleted file mode 100644
index a32a6f4..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java
+++ /dev/null
@@ -1,78 +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.virtualbox.domain;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotEquals;
-
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.StorageBus;
-
-public class VmSpecTest {
-
-   @Test
-   public void testEqualsSuccessful() throws Exception {
-      VmSpec vmSpec = defaultVm().build();
-      VmSpec sameVmSpec = defaultVm().build();
-      assertEquals(vmSpec, sameVmSpec);
-   }
-
-   @Test
-   public void testEqualsWrongId() throws Exception {
-      VmSpec vmSpec = defaultVm().build();
-      VmSpec other = defaultVm().id("OtherVMId").build();
-      assertNotEquals(vmSpec, other);
-   }
-
-   @Test
-   public void testEqualsWrongName() throws Exception {
-      VmSpec vmSpec = defaultVm().build();
-      VmSpec other = defaultVm().name("OtherName").build();
-      assertNotEquals(vmSpec, other);
-   }
-
-   @Test
-   public void testEqualsWrongOsType() throws Exception {
-      VmSpec vmSpec = defaultVm().build();
-      VmSpec other = defaultVm().osTypeId("OtherOS").build();
-      assertNotEquals(vmSpec, other);
-   }
-
-   @Test
-   public void testEqualsWrongForceOverwriteRule() throws Exception {
-      VmSpec vmSpec = defaultVm().build();
-      VmSpec other = defaultVm().forceOverwrite(false).build();
-      assertNotEquals(vmSpec, other);
-   }
-
-   private VmSpec.Builder defaultVm() {
-		return VmSpec.builder()
-              .id("MyVmId")
-              .name("My VM")
-              .osTypeId("Ubuntu")
-              .memoryMB(1024)
-              .cleanUpMode(CleanupMode.Full)
-              .forceOverwrite(true)
-              .controller(
-                      StorageController.builder().name("Controller")
-                              .bus(StorageBus.IDE)
-                              .attachHardDisk(HardDisk.builder().diskpath("/tmp/tempdisk.vdi")
-                                    .controllerPort(0).deviceSlot(0).build())
-                              .build());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/experiment/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/experiment/TestConfiguration.java b/virtualbox/src/test/java/org/jclouds/virtualbox/experiment/TestConfiguration.java
deleted file mode 100644
index e778f5e..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/experiment/TestConfiguration.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.virtualbox.experiment;
-
-import java.util.Map;
-
-import org.jclouds.scriptbuilder.statements.login.AdminAccess.Configuration;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-
-public enum TestConfiguration implements Configuration {
-   INSTANCE;
-   int pwCount = 0;
-
-   public TestConfiguration reset() {
-      pwCount = 0;
-      return this;
-   }
-
-   private final Supplier<String> defaultAdminUsername = Suppliers.ofInstance("defaultAdminUsername");
-   private final Supplier<Map<String, String>> defaultAdminSshKeys = Suppliers
-         .<Map<String, String>> ofInstance(ImmutableMap.of("public", "publicKey", "private", "privateKey"));
-   private final Supplier<String> passwordGenerator = new Supplier<String>() {
-
-      @Override
-      public String get() {
-         return pwCount++ + "";
-      }
-
-   };
-
-   private final Function<String, String> cryptFunction = new Function<String, String>() {
-
-      @Override
-      public String apply(String input) {
-         return String.format("crypt(%s)", input);
-      }
-
-   };
-
-   @Override
-   public Supplier<String> defaultAdminUsername() {
-      return defaultAdminUsername;
-   }
-
-   @Override
-   public Supplier<Map<String, String>> defaultAdminSshKeys() {
-      return defaultAdminSshKeys;
-   }
-
-   @Override
-   public Supplier<String> passwordGenerator() {
-      return passwordGenerator;
-   }
-
-   @Override
-   public Function<String, String> cryptFunction() {
-      return cryptFunction;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExistsTest.java
deleted file mode 100644
index 63fc292..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExistsTest.java
+++ /dev/null
@@ -1,87 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.jclouds.virtualbox.domain.StorageController;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IStorageController;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-
-@Test(groups = "unit", testName = "AddIDEControllerIfNotExistsTest")
-public class AddIDEControllerIfNotExistsTest {
-
-   @Test
-   public void testFine() throws Exception {
-      IMachine vm = createMock(IMachine.class);
-
-      String controllerName = "IDE Controller";
-      StorageController storageController = StorageController.builder().bus(StorageBus.IDE).name(controllerName).build();
-
-      expect(vm.addStorageController(controllerName, StorageBus.IDE)).andReturn(
-              createNiceMock(IStorageController.class));
-      vm.saveSettings();
-
-      replay(vm);
-
-      new AddIDEControllerIfNotExists(storageController).apply(vm);
-
-      verify(vm);
-   }
-
-   @Test
-   public void testAcceptableException() throws Exception {
-      IMachine vm = createMock(IMachine.class);
-
-      String controllerName = "IDE Controller";
-      StorageController storageController = StorageController.builder().bus(StorageBus.IDE).name(controllerName).build();
-
-      expect(vm.addStorageController(controllerName, StorageBus.IDE)).andThrow(
-              new VBoxException(createNiceMock(Throwable.class),
-                      "VirtualBox error: Storage controller named 'IDE Controller' already exists (0x80BB000C)"));
-
-      replay(vm);
-
-      new AddIDEControllerIfNotExists(storageController).apply(vm);
-
-      verify(vm);
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testUnacceptableException() throws Exception {
-      IMachine vm = createMock(IMachine.class);
-
-      String controllerName = "IDE Controller";
-      StorageController storageController = StorageController.builder().bus(StorageBus.IDE).name(controllerName).build();
-
-      expect(vm.addStorageController(controllerName, StorageBus.IDE)).andThrow(
-              new VBoxException(createNiceMock(Throwable.class), "VirtualBox error: General Error"));
-
-      replay(vm);
-
-      new AddIDEControllerIfNotExists(storageController).apply(vm);
-
-      verify(vm);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachineTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachineTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachineTest.java
deleted file mode 100644
index 922ece6..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachineTest.java
+++ /dev/null
@@ -1,46 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import com.google.common.collect.ImmutableMap;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-
-import java.util.Map;
-
-@Test(groups = "unit", testName = "ApplyBootOrderToMachineTest")
-public class ApplyBootOrderToMachineTest {
-
-   @Test
-   public void testSetBootOrderSuccessful() throws Exception {
-      Map<Long, DeviceType> positionAndDeviceType = ImmutableMap.of(1l, DeviceType.HardDisk);
-      IMachine machine = createMock(IMachine.class);
-      for (long position : positionAndDeviceType.keySet()) {
-         machine.setBootOrder(position, positionAndDeviceType.get(position));
-      }
-      machine.saveSettings();
-      replay(machine);
-      new ApplyBootOrderToMachine(positionAndDeviceType).apply(machine);
-      verify(machine);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachineTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachineTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachineTest.java
deleted file mode 100644
index 6efe32b..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachineTest.java
+++ /dev/null
@@ -1,66 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VBoxException;
-
-@Test(groups = "unit", testName = "ApplyMemoryToMachineTest")
-public class ApplyMemoryToMachineTest {
-
-   @Test
-   public void testSetRAMSizeSuccessful() throws Exception {
-      long memorySize = 1024l;
-      IMachine machine = createMock(IMachine.class);
-
-      machine.setMemorySize(memorySize);
-      machine.saveSettings();
-
-      replay(machine);
-
-      new ApplyMemoryToMachine(memorySize).apply(machine);
-
-      verify(machine);
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testRethrowInvalidRamSizeError() throws Exception {
-      // Mainly here for documentation purposes
-      final String error = "VirtualBox error: Invalid RAM size: "
-            + "3567587327 MB (must be in range [4, 2097152] MB) (0x80070057)";
-
-      long memorySize = 1024l;
-      IMachine machine = createMock(IMachine.class);
-
-      VBoxException invalidRamSizeException = new VBoxException(createNiceMock(Throwable.class), error);
-      machine.setMemorySize(memorySize);
-      expectLastCall().andThrow(invalidRamSizeException);
-      machine.saveSettings();
-
-      replay(machine);
-
-      new ApplyMemoryToMachine(memorySize).apply(machine);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachineTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachineTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachineTest.java
deleted file mode 100644
index d97774c..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachineTest.java
+++ /dev/null
@@ -1,62 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.virtualbox_4_2.NetworkAttachmentType.Bridged;
-
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.NetworkAttachmentType;
-
-@Test(groups = "unit", testName = "AttachBridgedAdapterToMachineTest")
-public class AttachBridgedAdapterToMachineTest {
-
-	private String macAddress;
-	private String hostInterface;
-
-	@Test
-	public void testApplyNetworkingToNonExistingAdapter() throws Exception {
-		Long adapterId = 0l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-
-		expect(machine.getNetworkAdapter(adapterId)).andReturn(iNetworkAdapter);
-		iNetworkAdapter.setAttachmentType(Bridged);
-		iNetworkAdapter.setMACAddress(macAddress);
-		iNetworkAdapter.setBridgedInterface(hostInterface);
-		iNetworkAdapter.setEnabled(true);
-		machine.saveSettings();
-
-		replay(machine, iNetworkAdapter);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.Bridged).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-
-		new AttachBridgedAdapterToMachine(networkInterfaceCard).apply(machine);
-
-		verify(machine, iNetworkAdapter);
-	}
-
-}


[6/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunning.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunning.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunning.java
deleted file mode 100644
index 90ab02d..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunning.java
+++ /dev/null
@@ -1,94 +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.virtualbox.functions;
-
-import static com.google.common.base.Throwables.propagate;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.jclouds.virtualbox.domain.ExecutionType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-
-/**
- * Starts a machine using launchMachine() with the provided type and
- * environment.
- * <p/>
- * Note that launchMachine() may throw VBoxException with the following error
- * codes:
- * <p/>
- * VBOX_E_UNEXPECTED: Virtual machine not registered. VBOX_E_INVALIDARG: Invalid
- * session type type. VBOX_E_OBJECT_NOT_FOUND: No machine matching machineId
- * found. VBOX_E_INVALID_OBJECT_STATE: Session already open or being opened.
- * VBOX_E_IPRT_ERROR: Launching process for machine failed. VBOX_E_VM_ERROR:
- * Failed to assign machine to session.
- *
- * @see ErrorCode
- */
-public class LaunchMachineIfNotAlreadyRunning implements Function<IMachine, ISession> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final VirtualBoxManager manager;
-   private final ExecutionType type;
-   private final String environment;
-
-   public LaunchMachineIfNotAlreadyRunning(VirtualBoxManager manager, ExecutionType type, String environment) {
-      this.manager = manager;
-      this.type = type;
-      this.environment = environment;
-   }
-
-   @Override
-   public ISession apply(IMachine machine) {
-      ISession session = manager.getSessionObject();
-      try {
-         final IProgress progress = machine
-                 .launchVMProcess(session, type.stringValue(), environment);
-         progress.waitForCompletion(-1);
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         switch (errorCode) {
-            case VBOX_E_INVALID_OBJECT_STATE:
-               logger.warn(e, "Could not start machine. Got error code %s from launchMachine(). "
-                       + "The machine might already be running.", errorCode);
-               break;
-            default:
-               propagate(e);
-         }
-      } finally {
-         if (session.getState() == SessionState.Locked) {
-            // Remove session lock taken by launchVmProcess()
-            session.unlockMachine();
-            // TODO this unlock is not IMMEDIATELY visible outside (vbox doc)
-         }
-      }
-      return session;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MacAddressToBSD.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MacAddressToBSD.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MacAddressToBSD.java
deleted file mode 100644
index e058848..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MacAddressToBSD.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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-
-public enum MacAddressToBSD implements Function<String, String> {
-
-   INSTANCE;
-
-   @Override
-   public String apply(String macAddress) {
-      checkArgument(macAddress.length() == 17);
-      return Joiner.on(":").join(
-              Iterables.transform(Splitter.on(":").split(macAddress),
-                      new Function<String, String>() {
-                         @Override
-                         public String apply(String addressPart) {
-                            if (addressPart.equals("00"))
-                               return "0";
-                            if (addressPart.startsWith("0"))
-                               return addressPart.substring(1);
-
-                            return addressPart;
-                         }
-                      }));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java
deleted file mode 100644
index 658429a..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/MastersLoadingCache.java
+++ /dev/null
@@ -1,286 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAULT_DIR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
-import static org.jclouds.virtualbox.util.MachineUtils.machineNotFoundException;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ExecutionException;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.callables.RunScriptOnNode.Factory;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.location.Provider;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.annotations.BuildVersion;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.StatementList;
-import org.jclouds.scriptbuilder.domain.Statements;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.Master;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.domain.YamlImage;
-import org.jclouds.virtualbox.functions.admin.PreseedCfgServer;
-import org.jclouds.virtualbox.predicates.RetryIfSocketNotYetOpen;
-import org.jclouds.virtualbox.statements.Md5;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.base.Supplier;
-import com.google.common.cache.AbstractLoadingCache;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.net.HostAndPort;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * A {@link LoadingCache} for masters. If the requested master has been
- * previously created this returns it, if not it coordinates its creation
- * including downloading isos and creating cache/config directories. This also
- * implements {@link Supplier} in order to provide jetty with the current image
- * (only one master can be created at a time).
- */
-@Singleton
-public class MastersLoadingCache extends AbstractLoadingCache<Image, Master> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Map<String, Master> masters = Maps.newHashMap();
-   private final Function<MasterSpec, IMachine> masterCreatorAndInstaller;
-   private final Map<String, YamlImage> imageMapping;
-   private final String workingDir;
-   private final String isosDir;
-   private final Supplier<VirtualBoxManager> manager;
-   private final String version;
-   private final String preconfigurationUrl;
-
-   private final Factory runScriptOnNodeFactory;
-   private final RetryIfSocketNotYetOpen socketTester;
-   private final Supplier<NodeMetadata> host;
-   private final Supplier<URI> providerSupplier;
-   private final HardcodedHostToHostNodeMetadata hardcodedHostToHostNodeMetadata;
-
-   @Inject
-   public MastersLoadingCache(@BuildVersion String version,
-         @Named(VIRTUALBOX_PRECONFIGURATION_URL) String preconfigurationUrl,
-         @Named(VIRTUALBOX_WORKINGDIR) String workingDir, Function<MasterSpec, IMachine> masterLoader,
-         Supplier<Map<Image, YamlImage>> yamlMapper, Supplier<VirtualBoxManager> manager,
-         Factory runScriptOnNodeFactory, RetryIfSocketNotYetOpen socketTester, Supplier<NodeMetadata> host,
-         @Provider Supplier<URI> providerSupplier, HardcodedHostToHostNodeMetadata hardcodedHostToHostNodeMetadata) {
-      this.manager = checkNotNull(manager, "vboxmanager can't be null");
-      this.masterCreatorAndInstaller = masterLoader;
-      this.workingDir = workingDir == null ? VIRTUALBOX_DEFAULT_DIR : workingDir;
-      this.isosDir = workingDir + File.separator + "isos";
-      this.imageMapping = Maps.newLinkedHashMap();
-      for (Entry<Image, YamlImage> entry : yamlMapper.get().entrySet()) {
-         this.imageMapping.put(entry.getKey().getId(), entry.getValue());
-      }
-      this.version = Iterables.get(Splitter.on('r').split(checkNotNull(version, "version")), 0);
-      this.preconfigurationUrl = preconfigurationUrl;
-
-      this.runScriptOnNodeFactory = checkNotNull(runScriptOnNodeFactory, "runScriptOnNodeFactory");
-      this.socketTester = checkNotNull(socketTester, "socketTester");
-      this.socketTester.seconds(3L);
-      this.host = checkNotNull(host, "host");
-      this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox websrvd is needed");
-      this.hardcodedHostToHostNodeMetadata = hardcodedHostToHostNodeMetadata;
-   }
-
-   @PostConstruct
-   public void createCacheDirStructure() {
-      if (!new File(workingDir).exists()) {
-         new File(workingDir, "isos").mkdirs();
-      }
-   }
-
-   @Override
-   public synchronized Master get(Image key) throws ExecutionException {
-      // check if we have loaded this machine before
-      if (masters.containsKey(key.getId())) {
-         return masters.get(key.getId());
-      }
-      checkState(!key.getId().contains(VIRTUALBOX_NODE_NAME_SEPARATOR), "master image names cannot contain \""
-            + VIRTUALBOX_NODE_NAME_SEPARATOR + "\"");
-      String vmName = VIRTUALBOX_IMAGE_PREFIX + key.getId();
-      IMachine masterMachine;
-      Master master;
-      // ready the preseed file server
-      PreseedCfgServer server = new PreseedCfgServer();
-      try {
-         // try and find a master machine in vbox
-         masterMachine = manager.get().getVBox().findMachine(vmName);
-         master = Master.builder().machine(masterMachine).build();
-      } catch (VBoxException e) {
-         if (machineNotFoundException(e)) {
-            // machine was not found try to build one from a yaml file
-            YamlImage currentImage = checkNotNull(imageMapping.get(key.getId()), "currentImage");
-            URI preseedServer;
-            try {
-               preseedServer = new URI(preconfigurationUrl);
-               if (!socketTester.apply(HostAndPort.fromParts(preseedServer.getHost(), preseedServer.getPort()))) {
-                  server.start(preconfigurationUrl, currentImage.preseed_cfg);
-               }
-            } catch (URISyntaxException e1) {
-               logger.error("Cannot start the preseed server", e);
-               throw e;
-            }
-
-            MasterSpec masterSpec = buildMasterSpecFromYaml(currentImage, vmName);
-            masterMachine = masterCreatorAndInstaller.apply(masterSpec);
-            master = Master.builder().machine(masterMachine).spec(masterSpec).build();
-         } else {
-            logger.error("Problem during master creation", e);
-            throw e;
-         }
-      } finally {
-         server.stop();
-      }
-
-      masters.put(key.getId(), master);
-      return master;
-   }
-
-   private MasterSpec buildMasterSpecFromYaml(YamlImage currentImage, String vmName) throws ExecutionException {
-      String guestAdditionsFileName = String.format("VBoxGuestAdditions_%s.iso", version);
-      String guestAdditionsIso = String.format("%s/%s", isosDir, guestAdditionsFileName);
-      String guestAdditionsUri = "http://download.virtualbox.org/virtualbox/" + version + "/" + guestAdditionsFileName;
-      if (!new File(guestAdditionsIso).exists()) {
-         getFilePathOrDownload(guestAdditionsUri, null);
-      }
-      // check if the iso is here, download if not
-      String localIsoUrl = checkNotNull(getFilePathOrDownload(currentImage.iso, currentImage.iso_md5), "distro iso");
-      String adminDisk = workingDir + File.separator + vmName + ".vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true).controllerPort(0).deviceSlot(1)
-            .build();
-
-      StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
-            .attachISO(0, 0, localIsoUrl).attachHardDisk(hardDisk).build();
-
-      VmSpec vmSpecification = VmSpec.builder().id(currentImage.id).name(vmName).memoryMB(512)
-            .osTypeId(getOsTypeId(currentImage.os_family, currentImage.os_64bit)).controller(ideController)
-            .forceOverwrite(true).guestUser(currentImage.username).guestPassword(currentImage.credential)
-            .cleanUpMode(CleanupMode.Full).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
-            .tcpRedirectRule(providerSupplier.get().getHost(), NetworkUtils.MASTER_PORT, "", 22).build();
-
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-            .slot(0L).build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-
-      String installationSequence = currentImage.keystroke_sequence.replace("HOSTNAME", vmSpecification.getVmName());
-      return MasterSpec.builder()
-                       .vm(vmSpecification)
-                       .iso(IsoSpec.builder()
-                                   .sourcePath(localIsoUrl)
-                                   .installationScript(installationSequence)
-                                   .build())
-                       .network(networkSpec)
-                       .credentials(LoginCredentials.builder()
-                                                    .user(currentImage.username)
-                                                    .password(currentImage.credential)
-                                                    .authenticateSudo(true)
-                                                    .build())
-                       .build();
-   }
-
-   @Override
-   public synchronized Master getIfPresent(Object key) {
-      checkArgument(key instanceof Image, "this cache is for entries who's keys are Images");
-      Image image = Image.class.cast(key);
-      if (masters.containsKey(image.getId())) {
-         return masters.get(image.getId());
-      }
-      return null;
-   }
-
-   private String getFilePathOrDownload(String httpUrl, String expectedMd5) throws ExecutionException {
-      String fileName = httpUrl.substring(httpUrl.lastIndexOf('/') + 1, httpUrl.length());
-      URI provider = providerSupplier.get();
-      if (!socketTester.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))) {
-         throw new RuntimeException("could not connect to virtualbox");
-      }
-      File file = new File(isosDir, fileName);
-      List<Statement> statements = new ImmutableList.Builder<Statement>().add(
-            Statements.saveHttpResponseTo(URI.create(httpUrl), isosDir, fileName)).build();
-      StatementList statementList = new StatementList(statements);
-      NodeMetadata hostNode = checkNotNull(hardcodedHostToHostNodeMetadata.apply(host.get()), "hostNode");
-      ListenableFuture<ExecResponse> future = runScriptOnNodeFactory.submit(hostNode, statementList,
-            runAsRoot(false));
-      Futures.getUnchecked(future);
-
-      if (expectedMd5 != null) {
-         String filePath = isosDir + File.separator + fileName;
-         ListenableFuture<ExecResponse> md5future = runScriptOnNodeFactory.submit(hostNode, new Md5(filePath),
-               runAsRoot(false));
-
-         ExecResponse responseMd5 = Futures.getUnchecked(md5future);
-         assert responseMd5.getExitStatus() == 0 : hostNode.getId() + ": " + responseMd5;
-         checkNotNull(responseMd5.getOutput(), "iso_md5 missing");
-         String actualMd5 = responseMd5.getOutput().trim();
-         checkState(actualMd5.equals(expectedMd5), "md5 of %s is %s but expected %s", filePath, actualMd5, expectedMd5);
-      }
-      return file.getAbsolutePath();
-   }
-
-   private String getOsTypeId(String os_family, boolean os_64bit) {
-      String osFamily = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, os_family);
-      return os_64bit ? osFamily + "_64" : osFamily;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java
deleted file mode 100644
index 739c197..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java
+++ /dev/null
@@ -1,294 +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.virtualbox.functions;
-
- import com.google.common.base.Charsets;
- import com.google.common.base.Function;
- import com.google.common.base.Optional;
- import com.google.common.base.Predicate;
- import com.google.common.base.Supplier;
- import com.google.common.collect.ImmutableSet;
- import com.google.common.collect.Iterables;
- import com.google.common.io.Files;
- import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
- import org.jclouds.compute.domain.NodeMetadata;
- import org.jclouds.compute.domain.NodeMetadataBuilder;
- import org.jclouds.compute.options.RunScriptOptions;
- import org.jclouds.compute.reference.ComputeServiceConstants;
- import org.jclouds.domain.LoginCredentials;
- import org.jclouds.logging.Logger;
- import org.jclouds.util.Strings2;
- import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
- import org.jclouds.virtualbox.domain.CloneSpec;
- import org.jclouds.virtualbox.domain.Master;
- import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
- import org.jclouds.virtualbox.domain.NetworkSpec;
- import org.jclouds.virtualbox.domain.NodeSpec;
- import org.jclouds.virtualbox.domain.VmSpec;
- import org.jclouds.virtualbox.statements.DeleteGShadowLock;
- import org.jclouds.virtualbox.statements.PasswordlessSudo;
- import org.jclouds.virtualbox.util.MachineController;
- import org.jclouds.virtualbox.util.MachineUtils;
- import org.jclouds.virtualbox.util.NetworkUtils;
- import org.virtualbox_4_2.CleanupMode;
- import org.virtualbox_4_2.IMachine;
- import org.virtualbox_4_2.IProgress;
- import org.virtualbox_4_2.ISession;
- import org.virtualbox_4_2.LockType;
- import org.virtualbox_4_2.NetworkAttachmentType;
- import org.virtualbox_4_2.VirtualBoxManager;
- import com.google.common.collect.ImmutableList;
-
- import javax.annotation.Resource;
- import javax.inject.Inject;
- import javax.inject.Named;
- import javax.inject.Singleton;
-
- import java.io.File;
- import java.io.IOException;
-
- import static com.google.common.base.Preconditions.checkNotNull;
- import static com.google.common.base.Preconditions.checkState;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_PASSWORD;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_GUEST_MEMORY;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
- import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
-
-/**
- * Creates nodes, by cloning a master vm and based on the provided {@link NodeSpec}. Must be
- * synchronized mainly because of snapshot creation (must be synchronized on a per-master-basis).
- */
-@Singleton
-public class NodeCreator implements Function<NodeSpec, NodeAndInitialCredentials<IMachine>> {
-   
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-   
-   private final Supplier<VirtualBoxManager> manager;
-   private final Function<CloneSpec, IMachine> cloner;
-   private final MachineUtils machineUtils;
-   private final MachineController machineController;
-   private final NetworkUtils networkUtils;
-   private final int ram;
-   private final String workingDir;
-   
-   @Inject
-   public NodeCreator(Supplier<VirtualBoxManager> manager, Function<CloneSpec, IMachine> cloner,
-            MachineUtils machineUtils, MachineController machineController,
-            NetworkUtils networkUtils,
-            @Named(VIRTUALBOX_GUEST_MEMORY) String ram,
-            @Named(VIRTUALBOX_WORKINGDIR) String workingDir) {
-      this.manager = checkNotNull(manager, "manager");
-      this.cloner = checkNotNull(cloner, "cloner");
-      this.networkUtils = checkNotNull(networkUtils, "networkUtils");
-      this.machineUtils = checkNotNull(machineUtils, "machineUtils");
-      this.machineController = checkNotNull(machineController, "machineController");
-      this.ram = checkNotNull(Integer.valueOf(ram), "ram");
-      this.workingDir = checkNotNull(workingDir, "workingDir");
-   }
-
-   @Override
-   public synchronized NodeAndInitialCredentials<IMachine> apply(NodeSpec nodeSpec) {
-      checkNotNull(nodeSpec, "NodeSpec");
-      Master master = checkNotNull(nodeSpec.getMaster(), "Master");
-      IMachine masterMachine = master.getMachine();
-      String guestOsUser = masterMachine.getExtraData(GUEST_OS_USER);
-      String guestOsPassword = masterMachine.getExtraData(GUEST_OS_PASSWORD);
-
-      cleanUpMaster(master);
-      CloneSpec cloneSpec = configureCloneSpec(nodeSpec, guestOsUser, guestOsPassword);
-      IMachine clone = cloner.apply(cloneSpec);
-      String cloneName =  cloneSpec.getVmSpec().getVmName();
-      logger.debug("<< cloned a vm(%s) from master(%s)", cloneName, nodeSpec.getMaster().getMachine().getName());
-      machineController.ensureMachineIsLaunched(cloneName);
-      logger.debug("<< cloned vm(%s) is up and running", cloneName);
-
-      reconfigureNetworkInterfaces(masterMachine, guestOsUser, guestOsPassword, cloneSpec.getNetworkSpec(), clone);
-
-      postConfigurations(clone, guestOsUser, guestOsPassword);
-
-      LoginCredentials credentials = LoginCredentials.builder()
-                                                     .user(guestOsUser)
-                                                     .password(guestOsPassword)
-                                                     .authenticateSudo(true)
-                                                     .build();
-      return new NodeAndInitialCredentials<IMachine>(clone, cloneName, credentials);
-   }
-
-   private void reconfigureNetworkInterfaces(IMachine masterMachine, String guestOsUser, String guestOsPassword, NetworkSpec networkSpec, IMachine clone) {
-      reconfigureHostOnlyInterfaceIfNeeded(guestOsUser, guestOsPassword, clone.getName(), masterMachine.getOSTypeId());
-      logger.debug("<< reconfigured hostOnly interface of node(%s)", clone.getName());
-      reconfigureNatInterfaceIfNeeded(guestOsUser, guestOsPassword, clone.getOSTypeId(), clone, networkSpec);
-      logger.debug("<< reconfigured NAT interface of node(%s)", clone.getName());
-   }
-
-   /**
-    * {@see DeleteGShadowLock} and {@see PasswordlessSudo} for a detailed explanation
-    *
-    * @param clone the target machine
-    * @param guestOsUser the user to access the target machine
-    * @param guestOsPassword the password to access the target machine
-    */
-   private void postConfigurations(IMachine clone, String guestOsUser, String guestOsPassword) {
-      NodeMetadata partialNodeMetadata = buildPartialNodeMetadata(clone, guestOsUser, guestOsPassword);
-      machineUtils.runScriptOnNode(partialNodeMetadata, new DeleteGShadowLock(), RunScriptOptions.NONE);
-      machineUtils.runScriptOnNode(partialNodeMetadata, new PasswordlessSudo(partialNodeMetadata.getCredentials().identity), RunScriptOptions.Builder.runAsRoot(true));
-   }
-
-   private CloneSpec configureCloneSpec(
-           NodeSpec nodeSpec, String guestOsUser, String guestOsPassword) {
-
-      String cloneName = generateCloneName(nodeSpec);
-
-      VmSpec cloneVmSpec = VmSpec.builder()
-              .id(cloneName)
-              .name(cloneName)
-              .memoryMB(ram)
-              .osTypeId(nodeSpec.getMaster().getMachine().getOSTypeId())
-              .guestUser(guestOsUser)
-              .guestPassword(guestOsPassword)
-              .cleanUpMode(CleanupMode.Full)
-              .forceOverwrite(true)
-              .build();
-
-      // case 'vbox host is localhost': NAT + HOST-ONLY
-      NetworkSpec networkSpec = networkUtils.createNetworkSpecWhenVboxIsLocalhost();
-
-      return CloneSpec.builder()
-              .linked(true)
-              .master(nodeSpec.getMaster().getMachine())
-              .network(networkSpec)
-              .vm(cloneVmSpec).build();
-   }
-
-   private void cleanUpMaster(Master master) {
-      deleteExistingSnapshot(master);
-   }
-
-   private void reconfigureHostOnlyInterfaceIfNeeded(final String username, final String password,
-                                                         String vmName, String osTypeId) {
-      final String scriptName = "hostOnly";
-      if (osTypeId.contains("RedHat")) {
-         File scriptFile = copyScriptToWorkingDir("redHatAndDerivatives", scriptName);
-         copyToNodeAndExecScript(username, password, vmName, scriptFile);
-      }
-   }
-
-   private void reconfigureNatInterfaceIfNeeded(final String guestOsUser, final String guestOsPassword,
-                                                String osTypeId, IMachine clone, NetworkSpec networkSpec) {
-
-      final String scriptName = "nat";
-      final String folder = "redHatAndDerivatives";
-      if (osTypeId.contains("RedHat")) {
-         File scriptFile = copyScriptToWorkingDir(folder, scriptName);
-         copyToNodeAndExecScript(guestOsUser, guestOsPassword, clone.getName(), scriptFile);
-      } else if (osTypeId.contains("Ubuntu") || osTypeId.contains("Debian")) {
-         NodeMetadata partialNodeMetadata = buildPartialNodeMetadata(clone, guestOsUser, guestOsPassword);
-
-         Optional<NetworkInterfaceCard> optionalNatIfaceCard = Iterables.tryFind(
-                 networkSpec.getNetworkInterfaceCards(),
-                 new Predicate<NetworkInterfaceCard>() {
-
-                    @Override
-                    public boolean apply(NetworkInterfaceCard nic) {
-                       return nic.getNetworkAdapter().getNetworkAttachmentType()
-                               .equals(NetworkAttachmentType.NAT);
-                    }
-                 });
-
-         checkState(networkUtils.enableNetworkInterface(partialNodeMetadata, optionalNatIfaceCard.get()),
-                 "cannot enable NAT Interface on vm(%s)", clone.getName());
-      }
-   }
-
-   private File copyScriptToWorkingDir(String folder, String scriptName) {
-      File scriptFile = new File(workingDir + "/conf/" + "/" + folder + "/" + scriptName);
-      scriptFile.getParentFile().mkdirs();
-      if (!scriptFile.exists()) {
-         try {
-            Files.write(Strings2.toStringAndClose(getClass().getResourceAsStream("/" + folder + "/" + scriptName)), scriptFile, Charsets.UTF_8);
-         } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-         }
-      }
-      return scriptFile;
-   }
-
-   private void copyToNodeAndExecScript(final String username, final String password,
-                                        String vmName, final File scriptFile) {
-      machineUtils.sharedLockMachineAndApplyToSession(vmName, new Function<ISession, Void>() {
-
-         @Override
-         public Void apply(ISession session) {
-            String scriptName = scriptFile.getName();
-
-            manager.get().getSessionObject().getConsole().getGuest()
-                    .createSession(username, password, null, null)
-                    .copyTo(scriptFile.getAbsolutePath(), "/tmp/" + scriptName, null);
-
-            manager.get().getSessionObject().getConsole().getGuest()
-                    .createSession(username, password, null, null)
-                    .processCreate("/bin/chmod", ImmutableList.of("777", "/tmp/" + scriptName), null, null, 5 * 1000l);
-
-            manager.get().getSessionObject().getConsole().getGuest()
-                    .createSession(username, password, null, null)
-                    .processCreate("/bin/sh", ImmutableList.of("/tmp/" + scriptName), null, null, 5 * 1000l);
-            return null;
-         }
-      });
-   }
-
-   private String generateCloneName(NodeSpec nodeSpec) {
-      String masterNameWithoutPrefix = nodeSpec.getMaster().getMachine().getName().replace(VIRTUALBOX_IMAGE_PREFIX, "");
-      return VIRTUALBOX_NODE_PREFIX + masterNameWithoutPrefix + VIRTUALBOX_NODE_NAME_SEPARATOR
-               + nodeSpec.getTag() + VIRTUALBOX_NODE_NAME_SEPARATOR + nodeSpec.getName();
-   }
-
-   private void deleteExistingSnapshot(Master master) {
-      if (master.getMachine().getCurrentSnapshot() != null) {
-         ISession session;
-         try {
-            session = manager.get().getSessionObject();
-            master.getMachine().lockMachine(session, LockType.Write);
-            IProgress progress = session.getConsole().deleteSnapshot(master.getMachine().getCurrentSnapshot().getId());
-            progress.waitForCompletion(-1);
-            session.unlockMachine();
-         } catch (Exception e) {
-            throw new RuntimeException("error opening vbox machine session: " + e.getMessage(), e);
-         }
-         logger.debug("<< deleted an existing snapshot of vm(%s)", master.getMachine().getName());
-      }
-   }
-
-   private NodeMetadata buildPartialNodeMetadata(IMachine clone, String guestOsUser, String guestOsPassword) {
-      NodeMetadataBuilder nodeMetadataBuilder = new NodeMetadataBuilder();
-      nodeMetadataBuilder.id(clone.getName());
-      nodeMetadataBuilder.status(VirtualBoxComputeServiceContextModule.toPortableNodeStatus.get(clone.getState()));
-      nodeMetadataBuilder.publicAddresses(ImmutableSet.of(networkUtils.getValidHostOnlyIpFromVm(clone.getName())));
-      nodeMetadataBuilder.credentials(LoginCredentials.builder()
-                                                      .user(guestOsUser)
-                                                      .password(guestOsPassword)
-                                                      .authenticateSudo(true).build());
-      return nodeMetadataBuilder.build();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfaces.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfaces.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfaces.java
deleted file mode 100644
index 8c076c2..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfaces.java
+++ /dev/null
@@ -1,118 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
-
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-
-import org.jclouds.compute.callables.RunScriptOnNode.Factory;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.Statements;
-import org.jclouds.virtualbox.domain.BridgedIf;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-
-public class RetrieveActiveBridgedInterfaces implements Function<NodeMetadata, List<BridgedIf>> {
-
-@Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Factory runScriptOnNodeFactory;
-
-   @Inject
-   public RetrieveActiveBridgedInterfaces(Factory runScriptOnNodeFactory) {	   
-      this.runScriptOnNodeFactory = checkNotNull(runScriptOnNodeFactory, "runScriptOnNodeFactory");
-   }
-
-   @Override
-   public List<BridgedIf> apply(NodeMetadata host) {
-      // Bridged Network
-      Statement command = Statements.exec("VBoxManage list bridgedifs");
-      String bridgedIfBlocks = runScriptOnNodeFactory.create(host, command, runAsRoot(false).wrapInInitScript(false))
-               .init().call().getOutput();
-
-      List<BridgedIf> bridgedInterfaces = retrieveBridgedInterfaceNames(bridgedIfBlocks);
-      checkNotNull(bridgedInterfaces);
-
-      // union of bridgedNetwork with inet up and !loopback
-      List<BridgedIf> activeNetworkInterfaces = Lists.newArrayList();
-      try {
-         Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
-         for (NetworkInterface inet : Collections.list(nets)) {
-            Iterable<BridgedIf> filteredBridgedInterface = filter(bridgedInterfaces, new IsActiveBridgedInterface(inet));
-            Iterables.addAll(activeNetworkInterfaces, filteredBridgedInterface);
-         }
-      } catch (SocketException e) {
-         logger.error(e, "Problem in listing network interfaces.");
-         throw Throwables.propagate(e);
-      }
-      return activeNetworkInterfaces;
-   }
-
-   protected static List<BridgedIf> retrieveBridgedInterfaceNames(String bridgedIfBlocks) {
-      List<BridgedIf> bridgedInterfaces = Lists.newArrayList();
-      // separate the different bridge block
-      for (String bridgedIfBlock : Splitter.on(Pattern.compile("(?m)^[ \t]*\r?\n")).split(bridgedIfBlocks)) {
-    	  if (!bridgedIfBlock.isEmpty())
-    		  bridgedInterfaces.add(new BridgedIfStringToBridgedIf().apply(bridgedIfBlock));
-      }
-      return bridgedInterfaces;
-   }
-
-   private class IsActiveBridgedInterface implements Predicate<BridgedIf> {
-
-      private NetworkInterface networkInterface;
-
-      public IsActiveBridgedInterface(NetworkInterface networkInterface) {
-         this.networkInterface = networkInterface;
-      }
-
-      @Override
-      public boolean apply(BridgedIf bridgedInterface) {
-         try {
-            return bridgedInterface.getName().startsWith(networkInterface.getDisplayName()) &&
-            		bridgedInterface.getStatus().equals("Up") &&
-            		networkInterface.isUp() && 
-            		!networkInterface.isLoopback();
-         } catch (SocketException e) {
-            logger.error(e, "Problem in listing network interfaces.");
-            throw Throwables.propagate(e);
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/SendScancodes.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/SendScancodes.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/SendScancodes.java
deleted file mode 100644
index e5929c6..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/SendScancodes.java
+++ /dev/null
@@ -1,71 +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.virtualbox.functions;
-
-import static com.google.common.base.Predicates.in;
-import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Lists.partition;
-import static org.jclouds.compute.reference.ComputeServiceConstants.COMPUTE_LOGGER;
-import static org.jclouds.virtualbox.settings.KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP_LIST;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.logging.Logger;
-import org.virtualbox_4_2.ISession;
-
-import com.google.common.base.Function;
-import com.google.common.util.concurrent.Uninterruptibles;
-
-class SendScancodes implements Function<ISession, Void> {
-
-   @Resource
-   @Named(COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private static final int MAX_SIZE = 30;
-
-   private final List<Integer> scancodes;
-
-   public SendScancodes(List<Integer> scancodes) {
-      this.scancodes = scancodes;
-   }
-
-   @Override
-   public Void apply(ISession iSession) {
-      for (List<Integer> maxOrLess : partition(scancodes, MAX_SIZE)) {
-         long codesSent = iSession.getConsole().getKeyboard().putScancodes(maxOrLess);
-         logger.debug("List of scancodes sent: ", maxOrLess);
-         assert codesSent == maxOrLess.size();
-         if (any(maxOrLess, in(SPECIAL_KEYBOARD_BUTTON_MAP_LIST.values()))) {
-            // in case of special keystroke we assume more time needed than normal (page refresh)
-            Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-         } else {
-            Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
-         }
-      }
-      return null;
-   }
-
-   @Override
-   public String toString() {
-      return "sendScancodes(" + scancodes + ")";
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java
deleted file mode 100644
index 3c9af94..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/StringToKeyCode.java
+++ /dev/null
@@ -1,67 +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.virtualbox.functions;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.jclouds.virtualbox.settings.KeyboardScancodes;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
-
-public class StringToKeyCode implements Function<String, List<Integer>> {
-
-   @Override
-   public List<Integer> apply(String subsequence) {
-	   return stringToKeycode(subsequence);
-   }
-   
-   private List<Integer> stringToKeycode(String s) {
-      if (containsSpecialCharacter(s)) {
-         return transformSpecialCharIntoKeycodes(s);
-      } else {
-         return transformStandardCharacterIntoKeycodes(s);
-      }
-   }
-   
-   private List<Integer> transformStandardCharacterIntoKeycodes(String s) {
-      List<Integer> values = Lists.newArrayList();
-      for (String digit : Splitter.fixedLength(1).split(s)) {
-         Collection<Integer> hex = KeyboardScancodes.NORMAL_KEYBOARD_BUTTON_MAP_LIST.get(digit);
-         if (hex != null)
-            values.addAll(hex);
-      }
-      values.addAll(KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP_LIST.get("<Spacebar>"));
-      return values;
-   }
-
-   private List<Integer> transformSpecialCharIntoKeycodes(String s) {
-      List<Integer> values = Lists.newArrayList();
-      for (String special : s.split("<")) {
-         Collection<Integer> value = KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP_LIST.get("<" + special);
-         if (value != null)
-            values.addAll(value);
-      }
-      return values;
-   }
-
-   private boolean containsSpecialCharacter(String s) {
-      return s.startsWith("<");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttached.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttached.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttached.java
deleted file mode 100644
index e7dad2b..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttached.java
+++ /dev/null
@@ -1,110 +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.virtualbox.functions;
-
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.logging.Logger;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.ISnapshot;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.util.concurrent.Uninterruptibles;
-
-public class TakeSnapshotIfNotAlreadyAttached implements Function<IMachine, ISnapshot> {
-
-   private Supplier<VirtualBoxManager> manager;
-   private String snapshotName;
-   private String snapshotDesc;
-   private Logger logger;
-
-   public TakeSnapshotIfNotAlreadyAttached(Supplier<VirtualBoxManager> manager, String snapshotName,
-            String snapshotDesc, Logger logger) {
-      this.manager = manager;
-      this.snapshotName = snapshotName;
-      this.snapshotDesc = snapshotDesc;
-      this.logger = logger;
-   }
-
-   @Override
-   public ISnapshot apply(IMachine machine) {
-      // Snapshot a machine
-      ISession session = null;
-      ISnapshot snap = machine.getCurrentSnapshot();
-
-      if (snap == null) {
-         try {
-            session = manager.get().openMachineSession(machine);
-            int retries = 10;
-            while (true) {
-               try {
-
-                  // running machines need to be pause before a snapshot can be taken
-                  // due to a vbox bug see https://www.virtualbox.org/ticket/9255
-                  boolean paused = false;
-                  if (machine.getState() == MachineState.Running) {
-                     session.getConsole().pause();
-                     paused = true;
-                  }
-
-                  IProgress progress = session.getConsole().takeSnapshot(snapshotName, snapshotDesc);
-                  progress.waitForCompletion(-1);
-
-                  if (paused) {
-                     session.getConsole().resume();
-                  }
-
-                  snap = machine.getCurrentSnapshot();
-                  logger.debug("<< snapshot(%s) with description(%s) taken from master(%s)", snapshotName, snapshotDesc,
-                           machine.getName());
-                  break;
-               } catch (Exception e) {
-                  if (e.getMessage().contains("VirtualBox error: The object is not ready")
-                           || e.getMessage().contains("This machine does not have any snapshots")) {
-                     retries--;
-                     if (retries == 0) {
-                        logger.error(e,
-                                 "Problem creating snapshot (too many retries) %s (description: %s) from machine %s",
-                                 snapshotName, snapshotDesc, machine.getName());
-                        throw Throwables.propagate(e);
-                     }
-                     Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
-                     continue;
-                  }
-                  logger.error(e, "Problem creating snapshot %s (description: %s) from machine %s", snapshotName,
-                           snapshotDesc, machine.getName());
-                  throw Throwables.propagate(e);
-               }
-            }
-         } catch (Exception e) {
-            Throwables.propagate(e);
-         } finally {
-            if (session != null) {
-               manager.get().closeMachineSession(session);
-            }
-         }
-
-      }
-      return snap;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/YamlImagesFromFileConfig.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/YamlImagesFromFileConfig.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/YamlImagesFromFileConfig.java
deleted file mode 100644
index 0415ad9..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/YamlImagesFromFileConfig.java
+++ /dev/null
@@ -1,64 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.util.Strings2;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Supplier;
-import com.google.common.io.Files;
-
-/**
- * A supplier for vbox yaml config that reads a yaml whose path is stored under
- * VirtualBoxConstants.VIRTUALBOX_IMAGES_DESCRIPTOR.
- */
-public class YamlImagesFromFileConfig implements Supplier<String> {
-
-   private String yamlFilePath;
-
-   @Inject
-   public YamlImagesFromFileConfig(@Named(VirtualBoxConstants.VIRTUALBOX_IMAGES_DESCRIPTOR) String yamlFilePath) {
-      this.yamlFilePath = yamlFilePath;
-   }
-
-   @Override
-   public String get() {
-      try {
-         File yamlFile = new File(yamlFilePath);
-         String yamlDesc = null;
-         // if the yaml file does not exist just use default-images.yaml
-         if (!yamlFile.exists()) {
-            yamlDesc = Strings2.toStringAndClose(getClass().getResourceAsStream("/default-images.yaml"));
-         } else {
-            yamlDesc = Files.toString(yamlFile, Charsets.UTF_8);
-         }
-         checkNotNull(yamlDesc, "yaml descriptor");
-         return yamlDesc;
-      } catch (IOException e) {
-         throw new RuntimeException("error reading yaml file");
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/FileDownloadFromURI.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/FileDownloadFromURI.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/FileDownloadFromURI.java
deleted file mode 100644
index f9b8a14..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/FileDownloadFromURI.java
+++ /dev/null
@@ -1,83 +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.virtualbox.functions.admin;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.util.Closeables2.closeQuietly;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.HttpClient;
-
-import com.google.common.base.Function;
-import com.google.common.base.Throwables;
-import com.google.common.io.Files;
-
-public class FileDownloadFromURI implements Function<URI, File> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final HttpClient client;
-   private final String isosDir;
-
-   @Inject
-   public FileDownloadFromURI(HttpClient client, @Named(VIRTUALBOX_WORKINGDIR) String workingDir) {
-      this.client = client;
-      this.isosDir = workingDir + File.separator + "isos";
-   }
-
-   @Override
-   public File apply(@Nullable URI input) {
-      final File file = new File(isosDir, new File(input.getPath()).getName());
-      try {
-         if (!file.exists()) {
-            final InputStream inputStream = client.get(input);
-            checkNotNull(inputStream, "%s not found", input);
-            try {
-               Files.asByteSink(file).writeFrom(inputStream);
-               return file;
-            } catch (FileNotFoundException e) {
-               logger.error(e, "File %s could not be found", file.getPath());
-            } catch (IOException e) {
-               logger.error(e, "Error when downloading file %s", input.toString());
-            } finally {
-               closeQuietly(inputStream);
-            }
-            return null;
-         } else {
-            logger.debug("File %s already exists. Skipping download", file.getPath());
-            return file;
-         }
-      } catch (Exception e) {
-         throw Throwables.propagate(e);
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java
deleted file mode 100644
index 5159f24..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java
+++ /dev/null
@@ -1,82 +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.virtualbox.functions.admin;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.virtualbox.domain.YamlImage;
-import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig;
-import org.yaml.snakeyaml.Loader;
-import org.yaml.snakeyaml.TypeDescription;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Maps;
-
-@Singleton
-public class ImagesToYamlImagesFromYamlDescriptor implements Supplier<Map<Image, YamlImage>> {
-
-   private String yamlDescriptor;
-
-   @Inject
-   public ImagesToYamlImagesFromYamlDescriptor(YamlImagesFromFileConfig yamlDescriptorSupplier) {
-      this.yamlDescriptor = yamlDescriptorSupplier.get();
-      checkNotNull(yamlDescriptor, "yaml descriptor");
-      checkState(!yamlDescriptor.equals(""), "yaml descriptor is empty");
-   }
-
-   /**
-    * Type-safe config class for YAML
-    * 
-    */
-   public static class Config {
-      public List<YamlImage> images;
-   }
-
-   @Override
-   public Map<Image, YamlImage> get() {
-
-      Constructor constructor = new Constructor(Config.class);
-
-      TypeDescription imageDesc = new TypeDescription(YamlImage.class);
-      imageDesc.putListPropertyType("images", String.class);
-      constructor.addTypeDescription(imageDesc);
-
-      // Issue 855: testng is rev-locking us to snakeyaml 1.6
-      // we have to use old constructor until this is fixed
-      Yaml yaml = new Yaml(new Loader(constructor));
-      Config config = (Config) yaml.load(yamlDescriptor);
-      checkState(config != null, "missing config: class");
-      checkState(config.images != null, "missing images: collection");
-
-      Map<Image, YamlImage> backingMap = Maps.newLinkedHashMap();
-      for (YamlImage yamlImage : config.images) {
-         backingMap.put(YamlImage.toImage.apply(yamlImage), yamlImage);
-      }
-      return backingMap;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/PreseedCfgServer.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/PreseedCfgServer.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/PreseedCfgServer.java
deleted file mode 100644
index 4f5d410..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/PreseedCfgServer.java
+++ /dev/null
@@ -1,69 +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.virtualbox.functions.admin;
-
-import java.io.IOException;
-import java.net.URI;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.AbstractHandler;
-
-import com.google.common.base.Throwables;
-
-/**
- * Sets up jetty so that it can serve the preseed.cfg file to automate master creation.
- */
-public class PreseedCfgServer {
-
-   private Server jetty;
-
-   public void start(String preconfigurationUrl, final String preseedCfg) {
-      this.jetty = new Server(URI.create(preconfigurationUrl).getPort());
-      try {
-         // since we're only serving the preseed.cfg file respond to all requests with it
-         jetty.setHandler(new AbstractHandler() {
-            @Override
-            public void handle(String target, Request baseRequest, HttpServletRequest request,
-                     HttpServletResponse response) throws IOException, ServletException {
-               response.setContentType("text/plain;charset=utf-8");
-               response.setStatus(HttpServletResponse.SC_OK);
-               baseRequest.setHandled(true);
-               response.getWriter().println(preseedCfg);
-            }
-         });
-         jetty.start();
-      } catch (Exception e) {
-         throw Throwables.propagate(e);
-      }
-   }
-
-   public void stop() {
-      try {
-         if (jetty != null) {
-            jetty.stop();
-         }
-      } catch (Exception e) {
-         throw Throwables.propagate(e);
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java
deleted file mode 100644
index 8324838..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java
+++ /dev/null
@@ -1,138 +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.virtualbox.functions.admin;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
-import static org.jclouds.scriptbuilder.domain.Statements.exec;
-import static org.jclouds.scriptbuilder.domain.Statements.findPid;
-import static org.jclouds.scriptbuilder.domain.Statements.kill;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.callables.RunScriptOnNode.Factory;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.location.Provider;
-import org.jclouds.logging.Logger;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.StatementList;
-import org.jclouds.virtualbox.functions.HardcodedHostToHostNodeMetadata;
-import org.jclouds.virtualbox.predicates.RetryIfSocketNotYetOpen;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.net.HostAndPort;
-import com.google.common.util.concurrent.UncheckedTimeoutException;
-
-@Singleton
-public class StartVBoxIfNotAlreadyRunning implements Supplier<VirtualBoxManager> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Factory runScriptOnNodeFactory;
-   private final RetryIfSocketNotYetOpen socketTester;
-   private final Supplier<NodeMetadata> host;
-   private final Supplier<URI> providerSupplier;
-   private final Function<Supplier<NodeMetadata>, VirtualBoxManager> managerForNode;
-   private transient VirtualBoxManager manager;
-   private final HardcodedHostToHostNodeMetadata hardcodedHostToHostNodeMetadata;
-
-   // the functions and suppliers here are to ensure we don't do heavy i/o in injection
-   @Inject
-   public StartVBoxIfNotAlreadyRunning(Function<Supplier<NodeMetadata>, VirtualBoxManager> managerForNode,
-         Factory runScriptOnNodeFactory, RetryIfSocketNotYetOpen socketTester, Supplier<NodeMetadata> host,
-         @Provider Supplier<URI> providerSupplier, HardcodedHostToHostNodeMetadata hardcodedHostToHostNodeMetadata) {
-      this.runScriptOnNodeFactory = checkNotNull(runScriptOnNodeFactory, "runScriptOnNodeFactory");
-      this.socketTester = checkNotNull(socketTester, "socketTester");
-      this.socketTester.seconds(3L);
-      this.host = checkNotNull(host, "host");
-      this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox websrvd is needed");
-      this.managerForNode = checkNotNull(managerForNode, "managerForNode");
-      this.hardcodedHostToHostNodeMetadata = hardcodedHostToHostNodeMetadata;
-   }
-
-   @PostConstruct
-   public void start() {
-      URI provider = providerSupplier.get();
-      NodeMetadata hostNodeMetadata = hardcodedHostToHostNodeMetadata.apply(host.get());
-
-      if (!socketTester.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))) {
-         logger.debug("disabling password access");
-         runScriptOnNodeFactory
-               .create(hostNodeMetadata, exec("VBoxManage setproperty websrvauthlibrary null"),
-                     runAsRoot(false).wrapInInitScript(false)).init().call();
-
-         logger.debug(">> starting vboxwebsrv");
-         String vboxwebsrv = "vboxwebsrv -t0 -v -b -H " + providerSupplier.get().getHost();
-         runScriptOnNodeFactory
-               .create(hostNodeMetadata, exec(vboxwebsrv),
-                     runAsRoot(false).wrapInInitScript(false).blockOnComplete(false).nameTask("vboxwebsrv")).init()
-               .call();
-
-         if (!socketTester.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))) {
-            throw new UncheckedTimeoutException(String.format("could not connect to virtualbox at %s", provider));
-         }
-      }
-
-      manager = managerForNode.apply(host);
-      manager.connect(provider.toASCIIString(), "", "");
-      if (logger.isDebugEnabled())
-         if (manager.getSessionObject().getState() != SessionState.Unlocked)
-            logger.warn("manager is not in unlocked state " + manager.getSessionObject().getState());
-
-   }
-
-   public void cleanUpHost() {
-      // kill previously started vboxwebsrv (possibly dirty session)
-      URI provider = providerSupplier.get();
-      NodeMetadata hostNodeMetadata = hardcodedHostToHostNodeMetadata.apply(host.get());
-      List<Statement> statements = new ImmutableList.Builder<Statement>()
-            .add(findPid("vboxwebsrv"))
-            .add(kill()).build();
-      StatementList statementList = new StatementList(statements);
-
-      if (socketTester.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))) {
-         logger.debug(String.format("shutting down previously started vboxwewbsrv at %s", provider));
-         ExecResponse execResponse = runScriptOnNodeFactory.create(hostNodeMetadata, statementList, runAsRoot(false))
-               .init().call();
-         if (execResponse.getExitStatus() != 0)
-            throw new RuntimeException(String.format("Cannot shutdown a running vboxwebsrv at %s. ExecResponse: %s", provider, execResponse));
-      }
-   }
-
-   @Override
-   public VirtualBoxManager get() {
-      checkState(manager != null, "VirtualBoxManager is not initialised");
-      return manager;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMedia.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMedia.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMedia.java
deleted file mode 100644
index 4437c79..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMedia.java
+++ /dev/null
@@ -1,125 +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.virtualbox.functions.admin;
-
-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 java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-@Singleton
-public class UnregisterMachineIfExistsAndDeleteItsMedia implements Function<IMachine, Void> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final VmSpec vmSpec;
-
-   public UnregisterMachineIfExistsAndDeleteItsMedia(VmSpec vmSpec) {
-      this.vmSpec = vmSpec;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      List<IMedium> mediaToBeDeleted = ImmutableList.of();
-      try {
-         mediaToBeDeleted = machine.unregister(vmSpec.getCleanupMode());
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         switch (errorCode) {
-            case VBOX_E_OBJECT_NOT_FOUND:
-               logger.debug("Machine %s does not exists, cannot unregister", vmSpec.getVmName());
-               break;
-            default:
-               throw e;
-         }
-      }
-
-      List<IMedium> filteredMediaToBeDeleted = Lists.newArrayList(transform(
-               filter(mediaToBeDeleted, new AutoDeleteHardDiskPredicate(vmSpec)), new DeleteChildrenOfMedium()));
-
-      if (!filteredMediaToBeDeleted.isEmpty()) {
-         try {
-            IProgress deletion = machine.delete(filteredMediaToBeDeleted);
-            deletion.waitForCompletion(-1);
-         } catch (Exception e) {
-            logger.error(e, "Problem in deleting the media attached to %s", machine.getName());
-            Throwables.propagate(e);
-         }
-      }
-
-      return null;
-   }
-
-   private static class AutoDeleteHardDiskPredicate implements Predicate<IMedium> {
-
-      private VmSpec vmSpec;
-
-      public AutoDeleteHardDiskPredicate(VmSpec vmSpec) {
-         this.vmSpec = vmSpec;
-      }
-
-      @Override
-      public boolean apply(IMedium medium) {
-         for (StorageController controller : vmSpec.getControllers()) {
-            if (controller.getHardDisk(medium.getName()).isAutoDelete())
-               return true;
-         }
-         return false;
-      }
-
-   };
-
-   private static class DeleteChildrenOfMedium implements Function<IMedium, IMedium> {
-      @Override
-      public IMedium apply(IMedium medium) {
-         checkNotNull(medium.getChildren());
-         if (medium.getDeviceType().equals(DeviceType.HardDisk)) {
-            for (IMedium child : medium.getChildren()) {
-               IProgress deletion = child.deleteStorage();
-               deletion.waitForCompletion(-1);
-            }
-         }
-         return medium;
-      }
-
-   };
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndForceDeleteItsMedia.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndForceDeleteItsMedia.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndForceDeleteItsMedia.java
deleted file mode 100644
index 487bd9e..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndForceDeleteItsMedia.java
+++ /dev/null
@@ -1,105 +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.virtualbox.functions.admin;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.transform;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-@Singleton
-public class UnregisterMachineIfExistsAndForceDeleteItsMedia implements Function<IMachine, Void> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   @Override
-   public Void apply(IMachine machine) {
-      List<IMedium> mediaToBeDeleted = ImmutableList.of();
-      try {
-         mediaToBeDeleted = machine.unregister(CleanupMode.Full);
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         switch (errorCode) {
-            case VBOX_E_OBJECT_NOT_FOUND:
-               logger.debug("Machine %s does not exists, cannot unregister", machine.getName());
-               break;
-            default:
-               throw e;
-         }
-      }
-
-      List<IMedium> filteredMediaToBeDeleted = Lists.newArrayList(transform(mediaToBeDeleted,
-               new DeleteChildrenOfMedium()));
-      if (!filteredMediaToBeDeleted.isEmpty()) {
-         try {
-            IProgress deletion = machine.delete(filteredMediaToBeDeleted);
-            deletion.waitForCompletion(100);
-         } catch (Exception e) {
-            logger.error(e, "Problem in deleting the media attached to %s", machine.getName());
-            Throwables.propagate(e);
-         }
-      }
-
-      return null;
-   }
-
-   private class DeleteChildrenOfMedium implements Function<IMedium, IMedium> {
-      @Override
-      public IMedium apply(IMedium medium) {
-         checkNotNull(medium.getChildren());
-         if (medium.getDeviceType().equals(DeviceType.HardDisk)) {
-            for (IMedium child : medium.getChildren()) {
-               try {
-                  IProgress deletion = child.deleteStorage();
-                  deletion.waitForCompletion(-1);
-               } catch (Exception e) {
-                  // work around media that are still attached to other vm's. this can happen when a
-                  // running node is used to create a new image and then an attempt at deleting it
-                  // is made
-                  if (e.getMessage().contains("is still attached to the following")) {
-                     logger.warn("Media could not be deleted. Ignoring... [Message %s]", e.getMessage());
-                  }
-               }
-            }
-         }
-         return medium;
-      }
-
-   };
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMachinePredicates.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMachinePredicates.java b/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMachinePredicates.java
deleted file mode 100644
index 3db5121..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMachinePredicates.java
+++ /dev/null
@@ -1,60 +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.virtualbox.predicates;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.virtualbox.predicates.IMediumPredicates.deviceTypeEquals;
-import static org.jclouds.virtualbox.predicates.IMediumPredicates.hasParent;
-import static org.jclouds.virtualbox.predicates.IMediumPredicates.machineIdsContain;
-import static org.jclouds.virtualbox.util.IMediumAttachments.toMedium;
-import static org.virtualbox_4_2.DeviceType.HardDisk;
-
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-
-import com.google.common.base.Predicate;
-
-public class IMachinePredicates {
-   /**
-    * TODO: andrea please explain
-    * 
-    */
-   static enum IsLinkedClone implements Predicate<IMachine> {
-      INSTANCE;
-
-      @SuppressWarnings("unchecked")
-      @Override
-      public boolean apply(IMachine machine) {
-         Iterable<IMedium> mediumsOnMachine = transform(machine.getMediumAttachments(), toMedium());
-         // TODO: previous impl walked the parent medium back to the child
-         // before checking machine ids. Determine if that extra walk was really
-         // necessary
-         return any(mediumsOnMachine, and(deviceTypeEquals(HardDisk), hasParent(), machineIdsContain(machine.getId())));
-      }
-
-      @Override
-      public String toString() {
-         return "isLinkedClone()";
-      }
-   }
-
-   public static Predicate<IMachine> isLinkedClone() {
-      return IsLinkedClone.INSTANCE;
-   }
-}


[9/9] git commit: JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
JCLOUDS-758 Drop VirtualBox labs provider.


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/75178c77
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/75178c77
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/75178c77

Branch: refs/heads/master
Commit: 75178c7708260d9d9e3a70161b88a9dd6985a726
Parents: eea1bdb
Author: Adrian Cole <ad...@apache.org>
Authored: Mon Oct 27 09:36:14 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Mon Oct 27 09:36:14 2014 -0700

----------------------------------------------------------------------
 pom.xml                                         |   1 -
 virtualbox/README.md                            | 238 ---------------
 virtualbox/pom.xml                              | 156 ----------
 .../main/java/org/jclouds/virtualbox/Host.java  |  34 ---
 .../jclouds/virtualbox/Preconfiguration.java    |  34 ---
 .../java/org/jclouds/virtualbox/VirtualBox.java |  32 --
 .../virtualbox/VirtualBoxApiMetadata.java       | 104 -------
 .../compute/LoadMachineFromVirtualBox.java      |  90 ------
 .../VirtualBoxComputeServiceAdapter.java        | 271 ----------------
 .../extensions/VirtualBoxImageExtension.java    | 168 ----------
 ...HardcodeLocalhostAsNodeMetadataSupplier.java | 130 --------
 .../VirtualBoxComputeServiceContextModule.java  | 234 --------------
 .../virtualbox/config/VirtualBoxConstants.java  |  66 ----
 .../jclouds/virtualbox/domain/BridgedIf.java    | 194 ------------
 .../jclouds/virtualbox/domain/CloneSpec.java    | 116 -------
 .../virtualbox/domain/DeviceDetails.java        | 116 -------
 .../jclouds/virtualbox/domain/ErrorCode.java    | 108 -------
 .../virtualbox/domain/ExecutionType.java        |  32 --
 .../org/jclouds/virtualbox/domain/HardDisk.java | 146 ---------
 .../org/jclouds/virtualbox/domain/IsoImage.java |  69 -----
 .../org/jclouds/virtualbox/domain/IsoSpec.java  |  92 ------
 .../org/jclouds/virtualbox/domain/Master.java   |  64 ----
 .../jclouds/virtualbox/domain/MasterSpec.java   | 117 -------
 .../jclouds/virtualbox/domain/NatAdapter.java   | 106 -------
 .../virtualbox/domain/NetworkAdapter.java       | 172 -----------
 .../virtualbox/domain/NetworkInterfaceCard.java | 122 --------
 .../jclouds/virtualbox/domain/NetworkSpec.java  |  80 -----
 .../org/jclouds/virtualbox/domain/NodeSpec.java |  89 ------
 .../jclouds/virtualbox/domain/RedirectRule.java | 101 ------
 .../virtualbox/domain/StorageController.java    | 157 ----------
 .../org/jclouds/virtualbox/domain/VmSpec.java   | 180 -----------
 .../jclouds/virtualbox/domain/YamlImage.java    | 166 ----------
 .../functions/AddIDEControllerIfNotExists.java  |  50 ---
 .../functions/ApplyBootOrderToMachine.java      |  42 ---
 .../functions/ApplyMemoryToMachine.java         |  37 ---
 .../AttachBridgedAdapterToMachine.java          |  46 ---
 .../functions/AttachHostOnlyAdapter.java        |  45 ---
 ...tachMediumToMachineIfNotAlreadyAttached.java |  55 ----
 ...chNATAdapterToMachineIfNotAlreadyExists.java |  65 ----
 .../functions/AttachNicToMachine.java           |  60 ----
 .../functions/BridgedIfStringToBridgedIf.java   |  97 ------
 ...erMachineFromIMachineIfNotAlreadyExists.java | 133 --------
 .../functions/CreateAndInstallVm.java           | 168 ----------
 ...egisterMachineFromIsoIfNotAlreadyExists.java | 184 -----------
 .../CreateMediumIfNotAlreadyExists.java         | 144 ---------
 .../DetachDistroMediumFromMachine.java          |  53 ----
 .../HardcodedHostToHostNodeMetadata.java        |  65 ----
 .../functions/IMachineToHardware.java           |  56 ----
 .../virtualbox/functions/IMachineToImage.java   |  74 -----
 .../functions/IMachineToIpAddress.java          |  95 ------
 .../functions/IMachineToNodeMetadata.java       | 164 ----------
 .../functions/IMachineToSshClient.java          |  96 ------
 .../virtualbox/functions/IMachineToVmSpec.java  |  92 ------
 .../functions/IpAddressesLoadingCache.java      |  85 ------
 .../LaunchMachineIfNotAlreadyRunning.java       |  94 ------
 .../virtualbox/functions/MacAddressToBSD.java   |  47 ---
 .../functions/MastersLoadingCache.java          | 286 -----------------
 .../virtualbox/functions/NodeCreator.java       | 294 ------------------
 .../RetrieveActiveBridgedInterfaces.java        | 118 -------
 .../virtualbox/functions/SendScancodes.java     |  71 -----
 .../virtualbox/functions/StringToKeyCode.java   |  67 ----
 .../TakeSnapshotIfNotAlreadyAttached.java       | 110 -------
 .../functions/YamlImagesFromFileConfig.java     |  64 ----
 .../functions/admin/FileDownloadFromURI.java    |  83 -----
 .../ImagesToYamlImagesFromYamlDescriptor.java   |  82 -----
 .../functions/admin/PreseedCfgServer.java       |  69 -----
 .../admin/StartVBoxIfNotAlreadyRunning.java     | 138 ---------
 ...egisterMachineIfExistsAndDeleteItsMedia.java | 125 --------
 ...erMachineIfExistsAndForceDeleteItsMedia.java | 105 -------
 .../predicates/IMachinePredicates.java          |  60 ----
 .../predicates/IMediumPredicates.java           |  91 ------
 .../predicates/RetryIfSocketNotYetOpen.java     |  94 ------
 .../virtualbox/predicates/SshAvailable.java     |  65 ----
 .../virtualbox/predicates/SshResponds.java      |  48 ---
 .../virtualbox/settings/KeyboardScancodes.java  | 162 ----------
 .../statements/DeleteGShadowLock.java           |  43 ---
 .../statements/EnableNetworkInterface.java      |  79 -----
 .../statements/GetIPAddressFromMAC.java         |  70 -----
 .../statements/InstallGuestAdditions.java       |  99 ------
 .../org/jclouds/virtualbox/statements/Md5.java  |  47 ---
 .../virtualbox/statements/PasswordlessSudo.java |  49 ---
 .../statements/ScanNetworkWithPing.java         |  56 ----
 .../virtualbox/statements/SetHostname.java      |  50 ---
 .../virtualbox/statements/SetIpAddress.java     |  70 -----
 .../virtualbox/statements/Statements.java       |  36 ---
 .../virtualbox/util/IMediumAttachments.java     |  41 ---
 .../virtualbox/util/MachineController.java      | 262 ----------------
 .../util/MachineNameOrIdAndNicSlot.java         | 131 --------
 .../jclouds/virtualbox/util/MachineUtils.java   | 280 -----------------
 .../jclouds/virtualbox/util/NetworkUtils.java   | 305 -------------------
 .../services/org.jclouds.apis.ApiMetadata       |   1 -
 .../src/main/resources/default-images.yaml      | 149 ---------
 .../resources/functions/checkVBoxService.sh     |  24 --
 .../resources/functions/cleanupUdevIfNeeded.sh  |  23 --
 .../functions/exportIpAddressFromVmNamed.sh     |  32 --
 .../main/resources/functions/getIpAddress.cmd   |  16 -
 .../main/resources/functions/getIpAddress.sh    |  32 --
 .../functions/installModuleAssistantIfNeeded.sh |  27 --
 .../BaseVirtualBoxClientLiveTest.java           | 211 -------------
 .../virtualbox/PreseedCfgServerTest.java        |  70 -----
 .../virtualbox/VirtualBoxApiMetadataTest.java   |  28 --
 ...VirtualBoxComputeServiceAdapterLiveTest.java | 115 -------
 .../VirtualBoxComputeServiceAdapterTest.java    |  84 -----
 .../compute/VirtualBoxExperimentLiveTest.java   |  85 ------
 .../VirtualBoxImageExtensionLiveTest.java       |  56 ----
 .../domain/ExportIpAddressForVMNamedTest.java   |  44 ---
 .../domain/ScanNetworkWithPingTest.java         |  37 ---
 .../jclouds/virtualbox/domain/VmSpecTest.java   |  78 -----
 .../experiment/TestConfiguration.java           |  77 -----
 .../AddIDEControllerIfNotExistsTest.java        |  87 ------
 .../functions/ApplyBootOrderToMachineTest.java  |  46 ---
 .../functions/ApplyMemoryToMachineTest.java     |  66 ----
 .../AttachBridgedAdapterToMachineTest.java      |  62 ----
 ...MediumToMachineIfNotAlreadyAttachedTest.java | 159 ----------
 ...TAdapterToMachineIfNotAlreadyExistsTest.java | 138 ---------
 .../BridgedIfStringToBridgedIfTest.java         |  68 -----
 ...eFromIMachineIfNotAlreadyExistsLiveTest.java | 135 --------
 .../functions/CreateAndInstallVmLiveTest.java   | 162 ----------
 ...achineFromIsoIfNotAlreadyExistsLiveTest.java | 123 --------
 ...terMachineFromIsoIfNotAlreadyExistsTest.java | 162 ----------
 .../CreateMediumIfNotAlreadyExistsLiveTest.java |  88 ------
 .../CreateMediumIfNotAlreadyExistsTest.java     | 242 ---------------
 .../DetachDistroMediumFromMachineTest.java      | 106 -------
 .../functions/IMachineToHardwareTest.java       |  69 -----
 .../functions/IMachineToImageTest.java          | 156 ----------
 .../functions/IMachineToNodeMetadataTest.java   | 140 ---------
 .../functions/IMachineToVmSpecTest.java         |  99 ------
 .../LaunchMachineIfNotAlreadyRunningTest.java   |  68 -----
 .../functions/MacAddressToBSDTest.java          |  37 ---
 ...trieveActiveBridgedInterfacesExpectTest.java |  56 ----
 .../TakeSnapshotIfNotAlreadyAttachedTest.java   | 105 -------
 .../admin/ImageFromYamlStringTest.java          |  57 ----
 .../StartVBoxIfNotAlreadyRunningLiveTest.java   |  64 ----
 ...terMachineIfExistsAndDeleteItsMediaTest.java |  81 -----
 .../GuestAdditionsInstallerLiveTest.java        | 136 ---------
 .../predicates/IMachinePredicatesLiveTest.java  | 117 -------
 .../predicates/RetryIfSocketNotYetOpenTest.java |  83 -----
 .../InstallGuestAdditionsLiveTest.java          |  60 ----
 .../statements/InstallGuestAdditionsTest.java   |  76 -----
 .../virtualbox/statements/PasswordlessTest.java |  34 ---
 .../virtualbox/statements/SetIpAddressTest.java |  64 ----
 .../util/MachineControllerLiveTest.java         | 125 --------
 .../virtualbox/util/MachineUtilsLiveTest.java   | 181 -----------
 virtualbox/src/test/resources/.gitattributes    |   1 -
 .../src/test/resources/default-images.yaml      | 151 ---------
 .../test/resources/default-keystroke-sequence   |  19 --
 virtualbox/src/test/resources/logback.xml       |  76 -----
 .../resources/redHatAndDerivatives/hostOnly     |  26 --
 .../src/test/resources/redHatAndDerivatives/nat |  30 --
 .../test_export_ip_address_from_vm_named.sh     |  29 --
 .../src/test/resources/test_get_ip_address.cmd  |   0
 .../src/test/resources/test_get_ip_address.sh   |  29 --
 .../resources/test_guest_additions_installer.sh |   6 -
 .../test_guest_additions_installer_init.sh      | 223 --------------
 154 files changed, 14813 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ebedd4d..6b91b42 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,6 @@
   <modules>
     <module>azurecompute</module>
     <module>docker</module>
-    <module>virtualbox</module>
     <module>vcloud-director</module>
     <module>cdmi</module>
     <module>cloudsigma2</module>

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/README.md
----------------------------------------------------------------------
diff --git a/virtualbox/README.md b/virtualbox/README.md
deleted file mode 100644
index 84fd2d6..0000000
--- a/virtualbox/README.md
+++ /dev/null
@@ -1,238 +0,0 @@
-# VirtualBox as a local cloud provider
-jclouds-virtualbox is a local cloud provider modelled on the virtualbox hypervisor. Similar to other jclouds supported providers, it supports the same portable abstractions offered by jclouds.
-
-##Setup
-
-Please follow these steps to configure your workstation for jclouds-virtualbox:
-
-- install the latest VirtualBox release (please visit https://www.virtualbox.org/wiki/Downloads)
-- assign passwordless ssh and passwordless sudo rights to your user
-
-### Passwordless ssh
-
-jclouds-virtualbox uses the current user.name and private key  for sending commands to localhost over ssh.
-
-The current user (user.name) should have passwordless ssh. On a *nix system, you can enable this feature using `ssh-keygen` and `ssh-copy-id`.
-
-- ssh-keygen \- creates the public and private keys (by default in `${user.home}/.ssh/id_rsa.pub` and `${user.home}/.ssh/id_rsa`)
-> $ ssh-keygen
-- ssh-copy-id \- copies the user’s public key to a specified host’s `authorized_keys` file. 
-ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys
-
-In this case:
-> $ ssh-copy-id -i ~/.ssh/id_rsa your-user@localhost
-
-If your system does not have an `ssh-copy-id` command, use something like this:
-> $ cat ~/.ssh/id_rsa.pub | ssh your-user@localhost "cat -> ~/.ssh/authorized_keys"
-
-### Passwordless sudo
-
-You need to have passwordless sudo rights on localhost. This is done by editing the sudoers file (/etc/sudoers). Use caution when editing this file, as introducing errors will lock you out of the system. Therefore, it is recommended to edit this file through the visudo command.
-
-The sudoers file should have a line like this (replace your-user):
-> your-user    ALL=(ALL)   NOPASSWD: ALL
-
-At this point, you should be able to login to localhost with `ssh your-user@localhost` without password.
-
-#How it works
-
-
-                                              ---------------   -------------
-                                             |   Image(s)    | |   Node(s)   | 
-                                              ---------------   -------------
-                                              -------------------------------  -------
-                                             |          VirtualBox           || Jetty |
-                                              -------------------------------  -------
-     ---------    passwordless ssh+sudo       ----------------------------------------
-    | jclouds | ---------------------------> |                 localhost              |
-     ---------                                ----------------------------------------
-
-###Components
-- jclouds \- acts as a java (or clojure) client to access to virtualbox functionalities
-- localhost \- hosts the VirtualBox hypervisor and a jetty server which is automatically installed by jclouds-virtualbox during Images creation
-- VirtualBox \- jclouds-virtualbox assumes that the latest VirtualBox is installed (please see https://www.virtualbox.org/wiki/Downloads)
-- Jetty \- in this scenario, this http server is used to serve the preseed.cfg specified in YAML descriptor file
-- Image \- it logically represents a master VM (Virtual Machine) that can be cloned. It is a union of 2 sets of entities: 
-    * a list of supported images, described in the YAML descriptor files
-    * a list of existing virtualbox VMs with name starting with "jclouds-image-0x0-"
-- Node \- is a virtualbox VM, linked cloned from another virtualbox VM marked as Image
-
-## Image creation
-
-                        ssh                   --------------- 
-        /----------------------------------> |   Image(s)    |
-        |                                     --------------- 
-        |                                     -------------------------------  -------
-        |                                    |          VirtualBox           || Jetty |
-        |                                     -------------------------------  -------
-     ---------    passwordless ssh+sudo       ----------------------------------------
-    | jclouds | ---------------------------> |                 localhost              |
-     ---------                                ----------------------------------------
-
-The OS supported by jclouds-virtualbox are described in a YAML file `default-images.yaml` stored at `src/main/resources/`.
-
-For each OS supported, it stores the following information:
-a unique id, a name, a description, an os_arch, os_family, os_description, os_version, the iso url, the iso md5, username and credential to access this vm, a keystroke sequence for the OS installer and a preseed configuration file that contains the settings for this OS installation.
-
-For example, the corresponding YAML section for ubuntu 10.04.4 server (32 bit) looks like:
-
-    - id: ubuntu-10.04.4-server-i386
-      name: ubuntu-10.04-server-i386
-      description: ubuntu 10.04.4 server (i386)
-      os_arch: x86
-      os_family: ubuntu
-      os_description: ubuntu
-      os_version: 10.04.4
-      iso: http://releases.ubuntu.com/10.04.4/ubuntu-10.04.4-server-i386.iso
-      iso_md5: fc08a01e78348e3918180ea91a6883bb
-      username: toor
-      credential: password      
-      keystroke_sequence: |
-                <Esc><Esc><Enter> 
-                /install/vmlinuz noapic preseed/url=http://10.0.2.2:8080/src/test/resources/preseed.cfg 
-                debian-installer=en_US auto locale=en_US kbd-chooser/method=us 
-                hostname=vmName 
-                fb=false debconf/frontend=noninteractive
-                console-setup/ask_detect=false console-setup/modelcode=pc105 console-setup/layoutcode=us
-                initrd=/install/initrd.gz -- <Enter>
-      preseed_cfg: |
-                      ## Options to set on the command line
-                      d-i debian-installer/locale string en_US
-                      d-i console-setup/ask_detect boolean false
-                      d-i console-setup/layoutcode string us
-                      d-i netcfg/get_hostname string unassigned-hostname
-                      d-i netcfg/get_domain string unassigned-domain
-                      d-i time/zone string UTC
-                      d-i clock-setup/utc-auto boolean true
-                      d-i clock-setup/utc boolean true
-                      d-i kbd-chooser/method select   American English
-                      d-i netcfg/wireless_wep string
-                      d-i base-installer/kernel/override-image string linux-server
-                      d-i debconf debconf/frontend select Noninteractive
-                      d-i pkgsel/install-language-support boolean false
-                      tasksel tasksel/first multiselect standard, ubuntu-server
-                      d-i partman-auto/method string lvm
-                      #d-i partman-auto/purge_lvm_from_device boolean true
-                      d-i partman-lvm/confirm boolean true
-                      d-i partman-lvm/device_remove_lvm boolean true
-                      d-i partman-auto/choose_recipe select atomic
-                      d-i partman/confirm_write_new_label boolean true
-                      d-i partman/confirm_nooverwrite boolean true
-                      d-i partman/choose_partition select finish
-                      d-i partman/confirm boolean true
-                      # Write the changes to disks and configure LVM?
-                      d-i partman-lvm/confirm boolean true
-                      d-i partman-lvm/confirm_nooverwrite boolean true
-                      d-i partman-auto-lvm/guided_size string max
-                      ## Default user, we can get away with a recipe to change this
-                      d-i passwd/user-fullname string toor
-                      d-i passwd/username string toor
-                      d-i passwd/user-password password password
-                      d-i passwd/user-password-again password password
-                      d-i user-setup/encrypt-home boolean false
-                      d-i user-setup/allow-password-weak boolean true
-                      d-i pkgsel/include string openssh-server ntp
-                      # Whether to upgrade packages after debootstrap.
-                      # Allowed values: none, safe-upgrade, full-upgrade
-                      d-i pkgsel/upgrade select full-upgrade
-                      d-i grub-installer/only_debian boolean true
-                      d-i grub-installer/with_other_os boolean true
-                      d-i finish-install/reboot_in_progress note
-                      #For the update
-                      d-i pkgsel/update-policy select none
-                      # debconf-get-selections --install
-                      #Use mirror
-                      choose-mirror-bin mirror/http/proxy string
-
-The OS isos and guest additions isos will be stored in the jclouds working directory (by default ~/.jclouds-vbox/isos/)
-
-##Cloning nodes
-
-              ssh                              ---------------   -------------
-        /----------------------------------> |    Node(s)    | |    Image    | 
-        |                                     ---------------   -------------
-        |                                     ------------------------------- 
-        |                                    |          VirtualBox           |
-        |                                     ------------------------------- 
-     ---------    (a) passwordless ssh+sudo   ----------------------------------------
-    | jclouds | ---------------------------> |                 localhost              |
-     ---------                                ----------------------------------------
-
-###Cloning strategy
-By default, a new node is cloned from a matching 'Image' with 'CloneOptions.Link'. This advanced option will save a lot of disk space and installation time as opposed to creating completely unique VMs for each new node.
-
-### Networking
-Each Node will have 2 NICs (Network Interface Cards) to enable an NAT+Host-Only networking strategy:
-
-* NIC1 at port 0 will be attached to Host-Only network to allow localhost-nodes communication and node-node communication
-* NIC2 at port 1 will be attached to NAT network to give each node internet access
-
---------------
-
-#Interacting with jclouds-vbox and connecting to machines
-
-For java guidance, please see [src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java].  
-For now nat+host-only is the only available network configuration, nodes should be accessible from the host by:
-
-     ssh user@192.168.56.X  
-
-where:
-
-- user \- has passwordless ssh and sudo rights
-- X (2-253) \- is assigned by DHCP server of `vboxnet0`
-
---------------
-
-
-#Customization
-
-##Identity and Credential
-By default, jclouds-virtualbox will try to use the current user (with passwordless ssh and sudo rights), but you can also override this default by specifying 
-`-Dvirtualbox.identity` and `-Dvirtualbox.credential`, if you want to use another user available on your local machine.
-
-##Preseed file
-In order to make available a preseed file, jclouds-virtualbox will start a PreseedServer at `http://localhost:23232` that will serve a preseed.cfg file.
-Make sure your firewall rules are not blocking this port.
-If you need to override this default you can use `-Djclouds.virtualbox.preconfigurationurl=http://localhost:PORT/preseed.cfg`, with a different PORT.
-
-##Working directory
-By default, cached isos for the OSs, guest additions, VMs and most configs are kept at the default working directory named `~/.jclouds-vbox/`, 
-you can override the default working directory using `-Dtest.virtualbox.workingDir=/path/to/your/workingDir`.
-
-##Host-Only network
-jclouds-virtualbox needs an Host-Only network with DHCP enabled. This DHCP server will be responsible for assigning local IP addresses to the Nodes created by jclouds-virtualbox.
-
-jclouds-virtualbox will automatically create an Host-Only network with these settings:
-
-- IPv4: 192.168.56.1
-- IPv4 Network Mask: 255.255.255.0
-- DHCP Server: enabled
-
-with
-- Server Address: 192.168.56.254
-- Server Mask: 255.255.255.0
-- Lower Address Bound: 192.168.56.2
-- Upper Address Bound: 192.168.56.253
-
-Check virtualbox->Preferences->Networks for more details.
-
-**NB**: jclouds-virtualbox will not edit/replace a pre-exisiting Host-Only network.
-
---------------
-
-#Notes:
-
-- jclouds-virtualbox is still at alpha stage please report any issues you find at [jclouds issues](https://github.com/jclouds/jclouds/issues?state=open) or [jclouds google group](http://groups.google.com/group/jclouds).
-- jclouds-virtualbox has been tested on Mac OSX, it might work on Linux iff vbox is running and set up correctly. However, it will not currently run on Windows.
-
---------------
-
-#Troubleshooting
-
-As jclouds vbox support is quite new, issues may occasionally arise. Please follow these steps to get things going again:
-
-1. Remove all relevant VMs (named "jclouds-* ") with the vbox GUI. Make sure to select "delete all files". This step will solve most issues.
-2. If you are still receiving errors, please try the following steps to resolve any issues:
-     * Kill all vbox processes (VboxHadless, VBoxSVC, VBoxXPCOMIPCD, VirtualBox, vboxwebsrv)
-     * Manually delete the files by executing: "rm -rf ~/.jclouds-vbox/jclouds-*"
-     * Restart the vbox GUI and make sure to delete all remaining machines while ignoring all errors

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/pom.xml
----------------------------------------------------------------------
diff --git a/virtualbox/pom.xml b/virtualbox/pom.xml
deleted file mode 100644
index da72c7f..0000000
--- a/virtualbox/pom.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.jclouds.labs</groupId>
-    <artifactId>jclouds-labs</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-  </parent>
-
-  <!-- TODO: when out of labs, switch to org.jclouds.api -->
-  <groupId>org.apache.jclouds.labs</groupId>
-  <artifactId>virtualbox</artifactId>
-  <name>jclouds virtualbox api</name>
-  <description>jclouds components to access an implementation of virtualbox</description>
-  <packaging>bundle</packaging>
-
-  <properties>
-    <virtualbox.version>4.2.8</virtualbox.version>
-    <test.virtualbox.endpoint>http://localhost:18083/</test.virtualbox.endpoint>
-    <test.virtualbox.api-version>4.2.8</test.virtualbox.api-version>
-    <test.virtualbox.build-version>${virtualbox.version}</test.virtualbox.build-version>
-    <test.virtualbox.identity>${user.name}</test.virtualbox.identity>
-    <test.virtualbox.credential>CHANGE_ME</test.virtualbox.credential>
-    <test.virtualbox.template>osFamily=UBUNTU,osVersionMatches=12.04.1,os64Bit=true,osArchMatches=amd64,loginUser=toor:password,authenticateSudo=true</test.virtualbox.template>
-    <jclouds.osgi.export>org.jclouds.virtualbox*;version="${project.version}"</jclouds.osgi.export>
-    <jclouds.osgi.import>
-      org.jclouds.labs*;version="${project.version}",
-      org.jclouds*;version="${jclouds.version}",
-      org.eclipse.jetty*;version="[7.5,9)",
-      javax.servlet*;version="[2.5,3)",
-      *
-    </jclouds.osgi.import>
-  </properties>
-  
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.jclouds</groupId>
-      <artifactId>jclouds-compute</artifactId>
-      <version>${jclouds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.virtualbox</groupId>
-      <artifactId>vboxjws</artifactId>
-      <version>${virtualbox.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jclouds.api</groupId>
-      <artifactId>byon</artifactId>
-      <version>${jclouds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-security</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-server</artifactId>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jclouds.driver</groupId>
-      <artifactId>jclouds-sshj</artifactId>
-      <version>${jclouds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jclouds.driver</groupId>
-      <artifactId>jclouds-slf4j</artifactId>
-      <version>${jclouds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-      <scope>test</scope>
-    </dependency>    
-    <dependency>
-      <groupId>org.apache.jclouds</groupId>
-      <artifactId>jclouds-core</artifactId>
-      <version>${jclouds.version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jclouds</groupId>
-      <artifactId>jclouds-compute</artifactId>
-      <version>${jclouds.version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.testng</groupId>
-      <artifactId>testng</artifactId>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <artifactId>snakeyaml</artifactId>
-          <groupId>org.yaml</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-  </dependencies>
-
-  <profiles>
-    <profile>
-      <id>live</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>integration</id>
-                <phase>integration-test</phase>
-                <goals>
-                  <goal>test</goal>
-                </goals>
-                <configuration>
-                  <threadCount>1</threadCount>
-                  <parallel>false</parallel>
-                  <systemPropertyVariables>
-                    <test.virtualbox.endpoint>${test.virtualbox.endpoint}</test.virtualbox.endpoint>
-                    <test.virtualbox.api-version>${test.virtualbox.api-version}</test.virtualbox.api-version>
-                    <test.virtualbox.build-version>${test.virtualbox.build-version}</test.virtualbox.build-version>
-                    <test.virtualbox.identity>${test.virtualbox.identity}</test.virtualbox.identity>
-                    <test.virtualbox.credential>${test.virtualbox.credential}</test.virtualbox.credential>
-                    <test.virtualbox.template>${test.virtualbox.template}</test.virtualbox.template>
-                  </systemPropertyVariables>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
-</project>

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/Host.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/Host.java b/virtualbox/src/main/java/org/jclouds/virtualbox/Host.java
deleted file mode 100644
index d2fb65a..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/Host.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.virtualbox;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Signals the annotated target pertains to the vbox host and not to one of the nodes.
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
-@Qualifier
-public @interface Host {
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/Preconfiguration.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/Preconfiguration.java b/virtualbox/src/main/java/org/jclouds/virtualbox/Preconfiguration.java
deleted file mode 100644
index 11718db..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/Preconfiguration.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.virtualbox;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Relating to a preseed or KickStart source
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
-@Qualifier
-public @interface Preconfiguration {
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBox.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBox.java b/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBox.java
deleted file mode 100644
index e745160..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBox.java
+++ /dev/null
@@ -1,32 +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.virtualbox;
-
-import org.virtualbox_4_2.VirtualBoxManager;
-
-public class VirtualBox {
-
-   private VirtualBoxManager manager;
-
-   public VirtualBox() {
-      this.manager = VirtualBoxManager.createInstance("");
-   }
-
-   public VirtualBoxManager manager() {
-      return manager;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxApiMetadata.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxApiMetadata.java b/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxApiMetadata.java
deleted file mode 100644
index 51f2bb2..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxApiMetadata.java
+++ /dev/null
@@ -1,104 +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.virtualbox;
-
-import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAULT_DIR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_GUEST_MEMORY;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGES_DESCRIPTOR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
-
-import java.io.File;
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.apis.internal.BaseApiMetadata;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.virtualbox.config.HardcodeLocalhostAsNodeMetadataSupplier;
-import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for VirtualBox API
-
- */
-public class VirtualBoxApiMetadata extends BaseApiMetadata {
-
-   @Override
-   public Builder toBuilder() {
-      return new Builder().fromApiMetadata(this);
-   }
-
-   public VirtualBoxApiMetadata() {
-      this(new Builder());
-   }
-
-   protected VirtualBoxApiMetadata(Builder builder) {
-      super(builder);
-   }
-
-   public static Properties defaultProperties() {
-      Properties properties = BaseApiMetadata.defaultProperties();
-
-      String workingDir = System.getProperty("test.virtualbox.workingDir", VIRTUALBOX_DEFAULT_DIR);
-      properties.put(VIRTUALBOX_WORKINGDIR, workingDir);
-
-      String ram = System.getProperty(VIRTUALBOX_GUEST_MEMORY, "512");
-      properties.put(VIRTUALBOX_GUEST_MEMORY, ram);
-      
-      String yamlDescriptor = System.getProperty("test.virtualbox.image.descriptor.yaml", VIRTUALBOX_WORKINGDIR
-               + File.separator + "images.yaml");
-
-      properties.put(VIRTUALBOX_IMAGES_DESCRIPTOR, yamlDescriptor);
-      properties.put(VIRTUALBOX_PRECONFIGURATION_URL, "http://10.0.2.2:23232");
-      properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=12.04.1,os64Bit=true,osArchMatches=amd64");
-      return properties;
-   }
-
-   public static class Builder extends BaseApiMetadata.Builder<Builder> {
-
-      protected Builder() {
-         id("virtualbox")
-         .name("VirtualBox API")
-         .identityName("User")
-         .credentialName("Password")
-         .documentation(URI.create("https://www.virtualbox.org/sdkref/index.html"))
-         .defaultIdentity(System.getProperty("user.name"))
-         .defaultCredential("CHANGE_ME")
-         .defaultEndpoint("http://localhost:18083/")
-         .documentation(URI.create("https://github.com/jclouds/jclouds/tree/master/labs/virtualbox"))
-         .version("4.2.8")
-         .buildVersion("4.2.8")
-         .defaultProperties(VirtualBoxApiMetadata.defaultProperties())
-         .view(ComputeServiceContext.class)
-         .defaultModules(ImmutableSet.<Class<? extends Module>>of(HardcodeLocalhostAsNodeMetadataSupplier.class, VirtualBoxComputeServiceContextModule.class));
-      }
-
-      @Override
-      public VirtualBoxApiMetadata build() {
-         return new VirtualBoxApiMetadata(this);
-      }
-
-      @Override
-      protected Builder self() {
-         return this;
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/compute/LoadMachineFromVirtualBox.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/compute/LoadMachineFromVirtualBox.java b/virtualbox/src/main/java/org/jclouds/virtualbox/compute/LoadMachineFromVirtualBox.java
deleted file mode 100644
index 5e02162..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/compute/LoadMachineFromVirtualBox.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.virtualbox.compute;
-
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_MACHINE_CREDENTIAL;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_MACHINE_GROUP;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_MACHINE_LOCATION;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_MACHINE_USERNAME;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.inject.Inject;
-
-import org.jclouds.byon.Node;
-import org.jclouds.compute.domain.OsFamily;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.cache.CacheLoader;
-
-/**
- * Loads a node from a VirtualBox IMachine
- */
-public class LoadMachineFromVirtualBox extends CacheLoader<String, Node> {
-
-   private VirtualBoxManager manager;
-   private Function<IMachine, String> iMachineToIpAddress;
-
-   @Inject
-   public LoadMachineFromVirtualBox(VirtualBoxManager manager, Function<IMachine, String> iMachineToIpAddress) {
-      this.manager = manager;
-      this.iMachineToIpAddress = iMachineToIpAddress;
-   }
-
-   @Override
-   public Node load(final String id) throws Exception {
-
-      if (id.equals("host")) {
-         final Node hostNode = Node.builder().id("host").name("host installing virtualbox").hostname("localhost")
-               .osFamily(OsFamily.LINUX.toString()).osDescription(System.getProperty("os.name"))
-               .osVersion(System.getProperty("os.version")).group("ssh").username(System.getProperty("user.name"))
-               .credentialUrl(privateKeyFile()).build();
-         return hostNode;
-      }
-
-      final IMachine machine = manager.getVBox().findMachine(id);
-      final String ipAddress = iMachineToIpAddress.apply(machine);
-      final String osTypeId = machine.getOSTypeId();
-      final IGuestOSType guestOSType = manager.getVBox().getGuestOSType(osTypeId);
-
-      final Node node = Node.builder().id(machine.getId()).name(machine.getName())
-            .description(machine.getDescription()).loginPort(22).group(System.getProperty(VIRTUALBOX_MACHINE_GROUP))
-            .username(System.getProperty(VIRTUALBOX_MACHINE_USERNAME))
-            .credential(System.getProperty(VIRTUALBOX_MACHINE_CREDENTIAL))
-            .sudoPassword(System.getProperty(VIRTUALBOX_MACHINE_CREDENTIAL))
-            .locationId(System.getProperty(VIRTUALBOX_MACHINE_LOCATION)).os64Bit(guestOSType.getIs64Bit())
-            .osArch(guestOSType.getDescription()).osFamily(guestOSType.getFamilyDescription())
-            .osVersion(guestOSType.getId()).osDescription(guestOSType.getDescription()).hostname(ipAddress).build();
-
-      return node;
-
-   }
-
-   private static URI privateKeyFile() {
-      try {
-         return new URI("file://" + System.getProperty("user.home") + "/.ssh/id_rsa");
-      } catch (URISyntaxException e) {
-         e.printStackTrace();
-      }
-      return null;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java b/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java
deleted file mode 100644
index 61c459b..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java
+++ /dev/null
@@ -1,271 +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.virtualbox.compute;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-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 org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.domain.Master;
-import org.jclouds.virtualbox.domain.NodeSpec;
-import org.jclouds.virtualbox.domain.YamlImage;
-import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndForceDeleteItsMedia;
-import org.jclouds.virtualbox.util.MachineController;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import com.google.inject.Singleton;
-
-/**
- * Defines the connection between the {@link org.virtualbox_4_2.VirtualBoxManager} implementation
- * and the jclouds {@link org.jclouds.compute.ComputeService}
- */
-@Singleton
-public class VirtualBoxComputeServiceAdapter implements ComputeServiceAdapter<IMachine, Hardware, Image, Location> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final Map<Image, YamlImage> imagesToYamlImages;
-   private final LoadingCache<Image, Master> mastersLoader;
-   private final Function<NodeSpec, NodeAndInitialCredentials<IMachine>> cloneCreator;
-   private final Function<IMachine, Image> imachineToImage;
-   private final MachineController machineController;
-
-   @Inject
-   public VirtualBoxComputeServiceAdapter(Supplier<VirtualBoxManager> manager,
-            Supplier<Map<Image, YamlImage>> imagesMapper, LoadingCache<Image, Master> mastersLoader,
-            Function<NodeSpec, NodeAndInitialCredentials<IMachine>> cloneCreator,
-            Function<IMachine, Image> imachineToImage,
-            MachineController machineController) {
-      this.manager = checkNotNull(manager, "virtualbox manager can't be null");
-      this.imagesToYamlImages = imagesMapper.get();
-      this.mastersLoader = mastersLoader;
-      this.cloneCreator = cloneCreator;
-      this.imachineToImage = imachineToImage;
-      this.machineController = machineController;
-   }
-
-   @Override
-   public NodeAndInitialCredentials<IMachine> createNodeWithGroupEncodedIntoName(String tag, String name,
-            Template template) {
-      try {
-         checkState(!tag.contains(VIRTUALBOX_NODE_NAME_SEPARATOR), "tag names cannot contain \""
-                  + VIRTUALBOX_NODE_NAME_SEPARATOR + "\"");
-         checkState(!name.contains(VIRTUALBOX_NODE_NAME_SEPARATOR), "node names cannot contain \""
-                  + VIRTUALBOX_NODE_NAME_SEPARATOR + "\"");
-         Master master = mastersLoader.get(template.getImage());
-         checkState(master != null, "could not find a master for image: " + template.getImage());
-         NodeSpec nodeSpec = NodeSpec.builder().master(master).name(name).tag(tag).template(template).build();
-         return cloneCreator.apply(nodeSpec);
-      } catch (Exception e) {
-         throw Throwables.propagate(e);
-      }
-   }
-
-   @Override
-   public Iterable<IMachine> listNodes() {
-      return Iterables.filter(manager.get().getVBox().getMachines(), new Predicate<IMachine>() {
-         @Override
-         public boolean apply(IMachine arg0) {
-            return arg0.getName().startsWith(VIRTUALBOX_NODE_PREFIX);
-         }
-      });
-   }
-
-   @Override
-   public Iterable<IMachine> listNodesByIds(final Iterable<String> ids) {
-      return filter(listNodes(), new Predicate<IMachine>() {
-
-         @Override
-         public boolean apply(IMachine machine) {
-            return contains(ids, machine.getId());
-         }
-      });
-   }
-
-   @Override
-   public Iterable<Hardware> listHardwareProfiles() {
-      Set<Hardware> hardware = Sets.newLinkedHashSet();
-      hardware.add(new HardwareBuilder().ids("t1.micro").hypervisor("VirtualBox").name("t1.micro").ram(512).build());
-      hardware.add(new HardwareBuilder().ids("m1.small").hypervisor("VirtualBox").name("m1.small").ram(1024).build());
-      hardware.add(new HardwareBuilder().ids("m1.medium").hypervisor("VirtualBox").name("m1.medium").ram(3840).build());
-      hardware.add(new HardwareBuilder().ids("m1.large").hypervisor("VirtualBox").name("m1.large").ram(7680).build());
-      return hardware;
-   }
-
-   @Override
-   public Iterable<Image> listImages() {
-      // the set of image vm names that were (or could be) built from the yaml file
-      final Set<String> imagesFromYamlNames = Sets.newHashSet(Iterables.transform(imagesToYamlImages.keySet(),
-               new Function<Image, String>() {
-                  @Override
-                  public String apply(Image input) {
-                     return VIRTUALBOX_IMAGE_PREFIX + input.getId();
-                  }
-
-               }));
-
-      // IMachines that were not built from the yaml file transformed to Images
-      Set<Image> imagesFromCloning = Sets.newHashSet(Iterables.transform(
-               Iterables.filter(imageMachines(), new Predicate<IMachine>() {
-                  @Override
-                  public boolean apply(IMachine input) {
-                     return !imagesFromYamlNames.contains(input.getName());
-                  }
-               }), imachineToImage));
-
-      // final set of images are those from yaml and those from vbox that were not a transformation
-      // of the yaml ones
-      return Sets.union(imagesToYamlImages.keySet(), imagesFromCloning);
-   }
-
-   private Iterable<IMachine> imageMachines() {
-      final Predicate<? super IMachine> imagePredicate = new Predicate<IMachine>() {
-         @Override
-         public boolean apply(@Nullable IMachine iMachine) {
-            return iMachine.getName().startsWith(VIRTUALBOX_IMAGE_PREFIX);
-         }
-      };
-      final Iterable<IMachine> imageMachines = filter(manager.get().getVBox().getMachines(), imagePredicate);
-      return imageMachines;
-   }
-
-   @Override
-   public Iterable<Location> listLocations() {
-      // Not using the adapter to determine locations
-      return ImmutableSet.<Location> of();
-   }
-
-   @Override
-   public IMachine getNode(String vmName) {
-      try {
-         return manager.get().getVBox().findMachine(vmName);
-      } catch (VBoxException e) {
-         if (e.getMessage().contains("Could not find a registered machine named")) {
-            return null;
-         }
-         throw Throwables.propagate(e);
-      }
-   }
-   
-   @Override
-   public Image getImage(String vmName) {
-      IMachine image = getNode(vmName);
-      if (image == null)
-         return null;
-      return imachineToImage.apply(image);
-   }
-
-   @Override
-   public synchronized void destroyNode(String vmName) {
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      powerDownMachine(machine);
-      try {
-         new UnregisterMachineIfExistsAndForceDeleteItsMedia().apply(machine);
-      } catch (Exception e) {
-         logger.error("Machine (%s) not unregistered!", vmName);
-      }
-   }
-
-   @Override
-   public void rebootNode(String vmName) {
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      powerDownMachine(machine);
-      launchVMProcess(machine, manager.get().getSessionObject());
-   }
-
-   @Override
-   public void resumeNode(String vmName) {
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      ISession machineSession;
-      try {
-         machineSession = manager.get().openMachineSession(machine);
-         machineSession.getConsole().resume();
-         machineSession.unlockMachine();
-      } catch (Exception e) {
-         throw Throwables.propagate(e);
-      }
-   }
-
-   @Override
-   public void suspendNode(String vmName) {
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      ISession machineSession;
-      try {
-         machineSession = manager.get().openMachineSession(machine);
-         machineSession.getConsole().pause();
-         machineSession.unlockMachine();
-      } catch (Exception e) {
-         throw Throwables.propagate(e);
-      }
-   }
-
-   private void launchVMProcess(IMachine machine, ISession session) {
-      IProgress prog = machine.launchVMProcess(session, "gui", "");
-      prog.waitForCompletion(-1);
-      session.unlockMachine();
-   }
-
-   private void powerDownMachine(IMachine machine) {
-      try {
-         if (machine.getState() == MachineState.PoweredOff) {
-            logger.debug("vm was already powered down: ", machine.getId());
-            return;
-         }
-         logger.debug("<< powering down vm(%s)", machine.getName());
-         machineController.ensureMachineHasPowerDown(machine.getName());
-      } catch (Exception e) {
-         logger.error(e, "problem in powering down vm(%s)", machine.getName());
-         throw Throwables.propagate(e);
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java b/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java
deleted file mode 100644
index ce15ee8..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/compute/extensions/VirtualBoxImageExtension.java
+++ /dev/null
@@ -1,168 +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.virtualbox.compute.extensions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAULT_DIR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.CloneImageTemplate;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageTemplate;
-import org.jclouds.compute.domain.ImageTemplateBuilder;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.functions.IMachineToVmSpec;
-import org.jclouds.virtualbox.functions.TakeSnapshotIfNotAlreadyAttached;
-import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.virtualbox_4_2.CloneMode;
-import org.virtualbox_4_2.CloneOptions;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISnapshot;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Virtualbox implementation of {@link ImageExtension}
- */
-@Singleton
-public class VirtualBoxImageExtension implements ImageExtension {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   private Logger logger = Logger.NULL;
-   private ComputeServiceAdapter<IMachine, Hardware, Image, Location> vboxAdapter;
-   private Function<IMachine, NodeMetadata> machineToNode;
-   private Supplier<VirtualBoxManager> manager;
-   private String workingDir;
-   private boolean isLinkedClone = true;
-   private Function<IMachine, Image> imachineToImage;
-   private MachineUtils machineUtils;
-
-   @Inject
-   public VirtualBoxImageExtension(ComputeServiceAdapter<IMachine, Hardware, Image, Location> vboxAdapter,
-            Function<IMachine, NodeMetadata> machineToNode, Supplier<VirtualBoxManager> manager,
-            @Named(VIRTUALBOX_WORKINGDIR) String workingDir, Function<IMachine, Image> imachineToImage,
-            MachineUtils machineUtils) {
-      this.vboxAdapter = vboxAdapter;
-      this.machineToNode = machineToNode;
-      this.manager = manager;
-      this.workingDir = workingDir == null ? VIRTUALBOX_DEFAULT_DIR : workingDir;
-      this.imachineToImage = imachineToImage;
-      this.machineUtils = machineUtils;
-   }
-
-   @Override
-   public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
-      Optional<NodeMetadata> sourceNode = getNodeById(id);
-      checkState(sourceNode.isPresent(), " there is no node with id " + id);
-      String vmName = VIRTUALBOX_IMAGE_PREFIX + name;
-
-      IMachine vm = null;
-      try {
-         vm = manager.get().getVBox().findMachine(vmName);
-      } catch (Exception e) {
-      }
-      checkState(vm == null, " a machine exists with name: " + vmName);
-      return new ImageTemplateBuilder.CloneImageTemplateBuilder().name(vmName).nodeId(id).build();
-   }
-
-   @Override
-   public ListenableFuture<Image> createImage(ImageTemplate template) {
-      checkState(template instanceof CloneImageTemplate, " vbox image extension only supports cloning for the moment.");
-      CloneImageTemplate cloneTemplate = CloneImageTemplate.class.cast(template);
-
-      IMachine source = manager.get().getVBox().findMachine(cloneTemplate.getSourceNodeId());
-
-      String flags = "";
-      List<String> groups = ImmutableList.of();
-      String group = "";
-      String settingsFile = manager.get().getVBox().composeMachineFilename(template.getName(), group , flags , workingDir);
-      IMachine clonedMachine = manager.get().getVBox()
-               .createMachine(settingsFile, template.getName(), groups, source.getOSTypeId(), flags);
-
-      List<CloneOptions> options = Lists.newArrayList();
-      if (isLinkedClone)
-         options.add(CloneOptions.Link);
-
-      // TODO snapshot name
-      ISnapshot currentSnapshot = new TakeSnapshotIfNotAlreadyAttached(manager, "pre-image-spawn", "before spawning "
-               + template.getName(), logger).apply(source);
-
-      checkNotNull(currentSnapshot);
-
-      // clone
-      IProgress progress = currentSnapshot.getMachine().cloneTo(clonedMachine, CloneMode.MachineState, options);
-      progress.waitForCompletion(-1);
-
-      logger.debug(String.format("<< master(%s) is cloned correctly to vm(%s)", source.getName(), clonedMachine.getName()));
-
-      // registering
-      manager.get().getVBox().registerMachine(clonedMachine);
-
-      return Futures.immediateFuture(imachineToImage.apply(clonedMachine));
-   }
-
-   @Override
-   public boolean deleteImage(String id) {
-      try {
-         IMachine machine = manager.get().getVBox().findMachine(VIRTUALBOX_IMAGE_PREFIX + id);
-         machineUtils.applyForMachine(machine.getId(), new UnregisterMachineIfExistsAndDeleteItsMedia(
-                  new IMachineToVmSpec().apply(machine)));
-      } catch (Exception e) {
-         logger.error(e, "Could not delete machine with id %s ", id);
-         return false;
-      }
-      return true;
-   }
-
-   private Optional<NodeMetadata> getNodeById(final String id) {
-      return Iterables.tryFind(Iterables.transform(vboxAdapter.listNodes(), machineToNode),
-               new Predicate<NodeMetadata>() {
-                  @Override
-                  public boolean apply(NodeMetadata input) {
-                     return input.getId().equals(id);
-                  }
-               });
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/config/HardcodeLocalhostAsNodeMetadataSupplier.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/config/HardcodeLocalhostAsNodeMetadataSupplier.java b/virtualbox/src/main/java/org/jclouds/virtualbox/config/HardcodeLocalhostAsNodeMetadataSupplier.java
deleted file mode 100644
index 0d69600..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/config/HardcodeLocalhostAsNodeMetadataSupplier.java
+++ /dev/null
@@ -1,130 +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.virtualbox.config;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.domain.LoginCredentials;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.io.Files;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-/**
- * In particular, this binds {@code Supplier<NodeMetadata>} so that it can be used in ssh commands.
- * Ssh is necessary for operations that cannot be performed in the virtual box api, such as clearing
- * sessions.
- * 
- * ex. once this is loaded, use Guice to inject {@code Supplier<NodeMetadata>} as {@code host} and
- * {@link RunScriptOnNode#Factory} as factory, to start making commands like the following:
- * 
- * <pre>
- * import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
- * import static org.jclouds.scriptbuilder.domain.Statements.*;
- * 
- *    ...
- *  
- *  // direct execute a script as opposed to using sudo, or an init wrapper
- *  ListenableFuture<ExecResponse> fooInTheFuture = factory.submit(host.get(), 
- *          exec("echo foo"), runAsRoot(false).wrapInInitScript(false));
- * 
- *  ExecResponse foo = Futures.getUnchecked(fooInTheFuture);
- * 
- *  // call a set of commands that are defined in classpath/functions/function_name.sh
- *  ListenableFuture<ExecResponse> kill = factory.submit(host.get(), 
- *          call("killsession"), runAsRoot(false).wrapInInitScript(false));
- * 
- * ...
- * 
- * </pre>
- * 
- * <h3>Note</h3>
- * 
- * People often forget to call {@link Future#get} when using {@link RunScriptOnNode.Factory#submit}.
- * Don't forget!
- */
-public class HardcodeLocalhostAsNodeMetadataSupplier extends AbstractModule {
-
-   public static final String HOST_ID = "host";
-   public static final String HOSTNAME = Strings.nullToEmpty(System.getenv("HOSTNAME"));
-
-   /**
-    * Lazy so that we don't hang up the injector reading a file
-    */
-   @Provides
-   @Singleton
-   protected Supplier<NodeMetadata> lazySupplyHostAsNodeMetadata() {
-      return new Supplier<NodeMetadata>() {
-
-         @Override
-         public NodeMetadata get() {
-            String privateKey = readRsaIdentity();
-            return new NodeMetadataBuilder()
-                                    .id(HOST_ID)
-                                    .name("host installing virtualbox")
-                                    .hostname(HOSTNAME)
-                                    .operatingSystem(OperatingSystem.builder()
-                                                                    .family(OsFamily.LINUX)
-                                                                    .description(System.getProperty("os.name"))
-                                                                    .arch(System.getProperty("os.arch"))
-                                                                    .version(System.getProperty("os.version"))
-                                                                    .build())
-                                    .status(Status.RUNNING)
-                                    .location(new LocationBuilder().id(HOST_ID)
-                                                                   .scope(LocationScope.HOST)
-                                                                   .description(HOSTNAME)
-                                                                   .build())
-                                    .credentials(LoginCredentials.builder()
-                                    		.user(System.getProperty("user.name"))
-                                    		.privateKey(privateKey)					 
-                                    		.build())
-                                    .build();
-         }
-
-      };
-   }
-   
-   static String readRsaIdentity() {
-      String privateKey;
-      try {
-         File keyFile = new File(System.getProperty("user.home") + "/.ssh/id_rsa");
-         privateKey = Files.toString(keyFile, Charsets.UTF_8);
-      } catch (IOException e) {
-         throw Throwables.propagate(e);
-      }
-      return privateKey;
-   }
-   
-   @Override
-   protected void configure() {
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java b/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java
deleted file mode 100644
index 0f4c5ed..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java
+++ /dev/null
@@ -1,234 +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.virtualbox.config;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.io.File;
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.eclipse.jetty.server.Server;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
-import org.jclouds.domain.Location;
-import org.jclouds.functions.IdentityFunction;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.compute.VirtualBoxComputeServiceAdapter;
-import org.jclouds.virtualbox.compute.extensions.VirtualBoxImageExtension;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.ExecutionType;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.Master;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NodeSpec;
-import org.jclouds.virtualbox.domain.YamlImage;
-import org.jclouds.virtualbox.functions.CloneAndRegisterMachineFromIMachineIfNotAlreadyExists;
-import org.jclouds.virtualbox.functions.CreateAndInstallVm;
-import org.jclouds.virtualbox.functions.IMachineToHardware;
-import org.jclouds.virtualbox.functions.IMachineToImage;
-import org.jclouds.virtualbox.functions.IMachineToNodeMetadata;
-import org.jclouds.virtualbox.functions.IMachineToSshClient;
-import org.jclouds.virtualbox.functions.MastersLoadingCache;
-import org.jclouds.virtualbox.functions.NodeCreator;
-import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig;
-import org.jclouds.virtualbox.functions.admin.FileDownloadFromURI;
-import org.jclouds.virtualbox.functions.admin.ImagesToYamlImagesFromYamlDescriptor;
-import org.jclouds.virtualbox.functions.admin.PreseedCfgServer;
-import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning;
-import org.jclouds.virtualbox.predicates.SshResponds;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-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;
-
-@SuppressWarnings("unchecked")
-public class VirtualBoxComputeServiceContextModule extends
-         ComputeServiceAdapterContextModule<IMachine, Hardware, Image, Location> {
-
-   @Override
-   protected void configure() {
-      super.configure();
-      bind(new TypeLiteral<ComputeServiceAdapter<IMachine, Hardware, Image, Location>>() {
-      }).to(VirtualBoxComputeServiceAdapter.class);
-      bind(new TypeLiteral<Function<IMachine, NodeMetadata>>() {
-      }).to(IMachineToNodeMetadata.class);
-      bind(new TypeLiteral<Function<Location, Location>>() {
-      }).to(Class.class.cast(IdentityFunction.class));
-      bind(new TypeLiteral<Function<Hardware, Hardware>>() {
-      }).to(Class.class.cast(IdentityFunction.class));
-      bind(new TypeLiteral<Function<Image, Image>>() {
-      }).to(Class.class.cast(IdentityFunction.class));
-      bind(new TypeLiteral<Function<IMachine, Hardware>>() {
-      }).to(IMachineToHardware.class);
-      bind(new TypeLiteral<Function<IMachine, Image>>() {
-      }).to(IMachineToImage.class);
-      bind(new TypeLiteral<CacheLoader<IsoSpec, URI>>() {
-      }).to(Class.class.cast(PreseedCfgServer.class));
-      bind(new TypeLiteral<Function<URI, File>>() {
-      }).to(Class.class.cast(FileDownloadFromURI.class));
-
-      bind(new TypeLiteral<Supplier<VirtualBoxManager>>() {
-      }).to(Class.class.cast(StartVBoxIfNotAlreadyRunning.class));
-      // the yaml config to image mapper
-      bind(new TypeLiteral<Supplier<Map<Image, YamlImage>>>() {
-      }).to(Class.class.cast(ImagesToYamlImagesFromYamlDescriptor.class));
-      // the yaml config provider
-      bind(YamlImagesFromFileConfig.class);
-
-      // the master machines cache
-      bind(new TypeLiteral<LoadingCache<Image, Master>>() {
-      }).to(MastersLoadingCache.class);
-
-      // the vbox image extension
-      bind(new TypeLiteral<ImageExtension>() {
-      }).to(VirtualBoxImageExtension.class);
-
-      // the master creating function
-      bind(new TypeLiteral<Function<MasterSpec, IMachine>>() {
-      }).to(Class.class.cast(CreateAndInstallVm.class));
-      // the machine cloning function
-      bind(new TypeLiteral<Function<NodeSpec, NodeAndInitialCredentials<IMachine>>>() {
-      }).to(Class.class.cast(NodeCreator.class));
-      bind(new TypeLiteral<Function<CloneSpec, IMachine>>() {
-      }).to(Class.class.cast(CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.class));
-      // the jetty server provider
-      bind(new TypeLiteral<Server>() {
-      }).to(Class.class.cast(PreseedCfgServer.class)).asEagerSingleton();
-
-      bind(new TypeLiteral<Function<IMachine, SshClient>>() {
-      }).to(IMachineToSshClient.class);
-
-      bind(ExecutionType.class).toInstance(ExecutionType.HEADLESS);
-      bind(LockType.class).toInstance(LockType.Write);
-   }
-
-   @Provides
-   @Singleton
-   protected Function<Supplier<NodeMetadata>, VirtualBoxManager> provideVBox() {
-      return new Function<Supplier<NodeMetadata>, VirtualBoxManager>() {
-
-         @Override
-         public VirtualBoxManager apply(Supplier<NodeMetadata> nodeSupplier) {
-            if (nodeSupplier.get().getId() != null)
-            	return VirtualBoxManager.createInstance(nodeSupplier.get().getId());
-
-           	return VirtualBoxManager.createInstance("");
-         }
-
-         @Override
-         public String toString() {
-            return "createInstanceByNodeId()";
-         }
-
-      };
-   }
-
-   @Provides
-   @Singleton
-   protected Predicate<SshClient> sshResponds(SshResponds sshResponds, Timeouts timeouts) {
-      return retry(sshResponds, timeouts.nodeRunning, 500l, MILLISECONDS);
-   }
-
-   @Override
-   protected Optional<ImageExtension> provideImageExtension(Injector i) {
-      return Optional.of(i.getInstance(ImageExtension.class));
-   }
-
-   @VisibleForTesting
-   public static final Map<MachineState, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
-            .<MachineState, NodeMetadata.Status> builder().put(MachineState.Running, NodeMetadata.Status.RUNNING)
-            .put(MachineState.PoweredOff, NodeMetadata.Status.SUSPENDED)
-            .put(MachineState.DeletingSnapshot, NodeMetadata.Status.PENDING)
-            .put(MachineState.DeletingSnapshotOnline, NodeMetadata.Status.PENDING)
-            .put(MachineState.DeletingSnapshotPaused, NodeMetadata.Status.PENDING)
-            .put(MachineState.FaultTolerantSyncing, NodeMetadata.Status.PENDING)
-            .put(MachineState.LiveSnapshotting, NodeMetadata.Status.PENDING)
-            .put(MachineState.SettingUp, NodeMetadata.Status.PENDING)
-            .put(MachineState.Starting, NodeMetadata.Status.PENDING)
-            .put(MachineState.Stopping, NodeMetadata.Status.PENDING)
-            .put(MachineState.Restoring, NodeMetadata.Status.PENDING)
-            // TODO What to map these states to?
-            .put(MachineState.FirstOnline, NodeMetadata.Status.PENDING)
-            .put(MachineState.FirstTransient, NodeMetadata.Status.PENDING)
-            .put(MachineState.LastOnline, NodeMetadata.Status.PENDING)
-            .put(MachineState.LastTransient, NodeMetadata.Status.PENDING)
-            .put(MachineState.Teleported, NodeMetadata.Status.PENDING)
-            .put(MachineState.TeleportingIn, NodeMetadata.Status.PENDING)
-            .put(MachineState.TeleportingPausedVM, NodeMetadata.Status.PENDING)
-            .put(MachineState.Aborted, NodeMetadata.Status.ERROR)
-            .put(MachineState.Stuck, NodeMetadata.Status.ERROR)
-            .put(MachineState.Null, NodeMetadata.Status.TERMINATED).build();
-   
-   @Singleton
-   @Provides
-   protected Map<MachineState, NodeMetadata.Status> toPortableNodeStatus() {
-      return toPortableNodeStatus;
-   }
-   
-   @VisibleForTesting
-   public static final Map<MachineState, Image.Status> toPortableImageStatus = ImmutableMap
-            .<MachineState, Image.Status> builder().put(MachineState.Running, Image.Status.PENDING)
-            .put(MachineState.PoweredOff, Image.Status.AVAILABLE)
-            .put(MachineState.DeletingSnapshot, Image.Status.PENDING)
-            .put(MachineState.DeletingSnapshotOnline, Image.Status.PENDING)
-            .put(MachineState.DeletingSnapshotPaused, Image.Status.PENDING)
-            .put(MachineState.FaultTolerantSyncing, Image.Status.PENDING)
-            .put(MachineState.LiveSnapshotting, Image.Status.PENDING)
-            .put(MachineState.SettingUp, Image.Status.PENDING)
-            .put(MachineState.Starting, Image.Status.PENDING)
-            .put(MachineState.Stopping, Image.Status.PENDING)
-            .put(MachineState.Restoring, Image.Status.PENDING)
-            // TODO What to map these states to?
-            .put(MachineState.FirstOnline, Image.Status.PENDING)
-            .put(MachineState.FirstTransient, Image.Status.PENDING)
-            .put(MachineState.LastOnline, Image.Status.PENDING)
-            .put(MachineState.LastTransient, Image.Status.PENDING)
-            .put(MachineState.Teleported, Image.Status.PENDING)
-            .put(MachineState.TeleportingIn, Image.Status.PENDING)
-            .put(MachineState.TeleportingPausedVM, Image.Status.PENDING)
-            .put(MachineState.Aborted, Image.Status.ERROR)
-            .put(MachineState.Stuck, Image.Status.ERROR)
-            .put(MachineState.Null, Image.Status.DELETED).build();
-   
-   @Singleton
-   @Provides
-   protected Map<MachineState, Image.Status> toPortableImageStatus() {
-      return toPortableImageStatus;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java b/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java
deleted file mode 100644
index 322bb83..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java
+++ /dev/null
@@ -1,66 +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.virtualbox.config;
-
-import java.io.File;
-
-/**
- * Configuration properties used for interacting with VirtualBox instances.
- */
-public final class VirtualBoxConstants {
-
-   public static final String VIRTUALBOX_NODE_NAME_SEPARATOR = "-0x0-";
-
-   public static final String VIRTUALBOX_IMAGE_PREFIX = "jclouds-image" + VIRTUALBOX_NODE_NAME_SEPARATOR;
-
-   public static final String VIRTUALBOX_NODE_PREFIX = "jclouds-node" + VIRTUALBOX_NODE_NAME_SEPARATOR;
-
-   public static final String VIRTUALBOX_PRECONFIGURATION_URL = "jclouds.virtualbox.preconfigurationurl";
-
-   public static final String VIRTUALBOX_WORKINGDIR = "jclouds.virtualbox.workingdir";
-
-   public static final String VIRTUALBOX_IMAGES_DESCRIPTOR = "jclouds.virtualbox.image.descriptor.yaml";
-
-   public static final String VIRTUALBOX_MACHINE_GROUP = "jclouds.virtualbox.machinegroup";
-
-   public static final String VIRTUALBOX_MACHINE_USERNAME = "jclouds.virtualbox.username";
-
-   public static final String VIRTUALBOX_MACHINE_CREDENTIAL = "jclouds.virtualbox.credential";
-
-   public static final String VIRTUALBOX_MACHINE_LOCATION = "jclouds.virtualbox.location";
-   
-   public static final String VIRTUALBOX_GUEST_MEMORY = "jclouds.virtualbox.guest.memory";
-
-   public static final String VIRTUALBOX_HOST_ID = "jclouds.virtualbox.hostid";
-
-   public static final String VIRTUALBOX_WEBSERVER_IDENTITY = "jclouds.virtualbox.webserver.identity";
-
-   public static final String VIRTUALBOX_WEBSERVER_CREDENTIAL = "jclouds.virtualbox.webserver.credential";
-
-   public static final String VIRTUALBOX_DEFAULT_DIR = System.getProperty("user.home") + File.separator
-            + ".jclouds-vbox";
-   
-   public static final String VIRTUALBOX_PROVIDER = "virtualbox";
-   
-   public static final String GUEST_OS_PASSWORD = "guestPassword";
-   
-   public static final String GUEST_OS_USER = "guestUser";
-
-   private VirtualBoxConstants() {
-      throw new AssertionError("intentionally unimplemented");
-   }
-}


[8/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java
deleted file mode 100644
index 930bc43..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/BridgedIf.java
+++ /dev/null
@@ -1,194 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Objects;
-
-/**
- * Name: en1: Wi-Fi (AirPort) GUID: 00316e65-0000-4000-8000-28cfdaf2917a Dhcp:
- * Disabled IPAddress: 192.168.57.1 NetworkMask: 255.255.255.0 IPV6Address:
- * IPV6NetworkMaskPrefixLength: 0 HardwareAddress: 28:cf:da:f2:91:7a MediumType:
- * Ethernet Status: Up VBoxNetworkName: HostInterfaceNetworking-en1: Wi-Fi
- * (AirPort)
- */
-public class BridgedIf {
-
-	private final String name;
-	private final String guid;
-	private final String dhcp;
-	private final String ipAddress;
-	private final String networkMask;
-	private final String ipv6Address;
-	private final String ipv6NetworkMask;
-	private final String mediumType;
-	private final String status;
-
-	public static Builder builder() {
-		return new Builder();
-	}
-
-	public static class Builder {
-
-		private String name;
-		private String guid;
-		private String dhcp;
-		private String ipAddress;
-		private String networkMask;
-		private String ipv6Address;
-		private String iv6NetworkMask;
-		private String mediumType;
-		private String status;
-
-		public Builder name(String name) {
-			this.name = name;
-			return this;
-		}
-
-		public Builder guid(String guid) {
-			this.guid = guid;
-			return this;
-		}
-
-		public Builder dhcp(String dhcp) {
-			this.dhcp = dhcp;
-			return this;
-		}
-
-		public Builder ip(String ipAddress) {
-			this.ipAddress = ipAddress;
-			return this;
-		}
-
-		public Builder networkMask(String networkMask) {
-			this.networkMask = networkMask;
-			return this;
-		}
-
-		public Builder ipv6(String ipv6Address) {
-			this.ipv6Address = ipv6Address;
-			return this;
-		}
-
-		public Builder ipv6networkMask(String iv6NetworkMask) {
-			this.iv6NetworkMask = iv6NetworkMask;
-			return this;
-		}
-
-		public Builder mediumType(String mediumType) {
-			this.mediumType = mediumType;
-			return this;
-		}
-
-		public Builder status(String status) {
-			this.status = status;
-			return this;
-		}
-
-		public BridgedIf build() {
-			return new BridgedIf(name, guid, dhcp, ipAddress, networkMask,
-					ipv6Address, iv6NetworkMask, mediumType, status);
-		}
-	}
-
-	public BridgedIf(String name, String guid, String dhcp, String ipAddress,
-			String networkMask, String ipv6Address, String iv6NetworkMask,
-			String mediumType, String status) {
-		this.name = checkNotNull(name, "bridgedIf name can't be null");
-		this.guid = guid;
-		this.dhcp = dhcp;
-		this.ipAddress = checkNotNull(ipAddress, "bridgedIf ipAddress can't be null");
-		this.networkMask = networkMask;
-		this.ipv6Address = ipv6Address;
-		this.ipv6NetworkMask = iv6NetworkMask;
-		this.mediumType = mediumType;
-		this.status = checkNotNull(status, "bridgedIf status can't be null");
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public String getGuid() {
-		return guid;
-	}
-
-	public String getDhcp() {
-		return dhcp;
-	}
-
-	public String getIpAddress() {
-		return ipAddress;
-	}
-
-	public String getNetworkMask() {
-		return networkMask;
-	}
-
-	public String getIpv6Address() {
-		return ipv6Address;
-	}
-
-	public String getIpv6NetworkMask() {
-		return ipv6NetworkMask;
-	}
-
-	public String getMediumType() {
-		return mediumType;
-	}
-
-	public String getStatus() {
-		return status;
-	}
-
-	@Override
-	public boolean equals(Object o) {
-		if (this == o)
-			return true;
-		if (o instanceof BridgedIf) {
-			BridgedIf other = (BridgedIf) o;
-			return Objects.equal(name, other.name)
-					&& Objects.equal(dhcp, other.dhcp)
-					&& Objects.equal(ipAddress, other.ipAddress)
-					&& Objects.equal(networkMask, other.networkMask)
-					&& Objects.equal(mediumType, other.mediumType)
-					&& Objects.equal(status, other.status);
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		return Objects.hashCode(name, guid, dhcp, ipAddress, networkMask, ipv6Address, ipv6NetworkMask, mediumType, status);
-	}
-
-	@Override
-	public String toString() {
-		return "BridgedIf{" +
-				"name=" + name + 
-				", dhcp=" + dhcp + 
-				", ipAddress=" + ipAddress + 
-				", networkMask=" + networkMask + 
-				", ipv6Address=" + ipv6Address + 
-				", ipv6NetworkMask=" + ipv6NetworkMask + 
-				", mediumType=" + mediumType + 				
-				", status=" + status + 
-				'}';
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java
deleted file mode 100644
index 477e0ba..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/CloneSpec.java
+++ /dev/null
@@ -1,116 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.virtualbox_4_2.IMachine;
-
-import com.google.common.base.Objects;
-
-/**
- * A complete specification of a "clone" node with networking setup and the physical machine
- * specification.
- */
-public class CloneSpec {
-
-   private final VmSpec vmSpec;
-   private final NetworkSpec networkSpec;
-   private final IMachine master;
-   private final boolean isLinked;
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private VmSpec vmSpec;
-      private NetworkSpec networkSpec;
-      private IMachine master;
-      private boolean isLinked;
-
-      public Builder vm(VmSpec vmSpec) {
-         this.vmSpec = vmSpec;
-         return this;
-      }
-
-      public Builder network(NetworkSpec networkSpec) {
-         this.networkSpec = networkSpec;
-         return this;
-      }
-
-      public Builder master(IMachine master) {
-         this.master = master;
-         return this;
-      }
-
-      public Builder linked(boolean isLinked) {
-         this.isLinked = isLinked;
-         return this;
-      }
-
-      public CloneSpec build() {
-         return new CloneSpec(vmSpec, networkSpec, master, isLinked);
-      }
-
-   }
-
-   public CloneSpec(VmSpec vmSpec, NetworkSpec networkSpec, IMachine master, boolean isLinked) {
-      this.vmSpec = checkNotNull(vmSpec, "vmSpec can't be null");
-      this.networkSpec =  checkNotNull(networkSpec, "networkSpec can't be null");
-      this.master =  checkNotNull(master, "master can't be null");
-      this.isLinked = isLinked;
-   }
-
-   public VmSpec getVmSpec() {
-      return vmSpec;
-   }
-
-   public NetworkSpec getNetworkSpec() {
-      return networkSpec;
-   }
-
-   public IMachine getMaster() {
-      return master;
-   }
-
-   public boolean isLinked() {
-      return isLinked;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o)
-         return true;
-      if (o instanceof CloneSpec) {
-         CloneSpec other = (CloneSpec) o;
-         return Objects.equal(vmSpec, other.vmSpec) && Objects.equal(networkSpec, other.networkSpec);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(vmSpec, networkSpec);
-   }
-
-   @Override
-   public String toString() {
-      return "CloneSpec{" + "vmSpec= " + vmSpec + ", networkSpec= " + networkSpec + '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java
deleted file mode 100644
index b345214..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/DeviceDetails.java
+++ /dev/null
@@ -1,116 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.virtualbox_4_2.DeviceType;
-
-import com.google.common.base.Objects;
-
-/**
- * Represents a specification for a device attachment.
- * <p/>
- * <p/>
- * From the VirtualBox SDK:
- * <p/>
- * port:
- * For an IDE controller, 0 specifies the primary controller and 1 specifies the secondary controller.
- * For a SCSI controller, this must range from 0 to 15; for a SATA controller, from 0 to 29; for an SAS controller,
- * from 0 to 7
- */
-public class DeviceDetails {
-
-   private final int port;
-   private final int deviceSlot;
-   private final DeviceType deviceType;
-
-   public DeviceDetails(int port, int deviceSlot, DeviceType deviceType) {
-      this.port = port;
-      this.deviceSlot = deviceSlot;
-      this.deviceType = checkNotNull(deviceType, "deviceType can't be null");
-   }
-
-   public int getPort() {
-      return port;
-   }
-
-   public int getDeviceSlot() {
-      return deviceSlot;
-   }
-
-   public DeviceType getDeviceType() {
-      return deviceType;
-   }
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private int port;
-      private int deviceSlot;
-      private DeviceType deviceType;
-
-      public Builder port(int port) {
-         this.port = port;
-         return this;
-      }
-
-      public Builder deviceType(DeviceType deviceType) {
-         this.deviceType = deviceType;
-         return this;
-      }
-
-      public Builder deviceSlot(int slot) {
-         this.deviceSlot = slot;
-         return this;
-      }
-
-      public DeviceDetails build() {
-         checkNotNull(deviceType, "deviceType can't be null");
-         return new DeviceDetails(port, deviceSlot, deviceType);
-      }
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof DeviceDetails) {
-         DeviceDetails other = (DeviceDetails) o;
-         return Objects.equal(port, other.port) &&
-                 Objects.equal(deviceSlot, other.deviceSlot)
-                 && Objects.equal(deviceType, other.deviceType);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(port, deviceSlot, deviceType);
-   }
-
-   @Override
-   public String toString() {
-      return "DeviceDetails{" +
-              "port=" + port +
-              ", deviceSlot=" + deviceSlot +
-              ", deviceType=" + deviceType +
-              '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java
deleted file mode 100644
index d43d518..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ErrorCode.java
+++ /dev/null
@@ -1,108 +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.virtualbox.domain;
-
-import java.util.Map;
-
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.jaxws.RuntimeFaultMsg;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- * Maps the error codes in the Virtual Box Java API into enum values.
- * <p/>
- * <p/>
- * To get the error code from a VBoxException, use:
- * 
- * <pre>
- * try {
- *    ...
- *    ...
- * }
- * catch (VBoxException vboxException) {
- *    RuntimeFaultMsg fault = (RuntimeFaultMsg) vboxException.getWrapped();
- *    int faultCode = fault.getFaultInfo().getResultCode();
- *    ErrorCode errorCode = ErrorCode.valueOf(faultCode);
- * }
- * </pre>
- */
-public enum ErrorCode {
-
-   VBOX_E_OBJECT_NOT_FOUND(2159738881L),
-   VBOX_E_INVALID_VM_STATE(2159738882L),
-   VBOX_E_VM_ERROR(2159738883L),
-   VBOX_E_FILE_ERROR(2159738884L),
-   VBOX_E_IPRT_ERROR(2159738885L),
-   VBOX_E_PDM_ERROR(2159738886L),
-   VBOX_E_INVALID_OBJECT_STATE(2159738887L),
-   VBOX_E_HOST_ERROR(2159738888L),
-   VBOX_E_NOT_SUPPORTED(2159738889L),
-   VBOX_E_XML_ERROR(2159738890L),
-   VBOX_E_INVALID_SESSION_STATE(2159738891L),
-   VBOX_E_OBJECT_IN_USE(2159738892L),
-   VBOX_E_ACCESSDENIED(2147942405L),
-   VBOX_E_POINTER(2147500035L),
-   VBOX_E_FAIL(2147500037L),
-   VBOX_E_NOTIMPL(2147500033L),
-   VBOX_E_OUTOFMEMORY(2147942414L),
-   VBOX_E_INVALIDARG(2147942487L),
-   VBOX_E_UNEXPECTED(2147549183L),
-   VBOX_E_UNKNOWN_ERROR_CODE(-1L),
-   VBOX_E_ERROR_CODE_UNAVAILABLE(-2L);
-
-   private final long code;
-
-   ErrorCode(long code) {
-      this.code = code;
-   }
-
-   private static final Map<Long, ErrorCode> TABLE;
-   static {
-      ImmutableMap.Builder<Long, ErrorCode> builder = ImmutableMap.builder();
-      for (ErrorCode errorCode : ErrorCode.values()) {
-         builder.put(errorCode.code, errorCode);
-      }
-      TABLE = builder.build();
-   }
-
-   /**
-    * Returns an ErrorCode from the fault code given by the VirtualBox API.
-    * 
-    * @param vboxException
-    *           the exception to get the error code from.
-    * @return an ErrorCode representing the given fault code.
-    */
-   public static ErrorCode valueOf(VBoxException vboxException) {
-      final Throwable backend = vboxException.getWrapped();
-      if (backend instanceof RuntimeFaultMsg) {
-         final RuntimeFaultMsg faultCode = (RuntimeFaultMsg) backend;
-         final int resultCode = faultCode.getFaultInfo().getResultCode();
-         final ErrorCode errorCode = TABLE.get(unsignedIntToLong(resultCode));
-         if (errorCode != null) {
-            return errorCode;
-         }
-         return VBOX_E_UNKNOWN_ERROR_CODE;
-      }
-      return VBOX_E_ERROR_CODE_UNAVAILABLE;
-   }
-
-   private static long unsignedIntToLong(int faultCode) {
-      return faultCode & 0xffffffffL;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java
deleted file mode 100644
index 8e66911..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/ExecutionType.java
+++ /dev/null
@@ -1,32 +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.virtualbox.domain;
-
-public enum ExecutionType {
-
-   GUI("gui"), HEADLESS("headless"), SDL("sdl"), EMERGENCYSTOP("emergencystop");
-
-   private final String type;
-
-   ExecutionType(String type) {
-      this.type = type;
-   }
-
-   public String stringValue() {
-      return type;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java
deleted file mode 100644
index bf7aa85..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/HardDisk.java
+++ /dev/null
@@ -1,146 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.virtualbox_4_2.DeviceType;
-
-import com.google.common.base.Objects;
-
-/**
- * A representation of a hard disk in a VirtualBox VM.
- * <p/>
- * name is a description to identify the hard disk.
- * diskPath is an absolute path to the file that is the location of the storage for the hard disk.
- * diskFormat is any of the formats supported by ISystemProperties.getMediumFormats() in the VirtualBox API.
- * This call is platform-dependent so the supported formats differ from host to host. The default format used is VDI.
- * deviceDetails contains information about how the HardDisk is attached to the StorageController.
- */
-public class HardDisk {
-
-   public static final String DEFAULT_DISK_FORMAT = "vdi";
-
-   // NB the name is not independent; the IMedium name is chosen based on the last part of diskPath
-   private final String name;
-   private final String diskFormat;
-   private final String diskPath;
-   private final DeviceDetails deviceDetails;
-   private final boolean autoDelete;
-
-   public HardDisk(DeviceDetails deviceDetails, String diskPath, String diskFormat, boolean autoDelete) {
-      this.diskPath = checkNotNull(diskPath, "diskPath can't be null");
-      this.diskFormat = checkNotNull(diskFormat, "diskFormat can't be null");
-      this.deviceDetails = checkNotNull(deviceDetails, "deviceDetails can't be null");
-      this.name = diskPath.substring(diskPath.lastIndexOf("/") + 1);
-      this.autoDelete = autoDelete;
-   }
-
-   public String getDiskPath() {
-      return diskPath;
-   }
-
-   public String getDiskFormat() {
-      return diskFormat;
-   }
-
-   public DeviceDetails getDeviceDetails() {
-      return deviceDetails;
-   }
-
-   public String getName() {
-		return name;
-	}
-
-	public boolean isAutoDelete() {
-      return autoDelete;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof HardDisk) {
-         HardDisk hardDisk = (HardDisk) o;
-         return Objects.equal(deviceDetails, hardDisk.deviceDetails) &&
-                 Objects.equal(diskFormat, hardDisk.diskFormat) &&
-                 Objects.equal(diskPath, hardDisk.diskPath) &&
-                 Objects.equal(name, hardDisk.name);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(diskPath, diskFormat, deviceDetails, name);
-   }
-
-   @Override
-   public String toString() {
-      return "HardDisk{" +
-              "diskFormat='" + diskFormat + '\'' +
-              ", diskPath='" + diskPath + '\'' +
-              ", deviceDetails=" + deviceDetails +
-              ", name=" + name +
-              '}';
-   }
-   
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private String diskFormat = "vdi";
-      private String diskPath;
-      private int controllerPort;
-      private int deviceSlot;
-      private DeviceType deviceType = DeviceType.HardDisk;
-      private boolean autoDelete = false;
-
-      public Builder diskFormat(String diskFormat) {
-         this.diskFormat = diskFormat;
-         return this;
-      }
-
-      public Builder diskpath(String diskPath) {
-         this.diskPath = diskPath;
-         return this;
-      }
-
-      public Builder controllerPort(int controllerPort) {
-         this.controllerPort = controllerPort;
-         return this;
-      }
-      
-      public Builder deviceSlot(int deviceSlot) {
-         this.deviceSlot = deviceSlot;
-         return this;
-      }
-      
-      public Builder autoDelete(boolean autoDelete) {
-         this.autoDelete = autoDelete;
-         return this;
-      }      
-
-      public HardDisk build() {
-         checkNotNull(diskPath);
-         checkNotNull(controllerPort);
-         checkNotNull(deviceSlot);
-         return new HardDisk(new DeviceDetails(controllerPort, deviceSlot, deviceType), diskPath, diskFormat, autoDelete);
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java
deleted file mode 100644
index 48df283..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoImage.java
+++ /dev/null
@@ -1,69 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Objects;
-
-/**
- * Represents an optical medium (DVD) in a VirtualBox VM.
- * <p/>
- * sourcePath is the location of the .iso file to load the medium from.
- * deviceDetails contains information about how the Dvd is attached to the StorageController.
- */
-public class IsoImage {
-   private DeviceDetails deviceDetails;
-   private String sourcePath;
-
-   public IsoImage(DeviceDetails deviceDetails, String sourcePath) {
-      this.deviceDetails = checkNotNull(deviceDetails, "deviceDetails  can't be null");
-      this.sourcePath = checkNotNull(sourcePath, "sourcePath can't be null");
-   }
-
-   public DeviceDetails getDeviceDetails() {
-      return deviceDetails;
-   }
-
-   public String getSourcePath() {
-      return sourcePath;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof IsoImage) {
-         IsoImage other = (IsoImage) o;
-         return Objects.equal(deviceDetails, other.deviceDetails) &&
-                 Objects.equal(sourcePath, other.sourcePath);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(deviceDetails, sourcePath);
-   }
-
-   @Override
-   public String toString() {
-      return "Dvd{" +
-              "deviceDetails=" + deviceDetails +
-              ", sourcePath='" + sourcePath + '\'' +
-              '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java
deleted file mode 100644
index daf6af0..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/IsoSpec.java
+++ /dev/null
@@ -1,92 +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.virtualbox.domain;
-
-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.
- */
-public class IsoSpec {
-
-   private final String installationKeySequence;
-   private final String sourcePath;
-
-   public IsoSpec(String sourcePath, String installationKeySequence) {
-      this.sourcePath = checkNotNull(sourcePath, "sourcePath can't be null");
-      this.installationKeySequence = checkNotNull(installationKeySequence, "installationKeySequence can't be null");
-   }
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private String installationSequence;
-      private String sourcePath;
-
-      public Builder installationScript(String installationSequence) {
-         this.installationSequence = installationSequence;
-         return this;
-      }
-
-      public Builder sourcePath(String sourcePath) {
-         this.sourcePath = sourcePath;
-         return this;
-      }
-
-
-      public IsoSpec build() {
-         return new IsoSpec(sourcePath, installationSequence);
-      }
-   }
-
-   public String getInstallationKeySequence() {
-      return installationKeySequence;
-   }
-
-   public String getSourcePath() {
-      return sourcePath;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof IsoSpec) {
-         IsoSpec other = (IsoSpec) o;
-         return Objects.equal(sourcePath, other.sourcePath) &&
-                 Objects.equal(installationKeySequence, other.installationKeySequence);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(sourcePath, installationKeySequence);
-   }
-
-   @Override
-   public String toString() {
-      return "IsoSpec{" +
-              "sourcePath='" + sourcePath + '\'' +
-              "installationKeySequence='" + installationKeySequence + '\'' +
-              '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java
deleted file mode 100644
index a8261ae..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/Master.java
+++ /dev/null
@@ -1,64 +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.virtualbox.domain;
-
-import org.virtualbox_4_2.IMachine;
-
-public class Master {
-
-   private final IMachine machine;
-   private final MasterSpec spec;
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-      private IMachine machine;
-      private MasterSpec spec;
-
-      public Builder machine(IMachine machine) {
-         this.machine = machine;
-         return this;
-      }
-
-      public Builder spec(MasterSpec spec) {
-         this.spec = spec;
-         return this;
-      }
-
-      public Master build() {
-         return new Master(machine, spec);
-      }
-
-   }
-
-   private Master(IMachine machine, MasterSpec spec) {
-      super();
-      this.machine = machine;
-      this.spec = spec;
-   }
-
-   public IMachine getMachine() {
-      return machine;
-   }
-
-   public MasterSpec getSpec() {
-      return spec;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java
deleted file mode 100644
index 0cd4bc1..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/MasterSpec.java
+++ /dev/null
@@ -1,117 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.domain.LoginCredentials;
-
-import com.google.common.base.Objects;
-
-/**
- * A complete specification of a "master" node, including the ISO, networking setup and the physical
- * machine specification.
- */
-public class MasterSpec {
-
-   private VmSpec vmSpec;
-   private IsoSpec isoSpec;
-   private NetworkSpec networkSpec;
-   private LoginCredentials loginCredentials;
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private VmSpec vmSpec;
-      private IsoSpec isoSpec;
-      private NetworkSpec networkSpec;
-      private LoginCredentials loginCredentials;
-
-      public Builder vm(VmSpec vmSpec) {
-         this.vmSpec = vmSpec;
-         return this;
-      }
-
-      public Builder network(NetworkSpec networkSpec) {
-         this.networkSpec = networkSpec;
-         return this;
-      }
-
-      public Builder iso(IsoSpec isoSpec) {
-         this.isoSpec = isoSpec;
-         return this;
-      }
-
-      public Builder credentials(LoginCredentials loginCredentials) {
-         this.loginCredentials = loginCredentials;
-         return this;
-      }
-      
-      public MasterSpec build() {
-         return new MasterSpec(vmSpec, isoSpec, networkSpec, loginCredentials);
-      }
-
-   }
-
-   private MasterSpec(VmSpec vmSpec, IsoSpec isoSpec, NetworkSpec networkSpec, LoginCredentials loginCredentials) {
-      this.vmSpec = checkNotNull(vmSpec, "vmSpec can't be null");
-      this.isoSpec = checkNotNull(isoSpec, "isoSpec can't be null");
-      this.networkSpec = checkNotNull(networkSpec, "networkSpec can't be null");
-      this.loginCredentials = loginCredentials;
-   }
-
-   public VmSpec getVmSpec() {
-      return vmSpec;
-   }
-
-   public IsoSpec getIsoSpec() {
-      return isoSpec;
-   }
-
-   public NetworkSpec getNetworkSpec() {
-      return networkSpec;
-   }
-   
-   public LoginCredentials getLoginCredentials() {
-      return loginCredentials;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o)
-         return true;
-      if (o instanceof MasterSpec) {
-         MasterSpec other = (MasterSpec) o;
-         return Objects.equal(vmSpec, other.vmSpec) && Objects.equal(isoSpec, other.isoSpec)
-                  && Objects.equal(networkSpec, other.networkSpec);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(vmSpec, isoSpec, networkSpec);
-   }
-
-   @Override
-   public String toString() {
-      return "IMachineSpec{" + "vmSpec=" + vmSpec + ", isoSpec=" + isoSpec + ", networkSpec=" + networkSpec + '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java
deleted file mode 100644
index d036151..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NatAdapter.java
+++ /dev/null
@@ -1,106 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.virtualbox_4_2.NATProtocol;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Sets;
-
-/**
- * Represents a NAT network adapter in VirtualBox.
- * <p/>
- * redirectRules are the redirect rules that are applied to the network adapter.
- */
-public class NatAdapter {
-
-   private final Set<RedirectRule> redirectRules = Sets.newLinkedHashSet();
-
-   public NatAdapter(Set<RedirectRule> redirectRules) {
-      checkNotNull(redirectRules);
-      this.redirectRules.addAll(redirectRules);
-   }
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private Set<RedirectRule> redirectRules = Sets.newLinkedHashSet();
-
-      /**
-       * @param host incoming address
-       * @param hostPort
-       * @param guest guest address or empty string for all addresses
-       * @param guestPort
-       * @return
-       */
-      public Builder tcpRedirectRule(String host, int hostPort, String guest, int guestPort) {
-         redirectRules.add(new RedirectRule(NATProtocol.TCP, host, hostPort, guest, guestPort));
-         return this;
-      }
-      
-      /**
-       * @param host incoming address
-       * @param hostPort
-       * @param guest guest address or empty string for all addresses
-       * @param guestPort
-       * @return
-       */
-      public Builder udpRedirectRule(String host, int hostPort, String guest, int guestPort) {
-         redirectRules.add(new RedirectRule(NATProtocol.UDP, host, hostPort, guest, guestPort));
-         return this;
-      }
-
-      public NatAdapter build() {
-         return new NatAdapter(redirectRules);
-      }
-
-   }
-
-   public Set<RedirectRule> getRedirectRules() {
-      return Collections.unmodifiableSet(redirectRules);
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof NatAdapter) {
-         NatAdapter other = (NatAdapter) o;
-         return Objects.equal(redirectRules, other.redirectRules);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(redirectRules);
-   }
-
-   @Override
-   public String toString() {
-      return "NatAdapter{" +
-              "redirectRules=" + redirectRules +
-              '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java
deleted file mode 100644
index 80ff812..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java
+++ /dev/null
@@ -1,172 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.virtualbox_4_2.NATProtocol;
-import org.virtualbox_4_2.NetworkAttachmentType;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-/**
- * Represents a network adapter in VirtualBox.
- * <p/>
- * redirectRules are the redirect rules that are applied to the network adapter.
- */
-public class NetworkAdapter {
-
-	private final NetworkAttachmentType networkAttachmentType;
-	private final String macAddress;
-	private final Set<RedirectRule> redirectRules;
-	private final String staticIp;
-
-	public NetworkAdapter(NetworkAttachmentType networkAttachmentType,
-			String macAddress, Set<RedirectRule> redirectRules,
-			String staticIp) {
-		this.networkAttachmentType = checkNotNull(networkAttachmentType,
-				"networkAttachmentType can't be null");
-		this.macAddress = macAddress;
-		this.redirectRules = ImmutableSet.<RedirectRule>copyOf(redirectRules);
-		this.staticIp = staticIp;
-	}
-
-	public static Builder builder() {
-		return new Builder();
-	}
-
-	public static class Builder {
-
-		private NetworkAttachmentType networkAttachmentType;
-		private String macAddress;
-		private Set<RedirectRule> redirectRules = Sets.newLinkedHashSet();
-		private String staticIp;
-
-		/**
-		 * 
-		 * @param networkAttachmentType
-		 * @return
-		 */
-		public Builder networkAttachmentType(
-				NetworkAttachmentType networkAttachmentType) {
-			this.networkAttachmentType = networkAttachmentType;
-			return this;
-		}
-
-		/**
-		 * 
-		 * @param macAddress
-		 * @return
-		 */
-		public Builder macAddress(String macAddress) {
-			this.macAddress = macAddress;
-			return this;
-		}
-
-		/**
-		 * @param host
-		 *            incoming address
-		 * @param hostPort
-		 * @param guest
-		 *            guest address or empty string for all addresses
-		 * @param guestPort
-		 * @return
-		 */
-		public Builder tcpRedirectRule(String host, int hostPort, String guest,
-				int guestPort) {
-			redirectRules.add(new RedirectRule(NATProtocol.TCP, host, hostPort,
-					guest, guestPort));
-			return this;
-		}
-
-		/**
-		 * @param host
-		 *            incoming address
-		 * @param hostPort
-		 * @param guest
-		 *            guest address or empty string for all addresses
-		 * @param guestPort
-		 * @return
-		 */
-		public Builder udpRedirectRule(String host, int hostPort, String guest,
-				int guestPort) {
-			redirectRules.add(new RedirectRule(NATProtocol.UDP, host, hostPort,
-					guest, guestPort));
-			return this;
-		}
-		
-		public Builder staticIp(@Nullable String staticIp) {
-		   this.staticIp = staticIp;
-		   return this;
-		}
-
-		public NetworkAdapter build() {
-			return new NetworkAdapter(networkAttachmentType, macAddress,
-					redirectRules, staticIp);
-		}
-	}
-
-	public NetworkAttachmentType getNetworkAttachmentType() {
-		return networkAttachmentType;
-	}
-
-	public Set<RedirectRule> getRedirectRules() {
-		return Collections.unmodifiableSet(redirectRules);
-	}
-
-	public String getMacAddress() {
-		return macAddress;
-	}
-	
-	public String getStaticIp() {
-         return staticIp;
-      }
-
-	@Override
-	public boolean equals(Object o) {
-		if (this == o)
-			return true;
-		if (o instanceof NetworkAdapter) {
-			NetworkAdapter other = (NetworkAdapter) o;
-			return Objects.equal(networkAttachmentType,
-					other.networkAttachmentType) &&
-					Objects.equal(macAddress, other.macAddress) &&		
-					Objects.equal(redirectRules, other.redirectRules);
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		return Objects.hashCode(networkAttachmentType, macAddress, redirectRules);
-	}
-
-	@Override
-	public String toString() {
-		return "NetworkAdapter{networkAttachmentType=" +
-				networkAttachmentType +
-				", macAddress=" + macAddress +
-				", redirectRules=" + redirectRules +
-				'}';
-	}
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java
deleted file mode 100644
index 7ee0278..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java
+++ /dev/null
@@ -1,122 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Objects;
-
-public class NetworkInterfaceCard {
-
-	private final long slot;
-	private final NetworkAdapter networkAdapter;
-	private final String hostInterfaceName;
-	private final boolean enabled;
-	
-	public NetworkInterfaceCard(long slot, NetworkAdapter networkAdapter, String hostInterfaceName, boolean enabled) {
-		this.slot = checkNotNull(slot, "slot can't be null");
-		this.networkAdapter = checkNotNull(networkAdapter, "networkAdapter can't be null");
-		this.hostInterfaceName = hostInterfaceName;
-		this.enabled = enabled;
-	}
-
-	public static Builder builder() {
-		return new Builder();
-	}
-	
-	public static class Builder {
-		
-		private long slot = 0L;
-		private NetworkAdapter networkAdapter;
-		private String hostInterfaceName;
-		private boolean enabled = true;
-		
-		public Builder slot(long slot) {
-		      checkArgument(slot >= 0 && slot < 4, "must be 0, 1, 2, 3: %s", slot);
-			this.slot = slot;
-			return this;
-		}
-		
-		public Builder addNetworkAdapter(
-				NetworkAdapter networkAdapter) {
-			this.networkAdapter = networkAdapter;
-			return this;
-		}
-		
-		public Builder addHostInterfaceName(
-				String hostInterfaceName) {
-			this.hostInterfaceName = hostInterfaceName;
-			return this;
-		}	
-		
-	    public Builder enabled(
-	          boolean enabled) {
-	         this.enabled = enabled;
-	         return this;
-	      }  
-		
-		public NetworkInterfaceCard build() {
-			return new NetworkInterfaceCard(slot, networkAdapter, hostInterfaceName, enabled);
-		}
-	}
-
-	public long getSlot() {
-		return slot;
-	}
-	
-	public NetworkAdapter getNetworkAdapter() {
-		return networkAdapter;
-	}
-	
-	public String getHostInterfaceName() {
-		return hostInterfaceName;
-	}
-	
-	public boolean isEnabled() {
-      return enabled;
-   }
-	
-	@Override
-	public boolean equals(Object o) {
-		if (this == o)
-			return true;
-		if (o instanceof NetworkInterfaceCard) {
-			NetworkInterfaceCard other = (NetworkInterfaceCard) o;
-			return Objects.equal(slot,
-					other.slot) &&
-					Objects.equal(networkAdapter, other.networkAdapter)
-					&& Objects.equal(enabled, other.enabled);
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		return Objects.hashCode(slot, networkAdapter, enabled);
-	}
-
-	@Override
-	public String toString() {
-		return "NetworkInterfaceCard{slot=" +
-				slot +
-				", networkAdapter=" + networkAdapter +
-				", enabled=" + enabled +
-				'}';
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java
deleted file mode 100644
index 98fa59e..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkSpec.java
+++ /dev/null
@@ -1,80 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-/**
- * Describes the network configuration for a VirtualBox machine.
- */
-public class NetworkSpec {
-
-   private final List<NetworkInterfaceCard> networkInterfaceCards;
-
-   public NetworkSpec(final List<NetworkInterfaceCard> networkInterfaceCards) {
-      this.networkInterfaceCards = ImmutableList.copyOf(checkNotNull(networkInterfaceCards, "networkInterfaceCards can't be null"));
-   }
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private List<NetworkInterfaceCard> networkInterfaceCards = Lists.newArrayList();
-
-      public Builder addNIC(NetworkInterfaceCard networkInterfaceCard) {
-         this.networkInterfaceCards.add(networkInterfaceCard);
-         return this;
-      }
-
-      public NetworkSpec build() {
-         return new NetworkSpec(networkInterfaceCards);
-      }
-   }
-
-   public List<NetworkInterfaceCard> getNetworkInterfaceCards() {
-      return networkInterfaceCards;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o)
-         return true;
-      if (o instanceof NetworkSpec) {
-         NetworkSpec other = (NetworkSpec) o;
-         return Objects.equal(networkInterfaceCards, other.networkInterfaceCards);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(networkInterfaceCards);
-   }
-
-   @Override
-   public String toString() {
-      return "NetworkSpec{" + "networkInterfaceCards= " + networkInterfaceCards + '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java
deleted file mode 100644
index 8c14b73..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NodeSpec.java
+++ /dev/null
@@ -1,89 +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.virtualbox.domain;
-
-import org.jclouds.compute.domain.Template;
-
-public class NodeSpec {
-
-   private final Master master;
-   private final String name;
-   private final String tag;
-   private final Template template;
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private Master master;
-      private String name;
-      private String tag;
-      private Template template;
-
-      public Builder master(Master master) {
-         this.master = master;
-         return this;
-      }
-
-      public Builder name(String name) {
-         this.name = name;
-         return this;
-      }
-
-      public Builder tag(String tag) {
-         this.tag = tag;
-         return this;
-      }
-
-      public Builder template(Template template) {
-         this.template = template;
-         return this;
-      }
-
-      public NodeSpec build() {
-         return new NodeSpec(master, name, tag, template);
-      }
-
-   }
-
-   private NodeSpec(Master master, String name, String tag, Template template) {
-      super();
-      this.master = master;
-      this.name = name;
-      this.tag = tag;
-      this.template = template;
-   }
-
-   public Master getMaster() {
-      return master;
-   }
-
-   public String getName() {
-      return name;
-   }
-
-   public String getTag() {
-      return tag;
-   }
-
-   public Template getTemplate() {
-      return template;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java
deleted file mode 100644
index 106d7b3..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/RedirectRule.java
+++ /dev/null
@@ -1,101 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.virtualbox_4_2.NATProtocol;
-
-import com.google.common.base.Objects;
-
-public class RedirectRule {
-
-   private final NATProtocol protocol;
-   private final String host;
-   private final int hostPort;
-   private final String guest;
-   private final int guestPort;
-   
-   /**
-    * @param protocol
-    * @param host incoming address
-    * @param hostPort
-    * @param guest guest address or empty string for all addresses
-    * @param guestPort
-    * @return
-    */
-   public RedirectRule(NATProtocol protocol, String host, int hostPort, String guest, int guestPort) {
-      checkNotNull(protocol);
-      checkNotNull(host);
-      checkNotNull(guest);
-      this.protocol = protocol;
-      this.host = host;
-      this.hostPort = hostPort;
-      this.guest = guest;
-      this.guestPort = guestPort;
-   }
-
-   public NATProtocol getProtocol() {
-      return protocol;
-   }
-
-   public String getHost() {
-      return host;
-   }
-
-   public int getHostPort() {
-      return hostPort;
-   }
-
-   public String getGuest() {
-      return guest;
-   }
-
-   public int getGuestPort() {
-      return guestPort;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof RedirectRule) {
-         RedirectRule other = (RedirectRule) o;
-         return Objects.equal(protocol, other.protocol) &&
-                 Objects.equal(host, other.host) &&
-                 Objects.equal(hostPort, other.hostPort) &&
-                 Objects.equal(guest, other.guest) &&
-                 Objects.equal(guestPort, other.guestPort);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(protocol, host, hostPort, guest, guestPort);
-   }
-
-   @Override
-   public String toString() {
-      return "RedirectRule{" +
-              "protocol=" + protocol +
-              ", host='" + host + '\'' +
-              ", hostPort=" + hostPort +
-              ", guest='" + guest + '\'' +
-              ", guestPort=" + guestPort +
-              '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java
deleted file mode 100644
index fa13bde..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/StorageController.java
+++ /dev/null
@@ -1,157 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-
-import java.util.Set;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-/**
- * Represents a storage controller in a VirtualBox VM.
- * <p/>
- * name is the unique name of the controller.
- * bus is the type of connection bus for the controller
- * hardDisks contains the hard disks that are attached (or should be attached) to this controller
- * isoImages contains the ISOs that are attached (or should be attached) to this controller
- *
- * @see StorageBus
- */
-public class StorageController {
-   private final String name;
-   private final StorageBus bus;
-   private Set<HardDisk> hardDisks;
-   private Set<IsoImage> isoImages;
-
-   public StorageController(String name, StorageBus bus, Set<HardDisk> hardDisks, Set<IsoImage> isoImages) {
-      this.name = checkNotNull(name, "storage name can't be null");
-      this.bus = checkNotNull(bus, "bus can't be null");
-      this.hardDisks = checkNotNull(hardDisks, "hardDisks can't be null");
-      this.isoImages = checkNotNull(isoImages, "isoImages can't be null");
-   }
-
-   public String getName() {
-      return name;
-   }
-
-   public StorageBus getBus() {
-      return bus;
-   }
-
-   public HardDisk getHardDisk(String diskName) {
-
-      final Iterable<HardDisk> hardDisks = filter(getHardDisks(), new HardDiskPredicate(diskName));
-      return Iterables.getFirst(hardDisks, HardDisk.builder().diskpath("notfound").controllerPort(0).deviceSlot(0).build());
-   }
-
-   public Set<HardDisk> getHardDisks() {
-      return hardDisks;
-   }
-
-   public Set<IsoImage> getIsoImages() {
-      return isoImages;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o instanceof StorageController) {
-         StorageController other = (StorageController) o;
-         return Objects.equal(name, other.name) &&
-                 Objects.equal(bus, other.bus) &&
-                 Objects.equal(hardDisks, other.hardDisks) &&
-                 Objects.equal(isoImages, other.isoImages);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(name, bus, hardDisks, isoImages);
-   }
-
-   @Override
-   public String toString() {
-      return "StorageController{" +
-              "name='" + name + '\'' +
-              ", bus=" + bus +
-              ", hardDisks=" + hardDisks +
-              ", isoImages=" + isoImages +
-              '}';
-   }
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private String name;
-      private StorageBus bus;
-      private Set<HardDisk> hardDisks = Sets.newHashSet();
-      private Set<IsoImage> dvds = Sets.newHashSet();
-
-      public Builder name(String name) {
-         this.name = name;
-         return this;
-      }
-
-      public Builder bus(StorageBus bus) {
-         this.bus = bus;
-         return this;
-      }
-
-      public Builder attachISO(int controllerPort, int deviceSlot, String sourcePath) {
-         dvds.add(new IsoImage(new DeviceDetails(controllerPort, deviceSlot, DeviceType.DVD), sourcePath));
-         return this;
-      }
-
-      public Builder attachHardDisk(HardDisk hardDisk) {
-         hardDisks.add(hardDisk);
-         return this;
-      }
-
-      public StorageController build() {
-         checkNotNull(name);
-         checkNotNull(bus);
-         return new StorageController(name, bus, hardDisks, dvds);
-      }
-   }
-   
-   private static class HardDiskPredicate implements Predicate<HardDisk>  {
-   	
-   	private String diskName;
-   	
-      public HardDiskPredicate(String diskName) {
-         this.diskName = diskName;
-      }
-   	
-      @Override
-      public boolean apply(@Nullable HardDisk hardDisk) {
-         return hardDisk.getName().equals(diskName);
-      }
-   };
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java
deleted file mode 100644
index 23a3fc4..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/VmSpec.java
+++ /dev/null
@@ -1,180 +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.virtualbox.domain;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.virtualbox_4_2.CleanupMode;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Sets;
-
-/**
- * A description of a Virtual Machine in VirtualBox.
- */
-public class VmSpec {
-
-   private final String vmName;
-   private final String osTypeId;
-   private final String vmId;
-   private final long memory;
-   private final boolean forceOverwrite;
-   private final Set<StorageController> controllers;
-   private final CleanupMode cleanupMode;
-
-   public VmSpec(String vmId, String vmName, String osTypeId, long memory, String guestUser, String guestPassword, boolean forceOverwrite,
-            Set<StorageController> controllers, CleanupMode cleanupMode) {
-      this.vmId = checkNotNull(vmId, "vmId can't be null");
-      this.vmName = checkNotNull(vmName, "vmName can't be null");
-      this.osTypeId = checkNotNull(osTypeId, "osTypeId can't be null");
-      checkArgument(memory > 0, "memory must be > 0");
-      this.memory = memory;
-      this.controllers = checkNotNull(controllers, "controllers can't be null");
-      this.cleanupMode = checkNotNull(cleanupMode, "cleanupMode can't be null");
-      this.forceOverwrite = forceOverwrite;
-   }
-
-   public static Builder builder() {
-      return new Builder();
-   }
-
-   public static class Builder {
-
-      private Set<StorageController> controllers = Sets.newHashSet();
-
-      private String name;
-      private String id;
-      private String osTypeId = "";
-      private boolean forceOverwrite = true;
-      private long memory;
-      private String guestUser;
-      private String guestPassword;
-      private CleanupMode cleanUpMode;
-
-      public Builder controller(StorageController controller) {
-         controllers.add(controller);
-         return this;
-      }
-
-      public Builder name(String name) {
-         this.name = name;
-         return this;
-      }
-
-      public Builder id(String id) {
-         this.id = id;
-         return this;
-      }
-
-      public Builder osTypeId(String osTypeId) {
-         this.osTypeId = osTypeId;
-         return this;
-      }
-
-      public Builder forceOverwrite(boolean forceOverwrite) {
-         this.forceOverwrite = forceOverwrite;
-         return this;
-      }
-
-      public Builder memoryMB(int memorySize) {
-         this.memory = (long) memorySize;
-         return this;
-      }
-
-      public Builder cleanUpMode(CleanupMode cleanupMode) {
-         this.cleanUpMode = cleanupMode;
-         return this;
-      }
-      
-      public Builder guestUser(String guestUser) {
-         this.guestUser = guestUser;
-         return this;
-      }  
-      
-      public Builder guestPassword(String guestPassword) {
-         this.guestPassword = guestPassword;
-         return this;
-      }    
-
-      public VmSpec build() {
-         checkNotNull(name, "name");
-         checkNotNull(id, "id");
-         checkArgument(memory > 0, "Memory must be set");
-         return new VmSpec(id, name, osTypeId, memory, guestUser, guestPassword, forceOverwrite, controllers, cleanUpMode);
-      }
-
-   }
-
-   public String getVmId() {
-      return vmId;
-   }
-
-   public String getVmName() {
-      return vmName;
-   }
-
-   public String getOsTypeId() {
-      return osTypeId;
-   }
-
-   public long getMemory() {
-      return memory;
-   }
-
-   public boolean isForceOverwrite() {
-      return forceOverwrite;
-   }
-
-   public Set<StorageController> getControllers() {
-      return Collections.unmodifiableSet(controllers);
-   }
-
-   public CleanupMode getCleanupMode() {
-      return cleanupMode;
-   }
-
-   @Override
-   public boolean equals(Object o) {
-      if (this == o)
-         return true;
-      if (o instanceof VmSpec) {
-         VmSpec other = (VmSpec) o;
-         return Objects.equal(vmId, other.vmId) && Objects.equal(vmName, other.vmName)
-                  && Objects.equal(osTypeId, other.osTypeId) && Objects.equal(memory, other.memory)
-                  && Objects.equal(forceOverwrite, other.forceOverwrite)
-                  && Objects.equal(controllers, other.controllers) && Objects.equal(cleanupMode, other.cleanupMode);
-      }
-      return false;
-   }
-
-   @Override
-   public int hashCode() {
-      return Objects.hashCode(vmId, vmName, osTypeId, memory, forceOverwrite, controllers);
-   }
-
-   @Override
-   public String toString() {
-      return "VmSpecification{" + "vmName='" + vmName + '\'' + ", osTypeId='" + osTypeId + '\'' + ", memory='" + memory
-            + '\'' + ", vmId='" + vmId + '\'' + '\''
-            + ", forceOverwrite=" + forceOverwrite + ", controllers="
-            + controllers + ", cleanupMode=" + cleanupMode + '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java b/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java
deleted file mode 100644
index c0dd59b..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/domain/YamlImage.java
+++ /dev/null
@@ -1,166 +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.virtualbox.domain;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.domain.LoginCredentials;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-/**
- * Serializes to the following
- * 
- * <pre>
- * id: myTestId
- *       name: ubuntu-11.04-server-i386
- *       description: ubuntu 11.04 server (i386)
- *       os_arch: x86
- *       os_family: linux
- *       os_description: ubuntu
- *       os_version: 11.04
- *       iso: http://releases.ubuntu.com/11.04/ubuntu-11.04-server-i386.iso
- *       keystroke_sequence: |
- *                 <Esc><Esc><Enter> 
- *                 /install/vmlinuz noapic preseed/url=http://10.0.2.2:8080/src/test/resources/preseed.cfg 
- *                 debian-installer=en_US auto locale=en_US kbd-chooser/method=us 
- *                 hostname=vmName 
- *                 fb=false debconf/frontend=noninteractive 
- *                 keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false 
- *                 initrd=/install/initrd.gz -- <Enter>
- *       preseed_cfg: |                
- *                       ## Options to set on the command line
- *                       d-i debian-installer/locale string en_US.utf8
- *                       d-i console-setup/ask_detect boolean false
- *                       d-i console-setup/layout string USA
- *                       d-i netcfg/get_hostname string unassigned-hostname
- *                       d-i netcfg/get_domain string unassigned-domain
- *                       # Continue without a default route
- *                       # Not working , specify a dummy in the DHCP
- *                       d-i time/zone string UTC
- *                       d-i clock-setup/utc-auto boolean true
- *                       d-i clock-setup/utc boolean true
- *                       d-i kbd-chooser/method	select	American English
- *                       d-i netcfg/wireless_wep string
- *                       d-i base-installer/kernel/override-image string linux-server
- *                       # Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
- *                       d-i debconf debconf/frontend select Noninteractive
- *                       d-i pkgsel/install-language-support boolean false
- *                       tasksel tasksel/first multiselect standard, ubuntu-server
- *                       d-i partman-auto/method string lvm
- *                       d-i partman-lvm/confirm boolean true
- *                       d-i partman-lvm/device_remove_lvm boolean true
- *                       d-i partman-auto/choose_recipe select atomic
- *                       d-i partman/confirm_write_new_label boolean true
- *                       d-i partman/confirm_nooverwrite boolean true
- *                       d-i partman/choose_partition select finish
- *                       d-i partman/confirm boolean true
- *                       # Write the changes to disks and configure LVM?
- *                       d-i partman-lvm/confirm boolean true
- *                       d-i partman-lvm/confirm_nooverwrite boolean true
- *                       d-i partman-auto-lvm/guided_size string max
- *                       ## Default user, we can get away with a recipe to change this
- *                       d-i passwd/user-fullname string toor
- *                       d-i passwd/username string toor
- *                       d-i passwd/user-password password password
- *                       d-i passwd/user-password-again password password
- *                       d-i user-setup/encrypt-home boolean false
- *                       d-i user-setup/allow-password-weak boolean true
- *                       # Individual additional packages to install
- *                       d-i pkgsel/include string openssh-server ntp
- *                       # Whether to upgrade packages after debootstrap.
- *                       # Allowed values: none, safe-upgrade, full-upgrade
- *                       d-i pkgsel/upgrade select full-upgrade
- *                       d-i grub-installer/only_debian boolean true
- *                       d-i grub-installer/with_other_os boolean true
- *                       d-i finish-install/reboot_in_progress note
- *                       #For the update
- *                       d-i pkgsel/update-policy select none
- *                       # debconf-get-selections --install
- *                       #Use mirror
- *                       choose-mirror-bin mirror/http/proxy string
- * </pre>
- */
-public class YamlImage {
-   public String id;
-   public String name;
-   public String description;
-   public String hostname;
-   public String location_id;
-   public String os_arch;
-   public String os_family;
-   public String os_description;
-   public String os_version;
-   public String iso_md5;
-   public String iso;
-   public String keystroke_sequence;
-   public String preseed_cfg;
-   public int login_port = 22;
-   public boolean os_64bit;
-   public String group;
-   public List<String> tags = Lists.newArrayList();
-   public Map<String, String> metadata = Maps.newLinkedHashMap();
-   public String username;
-   public String credential;
-   public String credential_url;
-   public String sudo_password;
-
-   public static final Function<YamlImage, Image> toImage = new Function<YamlImage, Image>() {
-      @Override
-      public Image apply(YamlImage arg0) {
-         if (arg0 == null)
-            return null;
-         
-         OsFamily family = parseOsFamilyOrUnrecognized(arg0.os_family);
-
-         OperatingSystem operatingSystem = OperatingSystem.builder().description(arg0.os_description).family(family)
-                  .version(arg0.os_version).is64Bit(arg0.os_64bit).arch(arg0.os_arch).build();
-
-         return new ImageBuilder().id(arg0.id).name(arg0.name).description(arg0.description)
-                  .operatingSystem(operatingSystem).status(Image.Status.AVAILABLE)
-                  .defaultCredentials(LoginCredentials.builder()
-                                                      .user(arg0.username)
-                                                      .password(arg0.credential)
-                                                      .authenticateSudo(true).build())
-                  .build();
-      }
-   };
-
-   public Image toImage() {
-      return toImage.apply(this);
-   }
-
-   @Override
-   public String toString() {
-      return "YamlImage [id=" + id + ", name=" + name + ", description=" + description + ", hostname=" + hostname
-               + ", location_id=" + location_id + ", os_arch=" + os_arch + ", os_family=" + os_family
-               + ", os_description=" + os_description + ", os_version=" + os_version + ", iso=" + iso 
-               + ", keystroke_sequence=" + keystroke_sequence + ", preseed_cfg=" + preseed_cfg + ", login_port="
-               + login_port + ", os_64bit=" + os_64bit + ", group=" + group + ", tags=" + tags + ", metadata="
-               + metadata + ", username=" + username + ", credential=" + credential + ", credential_url="
-               + credential_url + ", sudo_password=" + sudo_password + "]";
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java
deleted file mode 100644
index 7d6ee13..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AddIDEControllerIfNotExists.java
+++ /dev/null
@@ -1,50 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.virtualbox.domain.StorageController;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.common.base.Function;
-
-public class AddIDEControllerIfNotExists implements Function<IMachine, Void> {
-   private final StorageController storageController;
-
-   public AddIDEControllerIfNotExists(StorageController storageController) {
-      this.storageController = checkNotNull(storageController, "storageController can't be null");
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      try {
-         machine.addStorageController(storageController.getName(), storageController.getBus());
-         machine.saveSettings();
-      } catch (VBoxException e) {
-         if (!e.getMessage().contains("already exists"))
-            throw e;
-      }
-      return null;
-   }
-
-   @Override
-   public String toString() {
-      return String.format("addStorageController(%s)", storageController);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java
deleted file mode 100644
index addd1e5..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyBootOrderToMachine.java
+++ /dev/null
@@ -1,42 +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.virtualbox.functions;
-
-import com.google.common.base.Function;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-
-import java.util.Map;
-
-public class ApplyBootOrderToMachine implements Function<IMachine, Void> {
-
-
-   private Map<Long, DeviceType> positionAndDeviceType;
-
-   public ApplyBootOrderToMachine(Map<Long, DeviceType> positionAndDeviceType) {
-      this.positionAndDeviceType = positionAndDeviceType;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      for (long position : positionAndDeviceType.keySet()) {
-         machine.setBootOrder(position, positionAndDeviceType.get(position));
-      }
-      machine.saveSettings();
-      return null;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.java
deleted file mode 100644
index 352a8bb..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/ApplyMemoryToMachine.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.virtualbox.functions;
-
-import org.virtualbox_4_2.IMachine;
-
-import com.google.common.base.Function;
-
-public class ApplyMemoryToMachine implements Function<IMachine, Void> {
-
-   private long memorySize;
-
-   public ApplyMemoryToMachine(long memorySize) {
-      this.memorySize = memorySize;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      machine.setMemorySize(memorySize);
-      machine.saveSettings();
-      return null;
-   }
-}


[2/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToVmSpecTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToVmSpecTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToVmSpecTest.java
deleted file mode 100644
index 606e29b..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToVmSpecTest.java
+++ /dev/null
@@ -1,99 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoImage;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IMediumAttachment;
-import org.virtualbox_4_2.IStorageController;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.collect.Lists;
-
-@Test(groups = "unit")
-public class IMachineToVmSpecTest {
-
-   private static final String PATH_TO_DVD = "/path/to/dvd";
-   private static final String PATH_TO_HD = "/path/to/hd";
-   private static final StorageBus CONTROLLER_BUS = StorageBus.IDE;
-   private static final long MEMORY_SIZE = 512L;
-   private static final String OS_TYPE_ID = "ubuntu";
-   private static final String VM_NAME = "test";
-   private static final String CONTROLLER_NAME = "IDE Controller";
-   private static final String VM_ID = "test";
-
-   @Test
-   public void testConvert() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IStorageController iStorageController = createNiceMock(IStorageController.class);
-      IMediumAttachment iMediumAttachment = createNiceMock(IMediumAttachment.class);
-      IMedium hd = createNiceMock(IMedium.class);
-      IMedium dvd = createNiceMock(IMedium.class);
-      IMachine vm = createNiceMock(IMachine.class);
-
-      expect(vm.getStorageControllers()).andReturn(Lists.newArrayList(iStorageController)).anyTimes();
-      expect(iStorageController.getName()).andReturn(CONTROLLER_NAME).anyTimes();
-      expect(iStorageController.getBus()).andReturn(CONTROLLER_BUS).anyTimes();
-      expect(vm.getMediumAttachmentsOfController(CONTROLLER_NAME)).andReturn(Lists.newArrayList(iMediumAttachment)).anyTimes();
-      expect(iMediumAttachment.getPort()).andReturn(0).once();
-      expect(iMediumAttachment.getDevice()).andReturn(0).once();
-
-      expect(iMediumAttachment.getMedium()).andReturn(hd);
-      expect(hd.getDeviceType()).andReturn(DeviceType.HardDisk).once();
-      expect(hd.getLocation()).andReturn(PATH_TO_HD).once();
-
-      expect(iMediumAttachment.getMedium()).andReturn(dvd);
-      expect(dvd.getDeviceType()).andReturn(DeviceType.DVD).once();
-      expect(dvd.getLocation()).andReturn(PATH_TO_DVD).once();
-
-      expect(vm.getName()).andReturn(VM_NAME).anyTimes();
-      expect(vm.getId()).andReturn(VM_ID).anyTimes();
-      expect(vm.getOSTypeId()).andReturn(OS_TYPE_ID).anyTimes();
-      expect(vm.getMemorySize()).andReturn(MEMORY_SIZE).anyTimes();
-
-      replay(vbm, iStorageController, iMediumAttachment, hd, dvd, vm);
-
-      VmSpec vmSpec = new IMachineToVmSpec().apply(vm);
-
-      assertEquals(vmSpec.getVmName(), VM_NAME);
-      assertEquals(vmSpec.getVmId(), VM_ID);
-      assertEquals(vmSpec.getMemory(), MEMORY_SIZE);
-      for (StorageController controller : vmSpec.getControllers()) {
-         assertEquals(controller.getName(), CONTROLLER_NAME);
-         assertEquals(controller.getBus(), CONTROLLER_BUS);
-         for (HardDisk hardDisk : controller.getHardDisks()) {
-            assertEquals(hardDisk.getDiskPath(), PATH_TO_HD);
-         }
-         for (IsoImage iso : controller.getIsoImages()) {
-            assertEquals(iso.getSourcePath(), PATH_TO_DVD);
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunningTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunningTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunningTest.java
deleted file mode 100644
index 456a3af..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/LaunchMachineIfNotAlreadyRunningTest.java
+++ /dev/null
@@ -1,68 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.jclouds.virtualbox.domain.ExecutionType;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-@Test(groups = "unit", testName = "LaunchMachineIfNotAlreadyRunningTest")
-public class LaunchMachineIfNotAlreadyRunningTest {
-
-   @Test
-   public void testDoNotLaunchIfAlreadyRunning() throws Exception {
-
-   }
-
-   // VirtualBox error: The given session is busy (0x80BB0007)
-   // VirtualBox error: The machine
-   // 'jclouds-image-virtualbox-iso-to-machine-test' is not registered
-   // (0x8000FFFF)
-
-   @Test
-   public void testLaunchIfNotStarted() throws Exception {
-
-      final String type = "gui";
-      final String environment = "";
-      ISession session = createMock(ISession.class);
-      VirtualBoxManager manager = createMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IProgress progress = createMock(IProgress.class);
-
-      expect(manager.getSessionObject()).andReturn(session).anyTimes();
-      expect(machine.launchVMProcess(session, type, environment)).andReturn(progress);
-      progress.waitForCompletion(-1);
-      expect(session.getState()).andReturn(SessionState.Locked);
-      session.unlockMachine();
-
-      replay(manager, machine, session, progress);
-
-      new LaunchMachineIfNotAlreadyRunning(manager, ExecutionType.GUI, "").apply(machine);
-
-      verify(manager, machine, session, progress);
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/MacAddressToBSDTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/MacAddressToBSDTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/MacAddressToBSDTest.java
deleted file mode 100644
index 66a70cf..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/MacAddressToBSDTest.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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
-
-@Test(groups = "unit", testName = "MacAddressToBSDTest")
-public class MacAddressToBSDTest {
-
-   private static final String vboxMacAddressFormat = "0800271A9806";
-   private static final String bsdMacAddressFormat = "8:0:27:1a:98:6";
-
-
-@Test
-  public void testTransformMacAddressToBSDFormat() {
-     assertEquals(MacAddressToBSD.INSTANCE.apply(Joiner.on(":").join(Splitter.fixedLength(2).split(vboxMacAddressFormat)).toLowerCase()), bsdMacAddressFormat);
-  }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfacesExpectTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfacesExpectTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfacesExpectTest.java
deleted file mode 100644
index d23407e..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/RetrieveActiveBridgedInterfacesExpectTest.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.virtualbox.functions;
-
-import static org.jclouds.virtualbox.functions.RetrieveActiveBridgedInterfaces.retrieveBridgedInterfaceNames;
-import static org.testng.Assert.assertEquals;
-
-import java.util.List;
-
-import org.jclouds.virtualbox.domain.BridgedIf;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(singleThreaded = true, testName = "RetrieveActiveBridgedInterfacesExpectTest")
-public class RetrieveActiveBridgedInterfacesExpectTest {
-
-   public static final String TEST1 = "Name:            eth0\n"
-            + "GUID:            30687465-0000-4000-8000-00261834d0cb\n" + "Dhcp:            Disabled\n"
-            + "IPAddress:       209.x.x.x\n" + "NetworkMask:     255.255.255.0\n"
-            + "IPV6Address:     fe80:0000:0000:0000:0226:18ff:fe34:d0cb\n" + "IPV6NetworkMaskPrefixLength: 64\n"
-            + "HardwareAddress: 00:26:18:34:d0:cb\n" + "MediumType:      Ethernet\n" + "Status:          Up\n"
-            + "VBoxNetworkName: HostInterfaceNetworking-eth0\n" + "\n" + "Name:            vbox0\n"
-            + "GUID:            786f6276-0030-4000-8000-5a3ded993fed\n" + "Dhcp:            Disabled\n"
-            + "IPAddress:       192.168.56.1\n" + "NetworkMask:     255.255.255.0\n"
-            + "IPV6Address: fe80:0000:0000:0000:0226:18ff:fe34:d0cb\n" + "IPV6NetworkMaskPrefixLength: 0\n"
-            + "HardwareAddress: 5a:3d:ed:99:3f:ed\n" + "MediumType:      Ethernet\n" + "Status:          Down\n"
-            + "VBoxNetworkName: HostInterfaceNetworking-vbox0\n";
-
-   public static final List<BridgedIf> expectedBridgedInterfaces = ImmutableList.of(
-            BridgedIf.builder().name("eth0").ip("209.x.x.x").networkMask("255.255.255.0").mediumType("Ethernet")
-            .status("Up").build(), 
-            BridgedIf.builder().name("vbox0").ip("192.168.56.1").networkMask("255.255.255.0").mediumType("Ethernet")
-            .status("Down").build());
-
-   @Test
-   public void retrieveBridgedInterfaceNamesTest() {
-      List<BridgedIf> activeBridgedInterfaces = retrieveBridgedInterfaceNames(TEST1);
-         assertEquals(activeBridgedInterfaces, expectedBridgedInterfaces);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttachedTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttachedTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttachedTest.java
deleted file mode 100644
index 8cc05e8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/TakeSnapshotIfNotAlreadyAttachedTest.java
+++ /dev/null
@@ -1,105 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.jclouds.logging.Logger;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IConsole;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.ISnapshot;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-
-@Test(groups = "unit", testName = "TakeSnapshotIfNotAlreadyAttachedTest")
-public class TakeSnapshotIfNotAlreadyAttachedTest {
-
-   @Test
-   public void testTakeSnapshotIfNotAlreadyAttached() throws Exception {
-
-      String snapshotName = "snap";
-      String snapshotDesc = "snapDesc";
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      ISession session = createMock(ISession.class);
-      IConsole console = createNiceMock(IConsole.class);
-      IProgress progress = createNiceMock(IProgress.class);
-      ISnapshot snapshot = createNiceMock(ISnapshot.class);
-      expect(machine.getCurrentSnapshot()).andReturn(snapshot).anyTimes();
-      expect(machine.getState()).andReturn(MachineState.PoweredOff).anyTimes();
-
-      expect(manager.openMachineSession(machine)).andReturn(session);
-
-      expect(session.getConsole()).andReturn(console);
-      expect(console.takeSnapshot(snapshotName, snapshotDesc)).andReturn(
-            progress);
-      expect(progress.getCompleted()).andReturn(true);
-
-      session.unlockMachine();
-      replay(manager, machine, vBox, session, console, progress);
-
-      new TakeSnapshotIfNotAlreadyAttached(Suppliers.ofInstance(manager), snapshotName, snapshotDesc, Logger.CONSOLE)
-            .apply(machine);
-
-      verify(machine);
-   }
-
-   @Test
-   public void testDoNothingIfAlreadyTakenSnapshot() throws Exception {
-      String snapshotName = "snap";
-      String snapshotDesc = "snapDesc";
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      ISession session = createMock(ISession.class);
-      IConsole console = createNiceMock(IConsole.class);
-
-      IProgress progress = createNiceMock(IProgress.class);
-      expect(progress.getCompleted()).andReturn(true);
-      expect(machine.getCurrentSnapshot()).andReturn(null).anyTimes();
-      expect(manager.openMachineSession(machine)).andReturn(session);
-      expect(machine.getState()).andReturn(MachineState.PoweredOff).anyTimes();
-
-      expect(machine.getName()).andReturn("machine").anyTimes();
-      expect(session.getConsole()).andReturn(console);
-      expect(console.takeSnapshot(snapshotName, snapshotDesc)).andReturn(
-            progress);
-
-      session.unlockMachine();
-      replay(manager, machine, vBox, session, console, progress);
-
-      new TakeSnapshotIfNotAlreadyAttached(Suppliers.ofInstance(manager), snapshotName, snapshotDesc, Logger.CONSOLE)
-            .apply(machine);
-
-      verify(machine);
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java
deleted file mode 100644
index 5b36103..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java
+++ /dev/null
@@ -1,57 +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.virtualbox.functions.admin;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.virtualbox.domain.YamlImage;
-import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-@Test(groups = "unit", testName = "ImageFromYamlStringTest")
-public class ImageFromYamlStringTest {
-
-   public static final Image TEST1 = new ImageBuilder()
-            .id("ubuntu-12.04.1-amd64")
-            .name("ubuntu-12.04.1-server-amd64")
-            .description("ubuntu")
-            .operatingSystem(
-                     OperatingSystem.builder().description("ubuntu").family(OsFamily.UBUNTU).version("12.04.1")
-                              .arch("amd64").build())
-            .status(Image.Status.AVAILABLE).build();
-
-   Map<Image, YamlImage> images;
-
-   @BeforeMethod
-   public void setUp() {
-      images = new ImagesToYamlImagesFromYamlDescriptor(new YamlImagesFromFileConfig("/default-images.yaml")).get();
-   }
-
-   @Test
-   public void testNodesParse() {
-      assertEquals(Iterables.getFirst(images.keySet(), null), TEST1);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunningLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunningLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunningLiveTest.java
deleted file mode 100644
index 524ac88..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunningLiveTest.java
+++ /dev/null
@@ -1,64 +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.virtualbox.functions.admin;
-
-import static org.easymock.EasyMock.createMock;
-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 java.net.URI;
-
-import org.jclouds.compute.callables.RunScriptOnNode;
-import org.jclouds.compute.callables.RunScriptOnNode.Factory;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.virtualbox.functions.HardcodedHostToHostNodeMetadata;
-import org.jclouds.virtualbox.predicates.RetryIfSocketNotYetOpen;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Suppliers;
-import com.google.common.net.HostAndPort;
-
-@Test(groups = "live", singleThreaded = true, testName = "StartVBoxIfNotAlreadyRunningLiveTest")
-public class StartVBoxIfNotAlreadyRunningLiveTest {
-
-   @SuppressWarnings({ "unchecked", "rawtypes" })
-   @Test
-   public void testStartVboxConnectsToManagerWhenPortAlreadyListening() throws Exception {
-      VirtualBoxManager manager = createMock(VirtualBoxManager.class);
-      Factory runScriptOnNodeFactory = createMock(Factory.class);
-      RunScriptOnNode runScriptOnNode = createMock(RunScriptOnNode.class);
-      RetryIfSocketNotYetOpen client = createMock(RetryIfSocketNotYetOpen.class);
-      HardcodedHostToHostNodeMetadata hardcodedHostToHostNodeMetadata = createMock(HardcodedHostToHostNodeMetadata.class);
-      NodeMetadata host = new NodeMetadataBuilder().id("host").status(Status.RUNNING).build();
-      URI provider = URI.create("http://localhost:18083/");
-      expect(client.seconds(3)).andReturn(client);
-      expect(client.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))).andReturn(true).anyTimes();
-      manager.connect(provider.toASCIIString(), "", "");
-      expectLastCall().anyTimes();
-      replay(manager, runScriptOnNodeFactory, runScriptOnNode, client);
-      new StartVBoxIfNotAlreadyRunning((Function) Functions.constant(manager), runScriptOnNodeFactory, client,
-               Suppliers.ofInstance(host), Suppliers.ofInstance(provider), hardcodedHostToHostNodeMetadata).start();
-      verify(manager, runScriptOnNodeFactory, client);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java
deleted file mode 100644
index e62d108..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java
+++ /dev/null
@@ -1,81 +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.virtualbox.functions.admin;
-
-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 java.util.Collections;
-import java.util.List;
-
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.collect.Lists;
-
-@Test(groups = "unit", testName = "UnregisterMachineIfExistsTest")
-public class UnregisterMachineIfExistsAndDeleteItsMediaTest {
-
-   private String ideControllerName = "IDE Controller";
-   private CleanupMode mode = CleanupMode.Full;
-   private String vmName = "jclouds-image-example-machine-to-be-destroyed";
-   private String vmId = "jclouds-image-iso-unregister";
-   private String osTypeId = "";
-
-   @Test
-   public void testUnregisterExistingMachine() throws Exception {
-      VirtualBoxManager manager = createMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMachine registeredMachine = createMock(IMachine.class);
-      IProgress progress = createNiceMock(IProgress.class);
-      List<IMedium> media = Lists.newArrayList();
-      List<IMedium> mediums = Collections.unmodifiableList(media);
-
-      StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
-            .attachISO(0, 0, "/tmp/ubuntu-11.04-server-i386.iso")
-            .attachHardDisk(HardDisk.builder().diskpath("/tmp/testadmin.vdi").controllerPort(0).deviceSlot(1).build())
-            .attachISO(1, 1, "/tmp/VBoxGuestAdditions_4.1.2.iso").build();
-      VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).osTypeId(osTypeId)
-            .controller(ideController).forceOverwrite(true).cleanUpMode(CleanupMode.Full).build();
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.findMachine(vmName)).andReturn(registeredMachine);
-
-      expect(registeredMachine.unregister(mode)).andReturn(mediums);
-      expectLastCall().anyTimes();
-
-      expect(registeredMachine.delete(mediums)).andReturn(progress);
-      expectLastCall().anyTimes();
-
-      replay(manager, vBox, registeredMachine, progress);
-
-      new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpecification).apply(registeredMachine);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java
deleted file mode 100644
index 92b4bf1..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java
+++ /dev/null
@@ -1,136 +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.virtualbox.predicates;
-
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-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.CreateAndInstallVm;
-import org.jclouds.virtualbox.functions.IMachineToSshClient;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "GuestAdditionsInstallerLiveTest")
-public class GuestAdditionsInstallerLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private Injector injector;
-   private Function<IMachine, SshClient> sshClientForIMachine;
-   private Predicate<SshClient> sshResponds;
-   private VmSpec instanceVmSpec;
-   private NetworkSpec instanceNetworkSpec;
-   
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      injector = view.utils().injector();
-
-      String instanceName = VIRTUALBOX_IMAGE_PREFIX
-               + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController
-               .builder()
-               .name("IDE Controller")
-               .bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(
-                        HardDisk.builder().diskpath(adminDisk(instanceName)).controllerPort(0).deviceSlot(1)
-                                 .autoDelete(true).build()).attachISO(1, 1, guestAdditionsIso).build();
-
-      instanceVmSpec = VmSpec.builder().id(instanceName).name(instanceName).osTypeId("").memoryMB(512)
-               .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder()
-            .networkAttachmentType(NetworkAttachmentType.HostOnly)
-             .build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-            .addHostInterfaceName("vboxnet0").slot(0L).build();
-
-      instanceNetworkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-   }
-
-   @Test
-   public void testGuestAdditionsAreInstalled() throws Exception {
-      IMachine machine = null;
-      try {
-         machine = cloneFromMaster();
-         machineController.ensureMachineIsLaunched(machine.getName());
-         sshClientForIMachine = injector.getInstance(IMachineToSshClient.class);
-         SshClient client = sshClientForIMachine.apply(machine);
-
-         sshResponds = injector.getInstance(SshResponds.class);
-         checkState(sshResponds.apply(client), "timed out waiting for guest %s to be accessible via ssh",
-                  machine.getName());
-         
-         assertTrue(NetworkUtils.isIpv4(networkUtils.getIpAddressFromNicSlot(machine.getName(), 0l)));
-
-      } finally {
-         if (machine != null) {
-            for (String vmNameOrId : ImmutableSet.of(machine.getName())) {
-               machineController.ensureMachineHasPowerDown(vmNameOrId);
-               undoVm(vmNameOrId);
-            }
-         }
-      }
-   }
-
-   protected IMachine cloneFromMaster() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder()
-            .vm(instanceVmSpec)
-            .network(instanceNetworkSpec)
-            .master(source)
-            .linked(true)
-            .build();
-      return new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-               .apply(cloneSpec);
-   }
-
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         // already created
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java
deleted file mode 100644
index 077360e..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java
+++ /dev/null
@@ -1,117 +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.virtualbox.predicates;
-
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.jclouds.virtualbox.predicates.IMachinePredicates.isLinkedClone;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-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.CreateAndInstallVm;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "IMachinePredicatesLiveTest")
-public class IMachinePredicatesLiveTest extends BaseVirtualBoxClientLiveTest {
-   
-   private MasterSpec machineSpec;
-   private String instanceName;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-               + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController
-               .builder()
-               .name("IDE Controller")
-               .bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(
-                        HardDisk.builder().diskpath(adminDisk(instanceName)).controllerPort(0).deviceSlot(1)
-                                 .autoDelete(true).build()).attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec instanceVmSpec = VmSpec.builder().id(instanceName).name(instanceName).osTypeId("").memoryMB(512)
-               .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      Injector injector = view.utils().injector();
-      IsoSpec isoSpec = IsoSpec
-               .builder()
-               .sourcePath(operatingSystemIso)
-               .installationScript(keystrokeSequence).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
-               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-               .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-      machineSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();
-
-   }
-   
-   @Test
-   public void testCloneMachineFromAnotherMachine() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
-               .master(source).linked(true).build();
-      IMachine clone = new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-               .apply(cloneSpec);
-      assertTrue(isLinkedClone().apply(clone));
-   }
-
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         // already created
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-   
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      for (String vmName : ImmutableSet.of(instanceName)) {
-         undoVm(vmName);
-      }
-      super.tearDownContext();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpenTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpenTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpenTest.java
deleted file mode 100644
index a041913..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpenTest.java
+++ /dev/null
@@ -1,83 +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.virtualbox.predicates;
-
-import static org.jclouds.compute.predicates.SocketOpenPredicates.alwaysFail;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
-import org.jclouds.logging.Logger;
-import org.testng.annotations.Test;
-
-import com.google.common.net.HostAndPort;
-
-
-/**
- * Tests timeout behavior of {@link RetryIfSocketNotYetOpen} predicate.
- */
-public class RetryIfSocketNotYetOpenTest {
-
-    private static final Logger logger = Logger.NULL;
-    private static final HostAndPort socket = HostAndPort.fromParts("dummy", 0);
-    
-    @Test
-    public void fromConstructor() {
-        RetryIfSocketNotYetOpen fromSeconds = new RetryIfSocketNotYetOpen(alwaysFail, logger, 2000, TimeUnit.MILLISECONDS);
-        doAsserts(fromSeconds, socket, false, 2000, 3000);
-    }
-    
-    @Test
-    public void fromSeconds() {
-        RetryIfSocketNotYetOpen fromSeconds = new RetryIfSocketNotYetOpen(alwaysFail, logger).seconds(2);
-        doAsserts(fromSeconds, socket, false, 2000, 3000);
-    }
-
-    @Test
-    public void fromMilliseconds() {
-        RetryIfSocketNotYetOpen fromMilliseconds = new RetryIfSocketNotYetOpen(alwaysFail, logger).milliseconds(2000);
-        doAsserts(fromMilliseconds, socket, false, 2000, 3000);
-    }
-
-    @Test
-    public void fromTimeouts() {
-        Timeouts timeouts = new Timeouts() { { portOpen = 2 * 1000; } };
-        RetryIfSocketNotYetOpen fromTimeouts = new RetryIfSocketNotYetOpen(alwaysFail, timeouts);
-        doAsserts(fromTimeouts, socket, false, 2000, 3000);
-    }
-
-    @Test
-    public void timeoutUnset() {
-        // With no timeout specified, predicate should return immediately.
-        RetryIfSocketNotYetOpen uninitialised = new RetryIfSocketNotYetOpen(alwaysFail, logger);
-        doAsserts(uninitialised, socket, false, 0, 500);
-    }
-
-    private void doAsserts(RetryIfSocketNotYetOpen predicate, HostAndPort socket, boolean expectedResult, long minMilliseconds, long maxMilliseconds) {
-        long startTime = System.currentTimeMillis();
-        boolean result = predicate.apply(socket);
-        long elapsedTime = System.currentTimeMillis() - startTime;
-        
-        assertEquals(result, expectedResult);
-        assertTrue(elapsedTime >= minMilliseconds && elapsedTime < maxMilliseconds,
-                "apply() returned after ~" + elapsedTime + "ms, expected it to take between " +
-                minMilliseconds + " and " + maxMilliseconds);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsLiveTest.java
deleted file mode 100644
index f888a45..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsLiveTest.java
+++ /dev/null
@@ -1,60 +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.virtualbox.statements;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.StorageBus;
-
-@Test(testName = "InstallGuestAdditionsLiveTest", groups = "live", singleThreaded = true)
-public class InstallGuestAdditionsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   public void testIsoPresent() {
-      StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
-               .attachISO(1, 0, "VBoxGuestAdditions_").build();
-
-      VmSpec vmSpecification = VmSpec.builder().id("").name("").memoryMB(512).osTypeId("").controller(ideController)
-               .forceOverwrite(true).cleanUpMode(CleanupMode.Full).build();
-
-      InstallGuestAdditions installer = new InstallGuestAdditions(vmSpecification, "4.1.8");
-      String scripts = installer.render(OsFamily.UNIX);
-      assertEquals(scripts, "installModuleAssistantIfNeeded || return 1\n" + "mount -t iso9660 /dev/cdrom1 /mnt\n"
-            + "/mnt/VBoxLinuxAdditions.run --nox11\n");
-   }
-   
-   public void testIsoNotPresent() {
-      StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE).build();
-
-      VmSpec vmSpecification = VmSpec.builder().id("").name("").memoryMB(512).osTypeId("").controller(ideController)
-               .forceOverwrite(true).cleanUpMode(CleanupMode.Full).build();
-
-      InstallGuestAdditions installer = new InstallGuestAdditions(vmSpecification, "4.1.8");
-      String scripts = installer.render(OsFamily.UNIX);
-      assertEquals(scripts,
-               "installModuleAssistantIfNeeded || return 1\n"
-                        + "setupPublicCurl || return 1\n"
-                        + "(mkdir -p /tmp/ && cd /tmp/ && [ ! -f VBoxGuestAdditions_4.1.8.iso ] && curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -C - -X GET  http://download.virtualbox.org/virtualbox/4.1.8/VBoxGuestAdditions_4.1.8.iso >VBoxGuestAdditions_4.1.8.iso)\n"
-                        + "mount -o loop /tmp/VBoxGuestAdditions_4.1.8.iso /mnt\n"
-                        + "/mnt/VBoxLinuxAdditions.run --nox11\n");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsTest.java
deleted file mode 100644
index 62a97c4..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/InstallGuestAdditionsTest.java
+++ /dev/null
@@ -1,76 +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.virtualbox.statements;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.StorageBus;
-
-public class InstallGuestAdditionsTest {
-   
-   private static final String VBOX_VERISION = "4.2.0";
-
-   @Test
-   public void testInstallGAWhenIsoIsPresent() {
-      StorageController ideController = StorageController.builder()
-            .name("IDE Controller")
-            .bus(StorageBus.IDE)
-            .attachISO(1, 0, "VBoxGuestAdditions_")
-            .build();
-      VmSpec vmSpec = VmSpec.builder()
-            .id("").name("")
-            .memoryMB(512)
-            .osTypeId("")
-            .controller(ideController)
-            .forceOverwrite(true)
-            .cleanUpMode(CleanupMode.Full)
-            .build();
-      InstallGuestAdditions installGuestAdditions = new InstallGuestAdditions(vmSpec , VBOX_VERISION);
-      assertEquals(installGuestAdditions.render(OsFamily.UNIX), 
-            "installModuleAssistantIfNeeded || return 1\n" +
-             "mount -t iso9660 /dev/cdrom1 /mnt\n" +
-             "/mnt/VBoxLinuxAdditions.run --nox11\n");
-   }
-   
-   @Test
-   public void testInstallGAWhenIsoIsNotPresent() {
-      StorageController ideController = StorageController.builder()
-            .name("IDE Controller")
-            .bus(StorageBus.IDE)
-            .build();
-      VmSpec vmSpec = VmSpec.builder()
-            .id("").name("")
-            .memoryMB(512)
-            .osTypeId("")
-            .controller(ideController)
-            .forceOverwrite(true)
-            .cleanUpMode(CleanupMode.Full)
-            .build();
-      InstallGuestAdditions installGuestAdditions = new InstallGuestAdditions(vmSpec , VBOX_VERISION);
-      assertEquals(installGuestAdditions.render(OsFamily.UNIX), 
-            "installModuleAssistantIfNeeded || return 1\n" +
-            "setupPublicCurl || return 1\n" +
-            "(mkdir -p /tmp/ && cd /tmp/ && [ ! -f VBoxGuestAdditions_4.2.0.iso ] && curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -C - -X GET  http://download.virtualbox.org/virtualbox/4.2.0/VBoxGuestAdditions_4.2.0.iso >VBoxGuestAdditions_4.2.0.iso)\n" +
-            "mount -o loop /tmp/VBoxGuestAdditions_4.2.0.iso /mnt\n" +
-            "/mnt/VBoxLinuxAdditions.run --nox11\n");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/statements/PasswordlessTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/PasswordlessTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/statements/PasswordlessTest.java
deleted file mode 100644
index 430dbe9..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/PasswordlessTest.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.virtualbox.statements;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.testng.annotations.Test;
-
-public class PasswordlessTest {
-   
-
-   @Test
-   public void testApplyPasswordlessSudo() {
-      PasswordlessSudo passwordlessSudo = new PasswordlessSudo("barack");
-      assertEquals(passwordlessSudo.render(OsFamily.UNIX), 
-            "touch /etc/sudoers.d/passwordless && echo \"barack ALL = NOPASSWD: ALL\" > /etc/sudoers.d/passwordless && chmod 0440 /etc/sudoers.d/passwordless");
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/statements/SetIpAddressTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/SetIpAddressTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/statements/SetIpAddressTest.java
deleted file mode 100644
index d4be94a..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/statements/SetIpAddressTest.java
+++ /dev/null
@@ -1,64 +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.virtualbox.statements;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.NetworkAttachmentType;
-
-public class SetIpAddressTest {
-
-   @Test
-   public void testSetIpeth0() {
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-               .builder()
-               .slot(0L)
-               .addNetworkAdapter(
-                        NetworkAdapter.builder().staticIp("127.0.0.1").networkAttachmentType(NetworkAttachmentType.NAT)
-                                 .build()).build();
-      SetIpAddress setIpAddressStmtm = new SetIpAddress(networkInterfaceCard);
-      assertEquals("ifconfig eth0 127.0.0.1;", setIpAddressStmtm.render(OsFamily.UNIX));
-   }
-   
-   @Test
-   public void testSetIpeth3() {
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-               .builder()
-               .slot(3L)
-               .addNetworkAdapter(
-                        NetworkAdapter.builder().staticIp("localhost").networkAttachmentType(NetworkAttachmentType.NAT)
-                                 .build()).build();
-      SetIpAddress setIpAddressStmtm = new SetIpAddress(networkInterfaceCard);
-      assertEquals("ifconfig eth3 localhost;", setIpAddressStmtm.render(OsFamily.UNIX));
-   }
-   
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testThrowsIllegalArgumentExceptionOnWrongSlot() {
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-               .builder()
-               .slot(4L)
-               .addNetworkAdapter(
-                        NetworkAdapter.builder().staticIp("localhost").networkAttachmentType(NetworkAttachmentType.NAT)
-                                 .build()).build();
-      new SetIpAddress(networkInterfaceCard);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java
deleted file mode 100644
index 8624e72..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java
+++ /dev/null
@@ -1,125 +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.virtualbox.util;
-
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.assertEquals;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-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.CreateAndInstallVm;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-
-@Test(groups = "live", testName = "MachineControllerLiveTest")
-public class MachineControllerLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private MasterSpec masterSpec;
-   private String instanceName;
-   private IMachine clonedMachine;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-            + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController
-            .builder()
-            .name("IDE Controller")
-            .bus(StorageBus.IDE)
-            .attachISO(0, 0, operatingSystemIso)
-            .attachHardDisk(
-                  HardDisk.builder().diskpath(adminDisk(instanceName)).controllerPort(0).deviceSlot(1).autoDelete(true)
-                        .build()).attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec instanceVmSpec = VmSpec.builder().id(instanceName).name(instanceName).osTypeId("").memoryMB(512)
-            .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      IsoSpec isoSpec = IsoSpec
-            .builder()
-            .sourcePath(operatingSystemIso)
-            .installationScript(keystrokeSequence).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.HostOnly)
-            .build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-            .addHostInterfaceName("vboxnet0").slot(0L).build();
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-      masterSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();
-      clonedMachine = cloneFromMaster();
-   }
-
-   @Test
-   public void testEnsureMachineisLaunchedAndSessionIsUnlocked() {
-      ISession cloneMachineSession = machineController.ensureMachineIsLaunched(clonedMachine.getName());
-      assertTrue(cloneMachineSession.getState() == SessionState.Unlocked);
-      cloneMachineSession = machineController.ensureMachineHasPowerDown(clonedMachine.getName());
-      SessionState state = cloneMachineSession.getState();
-      assertEquals(SessionState.Unlocked, state);
-   }
-
-   private IMachine cloneFromMaster() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(masterSpec.getVmSpec()).network(masterSpec.getNetworkSpec())
-            .master(source).linked(true).build();
-      return new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-            .apply(cloneSpec);
-   }
-
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         // already created
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      for (String vmName : ImmutableSet.of(instanceName)) {
-         undoVm(vmName);
-      }
-      super.tearDownContext();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java
deleted file mode 100644
index ff0ea3e..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java
+++ /dev/null
@@ -1,181 +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.virtualbox.util;
-
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.AssertJUnit.assertEquals;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-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.CreateAndInstallVm;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Function;
-import com.google.inject.Injector;
-
-@Test(groups = "live", testName = "MachineControllerLiveTest")
-public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private MasterSpec machineSpec;
-   private String instanceName;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-            + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController
-            .builder()
-            .name("IDE Controller")
-            .bus(StorageBus.IDE)
-            .attachISO(0, 0, operatingSystemIso)
-            .attachHardDisk(
-                  HardDisk.builder().diskpath(adminDisk(instanceName)).controllerPort(0).deviceSlot(1).autoDelete(true)
-                        .build()).attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec instanceVmSpec = VmSpec.builder().id(instanceName).name(instanceName).osTypeId("").memoryMB(512)
-            .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      IsoSpec isoSpec = IsoSpec
-            .builder()
-            .sourcePath(operatingSystemIso)
-            .installationScript(keystrokeSequence).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
-            .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-            .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-      machineSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();
-   }
-
-   @Test(description = "write lock is acquired and released correctly")
-   public void writeLockSessionOnMachine() {
-      final IMachine clone = cloneFromMaster();
-      ISession session = machineUtils.writeLockMachineAndApplyToSession(clone.getName(),
-            new Function<ISession, ISession>() {
-               @Override
-               public ISession apply(ISession session) {
-                  assertEquals(session.getMachine().getName(), clone.getName());
-                  return session;
-               }
-            });
-      checkState(session.getState().equals(SessionState.Unlocked));
-      undoVm(clone.getName());
-   }
-
-   @Test(dependsOnMethods = "writeLockSessionOnMachine", description = "shared lock is acquired and released correctly")
-   public void sharedLockSessionOnMachine() {
-      final IMachine clone = cloneFromMaster();
-      ISession session = machineUtils.sharedLockMachineAndApplyToSession(clone.getName(),
-            new Function<ISession, ISession>() {
-               @Override
-               public ISession apply(ISession session) {
-                  assertEquals(session.getMachine().getName(), clone.getName());
-                  return session;
-               }
-            });
-      checkState(session.getState().equals(SessionState.Unlocked));
-      undoVm(clone.getName());
-   }
-
-   @Test(dependsOnMethods = "sharedLockSessionOnMachine", description = "shared lock can be acquired after a write lock")
-   public void sharedLockCanBeAcquiredAfterWriteLockSessionOnMachine() {
-      final IMachine clone = cloneFromMaster();
-      try {
-         ISession writeSession = machineUtils.writeLockMachineAndApplyToSession(clone.getName(),
-               new Function<ISession, ISession>() {
-                  @Override
-                  public ISession apply(ISession writeSession) {
-                     checkState(writeSession.getState().equals(SessionState.Locked));
-                     return writeSession;
-                  }
-               });
-         checkState(writeSession.getState().equals(SessionState.Unlocked));
-      } finally {
-         undoVm(clone.getName());
-      }
-   }
-
-   @Test(dependsOnMethods = "sharedLockCanBeAcquiredAfterWriteLockSessionOnMachine", description = "write lock cannot be acquired after a shared lock")
-   public void writeLockCannotBeAcquiredAfterSharedLockSessionOnMachine() {
-      final IMachine clone = cloneFromMaster();
-      try {
-         ISession sharedSession = machineUtils.sharedLockMachineAndApplyToSession(clone.getName(),
-               new Function<ISession, ISession>() {
-                  @Override
-                  public ISession apply(ISession sharedSession) {
-                     checkState(sharedSession.getState().equals(SessionState.Locked));
-                     return sharedSession;
-                  }
-               });
-         checkState(sharedSession.getState().equals(SessionState.Unlocked));
-         ISession writeSession = machineUtils.writeLockMachineAndApplyToSession(clone.getName(),
-               new Function<ISession, ISession>() {
-                  @Override
-                  public ISession apply(ISession writeSession) {
-                     checkState(writeSession.getState().equals(SessionState.Locked));
-                     assertEquals(writeSession.getMachine().getName(), clone.getName());
-                     return writeSession;
-                  }
-               });
-         checkState(writeSession.getState().equals(SessionState.Unlocked));
-      } finally {
-         undoVm(clone.getName());
-      }
-   }
-
-   private IMachine cloneFromMaster() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
-            .master(source).linked(true).build();
-      return new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-            .apply(cloneSpec);
-   }
-
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         // already created
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/.gitattributes
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/.gitattributes b/virtualbox/src/test/resources/.gitattributes
deleted file mode 100644
index ba409ff..0000000
--- a/virtualbox/src/test/resources/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-*.sh -crlf

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/default-images.yaml
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/default-images.yaml b/virtualbox/src/test/resources/default-images.yaml
deleted file mode 100644
index aa7fd6a..0000000
--- a/virtualbox/src/test/resources/default-images.yaml
+++ /dev/null
@@ -1,151 +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.
-#
-images:
-    - id: ubuntu-12.04.1-amd64
-      name: ubuntu-12.04.1-server-amd64
-      description: ubuntu 12.04.1 server (amd64)
-      os_arch: amd64
-      os_family: ubuntu
-      os_description: ubuntu
-      os_version: 12.04.1
-      os_64bit: true
-      iso: http://releases.ubuntu.com/12.04.1/ubuntu-12.04.1-server-amd64.iso
-      iso_md5: a8c667e871f48f3a662f3fbf1c3ddb17
-      username: toor
-      credential: password
-      keystroke_sequence: <Esc><Esc><Enter> /install/vmlinuz noapic preseed/url=PRECONFIGURATION_URL debian-installer=en_US auto locale=en_US kbd-chooser/method=us hostname=HOSTNAME fb=false debconf/frontend=noninteractive console-setup/ask_detect=false keyboard-configuration/layoutcode=us initrd=/install/initrd.gz -- <Enter>
-      preseed_cfg: |
-                      ## Options to set on the command line
-                      d-i debian-installer/locale string en_US.utf8
-                      d-i console-setup/ask_detect boolean false
-                      d-i console-setup/layout string USA
-                      d-i netcfg/get_hostname string unassigned-hostname
-                      d-i netcfg/get_domain string unassigned-domain
-                      # Continue without a default route
-                      # Not working , specify a dummy in the DHCP
-                      #d-i netcfg/no_default_route boolean
-                      d-i time/zone string UTC
-                      d-i clock-setup/utc-auto boolean true
-                      d-i clock-setup/utc boolean true
-                      d-i kbd-chooser/method select American English
-                      d-i netcfg/wireless_wep string
-                      d-i base-installer/kernel/override-image string linux-server
-                      #d-i base-installer/kernel/override-image string linux-image-2.6.32-21-generic
-                      # Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
-                      d-i debconf debconf/frontend select Noninteractive
-                      d-i pkgsel/install-language-support boolean false
-                      tasksel tasksel/first multiselect standard, ubuntu-server
-                      #d-i partman-auto/method string regular
-                      d-i partman-auto/method string lvm
-                      #d-i partman-auto/purge_lvm_from_device boolean true
-                      d-i partman-lvm/confirm boolean true
-                      d-i partman-lvm/device_remove_lvm boolean true
-                      d-i partman-auto/choose_recipe select atomic
-                      d-i partman/confirm_write_new_label boolean true
-                      d-i partman/confirm_nooverwrite boolean true
-                      d-i partman/choose_partition select finish
-                      d-i partman/confirm boolean true
-                      #http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9626883
-                      #Message: "write the changes to disk and configure lvm preseed"
-                      #http://serverfault.com/questions/189328/ubuntu-kickstart-installation-using-lvm-waits-for-input
-                      #preseed partman-lvm/confirm_nooverwrite boolean true
-                      # Write the changes to disks and configure LVM?
-                      d-i partman-lvm/confirm boolean true
-                      d-i partman-lvm/confirm_nooverwrite boolean true
-                      d-i partman-auto-lvm/guided_size string max
-                      ## Default user, we can get away with a recipe to change this
-                      d-i passwd/user-fullname string toor
-                      d-i passwd/username string toor
-                      d-i passwd/user-password password password
-                      d-i passwd/user-password-again password password
-                      d-i user-setup/encrypt-home boolean false
-                      d-i user-setup/allow-password-weak boolean true
-                      ## minimum is ssh and ntp
-                      # Individual additional packages to install
-                      d-i pkgsel/include string openssh-server ntp
-                      # Whether to upgrade packages after debootstrap.
-                      # Allowed values: none, safe-upgrade, full-upgrade
-                      d-i pkgsel/upgrade select full-upgrade
-                      d-i grub-installer/only_debian boolean true
-                      d-i grub-installer/with_other_os boolean true
-                      d-i finish-install/reboot_in_progress note
-                      #For the update
-                      d-i pkgsel/update-policy select none
-                      # debconf-get-selections --install
-                      #Use mirror
-                      #d-i apt-setup/use_mirror boolean true
-                      #d-i mirror/country string manual
-                      #choose-mirror-bin mirror/protocol string http
-                      #choose-mirror-bin mirror/http/hostname string 192.168.4.150
-                      #choose-mirror-bin mirror/http/directory string /ubuntu
-                      #choose-mirror-bin mirror/suite select maverick
-                      #d-i debian-installer/allow_unauthenticated string true
-                      choose-mirror-bin mirror/http/proxy string
-    - id: centos-6.3-amd64
-      name: centos-6.3-amd64
-      description: centos-6.3 (amd64)
-      os_arch: amd64
-      os_family: RedHat
-      os_description: RedHat
-      os_version: 6.3
-      os_64bit: true
-      iso: http://www.mirrorservice.org/sites/mirror.centos.org/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso
-      iso_md5: 087713752fa88c03a5e8471c661ad1a2
-      username: toor
-      credential: password
-      keystroke_sequence: <Tab> <Spacebar> text ks=PRECONFIGURATION_URL <Enter>
-      preseed_cfg: |
-                      ## Options to set on the command line
-                      install
-                      cdrom
-                      lang en_US.UTF-8
-                      keyboard us
-                      network --bootproto=dhcp
-                      rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
-                      firewall --enabled --service=ssh
-                      authconfig --enableshadow --passalgo=sha512
-                      selinux --disabled
-                      timezone UTC
-                      bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
-                      zerombr yes
-
-                      clearpart --all --drives=sda --initlabel
-                      autopart
-                      auth  --useshadow  --enablemd5
-                      #skip answers to the First Boot process
-                      firstboot --disable
-                      #reboot machine
-                      reboot
-
-                      %packages --ignoremissing
-                      @core
-                      %end
-
-                      %post
-                      /usr/bin/yum -y install sudo gcc make kernel kernel-devel openssl-devel perl wget dkms acpid
-                      /etc/init.d/haldaemon stop
-                      /etc/init.d/acpid start
-                      /etc/init.d/haldaemon start
-                      /usr/sbin/groupadd toor
-                      /usr/sbin/useradd toor -g toor -G wheel
-                      echo "password"|passwd --stdin toor
-                      echo "toor        ALL=(ALL)       NOPASSWD: ALL" > /etc/sudoers.d/toor
-                      chmod 0440 /etc/sudoers.d/toor
-                      sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
-                      %end

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/default-keystroke-sequence
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/default-keystroke-sequence b/virtualbox/src/test/resources/default-keystroke-sequence
deleted file mode 100644
index bcfd94b..0000000
--- a/virtualbox/src/test/resources/default-keystroke-sequence
+++ /dev/null
@@ -1,19 +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.
-#
-<Esc><Esc><Enter> /install/vmlinuz noapic preseed/url=PRECONFIGURATION_URL debian-installer=en_US auto locale=en_US kbd-chooser/method=us hostname=hostname fb=false debconf/frontend=noninteractive console-setup/ask_detect=false keyboard-configuration/layoutcode=us " initrd=/install/initrd.gz -- <Enter>

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/resources/logback.xml b/virtualbox/src/test/resources/logback.xml
deleted file mode 100644
index bce8c26..0000000
--- a/virtualbox/src/test/resources/logback.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<configuration scan="false">
-    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
-        <file>target/test-data/jclouds.log</file>
-
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <Pattern>%d %-5p [%c] (%t) %m%n</Pattern>
-        </layout>
-    </appender>
-
-    <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
-        <file>target/test-data/jclouds-wire.log</file>
-
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <Pattern>%d %-5p [%c] (%t) %m%n</Pattern>
-        </layout>
-    </appender>
-
-    <appender name="COMPUTEFILE" class="ch.qos.logback.core.FileAppender">
-        <file>target/test-data/jclouds-compute.log</file>
-
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <Pattern>%d %-5p [%c] (%t) %m%n</Pattern>
-        </layout>
-    </appender>
-    
-    <appender name="SSHFILE" class="ch.qos.logback.core.FileAppender">
-        <file>target/test-data/jclouds-ssh.log</file>
-
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <Pattern>%d %-5p [%c] (%t) %m%n</Pattern>
-        </layout>
-    </appender>
-    
-    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <Pattern>%-4r [%thread] %-5level - %msg%n</Pattern>
-        </encoder>
-    </appender>
-
-    <root>
-        <level value="INFO" />
-        <appender-ref ref="CONSOLE" />
-    </root>
-    
-   <logger name="net.schmizz.sshj">
-        <level value="INFO" />
-        <appender-ref ref="CONSOLE" />
-    </logger>
-
-    <logger name="org.jclouds">
-        <level value="DEBUG" />
-        <appender-ref ref="FILE" />
-    </logger>
-
-    <logger name="jclouds.wire">
-        <level value="DEBUG" />
-        <appender-ref ref="WIREFILE" />
-    </logger>
-
-    <logger name="jclouds.headers">
-        <level value="DEBUG" />
-        <appender-ref ref="WIREFILE" />
-    </logger>
-
-    <logger name="jclouds.compute">
-        <level value="DEBUG" />
-        <appender-ref ref="COMPUTEFILE" />
-    </logger>
-    
-    <logger name="jclouds.ssh">
-        <level value="DEBUG" />
-        <appender-ref ref="SSHFILE" />
-    </logger>
-
-</configuration>


[7/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachine.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachine.java
deleted file mode 100644
index 676f5b6..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachBridgedAdapterToMachine.java
+++ /dev/null
@@ -1,46 +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.virtualbox.functions;
-
-import static org.virtualbox_4_2.NetworkAttachmentType.Bridged;
-
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INetworkAdapter;
-
-import com.google.common.base.Function;
-
-public class AttachBridgedAdapterToMachine implements Function<IMachine, Void> {
-
-  private NetworkInterfaceCard networkInterfaceCard;
-
-
-   public AttachBridgedAdapterToMachine(NetworkInterfaceCard networkInterfaceCard) {
-	      this.networkInterfaceCard = networkInterfaceCard;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      INetworkAdapter iNetworkAdapter = machine.getNetworkAdapter(networkInterfaceCard.getSlot());
-      iNetworkAdapter.setAttachmentType(Bridged);
-      iNetworkAdapter.setMACAddress(networkInterfaceCard.getNetworkAdapter().getMacAddress());
-      iNetworkAdapter.setBridgedInterface(networkInterfaceCard.getHostInterfaceName());
-      iNetworkAdapter.setEnabled(networkInterfaceCard.isEnabled());
-      machine.saveSettings();
-      return null;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachHostOnlyAdapter.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachHostOnlyAdapter.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachHostOnlyAdapter.java
deleted file mode 100644
index b283681..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachHostOnlyAdapter.java
+++ /dev/null
@@ -1,45 +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.virtualbox.functions;
-
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.NetworkAttachmentType;
-
-import com.google.common.base.Function;
-
-public class AttachHostOnlyAdapter implements Function<IMachine, Void> {
-
-   private NetworkInterfaceCard networkInterfaceCard;
-
-   public AttachHostOnlyAdapter(NetworkInterfaceCard networkInterfaceCard) {
-      this.networkInterfaceCard = networkInterfaceCard;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      INetworkAdapter iNetworkAdapter = machine.getNetworkAdapter(networkInterfaceCard.getSlot());
-      iNetworkAdapter.setAttachmentType(NetworkAttachmentType.HostOnly);
-      iNetworkAdapter.setMACAddress(networkInterfaceCard.getNetworkAdapter().getMacAddress());
-      iNetworkAdapter.setHostOnlyInterface(networkInterfaceCard.getHostInterfaceName());
-      iNetworkAdapter.setEnabled(networkInterfaceCard.isEnabled());
-      machine.saveSettings();
-      return null;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttached.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttached.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttached.java
deleted file mode 100644
index a8b6af9..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttached.java
+++ /dev/null
@@ -1,55 +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.virtualbox.functions;
-
-import org.jclouds.virtualbox.domain.DeviceDetails;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.common.base.Function;
-
-public class AttachMediumToMachineIfNotAlreadyAttached implements Function<IMachine, Void> {
-
-   private final DeviceDetails device;
-   private final IMedium medium;
-   private final String controllerName;
-
-   public AttachMediumToMachineIfNotAlreadyAttached(DeviceDetails device, IMedium medium, String controllerName) {
-      this.device = device;
-      this.medium = medium;
-      this.controllerName = controllerName;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      try {
-         machine.attachDevice(controllerName, device.getPort(), device.getDeviceSlot(), device.getDeviceType(), medium);
-         machine.saveSettings();
-      } catch (VBoxException e) {
-         if (!alreadyAttached(e))
-            throw e;
-      }
-      return null;
-   }
-
-   private boolean alreadyAttached(VBoxException e) {
-      System.out.println(medium.getName() + " " + e.getMessage());
-      return e.getMessage().contains("is already attached to port");
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExists.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExists.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExists.java
deleted file mode 100644
index ec5210c..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExists.java
+++ /dev/null
@@ -1,65 +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.virtualbox.functions;
-
-import static org.virtualbox_4_2.NetworkAttachmentType.NAT;
-
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.RedirectRule;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-
-public class AttachNATAdapterToMachineIfNotAlreadyExists implements Function<IMachine, Void> {
-
-   private NetworkInterfaceCard networkInterfaceCard;
-
-   public AttachNATAdapterToMachineIfNotAlreadyExists(NetworkInterfaceCard networkInterfaceCard) {
-      this.networkInterfaceCard = networkInterfaceCard;
-   }
-
-   @Override
-   public Void apply(IMachine machine) {
-      INetworkAdapter iNetworkAdapter = machine.getNetworkAdapter(networkInterfaceCard.getSlot());
-      // clean up previously set rules
-      for (String redirectRule : iNetworkAdapter.getNATEngine().getRedirects()) {
-         String redirectRuleName = Iterables.getFirst(Splitter.on(",").split(redirectRule), null);
-         if (redirectRuleName != null) {
-            iNetworkAdapter.getNATEngine().removeRedirect(redirectRuleName);
-         }
-      }
-      iNetworkAdapter.setAttachmentType(NAT);
-      for (RedirectRule rule : networkInterfaceCard.getNetworkAdapter().getRedirectRules()) {
-         try {
-            String ruleName = String.format("%s@%s:%s->%s:%s", rule.getProtocol(), rule.getHost(), rule.getHostPort(), 
-                     rule.getGuest(), rule.getGuestPort());
-            iNetworkAdapter.getNATEngine().addRedirect(ruleName, rule.getProtocol(), rule.getHost(), rule.getHostPort(),
-                     rule.getGuest(), rule.getGuestPort());
-         } catch (VBoxException e) {
-            if (!e.getMessage().contains("already exists"))
-               throw e;
-         }
-      }
-      iNetworkAdapter.setEnabled(networkInterfaceCard.isEnabled());
-      machine.saveSettings();
-      return null;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNicToMachine.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNicToMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNicToMachine.java
deleted file mode 100644
index 04f2a87..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/AttachNicToMachine.java
+++ /dev/null
@@ -1,60 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.virtualbox_4_2.NetworkAttachmentType;
-
-import com.google.common.base.Function;
-
-public class AttachNicToMachine implements Function<NetworkInterfaceCard, Void> {
-
-   private final String vmName;
-   private final MachineUtils machineUtils;
-
-   public AttachNicToMachine(String vmName, MachineUtils machineUtils) {
-      this.vmName = checkNotNull(vmName, "vmName can't be null");
-      this.machineUtils = checkNotNull(machineUtils, "machineUtils can't be null");
-   }
-
-   @Override
-   public Void apply(NetworkInterfaceCard nic) {
-      if (hasNatAdapter(nic)) {
-         return machineUtils.writeLockMachineAndApply(vmName, new AttachNATAdapterToMachineIfNotAlreadyExists(nic));
-      } else if (hasBridgedAdapter(nic)) {
-         return machineUtils.writeLockMachineAndApply(vmName, new AttachBridgedAdapterToMachine(nic));
-      } else if (hasHostOnlyAdapter(nic)) {
-         return machineUtils.writeLockMachineAndApply(vmName, new AttachHostOnlyAdapter(nic));
-      } else
-         return null;
-   }
-
-   private boolean hasNatAdapter(NetworkInterfaceCard nic) {
-      return nic.getNetworkAdapter().getNetworkAttachmentType().equals(NetworkAttachmentType.NAT);
-   }
-
-   private boolean hasBridgedAdapter(NetworkInterfaceCard nic) {
-      return nic.getNetworkAdapter().getNetworkAttachmentType().equals(NetworkAttachmentType.Bridged);
-   }
-
-   private boolean hasHostOnlyAdapter(NetworkInterfaceCard nic) {
-      return nic.getNetworkAdapter().getNetworkAttachmentType().equals(NetworkAttachmentType.HostOnly);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIf.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIf.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIf.java
deleted file mode 100644
index 0934797..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIf.java
+++ /dev/null
@@ -1,97 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.virtualbox.domain.BridgedIf;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class BridgedIfStringToBridgedIf implements Function<String, BridgedIf> {
-
-	private static final String BRIDGED_IF_STATUS = "Status";
-	private static final String BRIDGED_IF_MEDIUM_TYPE = "MediumType";
-	private static final String BRIDGED_IF_NETWORK_MASK = "NetworkMask";
-	private static final String BRIDGED_IF_IP_ADDRESS = "IPAddress";
-	private static final String BRIDGED_IF_GUID = "GUID";
-	private static final String BRIDGED_IF_NAME = "Name";
-
-	@Inject
-	public BridgedIfStringToBridgedIf() {
-	}
-
-	@Override
-	public BridgedIf apply(String rawBridgedIf) {
-		checkNotNull(rawBridgedIf, "bridged interface can't be null");
-
-		String transformedBridgedIf = transformRawBridgedIf(rawBridgedIf);
-		Map<String, String> bridgedIfMap = Splitter.on("\n")
-				.omitEmptyStrings().withKeyValueSeparator("=")
-				.split(transformedBridgedIf);
-
-		return BridgedIf
-				.builder()
-				.name(getValueFromMap(bridgedIfMap, BRIDGED_IF_NAME))
-				.guid(getValueFromMap(bridgedIfMap, BRIDGED_IF_GUID))
-				.ip(getValueFromMap(bridgedIfMap, BRIDGED_IF_IP_ADDRESS))
-				.networkMask(getValueFromMap(bridgedIfMap, BRIDGED_IF_NETWORK_MASK))
-				.mediumType(getValueFromMap(bridgedIfMap, BRIDGED_IF_MEDIUM_TYPE))
-				.status(getValueFromMap(bridgedIfMap, BRIDGED_IF_STATUS))
-				.build();
-	}
-
-	private String getValueFromMap(Map<String, String> map, String key) {
-		return map.get(key).trim();
-	}
-
-	/**
-	 * This is an helper to simplify the split step of the raw bridgedIf
-	 * Substitute first ':' with '='
-	 * 
-	 * @param rawBridgedIf
-	 * @return
-	 */
-	private String transformRawBridgedIf(String rawBridgedIf) {
-		Iterable<String> transformedLines = Iterables.transform(
-				Splitter.on("\n").split(rawBridgedIf),
-				new Function<String, String>() {
-
-					@Override
-					public String apply(String line) {
-						return line.replaceFirst(":", "=");
-					}
-
-				});
-
-		StringBuilder stringBuilder = new StringBuilder();
-
-		for (String line : transformedLines) {
-			stringBuilder.append(line + "\n");
-		}
-		return stringBuilder.toString();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java
deleted file mode 100644
index 1168382..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java
+++ /dev/null
@@ -1,133 +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.virtualbox.functions;
-
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_PASSWORD;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.virtualbox_4_2.CloneMode;
-import org.virtualbox_4_2.CloneOptions;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISnapshot;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-/**
- * CloneAndRegisterMachineFromIMachineIfNotAlreadyExists will take care of the followings: - cloning
- * the master - register the clone machine.
- */
-public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements Function<CloneSpec, IMachine> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final String workingDir;
-   private final MachineUtils machineUtils;
-   
-   @Inject
-   public CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(Supplier<VirtualBoxManager> manager,
-            @Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR) String workingDir, MachineUtils machineUtils) {
-      this.manager = manager;
-      this.workingDir = workingDir;
-      this.machineUtils = machineUtils;
-   }
-
-   @Override
-   public IMachine apply(CloneSpec cloneSpec) {
-      VmSpec vmSpec = cloneSpec.getVmSpec();
-      try {
-         manager.get().getVBox().findMachine(vmSpec.getVmName());
-         throw new IllegalStateException("Machine " + vmSpec.getVmName() + " is already registered.");
-      } catch (VBoxException e) {
-         if (machineNotFoundException(e))
-            return cloneMachine(cloneSpec);
-         else
-            throw e;
-      }
-   }
-
-   private boolean machineNotFoundException(VBoxException e) {
-      return e.getMessage().contains("VirtualBox error: Could not find a registered machine named ")
-               || e.getMessage().contains("Could not find a registered machine with UUID {");
-   }
-
-   private IMachine cloneMachine(CloneSpec cloneSpec) {
-      VmSpec vmSpec = cloneSpec.getVmSpec();
-      NetworkSpec networkSpec = cloneSpec.getNetworkSpec();
-      boolean isLinkedClone = cloneSpec.isLinked();
-      IMachine master = cloneSpec.getMaster();
-      String flags = "";
-      List<String> groups = ImmutableList.of();
-      String group = "";
-      String settingsFile = manager.get().getVBox().composeMachineFilename(vmSpec.getVmName(), group , flags , workingDir);
-      IMachine clonedMachine = manager
-               .get()
-               .getVBox()
-               .createMachine(settingsFile, vmSpec.getVmName(), groups, vmSpec.getOsTypeId(), flags);
-      List<CloneOptions> options = Lists.newArrayList();
-      if (isLinkedClone)
-         options.add(CloneOptions.Link);
-
-      ISnapshot currentSnapshot = new TakeSnapshotIfNotAlreadyAttached(manager,
-            "snapshotName", "snapshotDesc", logger).apply(master);
-      IProgress progress = currentSnapshot.getMachine().cloneTo(clonedMachine,
-            CloneMode.MachineState, options);
-      progress.waitForCompletion(-1);
-
-      // memory may not be the same as the master vm
-      clonedMachine.setMemorySize(cloneSpec.getVmSpec().getMemory());
-
-      // registering
-      manager.get().getVBox().registerMachine(clonedMachine);
-
-      // Networking
-      for (NetworkInterfaceCard networkInterfaceCard : networkSpec.getNetworkInterfaceCards()) {
-         new AttachNicToMachine(vmSpec.getVmName(), machineUtils).apply(networkInterfaceCard);
-      }
-      
-      // set only once the creds for this machine, same coming from its master
-      logger.debug("<< storing guest credentials on vm(%s) as extra data", clonedMachine.getName());
-      String masterUsername = master.getExtraData(GUEST_OS_USER);
-      String masterPassword = master.getExtraData(GUEST_OS_PASSWORD);
-      clonedMachine.setExtraData(GUEST_OS_USER, masterUsername);
-      clonedMachine.setExtraData(GUEST_OS_PASSWORD, masterPassword);
-
-      return clonedMachine;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndInstallVm.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndInstallVm.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndInstallVm.java
deleted file mode 100644
index 2d1a03e..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndInstallVm.java
+++ /dev/null
@@ -1,168 +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.virtualbox.functions;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Inject;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.options.RunScriptOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.annotations.BuildVersion;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.statements.InstallGuestAdditions;
-import org.jclouds.virtualbox.util.MachineController;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMediumAttachment;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.scriptbuilder.domain.Statements.call;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_PASSWORD;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECONFIGURATION_URL;
-
-@Singleton
-public class CreateAndInstallVm implements Function<MasterSpec, IMachine> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final CreateAndRegisterMachineFromIsoIfNotAlreadyExists createAndRegisterMachineFromIsoIfNotAlreadyExists;
-   private final Predicate<SshClient> sshResponds;
-   private final Function<IMachine, SshClient> sshClientForIMachine;
-   private final MachineUtils machineUtils;
-   private final IMachineToNodeMetadata imachineToNodeMetadata;
-   private final MachineController machineController;
-   private final String version;
-   private final String preconfigurationUrl;
-   
-   @Inject
-   public CreateAndInstallVm(
-            CreateAndRegisterMachineFromIsoIfNotAlreadyExists CreateAndRegisterMachineFromIsoIfNotAlreadyExists,
-            IMachineToNodeMetadata imachineToNodeMetadata, Predicate<SshClient> sshResponds,
-            Function<IMachine, SshClient> sshClientForIMachine, MachineUtils machineUtils,
-            MachineController machineController, @BuildVersion String version,
-            @Named(VIRTUALBOX_PRECONFIGURATION_URL) String preconfigurationUrl) {
-      this.createAndRegisterMachineFromIsoIfNotAlreadyExists = CreateAndRegisterMachineFromIsoIfNotAlreadyExists;
-      this.sshResponds = sshResponds;
-      this.sshClientForIMachine = sshClientForIMachine;
-      this.machineUtils = machineUtils;
-      this.imachineToNodeMetadata = imachineToNodeMetadata;
-      this.machineController = machineController;
-      this.version = Iterables.get(Splitter.on('-').split(version), 0);
-      this.preconfigurationUrl = preconfigurationUrl;
-   }
-
-   @Override
-   public IMachine apply(MasterSpec masterSpec) {
-      VmSpec vmSpec = masterSpec.getVmSpec();
-      IsoSpec isoSpec = masterSpec.getIsoSpec();
-      String masterName = vmSpec.getVmName();
-      IMachine masterMachine =
-              checkNotNull(createAndRegisterMachineFromIsoIfNotAlreadyExists.apply(masterSpec), "master machine");
-      // Launch machine and wait for it to come online
-      machineController.ensureMachineIsLaunched(masterName);
-      String installationKeySequence = isoSpec.getInstallationKeySequence().replace("PRECONFIGURATION_URL",
-               preconfigurationUrl);
-      configureOsInstallationWithKeyboardSequence(masterName, installationKeySequence);
-
-      masterMachine.setExtraData(GUEST_OS_USER, masterSpec.getLoginCredentials().getUser());
-      masterMachine.setExtraData(GUEST_OS_PASSWORD, masterSpec.getLoginCredentials().getPassword());
-
-      SshClient client = sshClientForIMachine.apply(masterMachine);
-      logger.debug(">> awaiting installation to finish node(%s)", masterName);
-      Stopwatch stopwatch = Stopwatch.createUnstarted();
-      stopwatch.start();
-      checkState(sshResponds.apply(client), "timed out waiting for guest %s to be accessible via ssh", masterName);
-      stopwatch.stop();
-      logger.debug(String.format("Elapsed time for the OS installation: %d minutes", TimeUnit.SECONDS.convert(stopwatch.elapsed(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS)));
-      NodeMetadata nodeMetadata = imachineToNodeMetadata.apply(masterMachine);
-
-      logger.debug(">> awaiting post-installation actions on vm: %s", masterName);
-      ListenableFuture<ExecResponse> execCleanup = machineUtils.runScriptOnNode(nodeMetadata,
-               call("cleanupUdevIfNeeded"), RunScriptOptions.NONE);
-      ExecResponse cleanupResponse = Futures.getUnchecked(execCleanup);
-      checkState(cleanupResponse.getExitStatus() == 0, "post-installation actions on vm(%s) failed", masterName);
-
-      logger.debug(">> awaiting installation of guest additions on vm: %s", masterName);
-      ListenableFuture<ExecResponse> execInstallGA = machineUtils.runScriptOnNode(nodeMetadata,
-               new InstallGuestAdditions(vmSpec, version), RunScriptOptions.NONE);
-      ExecResponse execInstallGAResponse = Futures.getUnchecked(execInstallGA);
-      checkState(execInstallGAResponse.getExitStatus() == 0, "exec installation of guest additions on vm(%s) " +
-              "failed", masterName);
-
-      logger.debug(">> check installation of guest additions on vm: %s", masterName);
-      ListenableFuture<ExecResponse> checkGAinstallation = machineUtils.runScriptOnNode(nodeMetadata,
-              call("checkVBoxService"), RunScriptOptions.NONE);
-      ExecResponse checkGAinstallationResponse = Futures.getUnchecked(checkGAinstallation);
-      checkState(checkGAinstallationResponse.getExitStatus() == 0, "check installation of guest additions on vm(%s) " +
-              "failed", masterName);
-
-      machineController.ensureMachineIsShutdown(masterName);
-
-      // detach DVD and ISOs, if needed
-      Iterable<IMediumAttachment> mediumAttachments = Iterables.filter(
-            masterMachine.getMediumAttachmentsOfController("IDE Controller"),
-            new Predicate<IMediumAttachment>() {
-               public boolean apply(IMediumAttachment in) {
-                  return in.getMedium() != null
-                        && in.getMedium().getDeviceType()
-                              .equals(DeviceType.DVD);
-               }
-            });
-      for (IMediumAttachment iMediumAttachment : mediumAttachments) {
-         logger.debug("<< iMedium(%s) detached from (%s)", iMediumAttachment.getMedium()
-               .getName(), masterMachine.getName());
-         machineUtils.sharedLockMachineAndApply(
-               masterMachine.getName(),
-               new DetachDistroMediumFromMachine(iMediumAttachment
-                     .getController(), iMediumAttachment.getPort(),
-                     iMediumAttachment.getDevice()));
-      }
-      return masterMachine;
-   }
-
-   private void configureOsInstallationWithKeyboardSequence(String vmName, String installationKeySequence) {
-      Iterable<List<Integer>> scancodelist = transform(Splitter.on(" ").split(installationKeySequence),
-               new StringToKeyCode());
-      for (List<Integer> scancodes : scancodelist) {
-         machineUtils.sharedLockMachineAndApplyToSession(vmName, new SendScancodes(scancodes));
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExists.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExists.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExists.java
deleted file mode 100644
index 24ebeb2..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExists.java
+++ /dev/null
@@ -1,184 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.virtualbox.util.MachineUtils.machineNotFoundException;
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import com.google.common.collect.ImmutableMap;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.jclouds.virtualbox.domain.DeviceDetails;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoImage;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-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.virtualbox_4_2.AccessMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Lists;
-
-@Singleton
-public class CreateAndRegisterMachineFromIsoIfNotAlreadyExists implements Function<MasterSpec, IMachine> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final MachineUtils machineUtils;
-
-   private final String workingDir;
-
-   @Inject
-   public CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Supplier<VirtualBoxManager> manager,
-            MachineUtils machineUtils, @Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR) String workingDir) {
-      this.manager = manager;
-      this.machineUtils = machineUtils;
-      this.workingDir = workingDir;
-   }
-
-   @Override
-   public IMachine apply(MasterSpec masterSpec) {
-      final IVirtualBox vBox = manager.get().getVBox();
-      String vmName = masterSpec.getVmSpec().getVmName();
-      String vmId = masterSpec.getVmSpec().getVmId();
-
-      try {
-         vBox.findMachine(vmId);
-         throw new IllegalStateException("Machine " + vmName + " is already registered.");
-      } catch (VBoxException e) {
-         if (machineNotFoundException(e))
-            return createMachine(vBox, masterSpec);
-         else
-            throw e;
-      }
-   }
-
-   private IMachine createMachine(IVirtualBox vBox, MasterSpec masterSpec) {
-      VmSpec vmSpec = masterSpec.getVmSpec();
-      String flags = "";
-      List<String> groups = Lists.newArrayList();
-      String group = "";
-      String settingsFile = manager.get().getVBox().composeMachineFilename(vmSpec.getVmName(), group , flags , workingDir);
-
-      IMachine newMachine = vBox.createMachine(settingsFile, vmSpec.getVmName(), groups, vmSpec.getOsTypeId(), flags);
-      
-      manager.get().getVBox().registerMachine(newMachine);
-      ensureConfiguration(masterSpec);
-      return newMachine;
-   }
-
-   private void ensureConfiguration(MasterSpec machineSpec) {
-      VmSpec vmSpec = machineSpec.getVmSpec();
-      NetworkSpec networkSpec = machineSpec.getNetworkSpec();
-      String vmName = vmSpec.getVmName();
-
-      // Change BootOrder
-      Map<Long, DeviceType> positionAndDeviceType = ImmutableMap.of(1l, DeviceType.HardDisk);
-      ensureMachineHasDesiredBootOrder(vmName, positionAndDeviceType);
-
-      // Change RAM
-      ensureMachineHasMemory(vmName, vmSpec.getMemory());
-
-      Set<StorageController> controllers = vmSpec.getControllers();
-      if (controllers.isEmpty()) {
-         throw new IllegalStateException(missingIDEControllersMessage(vmSpec));
-      }
-      StorageController controller = controllers.iterator().next();
-      ensureMachineHasStorageControllerNamed(vmName, controller);
-      setupHardDisksForController(vmName, controller);
-      setupDvdsForController(vmSpec, vmName, controller);
-
-      // Networking
-      for (NetworkInterfaceCard networkInterfaceCard : networkSpec.getNetworkInterfaceCards()) {
-         new AttachNicToMachine(vmName, machineUtils).apply(networkInterfaceCard);
-      }
-   }
-
-   private void setupDvdsForController(VmSpec vmSpecification, String vmName, StorageController controller) {
-      Set<IsoImage> dvds = controller.getIsoImages();
-      for (IsoImage dvd : dvds) {
-         String dvdSource = dvd.getSourcePath();
-         final IMedium dvdMedium = manager.get().getVBox()
-                  .openMedium(dvdSource, DeviceType.DVD, AccessMode.ReadOnly, vmSpecification.isForceOverwrite());
-         ensureMachineDevicesAttached(vmName, dvdMedium, dvd.getDeviceDetails(), controller.getName());
-      }
-   }
-
-   private void ensureMachineDevicesAttached(String vmName, IMedium medium, DeviceDetails deviceDetails,
-            String controllerName) {
-      machineUtils.writeLockMachineAndApply(vmName, new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails,
-               medium, controllerName));
-   }
-
-   private String missingIDEControllersMessage(VmSpec vmSpecification) {
-      return String
-               .format("First controller is not an IDE controller. Please verify that the VM spec is a correct master node: %s",
-                        vmSpecification);
-   }
-
-   private void setupHardDisksForController(String vmName, StorageController controller) {
-      Set<HardDisk> hardDisks = controller.getHardDisks();
-      for (HardDisk hardDisk : hardDisks) {
-         String sourcePath = hardDisk.getDiskPath();
-         if (new File(sourcePath).exists()) {
-            boolean deleted = new File(sourcePath).delete();
-            if (!deleted) {
-               logger.error(String.format("File %s could not be deleted.", sourcePath));
-            }
-         }
-         IMedium medium = new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-         ensureMachineDevicesAttached(vmName, medium, hardDisk.getDeviceDetails(), controller.getName());
-      }
-   }
-
-   private void ensureMachineHasDesiredBootOrder(String vmName, Map<Long, DeviceType> positionAndDeviceType) {
-      machineUtils.writeLockMachineAndApply(vmName, new ApplyBootOrderToMachine(positionAndDeviceType));
-   }
-
-   private void ensureMachineHasMemory(String vmName, final long memorySize) {
-      machineUtils.writeLockMachineAndApply(vmName, new ApplyMemoryToMachine(memorySize));
-   }
-
-   public void ensureMachineHasStorageControllerNamed(String vmName, StorageController storageController) {
-      machineUtils.writeLockMachineAndApply(vmName,
-               new AddIDEControllerIfNotExists(checkNotNull(storageController, "storageController can't be null")));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExists.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExists.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExists.java
deleted file mode 100644
index ec0995a..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExists.java
+++ /dev/null
@@ -1,144 +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.virtualbox.functions;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.virtualbox_4_2.AccessMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IMediumAttachment;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class CreateMediumIfNotAlreadyExists implements Function<HardDisk, IMedium> {
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final MachineUtils machineUtils;
-   private final boolean overwriteIfExists;
-
-   @Inject
-   public CreateMediumIfNotAlreadyExists(Supplier<VirtualBoxManager> manager, MachineUtils machineUtils, boolean overwriteIfExists) {
-      this.manager = manager;
-      this.machineUtils = machineUtils;
-      this.overwriteIfExists = overwriteIfExists;
-   }
-
-   public static final Pattern ATTACHED_PATTERN = Pattern.compile(".*is still attached.*: ([-0-9a-f]+) .*");
-
-   @Override
-   public IMedium apply(HardDisk hardDisk) {
-      IVirtualBox vBox = manager.get().getVBox();
-      try {
-         String diskPath = hardDisk.getDiskPath();
-         final IMedium medium = vBox.openMedium(diskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false);
-         if (overwriteIfExists) {
-            try {
-               deleteMediumAndBlockUntilComplete(medium);
-            } catch (VBoxException e) {
-               onAlreadyAttachedExceptionDetachOrPropagate(vBox, medium, e);
-            }
-            return createNewMedium(vBox, hardDisk);
-         } else {
-            throw new IllegalStateException("Medium for path " + diskPath + " already exists.");
-         }
-      } catch (VBoxException e) {
-         if (notFoundException(e))
-            return createNewMedium(vBox, hardDisk);
-         throw e;
-      }
-   }
-
-   private void onAlreadyAttachedExceptionDetachOrPropagate(IVirtualBox vBox, final IMedium medium, VBoxException e) {
-      Matcher matcher = ATTACHED_PATTERN.matcher(e.getMessage());
-      if (matcher.find()) {
-         String machineId = matcher.group(1);
-         IMachine immutableMachine = vBox.findMachine(machineId);
-         IMediumAttachment mediumAttachment = Iterables.find(immutableMachine.getMediumAttachments(),
-                  new Predicate<IMediumAttachment>() {
-                     public boolean apply(IMediumAttachment in) {
-                        return in.getMedium().getId().equals(medium.getId());
-                     }
-                  });
-         machineUtils.writeLockMachineAndApply(immutableMachine.getName(), new DetachDistroMediumFromMachine(
-               mediumAttachment.getController(), mediumAttachment.getPort(), mediumAttachment.getDevice()));
-         deleteMediumAndBlockUntilComplete(medium);
-      } else {
-         throw e;
-      }
-   }
-
-   void deleteMediumAndBlockUntilComplete(IMedium medium) {
-      final IProgress progress = medium.deleteStorage();
-      progress.waitForCompletion(-1);
-   }
-
-   private IMedium createNewMedium(IVirtualBox vBox, HardDisk hardDisk) {
-      IMedium medium = vBox.createHardDisk(hardDisk.getDiskFormat(), hardDisk.getDiskPath());
-      createBaseStorage(medium);
-      return medium;
-   }
-
-   private boolean notFoundException(VBoxException e) {
-      return e.getMessage().contains("VirtualBox error: Could not find file for the medium ");
-   }
-
-   private void createBaseStorage(IMedium hardDisk) {
-      try {
-         long size = 4L * 1024L * 1024L * 1024L - 4L;
-         IProgress storageCreation = hardDisk.createBaseStorage(size,
-                  (long) org.virtualbox_4_2.jaxws.MediumVariant.STANDARD.ordinal());
-         storageCreation.waitForCompletion(-1);
-      } catch (VBoxException e) {
-         if (fileNotFoundException(e)) {
-            // File for medium could not be found. Something wrong with
-            // creation.
-            hardDisk.deleteStorage();
-         }
-         if (!storageAlreadyExists(e)) {
-            // Hard disk file was created but the storage had been created
-            // before that.
-            throw e;
-         }
-      }
-   }
-
-   private boolean fileNotFoundException(VBoxException e) {
-      return e.getMessage().contains("VERR_FILE_NOT_FOUND");
-   }
-
-   private boolean storageAlreadyExists(VBoxException e) {
-      return e.getMessage().contains("VirtualBox error: Storage for the medium ")
-               && e.getMessage().contains("is already created");
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachine.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachine.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachine.java
deleted file mode 100644
index dbe7959..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachine.java
+++ /dev/null
@@ -1,53 +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.virtualbox.functions;
-
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.common.base.Function;
-
-public class DetachDistroMediumFromMachine implements Function<IMachine, Void> {
-
-   private final String controller;
-   private int port;
-   private int deviceSlot;
-
-   public DetachDistroMediumFromMachine(String controller, int port, int deviceSlot) {
-      this.controller = controller;
-      this.port = port;
-      this.deviceSlot = deviceSlot;
-   }
-
-   //TODO: should this be a function on HardDisk?
-   @Override
-   public Void apply(IMachine machine) {
-      try {
-         machine.detachDevice(controller, port, deviceSlot);
-         machine.saveSettings();
-      } catch (VBoxException e) {
-         if (!alreadyDetached(e))
-            throw e;
-      }
-      return null;
-   }
-
-   private boolean alreadyDetached(VBoxException e) {
-      return e.getMessage().contains("is already detached from port");
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/HardcodedHostToHostNodeMetadata.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/HardcodedHostToHostNodeMetadata.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/HardcodedHostToHostNodeMetadata.java
deleted file mode 100644
index fdf1371..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/HardcodedHostToHostNodeMetadata.java
+++ /dev/null
@@ -1,65 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.location.Provider;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-@Singleton
-public class HardcodedHostToHostNodeMetadata implements Function<NodeMetadata, NodeMetadata> {
-   
-   private final Supplier<URI> providerSupplier;
-   private final Supplier<Credentials> creds;
-
-   @Inject
-   public HardcodedHostToHostNodeMetadata(@Provider Supplier<URI> providerSupplier,
-         @Provider Supplier<Credentials> creds) {
-      this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox websrvd is needed");
-      this.creds = creds;
-   }
-
-   @Override
-   public NodeMetadata apply(NodeMetadata host) {
-      Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
-      String username = currentCreds.identity;
-      String password = currentCreds.credential.equals("CHANGE_ME") ? "" : currentCreds.credential;
-
-      LoginCredentials.Builder credentialsBuilder = LoginCredentials.builder(host.getCredentials()).user(username);
-      if (!password.isEmpty())
-         credentialsBuilder.password(password);
-
-      return NodeMetadataBuilder
-            .fromNodeMetadata(host)
-            .credentials(credentialsBuilder.build())
-            .publicAddresses(ImmutableList.of(providerSupplier.get().getHost()))
-            .build();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToHardware.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToHardware.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToHardware.java
deleted file mode 100644
index e4e8a8e..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToHardware.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.virtualbox.functions;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-public class IMachineToHardware implements Function<IMachine, Hardware> {
-
-   private Supplier<VirtualBoxManager> virtualBoxManager;
-
-   @Inject
-   public IMachineToHardware(Supplier<VirtualBoxManager> virtualBoxManager) {
-      this.virtualBoxManager = virtualBoxManager;
-   }
-
-   @Override
-   public Hardware apply(@Nullable IMachine vm) {
-      String osTypeId = vm.getOSTypeId();
-      String vmNameWithoutPrefix = vm.getName().replace(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX, "");
-      
-      IGuestOSType guestOSType = virtualBoxManager.get().getVBox().getGuestOSType(osTypeId);
-      Boolean is64Bit = guestOSType.getIs64Bit();
-      HardwareBuilder hardwareBuilder = new HardwareBuilder();
-      hardwareBuilder.ids(vmNameWithoutPrefix);
-      hardwareBuilder.is64Bit(is64Bit);
-      hardwareBuilder.supportsImage(ImagePredicates.idEquals(vmNameWithoutPrefix));
-      hardwareBuilder.hypervisor("VirtualBox");
-      return hardwareBuilder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToImage.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToImage.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToImage.java
deleted file mode 100644
index f1b672b..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToImage.java
+++ /dev/null
@@ -1,74 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized;
-import static org.jclouds.compute.util.ComputeServiceUtils.parseVersionOrReturnEmptyString;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.Image.Status;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-@Singleton
-public class IMachineToImage implements Function<IMachine, Image> {
-
-   private final Map<MachineState, Status> toPortableImageStatus;
-   private final Supplier<VirtualBoxManager> virtualboxManager;
-   private final Map<OsFamily, Map<String, String>> osVersionMap;
-
-   @Inject
-   public IMachineToImage(Map<MachineState, Image.Status> toPortableImageStatus, Supplier<VirtualBoxManager> virtualboxManager, Map<OsFamily, Map<String, String>> osVersionMap) {
-      this.toPortableImageStatus = checkNotNull(toPortableImageStatus, "toPortableImageStatus");
-      this.virtualboxManager = checkNotNull(virtualboxManager, "virtualboxManager");
-      this.osVersionMap = checkNotNull(osVersionMap, "osVersionMap");
-   }
-
-   @Override
-   public Image apply(@Nullable IMachine from) {
-      if (from == null)
-         return null;
-
-      IGuestOSType guestOSType = virtualboxManager.get().getVBox().getGuestOSType(from.getOSTypeId());
-      OsFamily family = parseOsFamilyOrUnrecognized(guestOSType.getDescription());
-      String version = parseVersionOrReturnEmptyString(family, guestOSType.getDescription(), osVersionMap);
-      OperatingSystem os = OperatingSystem.builder().description(guestOSType.getDescription()).family(family)
-               .version(version).is64Bit(guestOSType.getIs64Bit()).build();
-
-      return new ImageBuilder()
-               .id(from.getName().substring(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX.length(),
-                        from.getName().length())).name(from.getName()).description(from.getDescription())
-               .operatingSystem(os).status(toPortableImageStatus.get(from.getState())).build();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToIpAddress.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToIpAddress.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToIpAddress.java
deleted file mode 100644
index 13b2216..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToIpAddress.java
+++ /dev/null
@@ -1,95 +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.virtualbox.functions;
-
-import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.options.RunScriptOptions;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-
-/**
- * Get an IP address from an IMachine using arp of the host machine.
- */
-public class IMachineToIpAddress implements Function<IMachine, String> {
-
-   private VirtualBoxManager manager;
-   private ComputeService computeService;
-
-   public IMachineToIpAddress(VirtualBoxManager manager, ComputeService computeService) {
-      this.manager = manager;
-      this.computeService = computeService;
-   }
-
-   @Override
-   public String apply(IMachine machine) {
-
-      String macAddress = machine.getNetworkAdapter(0l).getMACAddress();
-      int offset = 0;
-      int step = 2;
-      for (int j = 1; j <= 5; j++) {
-         macAddress = new StringBuilder(macAddress).insert(j * step + offset, ":").toString().toLowerCase();
-         offset++;
-      }
-
-      String simplifiedMacAddressOfClonedVM = macAddress;
-
-      final String hostId = System.getProperty(VirtualBoxConstants.VIRTUALBOX_HOST_ID);
-      IMachine hostMachine = manager.getVBox().findMachine(hostId);
-      if (isOSX(hostMachine)) {
-         if (simplifiedMacAddressOfClonedVM.contains("00"))
-            simplifiedMacAddressOfClonedVM = new StringBuilder(simplifiedMacAddressOfClonedVM).delete(
-                  simplifiedMacAddressOfClonedVM.indexOf("00"), simplifiedMacAddressOfClonedVM.indexOf("00") + 1)
-                  .toString();
-
-         if (simplifiedMacAddressOfClonedVM.contains("0"))
-            if (simplifiedMacAddressOfClonedVM.indexOf("0") + 1 != ':'
-                  && simplifiedMacAddressOfClonedVM.indexOf("0") - 1 != ':')
-               simplifiedMacAddressOfClonedVM = new StringBuilder(simplifiedMacAddressOfClonedVM).delete(
-                     simplifiedMacAddressOfClonedVM.indexOf("0"), simplifiedMacAddressOfClonedVM.indexOf("0") + 1)
-                     .toString();
-      }
-
-      // TODO: This is both shell-dependent and hard-coded. Needs to be fixed.
-      ExecResponse execResponse = runScriptOnNode(hostId, "for i in {1..254} ; do ping -c 1 -t 1 192.168.2.$i & done",
-            runAsRoot(false).wrapInInitScript(false));
-      System.out.println(execResponse);
-
-      String arpLine = runScriptOnNode(hostId, "arp -an | grep " + simplifiedMacAddressOfClonedVM,
-            runAsRoot(false).wrapInInitScript(false)).getOutput();
-      String ipAddress = arpLine.substring(arpLine.indexOf("(") + 1, arpLine.indexOf(")"));
-      System.out.println("IP address " + ipAddress);
-      return ipAddress;
-   }
-
-   private ExecResponse runScriptOnNode(String nodeId, String command, RunScriptOptions options) {
-      return computeService.runScriptOnNode(nodeId, command, options);
-   }
-
-   protected boolean isOSX(IMachine machine) {
-      String osTypeId = machine.getOSTypeId();
-      IGuestOSType guestOSType = manager.getVBox().getGuestOSType(osTypeId);
-      return guestOSType.getFamilyDescription().equals("Other");
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java
deleted file mode 100644
index 517494a..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java
+++ /dev/null
@@ -1,164 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized;
-import static org.jclouds.compute.util.ComputeServiceUtils.parseVersionOrReturnEmptyString;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_PASSWORD;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-@Singleton
-public class IMachineToNodeMetadata implements Function<IMachine, NodeMetadata> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-   
-   private final Supplier<VirtualBoxManager> virtualboxManager;
-   private final Map<MachineState, Status> toPortableNodeStatus;
-   private final NetworkUtils networkUtils;
-   private final Map<OsFamily, Map<String, String>> osVersionMap;
-
-   @Inject
-   public IMachineToNodeMetadata(Supplier<VirtualBoxManager> virtualboxManager, Map<MachineState, NodeMetadata.Status> toPortableNodeStatus, 
-         NetworkUtils networkUtils, Map<OsFamily, Map<String, String>> osVersionMap) {
-      this.virtualboxManager = checkNotNull(virtualboxManager, "virtualboxManager");
-      this.toPortableNodeStatus = checkNotNull(toPortableNodeStatus, "toPortableNodeStatus");
-      this.networkUtils = checkNotNull(networkUtils, "networkUtils");
-      this.osVersionMap = checkNotNull(osVersionMap, "osVersionMap");
-   }
-   
-   @Override
-   public NodeMetadata apply(@Nullable IMachine vm) {
-
-      String group = "";
-      String name = "";
-      String[] encodedInVmName = vm.getName().split(VIRTUALBOX_NODE_NAME_SEPARATOR);
-      if (vm.getName().startsWith(VIRTUALBOX_NODE_PREFIX)){
-         group = encodedInVmName[2];
-         name = encodedInVmName[3];
-      } else {
-         name = encodedInVmName[1];
-      }
-      
-      NodeMetadataBuilder nodeMetadataBuilder = new NodeMetadataBuilder();
-      nodeMetadataBuilder.name(name).ids(vm.getName()).group(group);
-      // TODO Set up location properly
-      LocationBuilder locationBuilder = new LocationBuilder();
-      locationBuilder.description("");
-      locationBuilder.id("");
-      locationBuilder.scope(LocationScope.HOST);
-      nodeMetadataBuilder.location(locationBuilder.build());
-      nodeMetadataBuilder.hostname(vm.getName());
-
-      MachineState vmState = vm.getState();
-      NodeMetadata.Status nodeState = toPortableNodeStatus.get(vmState);
-      if (nodeState == null)
-         nodeState = Status.UNRECOGNIZED;
-      nodeMetadataBuilder.status(nodeState);
-      nodeMetadataBuilder = getIpAddresses(vm, nodeMetadataBuilder);
-      
-      IGuestOSType guestOSType = virtualboxManager.get().getVBox().getGuestOSType(vm.getOSTypeId());
-      OsFamily family = parseOsFamilyOrUnrecognized(guestOSType.getDescription());
-      String version = parseVersionOrReturnEmptyString(family, guestOSType.getDescription(), osVersionMap);
-      OperatingSystem os = OperatingSystem.builder().description(guestOSType.getDescription()).family(family)
-               .version(version).is64Bit(guestOSType.getIs64Bit()).build();
-      nodeMetadataBuilder.operatingSystem(os);
-
-      String guestOsUser = vm.getExtraData(GUEST_OS_USER);
-      String guestOsPassword = vm.getExtraData(GUEST_OS_PASSWORD);
-      nodeMetadataBuilder.credentials(LoginCredentials.builder()
-                                                      .user(guestOsUser)
-                                                      .password(guestOsPassword)
-                                                      .authenticateSudo(true).build());
-      return nodeMetadataBuilder.build();
-   }
-   
-   private NodeMetadataBuilder getIpAddresses(IMachine vm, NodeMetadataBuilder nodeMetadataBuilder) {
-      List<String> publicIpAddresses = Lists.newArrayList();
-      List<String> privateIpAddresses = Lists.newArrayList();
-      for (long slot = 0; slot < 4; slot++) {
-         INetworkAdapter adapter = vm.getNetworkAdapter(slot);
-         if (adapter != null) {
-            if (adapter.getAttachmentType() == NetworkAttachmentType.NAT) {
-               String hostIP = adapter.getNATEngine().getHostIP();
-               if (!hostIP.isEmpty())
-                  publicIpAddresses.add(hostIP);
-               for (String nameProtocolnumberAddressInboudportGuestTargetport : adapter.getNATEngine().getRedirects()) {
-                  Iterable<String> stuff = Splitter.on(',').split(nameProtocolnumberAddressInboudportGuestTargetport);
-                  String protocolNumber = Iterables.get(stuff, 1);
-                  String hostAddress = Iterables.get(stuff, 2);
-                  String inboundPort = Iterables.get(stuff, 3);
-                  String targetPort = Iterables.get(stuff, 5);
-                  if ("1".equals(protocolNumber) && "22".equals(targetPort)) {
-                     int inPort = Integer.parseInt(inboundPort);
-                     publicIpAddresses.add(hostAddress);
-                     nodeMetadataBuilder.loginPort(inPort);
-                  }
-               }
-            } else if (adapter.getAttachmentType() == NetworkAttachmentType.Bridged) {
-               String clientIpAddress = networkUtils.getIpAddressFromNicSlot(vm.getName(), adapter.getSlot());
-               privateIpAddresses.add(clientIpAddress);
-
-            } else if (adapter.getAttachmentType() == NetworkAttachmentType.HostOnly) {
-               String clientIpAddress = networkUtils.getValidHostOnlyIpFromVm(vm.getName());             
-               publicIpAddresses.add(clientIpAddress);
-            }
-         }
-      }
-      nodeMetadataBuilder.publicAddresses(publicIpAddresses);
-      nodeMetadataBuilder.privateAddresses(publicIpAddresses);
-      return nodeMetadataBuilder;
-   }   
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToSshClient.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToSshClient.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToSshClient.java
deleted file mode 100644
index c515f5f..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToSshClient.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.virtualbox.functions;
-
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_PASSWORD;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.GUEST_OS_USER;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.logging.Logger;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.NetworkAttachmentType;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-import com.google.common.net.HostAndPort;
-import com.google.inject.Inject;
-
-@Singleton
-public class IMachineToSshClient implements Function<IMachine, SshClient> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final SshClient.Factory sshClientFactory;
-   private final NetworkUtils networkUtils;
-
-   @Inject
-   public IMachineToSshClient(SshClient.Factory sshClientFactory, NetworkUtils networkUtils) {
-      this.sshClientFactory = sshClientFactory;
-      this.networkUtils = networkUtils;
-   }
-
-   @Override
-   public SshClient apply(final IMachine vm) {
-      String sshPort = "22";
-      String guestIdentity = vm.getExtraData(GUEST_OS_USER);
-      String guestCredential = vm.getExtraData(GUEST_OS_PASSWORD);
-      LoginCredentials loginCredentials = LoginCredentials.builder().user(guestIdentity).password(guestCredential)
-            .authenticateSudo(true).build();
-
-      String clientIpAddress = null;
-
-      long nicSlot = 0;
-      while (nicSlot < 4 && Strings.isNullOrEmpty(clientIpAddress)) {
-         INetworkAdapter networkAdapter = vm.getNetworkAdapter(nicSlot);
-
-         if (networkAdapter.getAttachmentType().equals(NetworkAttachmentType.NAT)) {
-            for (String nameProtocolnumberAddressInboudportGuestTargetport : networkAdapter.getNATEngine()
-                  .getRedirects()) {
-               Iterable<String> stuff = Splitter.on(',').split(nameProtocolnumberAddressInboudportGuestTargetport);
-               String protocolNumber = Iterables.get(stuff, 1);
-               String hostAddress = Iterables.get(stuff, 2);
-               String inboundPort = Iterables.get(stuff, 3);
-               String targetPort = Iterables.get(stuff, 5);
-               if ("1".equals(protocolNumber) && "22".equals(targetPort)) {
-                  clientIpAddress = hostAddress;
-                  sshPort = inboundPort;
-               }
-            }
-         } else if (networkAdapter.getAttachmentType().equals(NetworkAttachmentType.Bridged)) {
-            clientIpAddress = networkUtils.getIpAddressFromNicSlot(vm.getName(), networkAdapter.getSlot());
-         } else if (networkAdapter.getAttachmentType().equals(NetworkAttachmentType.HostOnly)) {
-            clientIpAddress = networkUtils.getValidHostOnlyIpFromVm(vm.getName());
-         }
-         nicSlot++;
-      }
-      return sshClientFactory.create(HostAndPort.fromParts(clientIpAddress, Integer.parseInt(sshPort)),
-            loginCredentials);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToVmSpec.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToVmSpec.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToVmSpec.java
deleted file mode 100644
index 7601f74..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToVmSpec.java
+++ /dev/null
@@ -1,92 +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.virtualbox.functions;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.StorageController.Builder;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IMediumAttachment;
-import org.virtualbox_4_2.IStorageController;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-/**
- * Get a VmSpec from an IMachine
- */
-public class IMachineToVmSpec implements Function<IMachine, VmSpec> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   @Override
-   public VmSpec apply(IMachine machine) {
-      List<StorageController> controllers = buildControllers(machine);
-
-      // TODO some parameters are predefined cause the IMachine doesn't have the
-      // concept i.e.: cleanUpMode
-      org.jclouds.virtualbox.domain.VmSpec.Builder vmSpecBuilder = VmSpec.builder();
-
-      vmSpecBuilder.id(machine.getId()).name(machine.getName()).memoryMB(machine.getMemorySize().intValue())
-               .osTypeId(machine.getOSTypeId()).forceOverwrite(true).cleanUpMode(CleanupMode.Full);
-
-      for (StorageController storageController : controllers) {
-         vmSpecBuilder.controller(storageController);
-      }
-
-      return vmSpecBuilder.build();
-   }
-
-   private List<StorageController> buildControllers(IMachine machine) {
-
-      List<StorageController> controllers = Lists.newArrayList();
-      for (IStorageController iStorageController : machine.getStorageControllers()) {
-
-         Builder storageControllerBuilder = StorageController.builder();
-         for (IMediumAttachment iMediumAttachment : machine.getMediumAttachmentsOfController(iStorageController
-                  .getName())) {
-            IMedium iMedium = iMediumAttachment.getMedium();
-            if (iMedium != null) {
-               if (iMedium.getDeviceType().equals(DeviceType.HardDisk)) {
-                  storageControllerBuilder.attachHardDisk(HardDisk.builder().diskpath(iMedium.getLocation())
-                           .autoDelete(true).controllerPort(iMediumAttachment.getPort())
-                           .deviceSlot(iMediumAttachment.getDevice().intValue()).build());
-               } else if (iMedium.getDeviceType().equals(DeviceType.DVD)) {
-                  storageControllerBuilder.attachISO(iMediumAttachment.getPort(), iMediumAttachment.getDevice().intValue(),
-                           iMedium.getLocation());
-               }
-            }
-         }
-         controllers.add(storageControllerBuilder.name(iStorageController.getName()).bus(iStorageController.getBus())
-                  .build());
-      }
-      return controllers;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IpAddressesLoadingCache.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IpAddressesLoadingCache.java b/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IpAddressesLoadingCache.java
deleted file mode 100644
index b4097a4..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IpAddressesLoadingCache.java
+++ /dev/null
@@ -1,85 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.util.MachineNameOrIdAndNicSlot;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.cache.AbstractLoadingCache;
-import com.google.common.collect.Maps;
-
-/**
- * A {@link LoadingCache} for ip addresses. If the requested ip address has been
- * previously extracted this returns it, if not it calls vbox api.
- */
-@Singleton
-public class IpAddressesLoadingCache extends
-      AbstractLoadingCache<MachineNameOrIdAndNicSlot, String> {
-  
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Map<MachineNameOrIdAndNicSlot, String> masters = Maps.newHashMap();
-   private final Supplier<VirtualBoxManager> manager;
-
-   @Inject
-   public IpAddressesLoadingCache(Supplier<VirtualBoxManager> manager) {
-      this.manager = checkNotNull(manager, "vboxmanager");
-   }
-
-   @Override
-   public synchronized String get(MachineNameOrIdAndNicSlot machineNameOrIdAndNicPort) throws ExecutionException {
-      if (masters.containsKey(machineNameOrIdAndNicPort)) {
-         return masters.get(machineNameOrIdAndNicPort);
-      }
-      String query = String.format("/VirtualBox/GuestInfo/Net/%s/V4/IP", machineNameOrIdAndNicPort.getSlotText());
-      String ipAddress = Strings.nullToEmpty(manager.get().getVBox()
-            .findMachine(machineNameOrIdAndNicPort.getMachineNameOrId()).getGuestPropertyValue(query));
-      if (!ipAddress.isEmpty()) {
-         logger.debug("<< vm(%s) has IP address(%s) at slot(%s)", machineNameOrIdAndNicPort.getMachineNameOrId(),
-            ipAddress, machineNameOrIdAndNicPort.getSlotText());
-      }
-      masters.put(machineNameOrIdAndNicPort, ipAddress);
-      return ipAddress;
-   }
-
-   @Override
-   public String getIfPresent(Object key) {
-      return masters.get((MachineNameOrIdAndNicSlot) key);
-   }
-
-   @Override
-   public void invalidate(Object key) {
-      masters.remove(key);
-   }
-
-}


[3/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java
deleted file mode 100644
index 1f1a87c..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java
+++ /dev/null
@@ -1,159 +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.virtualbox.functions;
-
-import static com.google.common.collect.Iterables.getOnlyElement;
-import static org.easymock.EasyMock.anyLong;
-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 org.jclouds.virtualbox.domain.DeviceDetails;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-@Test(groups = "unit", testName = "AttachMediumToMachineIfNotAlreadyAttachedTest")
-public class AttachMediumToMachineIfNotAlreadyAttachedTest {
-
-   @Test
-   public void testAttachHardDiskIfNotAttached() throws Exception {
-
-      String controllerName = "IDE Controller";
-      String diskPath = "/Users/johndoe/jclouds-virtualbox-images/admin.vdi";
-      String diskFormat = "vdi";
-      int controllerPort = 0;
-      int deviceSlot = 1;
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium hardDisk = createNiceMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.createHardDisk(diskFormat, diskPath)).andReturn(hardDisk);
-      expect(hardDisk.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      machine.attachDevice(controllerName, controllerPort, deviceSlot, DeviceType.HardDisk, hardDisk);
-      machine.saveSettings();
-      replay(manager, machine, vBox, hardDisk);
-
-      StorageController controller = StorageController.builder()
-              .name(controllerName)
-              .bus(StorageBus.IDE)
-              .attachHardDisk(HardDisk.builder().diskpath(diskPath)
-                    .controllerPort(controllerPort).deviceSlot(deviceSlot).build())
-              .build();
-
-
-      DeviceDetails deviceDetails = getOnlyElement(controller.getHardDisks()).getDeviceDetails();
-      new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, hardDisk, controllerName).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test
-   public void testDoNothingIfAlreadyAttachedAttachHardDisk() throws Exception {
-
-      String controllerName = "IDE Controller";
-      int controllerPort = 0;
-      int deviceSlot = 1;
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium hardDisk = createNiceMock(IMedium.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Medium '/Users/mattias/jclouds-virtualbox-test/testadmin.vdi' ");
-      errorBuilder.append("is already attached to port 0, device 1 of controller 'IDE Controller' ");
-      errorBuilder.append("of this virtual machine (0x80BB000C)");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class),
-              isoAlreadyAttachedException);
-      machine.attachDevice(controllerName, controllerPort, deviceSlot, DeviceType.HardDisk, hardDisk);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(manager, machine, vBox, hardDisk);
-
-      StorageController controller = StorageController.builder()
-              .name(controllerName)
-              .bus(StorageBus.IDE)
-              .attachHardDisk(HardDisk.builder().diskpath("/Users/mattias/jclouds-virtualbox-test/testadmin.vdi")
-                                    .controllerPort(controllerPort).deviceSlot(deviceSlot).build())
-              .build();
-
-      DeviceDetails deviceDetails = getOnlyElement(controller.getHardDisks()).getDeviceDetails();
-      new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, hardDisk, controllerName).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailOnOtherVBoxError() throws Exception {
-
-      String controllerName = "IDE Controller";
-      int controllerPort = 0;
-      int deviceSlot = 1;
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium hardDisk = createNiceMock(IMedium.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Some other VBox error");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class),
-              isoAlreadyAttachedException);
-      machine.attachDevice(controllerName, controllerPort, deviceSlot, DeviceType.HardDisk, hardDisk);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(manager, machine, vBox, hardDisk);
-
-
-      StorageController controller = StorageController.builder()
-              .name(controllerName)
-              .bus(StorageBus.IDE)
-              .attachHardDisk(HardDisk.builder().diskpath("/Users/mattias/jclouds-virtualbox-test/testadmin.vdi")
-                    .controllerPort(controllerPort).deviceSlot(deviceSlot).build())
-              .build();
-
-      DeviceDetails deviceDetails = getOnlyElement(controller.getHardDisks()).getDeviceDetails();
-      new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, hardDisk, controllerName).apply(machine);
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java
deleted file mode 100644
index 9a17acb..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java
+++ /dev/null
@@ -1,138 +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.virtualbox.functions;
-
-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_2.NATProtocol.TCP;
-import static org.virtualbox_4_2.NetworkAttachmentType.NAT;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INATEngine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.VBoxException;
-
-@Test(groups = "unit", testName = "AttachNATAdapterToMachineIfNotAlreadyExistsTest")
-public class AttachNATAdapterToMachineIfNotAlreadyExistsTest {
-
-	@Test
-	public void testApplyNetworkingToNonExistingAdapter() throws Exception {
-		Long slotId = 0l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-		INATEngine natEngine = createMock(INATEngine.class);
-
-		expect(machine.getNetworkAdapter(slotId)).andReturn(iNetworkAdapter);
-		iNetworkAdapter.setAttachmentType(NAT);
-		expect(iNetworkAdapter.getNATEngine()).andReturn(natEngine).anyTimes();
-
-		List<String> redirects = Lists.newArrayList();
-		expect(natEngine.getRedirects()).andReturn(redirects);
-		natEngine.addRedirect("TCP@127.0.0.1:2222->:22", TCP, "127.0.0.1",
-				2222, "", 22);
-		iNetworkAdapter.setEnabled(true);
-		machine.saveSettings();
-
-		replay(machine, iNetworkAdapter, natEngine);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.NAT)
-				.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-
-		new AttachNATAdapterToMachineIfNotAlreadyExists(networkInterfaceCard)
-				.apply(machine);
-
-		verify(machine, iNetworkAdapter, natEngine);
-	}
-
-	@Test
-	public void testApplySkipsWhenAlreadyExists() throws Exception {
-		Long slotId = 0l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-		INATEngine natEngine = createMock(INATEngine.class);
-
-		expect(machine.getNetworkAdapter(slotId)).andReturn(iNetworkAdapter);
-		iNetworkAdapter.setAttachmentType(NAT);
-		expect(iNetworkAdapter.getNATEngine()).andReturn(natEngine).anyTimes();
-
-		List<String> redirects = Lists.newArrayList();
-		expect(natEngine.getRedirects()).andReturn(redirects);
-
-		natEngine.addRedirect("TCP@127.0.0.1:2222->:22", TCP, "127.0.0.1",
-				2222, "", 22);
-		expectLastCall()
-				.andThrow(
-						new VBoxException(null,
-								"VirtualBox error: A NAT rule of this name already exists (0x80070057)"));
-
-		iNetworkAdapter.setEnabled(true);
-		machine.saveSettings();
-
-		replay(machine, iNetworkAdapter, natEngine);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.NAT)
-				.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-		new AttachNATAdapterToMachineIfNotAlreadyExists(networkInterfaceCard)
-				.apply(machine);
-
-		verify(machine, iNetworkAdapter, natEngine);
-	}
-
-	@Test(enabled = false, expectedExceptions = VBoxException.class)
-	public void testRethrowInvalidAdapterSlotException() throws Exception {
-		Long slotId = 30l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-		INATEngine natEngine = createMock(INATEngine.class);
-
-		String error = "VirtualBox error: Argument slot is invalid "
-				+ "(must be slot < RT_ELEMENTS(mNetworkAdapters)) (0x80070057)";
-
-		VBoxException invalidSlotException = new VBoxException(
-				createNiceMock(Throwable.class), error);
-		expect(machine.getNetworkAdapter(slotId))
-				.andThrow(invalidSlotException);
-
-		replay(machine, iNetworkAdapter, natEngine);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.NAT)
-				.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-		new AttachNATAdapterToMachineIfNotAlreadyExists(networkInterfaceCard)
-				.apply(machine);
-
-		verify(machine, iNetworkAdapter, natEngine);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java
deleted file mode 100644
index d7238e7..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java
+++ /dev/null
@@ -1,68 +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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.virtualbox.domain.BridgedIf;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", singleThreaded = true, testName = "BridgedIfStringToBridgedIfTest")
-public class BridgedIfStringToBridgedIfTest {
-		
-	private static final String en0 = "Name:            en0: Ethernet\n" +
-	"GUID:            00306e65-0000-4000-8000-3c0754205d2f\n" + 
-	"Dhcp:            Disabled\n" +
-	"IPAddress:       192.168.56.1\n" +
-	"NetworkMask:     255.255.255.0\n" +
-	"IPV6Address:     \n" +
-	"IPV6NetworkMaskPrefixLength: 0\n" +
-	"HardwareAddress: 3c:07:54:20:5d:2f\n" +
-	"MediumType:      Ethernet\n" +
-	"Status:          Up\n" +
-	"VBoxNetworkName: HostInterfaceNetworking-en0: Ethernet\n";
-
-	private static final String en1 = "Name:            en1: Wi-Fi (AirPort)\n" +
-	"GUID:            00316e65-0000-4000-8000-28cfdaf2917a\n" +
-	"Dhcp:            Disabled\n" +
-	"IPAddress:       192.168.57.1\n" +
-	"NetworkMask:     255.255.255.0\n" +
-	"IPV6Address:     \n" +
-	"IPV6NetworkMaskPrefixLength: 0\n" +
-	"HardwareAddress: 28:cf:da:f2:91:7a\n" +
-	"MediumType:      Ethernet\n" +
-	"Status:          Up\n" +
-	"VBoxNetworkName: HostInterfaceNetworking-en1: Wi-Fi (AirPort)\n";
-
-	private static final String p2p0 = "Name:            p2p0\n" +
-	"GUID:            30703270-0000-4000-8000-0acfdaf2917a\n" +
-	"Dhcp:            Disabled\n" +
-	"IPAddress:       192.168.58.1\n" +
-	"NetworkMask:     255.255.255.0\n" +
-	"IPV6Address:     \n" +
-	"IPV6NetworkMaskPrefixLength: 0\n" +
-	"HardwareAddress: 0a:cf:da:f2:91:7a\n" +
-	"MediumType:      Ethernet\n" +
-	"Status:          Down\n" +
-	"VBoxNetworkName: HostInterfaceNetworking-p2p0\n";
-
-	@Test
-	public void transformRawBridgedifToBridgedIf() {
-		BridgedIf bridgedIfEn1 = new BridgedIfStringToBridgedIf().apply(en1);
-	      assertEquals(bridgedIfEn1.getName(), "en1: Wi-Fi (AirPort)");
-	}
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java
deleted file mode 100644
index b1c900e..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java
+++ /dev/null
@@ -1,135 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest")
-public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private MasterSpec machineSpec;
-   private String instanceName;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-               + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController.builder()
-                                                         .name("IDE Controller")
-                                                         .bus(StorageBus.IDE)
-                                                         .attachISO(0, 0, operatingSystemIso)
-                                                         .attachHardDisk(HardDisk.builder()
-                                                                                 .diskpath(adminDisk(instanceName))
-                                                                                 .controllerPort(0)
-                                                                                 .deviceSlot(1)
-                                                                                 .autoDelete(true)
-                                                                                 .build())
-                                                         .attachISO(1, 1, guestAdditionsIso)
-                                                         .build();
-
-      VmSpec instanceVmSpec = VmSpec.builder()
-                                    .id(instanceName)
-                                    .name(instanceName)
-                                    .osTypeId("")
-                                    .memoryMB(512)
-                                    .cleanUpMode(CleanupMode.Full)
-                                    .controller(ideController)
-                                    .forceOverwrite(true)
-                                    .build();
-
-      IsoSpec isoSpec = IsoSpec.builder()
-                               .sourcePath(operatingSystemIso)
-                               .installationScript(keystrokeSequence)
-                               .build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder()
-                                                    .networkAttachmentType(NetworkAttachmentType.NAT)
-                                                    .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder()
-                                                                      .addNetworkAdapter(networkAdapter)
-                                                                      .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder()
-                                           .addNIC(networkInterfaceCard)
-                                           .build();
-      machineSpec = MasterSpec.builder()
-                              .iso(isoSpec)
-                              .vm(instanceVmSpec)
-                              .network(networkSpec)
-                              .build();
-   }
-   
-   @Test
-   public void testCloneMachineFromAnotherMachine() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
-               .master(source).linked(true).build();
-      IMachine clone = checkNotNull(
-              new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-                                .apply(cloneSpec), "clone");
-      assertEquals(clone.getName(), cloneSpec.getVmSpec().getVmName());
-
-   }
-
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         // already created
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-   
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      for (String vmName : ImmutableSet.of(instanceName)) {
-         undoVm(vmName);
-      }
-      super.tearDownContext();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java
deleted file mode 100644
index 863158f..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java
+++ /dev/null
@@ -1,162 +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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.location.Provider;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.predicates.SshResponds;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "CreateAndInstallVmLiveTest")
-public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-            .getInstance(Json.class));
-
-   private Injector injector;
-   private Function<IMachine, SshClient> sshClientForIMachine;
-   private Predicate<SshClient> sshResponds;
-   
-   private MasterSpec machineSpec;
-   private String instanceName;
-   
-   @Inject 
-   @Provider
-   protected Supplier<URI> providerSupplier;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-               + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController
-               .builder()
-               .name("IDE Controller")
-               .bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(
-                        HardDisk.builder().diskpath(adminDisk(instanceName)).controllerPort(0).deviceSlot(1)
-                                 .autoDelete(true).build()).attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec instanceVmSpec = VmSpec.builder().id(instanceName).name(instanceName).osTypeId("").memoryMB(512)
-               .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      injector = view.utils().injector();
-      IsoSpec isoSpec = IsoSpec
-               .builder()
-               .sourcePath(operatingSystemIso)
-               .installationScript(keystrokeSequence).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.HostOnly)
-               .build();
-      NetworkInterfaceCard networkInterfaceCard =  NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-            .addHostInterfaceName("vboxnet0").slot(0L).build();
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-      machineSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();
-   }
-
-   @Test
-   public void testGuestAdditionsAreInstalled() throws Exception {
-      try {
-         IMachine machine = cloneFromMaster();
-         machineController.ensureMachineIsLaunched(machine.getName());
-
-         sshClientForIMachine = injector.getInstance(IMachineToSshClient.class);
-         SshClient client = sshClientForIMachine.apply(machine);
-
-         sshResponds = injector.getInstance(SshResponds.class);
-         checkState(sshResponds.apply(client), "timed out waiting for guest %s to be accessible via ssh",
-                  machine.getName());
-
-         String version = machine.getGuestPropertyValue("/VirtualBox/GuestAdd/Version");
-         
-         assertTrue(version != null && !version.isEmpty());
-      } finally {
-         for (VmSpec spec : ImmutableSet.of(machineSpec.getVmSpec())) {
-            machineController.ensureMachineIsShutdown(spec.getVmName());
-         }
-      }
-   }
-
-   private IMachine cloneFromMaster() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
-               .master(source).linked(true).build();
-      return new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-               .apply(cloneSpec);
-   }
-   
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      for (String vmName : ImmutableSet.of(instanceName)) {
-         undoVm(vmName);
-      }
-      super.tearDownContext();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java
deleted file mode 100644
index 9a982e1..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java
+++ /dev/null
@@ -1,123 +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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-import java.util.UUID;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest")
-public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private String ideControllerName;
-   private CleanupMode mode;
-   private String vmName = "";
-
-   @Override
-   public void setupContext() {
-      super.setupContext();
-      ideControllerName = "IDE Controller";
-      mode = CleanupMode.Full;
-   }
-
-   @Test
-   public void testCreateNewMachine() throws Exception {
-      vmName = "jclouds-test-create-1-node";
-      String vmId = UUID.randomUUID().toString();
-
-      StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(HardDisk.builder().diskpath(adminDisk(vmName)).controllerPort(0).deviceSlot(1).build())
-               .attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).controller(ideController).cleanUpMode(mode)
-               .osTypeId("Debian").forceOverwrite(true).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
-               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-               .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-
-      MasterSpec machineSpec = MasterSpec.builder()
-               .iso(IsoSpec.builder().sourcePath(operatingSystemIso).installationScript("").build()).vm(vmSpec)
-               .network(networkSpec).build();
-      IMachine debianNode = view.utils().injector()
-               .getInstance(CreateAndRegisterMachineFromIsoIfNotAlreadyExists.class).apply(machineSpec);
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      assertEquals(debianNode.getName(), machine.getName());
-      undoVm(vmName);
-
-   }
-
-   @Test
-   public void testCreateNewMachineWithBadOsType() throws Exception {
-      vmName = "jclouds-test-create-2-node";
-      String vmId = UUID.randomUUID().toString();
-
-      StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(HardDisk.builder().diskpath(adminDisk(vmName)).controllerPort(0).deviceSlot(1).build())
-               .attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).controller(ideController).cleanUpMode(mode)
-               .osTypeId("SomeWeirdUnknownOs").forceOverwrite(true).build();
-      IsoSpec isoSpec = IsoSpec.builder().sourcePath(operatingSystemIso).installationScript("").build();
-      NetworkSpec networkSpec = NetworkSpec.builder().build();
-      MasterSpec machineSpec = MasterSpec.builder().iso(isoSpec).vm(vmSpec).network(networkSpec).build();
-      try {
-         Injector injector = view.utils().injector();
-         injector.getInstance(CreateAndRegisterMachineFromIsoIfNotAlreadyExists.class).apply(machineSpec);
-         fail();
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         // According to the documentation VBOX_E_OBJECT_NOT_FOUND
-         // if osTypeId is not found.
-         assertEquals(errorCode, ErrorCode.VBOX_E_OBJECT_NOT_FOUND);
-      }
-      undoVm(vmName);
-   }
-   
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      super.tearDownContext();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java
deleted file mode 100644
index 889115c..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java
+++ /dev/null
@@ -1,162 +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.virtualbox.functions;
-
-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.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.util.List;
-
-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_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.beust.jcommander.internal.Lists;
-import com.google.common.base.Suppliers;
-
-@Test(groups = "unit", testName = "CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest")
-public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest {
-
-   @Test(enabled = false)
-   public void testCreateAndSetMemoryWhenNotAlreadyExists() throws Exception {
-
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-      VirtualBoxManager manager = createMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createMock(IVirtualBox.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(CleanupMode.Full).build();
-      MasterSpec machineSpec = MasterSpec.builder()
-            .iso(IsoSpec.builder().sourcePath("some.iso").installationScript("").build()).vm(vmSpec)
-            .network(NetworkSpec.builder().build()).build();
-      IMachine createdMachine = createMock(IMachine.class);
-      ISession session = createMock(ISession.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      String flags = "";
-      List<String> groups = Lists.newArrayList();
-      String group = "";
-      expect(vBox.composeMachineFilename(vmName, group, flags, "/tmp/workingDir")).andReturn("settingsFile");
-
-      StringBuilder errorMessageBuilder = new StringBuilder();
-      errorMessageBuilder.append("VirtualBox error: Could not find a registered machine with UUID {");
-      errorMessageBuilder.append("'jclouds-image-virtualbox-iso-to-machine-test'} (0x80BB0001)");
-      String errorMessage = errorMessageBuilder.toString();
-      VBoxException vBoxException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-
-      expect(vBox.findMachine(vmName)).andThrow(vBoxException);
-
-      expect(vBox.createMachine(anyString(), eq(vmName), groups, anyString(), anyString())).andReturn(createdMachine)
-            .anyTimes();
-      vBox.registerMachine(createdMachine);
-
-      expect(vBox.findMachine(vmName)).andReturn(createdMachine).anyTimes();
-      expect(manager.getSessionObject()).andReturn(session);
-      expect(session.getMachine()).andReturn(createdMachine);
-      createdMachine.lockMachine(session, LockType.Write);
-      createdMachine.setMemorySize(1024l);
-      createdMachine.saveSettings();
-      session.unlockMachine();
-
-      // TODO: this mock test is not finished.
-      replay(manager, createdMachine, vBox, session);
-
-      new CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils,
-            "/tmp/workingDir").apply(machineSpec);
-
-      verify(manager, createdMachine, vBox, session);
-   }
-
-   @Test(expectedExceptions = IllegalStateException.class)
-   public void testFailIfMachineIsAlreadyRegistered() throws Exception {
-
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      String vmName = "jclouds-image-my-ubuntu-image";
-
-      IMachine registeredMachine = createMock(IMachine.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.findMachine(vmName)).andReturn(registeredMachine).anyTimes();
-
-      replay(manager, vBox, machineUtils);
-
-      VmSpec launchSpecification = VmSpec.builder().id(vmName).name(vmName).osTypeId("").memoryMB(1024)
-            .cleanUpMode(CleanupMode.Full).build();
-
-      MasterSpec machineSpec = MasterSpec.builder()
-            .iso(IsoSpec.builder().sourcePath("some.iso").installationScript("dostuff").build())
-            .vm(launchSpecification).network(NetworkSpec.builder().build()).build();
-      new CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils,
-            "/tmp/workingDir").apply(machineSpec);
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailIfOtherVBoxExceptionIsThrown() throws Exception {
-
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      String vmName = "jclouds-image-my-ubuntu-image";
-
-      String errorMessage = "VirtualBox error: Some other VBox error";
-      VBoxException vBoxException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-
-      vBox.findMachine(vmName);
-      expectLastCall().andThrow(vBoxException);
-
-      replay(manager, vBox, machineUtils);
-
-      VmSpec launchSpecification = VmSpec.builder().id(vmName).name(vmName).osTypeId("").cleanUpMode(CleanupMode.Full)
-            .memoryMB(1024).build();
-      MasterSpec machineSpec = MasterSpec.builder()
-            .iso(IsoSpec.builder().sourcePath("some.iso").installationScript("dostuff").build())
-            .vm(launchSpecification).network(NetworkSpec.builder().build()).build();
-
-      new CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils,
-            "/tmp/workingDir").apply(machineSpec);
-
-   }
-
-   private String anyString() {
-      return EasyMock.<String> anyObject();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java
deleted file mode 100644
index 42bc5b8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java
+++ /dev/null
@@ -1,88 +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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.File;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.AccessMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.VBoxException;
-
-public class CreateMediumIfNotAlreadyExistsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   @Test
-   public void testCreateMedium() throws Exception {
-      String path = System.getProperty("user.home") + "/jclouds-virtualbox-test/test-medium-1.vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(path).controllerPort(0).deviceSlot(0).build();
-      IMedium iMedium = new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-      manager.get().getVBox().openMedium(path, DeviceType.HardDisk, AccessMode.ReadWrite, true);
-      try {
-         assertFileCanBeDeleted(path);
-      } finally {
-         deleteMediumAndBlockUntilComplete(iMedium);
-      }
-   }
-
-   @Test
-   public void testCreateMediumFailWhenUsingNonFullyQualifiedPath() throws Exception {
-      String path = "test-medium-2.vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(path).controllerPort(0).deviceSlot(0).build();
-      try {
-         new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-         fail();
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         assertEquals(errorCode, ErrorCode.VBOX_E_FILE_ERROR);
-      }
-   }
-
-   @Test
-   public void testCreateSameMediumTwiceWhenUsingOverwrite() throws Exception {
-      String path = System.getProperty("user.home") + "/jclouds-virtualbox-test/test-medium-3.vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(path).controllerPort(0).deviceSlot(0).build();
-      new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-      IMedium iMedium = new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-      manager.get().getVBox().openMedium(path, DeviceType.HardDisk, AccessMode.ReadWrite, true);
-      try {
-         assertFileCanBeDeleted(path);
-      } finally {
-         deleteMediumAndBlockUntilComplete(iMedium);
-      }
-   }
-
-   private void assertFileCanBeDeleted(String path) {
-      File file = new File(path);
-      boolean mediumDeleted = file.delete();
-      assertTrue(mediumDeleted);
-   }
-
-   void deleteMediumAndBlockUntilComplete(IMedium medium) {
-      final IProgress progress = medium.deleteStorage();
-      progress.waitForCompletion(-1);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java
deleted file mode 100644
index 1fbafe3..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java
+++ /dev/null
@@ -1,242 +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.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.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertNotSame;
-
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.AccessMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IMediumAttachment;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-
-public class CreateMediumIfNotAlreadyExistsTest {
-   
-   private String adminDiskPath;
-   private String diskFormat;
-
-   @BeforeMethod
-   public void setUp() throws Exception {
-      adminDiskPath = "/Users/johndoe/jclouds-virtualbox-images/admin.vdi";
-      diskFormat = "vdi";
-   }
-
-   @Test
-   public void testCreateMediumWhenDiskDoesNotExists() throws Exception {
-
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("org.virtualbox_4_2.VBoxException: VirtualBox error: ");
-      errorBuilder.append("Could not find file for the medium ");
-      errorBuilder.append("'/Users/johndoe/jclouds-virtualbox-test/testadmin.vdi' (0x80BB0001)");
-      String errorMessage = errorBuilder.toString();
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-
-      VBoxException notFoundException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andThrow(notFoundException);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(medium);
-      expect(medium.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-      //expect(machineUtils.writeLockMachineAndApply(anyString(), new DetachDistroMediumFromMachine(anyString(), anyInt() , anyInt()))).andReturn().anyTimes();
-
-      replay(manager, machine, vBox, medium, machineUtils);
-
-      new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-
-      verify(machine, vBox);
-
-   }
-
-   @Test
-   public void testDeleteAndCreateNewStorageWhenMediumExistsAndUsingOverwrite() throws Exception {
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IMedium newHardDisk = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andReturn(medium);
-
-      expect(medium.deleteStorage()).andReturn(progress);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(newHardDisk);
-      expect(newHardDisk.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      //expect(machineUtils.writeLockMachineAndApply(anyString(), new DetachDistroMediumFromMachine(anyString(), anyInt() , anyInt()))).andReturn(v).anyTimes();
-
-      replay(manager, machine, vBox, medium, newHardDisk, progress, machineUtils);
-
-      IMedium newDisk =  new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-
-      verify(machine, vBox, medium);
-      assertNotSame(newDisk, medium);
-   }
-
-   @Test(enabled = false)
-   public void testDeleteAndCreateNewStorageWhenMediumExistsAndUsingOverwriteAndStillAttachedDetachesOldThing()
-            throws Exception {
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-
-      IMedium newHardDisk = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andReturn(medium);
-
-      String oldMachineId = "a1e03931-29f3-4370-ada3-9547b1009212";
-      String oldMachineName = "oldMachine";
-      IMachine oldMachine = createMock(IMachine.class);
-      IMediumAttachment oldAttachment = createMock(IMediumAttachment.class);
-      String oldAttachmentController = "oldAttachmentController";
-      int oldAttachmentDevice = 1;
-      int oldAttachmentPort = 2;
-      IMedium oldMedium = createMock(IMedium.class);
-      String oldMediumId = "oldMediumId";
-      ISession detachSession = createNiceMock(ISession.class);
-
-      StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("org.virtualbox_4_2.VBoxException: VirtualBox error: ");
-      errorBuilder.append("Cannot delete storage: medium '/Users/adriancole/jclouds-virtualbox-test/testadmin.vdi ");
-      errorBuilder.append("is still attached to the following 1 virtual machine(s): ");
-      errorBuilder.append(oldMachineId + " (0x80BB000C)");
-      String errorMessage = errorBuilder.toString();
-
-      VBoxException stillAttached = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-      expect(medium.deleteStorage()).andThrow(stillAttached);
-
-      expect(vBox.findMachine(oldMachineId)).andReturn(oldMachine);
-      expect(oldMachine.getMediumAttachments()).andReturn(ImmutableList.of(oldAttachment));
-      expect(oldAttachment.getMedium()).andReturn(oldMedium);
-      expect(oldMedium.getId()).andReturn(oldMediumId);
-      // in this case, they are the same medium, so safe to detach
-      expect(medium.getId()).andReturn(oldMediumId);
-      expect(oldMachine.getName()).andReturn(oldMachineName);
-      expect(oldAttachment.getController()).andReturn(oldAttachmentController);
-      expect(oldAttachment.getDevice()).andReturn(oldAttachmentDevice);
-      expect(oldAttachment.getPort()).andReturn(oldAttachmentPort);
-      // TODO: is this ok that we searched by ID last time?
-      expect(vBox.findMachine(oldMachineName)).andReturn(oldMachine);
-      expect(manager.getSessionObject()).andReturn(detachSession);
-      oldMachine.lockMachine(detachSession, LockType.Write);
-      expect(detachSession.getMachine()).andReturn(oldMachine);
-      oldMachine.detachDevice(oldAttachmentController, oldAttachmentPort, oldAttachmentDevice);
-      oldMachine.saveSettings();
-
-      expect(medium.deleteStorage()).andReturn(progress);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(newHardDisk);
-      expect(newHardDisk.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      replay(manager, oldMachine, oldAttachment, oldMedium, detachSession, machine, vBox, medium, newHardDisk, progress, machineUtils);
-
-      IMedium newDisk = new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-
-      verify(machine, oldMachine, oldAttachment, detachSession, oldMedium, vBox, medium);
-      assertNotSame(newDisk, medium);
-   }
-
-   @Test(expectedExceptions = IllegalStateException.class)
-   public void testFailWhenMediumExistsAndNotUsingOverwrite() throws Exception {
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IMedium newHardDisk = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andReturn(medium);
-
-      replay(manager, machine, vBox, medium, newHardDisk, progress, machineUtils);
-
-      new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, false).apply(hardDisk);
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailOnOtherVBoxException() throws Exception {
-
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      String errorMessage = "VirtualBox error: Some other VBox error";
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-
-      VBoxException notFoundException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andThrow(notFoundException);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(medium);
-      expect(medium.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      replay(manager, machine, vBox, medium, machineUtils);
-
-      new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-   }
-
-   private HardDisk createTestHardDisk() {
-      return HardDisk.builder().diskpath(adminDiskPath).controllerPort(0).deviceSlot(0).build();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java
deleted file mode 100644
index 0bfbc07..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java
+++ /dev/null
@@ -1,106 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VBoxException;
-
-@Test(groups = "unit", testName = "DetachDistroMediumFromMachineTest")
-public class DetachDistroMediumFromMachineTest {
-
-   @Test
-   public void testDetachDistroMedium() throws Exception {
-
-      String controller = "IDE Controller";
-      IMachine machine = createMock(IMachine.class);
-
-      int controllerPort = 0;
-      int device = 1;
-
-      machine.saveSettings();
-      machine.detachDevice(controller, controllerPort, device);
-
-      replay(machine);
-
-      new DetachDistroMediumFromMachine(controller, controllerPort, device).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test
-   public void testAcceptAlreadyDetachedDistroMedium() throws Exception {
-
-      String controller = "IDE Controller";
-
-      IMachine machine = createNiceMock(IMachine.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Medium '/Users/johndoe/jclouds-virtualbox-test/ubuntu-11.04-server-i386.iso' ");
-      errorBuilder.append("is already detached from port 0, device 0 of controller 'IDE Controller' ");
-      errorBuilder.append("of this virtual machine (0x80BB000C)");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      int controllerPort = 0;
-      int device = 1;
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class), isoAlreadyAttachedException);
-      machine.detachDevice(controller, controllerPort, device);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(machine);
-
-      new DetachDistroMediumFromMachine(controller, controllerPort, device).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailOnOtherVBoxErrors() throws Exception {
-
-      String controllerName = "IDE Controller";
-
-      IMachine machine = createNiceMock(IMachine.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Some other VBox error");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      int controllerPort = 0;
-      int device = 1;
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class), isoAlreadyAttachedException);
-      machine.detachDevice(controllerName, controllerPort, device);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(machine);
-
-      new DetachDistroMediumFromMachine(controllerName, controllerPort, device).apply(machine);
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java
deleted file mode 100644
index 2475815..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java
+++ /dev/null
@@ -1,69 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-
-@Test(groups = "unit")
-public class IMachineToHardwareTest {
-
-   @Test
-   public void testConvert() throws Exception {
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-
-      String linuxDescription = "Ubuntu Linux 10.04";
-      String machineName = "hw-machineId";
-
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vm.getName()).andReturn(machineName).anyTimes();
-
-      expect(vm.getDescription()).andReturn(linuxDescription).anyTimes();
-
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vbm.getVBox()).andReturn(vBox);
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      Hardware hardware = new IMachineToHardware(Suppliers.ofInstance(vbm)).apply(vm);
-
-      assertEquals(hardware.getId(), machineName);
-      assertEquals(hardware.getProviderId(), machineName);
-      // for starters assume 1-to-1 relationship hardware to image (which
-      // correlate to a single source IMachine)
-      assertEquals(hardware.supportsImage().toString(), ImagePredicates.idEquals(machineName).toString());
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java
deleted file mode 100644
index 3f9f7e8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java
+++ /dev/null
@@ -1,156 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Map;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-import com.google.inject.Guice;
-
-@Test(groups = "unit", testName = "IMachineToImageTest")
-public class IMachineToImageTest {
-
-   Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-            .getInstance(Json.class));
-
-   @Test
-   public void testConvert() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-      String linuxDescription = "Ubuntu 10.04";
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vm.getName()).andReturn(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX + "my-vm-id").anyTimes();
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vm.getDescription()).andReturn("my-ubuntu-machine").anyTimes();
-      expect(guestOsType.getDescription()).andReturn(linuxDescription).anyTimes();
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-      expect(vm.getState()).andReturn(MachineState.PoweredOff);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
-               .ofInstance(vbm), map);
-
-      Image image = fn.apply(vm);
-
-      assertEquals(image.getDescription(), "my-ubuntu-machine");
-      assertEquals(image.getOperatingSystem().getDescription(), linuxDescription);
-      assertTrue(image.getOperatingSystem().is64Bit());
-      assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
-      assertEquals(image.getOperatingSystem().getVersion(), "10.04");
-      assertEquals(image.getId(), "my-vm-id");
-      assertEquals(image.getStatus(), Image.Status.AVAILABLE);
-
-   }
-
-   @Test
-   public void testConvert1() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-      String guestOsDescription = "ubuntu 11.04 server (i386)";
-      String vmDescription = "ubuntu-11.04-server-i386";
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-
-      expect(vm.getName()).andReturn(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX + "my-vm-id").anyTimes();
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vm.getDescription()).andReturn(vmDescription).anyTimes();
-      expect(guestOsType.getDescription()).andReturn(guestOsDescription).anyTimes();
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-      expect(vm.getState()).andReturn(MachineState.Running);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
-               .ofInstance(vbm), map);
-
-      Image image = fn.apply(vm);
-
-      assertEquals(image.getDescription(), vmDescription);
-      assertEquals(image.getOperatingSystem().getDescription(), guestOsDescription);
-      assertTrue(image.getOperatingSystem().is64Bit());
-      assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
-      assertEquals(image.getOperatingSystem().getVersion(), "11.04");
-      assertEquals(image.getId(), "my-vm-id");
-      assertEquals(image.getStatus(), Image.Status.PENDING);
-
-   }
-
-   @Test
-   public void testUnparseableOsString() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-
-      expect(vm.getName()).andReturn(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX + "my-vm-id").anyTimes();
-      String unknownOsDescription = "SomeOtherOs 2.04";
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vm.getDescription()).andReturn("my-unknown-machine").anyTimes();
-      expect(guestOsType.getDescription()).andReturn(unknownOsDescription).anyTimes();
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vm.getState()).andReturn(MachineState.PoweredOff);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
-               .ofInstance(vbm), map);
-
-      Image image = fn.apply(vm);
-
-      assertEquals(image.getOperatingSystem().getDescription(), "SomeOtherOs 2.04");
-      assertEquals(image.getOperatingSystem().getVersion(), "");
-      assertEquals(image.getId(), "my-vm-id");
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java
deleted file mode 100644
index 66288f8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java
+++ /dev/null
@@ -1,140 +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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INATEngine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.inject.Guice;
-
-public class IMachineToNodeMetadataTest {
-
-   private static final String MASTER_NAME = "mock-image-of-a-server";
-   Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-            .getInstance(Json.class));
-
-   @Test(enabled = false)
-   public void testCreateFromMaster() throws Exception {
-
-      IMachine vm = createNiceMock(IMachine.class);
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IGuestOSType iGuestOSType = createNiceMock(IGuestOSType.class);
-      INetworkAdapter nat = createNiceMock(INetworkAdapter.class);
-      INATEngine natEng = createNiceMock(INATEngine.class);
-
-      expect(vm.getName()).andReturn(VIRTUALBOX_IMAGE_PREFIX + MASTER_NAME).anyTimes();
-      expect(vm.getState()).andReturn(MachineState.PoweredOff).anyTimes();
-      expect(vm.getNetworkAdapter(eq(0l))).andReturn(nat).once();
-      expect(vm.getNetworkAdapter(eq(1l))).andReturn(null).once();
-      expect(nat.getAttachmentType()).andReturn(NetworkAttachmentType.NAT).once();
-      expect(nat.getNATEngine()).andReturn(natEng).anyTimes();
-      expect(natEng.getHostIP()).andReturn("127.0.0.1").once();
-      expect(natEng.getRedirects()).andReturn(ImmutableList.of("0,1,127.0.0.1,2222,,22"));
-      
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-      expect(vm.getOSTypeId()).andReturn("RedHat_64").anyTimes();
-      expect(vBox.getGuestOSType(vm.getOSTypeId())).andReturn(iGuestOSType);
-      
-      INetworkAdapter hostOnly = createNiceMock(INetworkAdapter.class);
-      NetworkUtils networkUtils = createNiceMock(NetworkUtils.class);
-
-      replay(vm, vBox, iGuestOSType, nat, natEng, hostOnly, networkUtils);
-
-      NodeMetadata node = new IMachineToNodeMetadata(Suppliers
-              .ofInstance(vbm), VirtualBoxComputeServiceContextModule.toPortableNodeStatus,
-            networkUtils, map).apply(vm);
-
-      assertEquals(MASTER_NAME, node.getName());
-      assertEquals(1, node.getPrivateAddresses().size());
-      assertEquals(1, node.getPublicAddresses().size());
-      assertEquals("127.0.0.1", Iterables.get(node.getPublicAddresses(), 0));
-      assertEquals(NetworkUtils.MASTER_PORT, node.getLoginPort());
-      assertEquals("", node.getGroup());
-   }
-
-   @Test(enabled = false)
-   public void testCreateFromNode() throws Exception {
-
-      IMachine vm = createNiceMock(IMachine.class);
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-      String group = "my-cluster-group";
-      String name = "a-name-with-a-code-338";
-
-      expect(vm.getName()).andReturn(
-               VIRTUALBOX_NODE_PREFIX + MASTER_NAME + VIRTUALBOX_NODE_NAME_SEPARATOR + group
-                        + VIRTUALBOX_NODE_NAME_SEPARATOR + name).anyTimes();
-      expect(vm.getState()).andReturn(MachineState.PoweredOff).anyTimes();
-
-      INetworkAdapter nat = createNiceMock(INetworkAdapter.class);
-      INATEngine natEng = createNiceMock(INATEngine.class);
-      
-      INetworkAdapter hostOnly = createNiceMock(INetworkAdapter.class);
-
-
-
-      expect(vm.getNetworkAdapter(eq(0l))).andReturn(nat).once();
-      expect(vm.getNetworkAdapter(eq(1l))).andReturn(hostOnly).once();
-      expect(nat.getAttachmentType()).andReturn(NetworkAttachmentType.NAT).once();
-      expect(nat.getNATEngine()).andReturn(natEng).anyTimes();
-      expect(natEng.getHostIP()).andReturn("127.0.0.1").once();
-      expect(natEng.getRedirects()).andReturn(ImmutableList.of("0,1,127.0.0.1,3000,,22"));
-      NetworkUtils networkUtils = createNiceMock(NetworkUtils.class);
-
-      replay(vm, nat, natEng, hostOnly, networkUtils);
-
-      NodeMetadata node = new IMachineToNodeMetadata(Suppliers
-              .ofInstance(vbm), VirtualBoxComputeServiceContextModule.toPortableNodeStatus,
-            networkUtils, map).apply(vm);
-
-      assertEquals(name, node.getName());
-      assertEquals(group, node.getGroup());
-      assertEquals(1, node.getPublicAddresses().size());
-   }
-}


[5/9] JCLOUDS-758 Drop VirtualBox labs provider.

Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMediumPredicates.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMediumPredicates.java b/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMediumPredicates.java
deleted file mode 100644
index 7cee923..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/IMediumPredicates.java
+++ /dev/null
@@ -1,91 +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.virtualbox.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.equalTo;
-import static com.google.common.collect.Iterables.any;
-
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMedium;
-
-import com.google.common.base.Predicate;
-
-public class IMediumPredicates {
-   public static class DeviceTypeEquals implements Predicate<IMedium> {
-      private final DeviceType deviceType;
-
-      public DeviceTypeEquals(DeviceType deviceType) {
-         this.deviceType = checkNotNull(deviceType, "deviceType");
-      }
-
-      @Override
-      public boolean apply(IMedium arg0) {
-         return deviceType.equals(arg0.getDeviceType());
-      }
-
-      @Override
-      public String toString() {
-         return "deviceTypeEquals(" + deviceType + ")";
-      }
-   }
-
-   public static Predicate<IMedium> deviceTypeEquals(DeviceType deviceType) {
-      return new DeviceTypeEquals(deviceType);
-   }
-
-   public static enum HasParent implements Predicate<IMedium> {
-      INSTANCE;
-
-      @Override
-      public boolean apply(IMedium arg0) {
-         return arg0.getParent() != null;
-      }
-
-      @Override
-      public String toString() {
-         return "hasParent()";
-      }
-   }
-
-   public static Predicate<IMedium> hasParent() {
-      return HasParent.INSTANCE;
-   }
-
-   public static class MachineIdsContain implements Predicate<IMedium> {
-      private final String id;
-
-      public MachineIdsContain(String id) {
-         this.id = checkNotNull(id, "id");
-      }
-
-      @Override
-      public boolean apply(IMedium arg0) {
-         return any(arg0.getMachineIds(), equalTo(id));
-      }
-
-      @Override
-      public String toString() {
-         return "machineIdsContain(" + id + ")";
-      }
-   }
-
-   public static Predicate<IMedium> machineIdsContain(String id) {
-      return new MachineIdsContain(id);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpen.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpen.java b/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpen.java
deleted file mode 100644
index 73ad969..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/RetryIfSocketNotYetOpen.java
+++ /dev/null
@@ -1,94 +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.virtualbox.predicates;
-
-import static org.jclouds.util.Predicates2.retry;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
-import org.jclouds.logging.Logger;
-import org.jclouds.predicates.SocketOpen;
-
-import com.google.common.base.Predicate;
-import com.google.common.net.HostAndPort;
-
-/**
- * 
- * 
- * Not singleton as seconds are mutable
- */
-public class RetryIfSocketNotYetOpen implements Predicate<HostAndPort> {
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   private Logger logger = Logger.NULL;
-   private final SocketOpen socketTester;
-   private long timeoutValue;
-   private TimeUnit timeoutUnits;
-
-
-   public RetryIfSocketNotYetOpen(SocketOpen socketTester, Logger logger, long timeoutValue, TimeUnit timeoutUnits) {
-      this.socketTester = socketTester;
-      this.logger = logger;
-      this.timeoutValue = timeoutValue;
-      this.timeoutUnits = timeoutUnits;
-   }
-   
-   public RetryIfSocketNotYetOpen(SocketOpen socketTester, Logger logger) {
-      this(socketTester, logger, 0, TimeUnit.MILLISECONDS);
-   }
-
-   @Inject
-   public RetryIfSocketNotYetOpen(SocketOpen socketTester, Timeouts timeouts) {
-       this(socketTester, Logger.NULL, timeouts.portOpen, TimeUnit.MILLISECONDS);
-   }
-
-   public RetryIfSocketNotYetOpen milliseconds(long milliseconds) {
-       this.timeoutValue = milliseconds;
-       this.timeoutUnits = TimeUnit.MILLISECONDS;
-       return this;
-   }
-   
-   public RetryIfSocketNotYetOpen seconds(long seconds) {
-      this.timeoutValue = seconds;
-      this.timeoutUnits = TimeUnit.SECONDS;
-      return this;
-   }
-
-   @Override
-   public String toString() {
-      return "retryIfSocketNotYetOpen(" + timeoutValue + " " + timeoutUnits + ")";
-   }
-
-   @Override
-   public boolean apply(HostAndPort socket) {
-      logger.debug(">> blocking on socket %s for %d %s", socket, timeoutValue, timeoutUnits);
-      // Specify a retry period of 1s, expressed in the same time units.
-      long period = timeoutUnits.convert(1, TimeUnit.SECONDS);
-      boolean passed = retry(socketTester, timeoutValue, period, timeoutUnits).apply(socket);
-      if (passed)
-         logger.debug("<< socket %s opened", socket);
-      else
-         logger.warn("<< socket %s didn't open after %d %s", socket, timeoutValue, timeoutUnits);
-      return passed;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshAvailable.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshAvailable.java b/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshAvailable.java
deleted file mode 100644
index 54546bf..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshAvailable.java
+++ /dev/null
@@ -1,65 +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.virtualbox.predicates;
-
-import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.ssh.SshException;
-
-import com.google.common.base.Predicate;
-
-public class SshAvailable implements Predicate<String> {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final ComputeServiceContext context;
-
-   public SshAvailable(ComputeServiceContext context) {
-      this.context = context;
-   }
-
-   @Override
-   public boolean apply(String nodeId) {
-      boolean sshDaemonIsRunning = false;
-      try {
-         if (context.getComputeService()
-               .runScriptOnNode(nodeId, "id", wrapInInitScript(false).runAsRoot(false))
-               .getExitStatus() == 0) {
-            logger.debug("Got response from ssh daemon running on %s", nodeId);
-            sshDaemonIsRunning = true;
-         }
-      } catch (SshException e) {
-         logger.debug("No response from ssh daemon running on %s", nodeId);
-         return sshDaemonIsRunning;
-      } 
-      return sshDaemonIsRunning;
-   }
-
-   @Override
-   public String toString() {
-      return "sshAvailable()";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshResponds.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshResponds.java b/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshResponds.java
deleted file mode 100644
index 9ab3dba..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/predicates/SshResponds.java
+++ /dev/null
@@ -1,48 +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.virtualbox.predicates;
-
-import javax.annotation.Resource;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.ssh.SshException;
-
-import com.google.common.base.Predicate;
-
-public class SshResponds implements Predicate<SshClient> {
-   @Resource
-   protected Logger logger = Logger.NULL;
-
-   @Override
-   public boolean apply(SshClient client) {
-
-      try {
-         client.connect();
-         if (client.exec("id").getExitStatus() == 0) {
-            return true;
-         }
-      } catch (SshException e) {
-         logger.trace("No response from ssh daemon connecting to %s: %s", client, e.getMessage());
-      } finally {
-        if (client != null) {
-         client.disconnect();
-        }
-      }
-      return false;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/settings/KeyboardScancodes.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/settings/KeyboardScancodes.java b/virtualbox/src/main/java/org/jclouds/virtualbox/settings/KeyboardScancodes.java
deleted file mode 100644
index 7c650ef..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/settings/KeyboardScancodes.java
+++ /dev/null
@@ -1,162 +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.virtualbox.settings;
-
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-
-/**
- * 
- * @see <a href="http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html" />
- */
-public class KeyboardScancodes {
-
-   public static final Multimap<String, Integer> NORMAL_KEYBOARD_BUTTON_MAP_LIST = ImmutableMultimap
-         .<String, Integer> builder()
-         
-            .putAll("1", 0x02, 0x82)
-            .putAll("2", 0x03, 0x83)
-            .putAll("3", 0x04, 0x84)
-            .putAll("4", 0x05, 0x85)
-            .putAll("5", 0x06, 0x86)
-            .putAll("6", 0x07, 0x87)
-            .putAll("7", 0x08, 0x88)
-            .putAll("8", 0x09, 0x89)
-            .putAll("9", 0x0a, 0x8a)
-            .putAll("0", 0x0b, 0x8b)
-
-            .putAll("-", 0x0c, 0x8c)
-            .putAll("=", 0x0d, 0x8d)
-            .putAll("Tab", 0x0f, 0x8f)
-            .putAll("q", 0x10, 0x90)
-            .putAll("w", 0x11, 0x91)
-            .putAll("e", 0x12, 0x92)
-            .putAll("r", 0x13, 0x93)
-            .putAll("t", 0x14, 0x94)
-            .putAll("y", 0x15, 0x95)
-            .putAll("u", 0x16, 0x96)
-            .putAll("i", 0x17, 0x97)
-            .putAll("o", 0x18, 0x98)
-            .putAll("p", 0x19, 0x99)
-
-            .putAll("Q", 0x2a, 0x10, 0xaa)
-            .putAll("W", 0x2a, 0x11, 0xaa)
-            .putAll("E", 0x2a, 0x12, 0xaa)
-            .putAll("R", 0x2a, 0x13, 0xaa)
-            .putAll("T", 0x2a, 0x14, 0xaa)
-            .putAll("Y", 0x2a, 0x15, 0xaa)
-            .putAll("U", 0x2a, 0x16, 0xaa)
-            .putAll("I", 0x2a, 0x17, 0xaa)
-            .putAll("O", 0x2a, 0x18, 0xaa)
-            .putAll("P", 0x2a, 0x19, 0xaa)
-
-            .putAll("a", 0x1e, 0x9e)
-            .putAll("s", 0x1f, 0x9f)
-            .putAll("d", 0x20, 0xa0)
-            .putAll("f", 0x21, 0xa1)
-            .putAll("g", 0x22, 0xa2)
-            .putAll("h", 0x23, 0xa3)
-            .putAll("j", 0x24, 0xa4)
-            .putAll("k", 0x25, 0xa5)
-            .putAll("l", 0x26, 0xa6)
-
-            .putAll("A", 0x2a, 0x1e, 0xaa, 0x9e)
-            .putAll("S", 0x2a, 0x1f, 0xaa, 0x9f)
-            .putAll("D", 0x2a, 0x20, 0xaa, 0xa0)
-            .putAll("F", 0x2a, 0x21, 0xaa, 0xa1)
-            .putAll("G", 0x2a, 0x22, 0xaa, 0xa2)
-            .putAll("H", 0x2a, 0x23, 0xaa, 0xa3)
-            .putAll("J", 0x2a, 0x24, 0xaa, 0xa4)
-            .putAll("K", 0x2a, 0x25, 0xaa, 0xa5)
-            .putAll("L", 0x2a, 0x26, 0xaa, 0xa6)
-
-            .putAll(") ", 0x27, 0xa7)
-            .putAll("\"", 0x2a, 0x28, 0xaa, 0xa8)
-            .putAll("\"", 0x28, 0xa8)
-            .putAll("\\", 0x2b, 0xab)
-            .putAll("|", 0x2a, 0x2b, 0xaa, 0x8b)
-            .putAll("[", 0x1a, 0x9a)
-            .putAll("", 0x1b, 0x9b)
-            .putAll("<", 0x2a, 0x33, 0xaa, 0xb3)
-            .putAll(">", 0x2a, 0x34, 0xaa, 0xb4)
-            .putAll("$", 0x2a, 0x05, 0xaa, 0x85)
-            .putAll("+", 0x2a, 0x0d, 0xaa, 0x8d)
-            
-            .putAll("z", 0x2c, 0xac)
-            .putAll("x", 0x2d, 0xad)
-            .putAll("c", 0x2e, 0xae)
-            .putAll("v", 0x2f, 0xaf)
-            .putAll("b", 0x30, 0xb0)
-            .putAll("n", 0x31, 0xb1)
-            .putAll("m", 0x32, 0xb2)
-            .putAll("Z", 0x2a, 0x2c, 0xaa, 0xac)
-            .putAll("X", 0x2a, 0x2d, 0xaa, 0xad)
-            .putAll("C", 0x2a, 0x2e, 0xaa, 0xae)
-            .putAll("V", 0x2a, 0x2f, 0xaa, 0xaf)
-            .putAll("B", 0x2a, 0x30, 0xaa, 0xb0)
-            .putAll("N", 0x2a, 0x31, 0xaa, 0xb1)
-            .putAll("M", 0x2a, 0x32, 0xaa, 0xb2)
-
-            .putAll(",", 0x33, 0xb3)
-            .putAll(".", 0x34, 0xb4)
-            .putAll("/", 0x35, 0xb5)
-            .putAll(":", 0x2a, 0x27, 0xaa, 0xa7)
-            .putAll("%", 0x2a, 0x06, 0xaa, 0x86)
-            .putAll("_", 0x2a, 0x0c, 0xaa, 0x8c)
-            .putAll("&", 0x2a, 0x08, 0xaa, 0x88)
-            .putAll("(", 0x2a, 0x0a, 0xaa, 0x8a)
-            .putAll(")", 0x2a, 0x0b, 0xaa, 0x8b)
-            .putAll("#", 0x2a, 0x04, 0xaa, 0x85)
-            
-            .build();
-
-
-   public static final Multimap<String, Integer> SPECIAL_KEYBOARD_BUTTON_MAP_LIST = ImmutableMultimap
-         .<String, Integer> builder()
-         
-            .putAll("<Enter>", 0x1c, 0x9c)
-            .putAll("<Backspace>", 0x0e, 0x8e)
-            .putAll("<Spacebar>", 0x39, 0xb9)
-            .putAll("<Return>", 0x1c, 0x9c)
-            .putAll("<Esc>", 0x01, 0x81)
-            .putAll("<Tab>", 0x0f, 0x8f)
-            .putAll("<KillX>", 0x1d, 0x38, 0x0e)
-
-            .putAll("<Up>", 0x48, 0xc8)
-            .putAll("<Down>", 0x50, 0xd0)
-            .putAll("<PageUp>", 0x49, 0xc9)
-            .putAll("<PageDown>", 0x51, 0xd1)
-            .putAll("<End>", 0x4f, 0xcf)
-            .putAll("<Insert>", 0x52, 0xd2)
-            .putAll("<Delete>", 0x53, 0xd3)
-            .putAll("<Left>", 0x4b, 0xcb)
-            .putAll("<Right>", 0x4d, 0xcd)
-            .putAll("<Home>", 0x47, 0xc7)
-
-            .putAll("<F1>", 0x3b)
-            .putAll("<F2>", 0x3c)
-            .putAll("<F3>", 0x3d)
-            .putAll("<F4>", 0x3e)
-            .putAll("<F5>", 0x3f)
-            .putAll("<F6>", 0x40)
-            .putAll("<F7>", 0x41)
-            .putAll("<F8>", 0x42)
-            .putAll("<F9>", 0x43)
-            .putAll("<F10>", 0x44)
-            .build();
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/DeleteGShadowLock.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/DeleteGShadowLock.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/DeleteGShadowLock.java
deleted file mode 100644
index b304f0d..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/DeleteGShadowLock.java
+++ /dev/null
@@ -1,43 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Deletes /etc/gshadow.lock. see https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/732864.
- */
-public class DeleteGShadowLock implements Statement {
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return "rm -f /etc/passwd.lock /etc/group.lock /etc/gshadow.lock";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java
deleted file mode 100644
index 421419b..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/EnableNetworkInterface.java
+++ /dev/null
@@ -1,79 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.scriptbuilder.domain.Statements.exec;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.StatementList;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-
-/**
- * Up the network interface chosen
- */
-public class EnableNetworkInterface implements Statement {
-
-   private final StatementList statements;
-
-   public EnableNetworkInterface(NetworkInterfaceCard networkInterfaceCard) {
-      int slot = (int) networkInterfaceCard.getSlot();
-      String iface = null;
-      switch (slot) {
-         case 0:
-            iface = "eth0";
-            break;
-         case 1:
-            iface = "eth1";
-            break;
-         case 2:
-            iface = "eth2";
-            break;
-         case 3:
-            iface = "eth3";
-            break;
-         default:
-            throw new IllegalArgumentException("slot must be 0,1,2,3 (was: " + slot + ")");
-      }
-      this.statements = new StatementList(getStatements(iface));
-   }
-
-   private List<Statement> getStatements(String iface) {
-      List<Statement> statements = Lists.newArrayList();
-      statements.add(exec(String.format("echo auto %s >> /etc/network/interfaces", iface)));
-      statements.add(exec(String.format("echo iface %s inet dhcp >> /etc/network/interfaces", iface)));
-      statements.add(exec("/etc/init.d/networking restart"));
-      return statements;
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return statements.functionDependencies(family);
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return statements.render(family);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/GetIPAddressFromMAC.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/GetIPAddressFromMAC.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/GetIPAddressFromMAC.java
deleted file mode 100644
index 7f9f463..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/GetIPAddressFromMAC.java
+++ /dev/null
@@ -1,70 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.util.Utils;
-import org.jclouds.virtualbox.functions.MacAddressToBSD;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class GetIPAddressFromMAC implements Statement {
-
-   public static final Map<OsFamily, String> OS_TO_ARP = ImmutableMap
-         .of(OsFamily.UNIX,
-               "MAC={macAddress} && [[ `uname -s` = \"Darwin\" ]] && MAC={macAddressBsd}\n arp -an | grep $MAC\n",
-               OsFamily.WINDOWS, "set MAC={macAddress} arp -a | Findstr %MAC%");
-
-   private String macAddress;
-   private String macAddressBsd; 
-
-   public GetIPAddressFromMAC(String macAddress) {
-   	this(Joiner.on(":").join(Splitter.fixedLength(2).split(macAddress)).toLowerCase(),
-   	      MacAddressToBSD.INSTANCE.apply(Joiner.on(":").join(Splitter.fixedLength(2).split(macAddress)).toLowerCase()));
-   }
-   
-   public GetIPAddressFromMAC(String macAddress, String macAddressBsd) {
-      checkNotNull(macAddress, "macAddress");
-      checkArgument(macAddress.length() == 17);
-      this.macAddress = macAddress;
-      checkNotNull(macAddressBsd, "macAddressBsd");
-      this.macAddressBsd = macAddressBsd;
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      StringBuilder arp = new StringBuilder();
-      arp.append(Utils.replaceTokens(OS_TO_ARP.get(family), ImmutableMap.of(
-            "macAddress", macAddress, "macAddressBsd", macAddressBsd)));
-      return arp.toString();
-   }
-   
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java
deleted file mode 100644
index e9258da..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/InstallGuestAdditions.java
+++ /dev/null
@@ -1,99 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.scriptbuilder.domain.Statements.call;
-import static org.jclouds.scriptbuilder.domain.Statements.exec;
-import static org.jclouds.scriptbuilder.domain.Statements.saveHttpResponseTo;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.StatementList;
-import org.jclouds.virtualbox.domain.IsoImage;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/**
- * Mounts the DVD with guest additions that was downloaded and attached as removable storage. If no
- * guest additions is attached to the vmspec then it is downloaded.
- */
-public class InstallGuestAdditions implements Statement {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-   private final StatementList statements;
-
-   public InstallGuestAdditions(VmSpec vmSpecification, String vboxVersion) {
-      this.statements = new StatementList(getStatements(vmSpecification, vboxVersion));
-   }
-
-   private List<Statement> getStatements(VmSpec vmSpecification, String vboxVersion) {
-      List<Statement> statements = Lists.newArrayList();
-      statements.add(call("installModuleAssistantIfNeeded"));
-      String mountPoint = "/mnt";
-      if (Iterables.tryFind(vmSpecification.getControllers(), new Predicate<StorageController>() {
-         @Override
-         public boolean apply(StorageController input) {
-            if (!input.getIsoImages().isEmpty()) {
-               for (IsoImage iso : input.getIsoImages()) {
-                  if (iso.getSourcePath().contains("VBoxGuestAdditions_")) {
-                     return true;
-                  }
-               }
-            }
-            return false;
-         }
-      }).isPresent()) {
-         statements.add(exec("mount -t iso9660 /dev/cdrom1 " + mountPoint));
-      } else {
-         String vboxGuestAdditionsIso = "VBoxGuestAdditions_" + vboxVersion + ".iso";
-         URI download = URI.create("http://download.virtualbox.org/virtualbox/" + vboxVersion + "/"
-                  + vboxGuestAdditionsIso);
-         statements.add(call("setupPublicCurl"));
-         statements.add(saveHttpResponseTo(download, "{tmp}{fs}", vboxGuestAdditionsIso));
-         statements.add(exec(String.format("mount -o loop {tmp}{fs}%s %s", vboxGuestAdditionsIso, mountPoint)));
-      }
-      statements.add(exec(String.format("%s%s", mountPoint, "/VBoxLinuxAdditions.run --nox11")));
-      return statements;
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return statements.render(family);
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return statements.functionDependencies(family);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Md5.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Md5.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Md5.java
deleted file mode 100644
index 36e30f2..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Md5.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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-import com.google.common.collect.ImmutableList;
-
-public class Md5 implements Statement {
-
-   private final String filePath;
-
-   public Md5(String filePath) {
-      this.filePath = checkNotNull(filePath, "filePath");
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return String.format("command -v md5sum >/dev/null 2>&1 && md5sum %s | awk '{print $1}' "
-            + "|| command -v md5 >/dev/null 2>&1 && md5 %s | awk '{ print $4 }'", filePath, filePath);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/PasswordlessSudo.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/PasswordlessSudo.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/PasswordlessSudo.java
deleted file mode 100644
index 0078730..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/PasswordlessSudo.java
+++ /dev/null
@@ -1,49 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Assign to user the passwordless sudo rights
- */
-public class PasswordlessSudo implements Statement {
-
-   private final String user;
-   
-   public PasswordlessSudo(String user) {
-      this.user = user;
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-   
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return String.format("touch /etc/sudoers.d/passwordless && echo \"%s ALL = NOPASSWD: ALL\" > /etc/sudoers.d/passwordless && chmod 0440 /etc/sudoers.d/passwordless", user);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/ScanNetworkWithPing.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/ScanNetworkWithPing.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/ScanNetworkWithPing.java
deleted file mode 100644
index 68f6ed9..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/ScanNetworkWithPing.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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.util.Utils;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class ScanNetworkWithPing implements Statement {
-
-   public static final Map<OsFamily, String> OS_TO_PING = ImmutableMap
-         .of(OsFamily.UNIX,
-               "for i in {1..254} ; do ping -c 1 -t 1 {network}.$i & done",
-               OsFamily.WINDOWS, "TODO");
-
-   private String network;
-
-   public ScanNetworkWithPing(String network) {
-      this.network = checkNotNull(network, "network");
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      network = network.substring(0, network.lastIndexOf("."));
-      StringBuilder arp = new StringBuilder();
-      arp.append(Utils.replaceTokens(OS_TO_PING.get(family), ImmutableMap.of("network", network)));
-      return arp.toString();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetHostname.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetHostname.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetHostname.java
deleted file mode 100644
index eae7006..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetHostname.java
+++ /dev/null
@@ -1,50 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Set hostname
- */
-public class SetHostname implements Statement {
-
-   private final String publicIpAddress;
-
-   public SetHostname(String publicIpAddress) {
-      this.publicIpAddress = checkNotNull(publicIpAddress, "publicIpAddress");
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return String.format("sudo hostname %s", publicIpAddress);
-   }
-
-}
-

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetIpAddress.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetIpAddress.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetIpAddress.java
deleted file mode 100644
index 4353fe5..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/SetIpAddress.java
+++ /dev/null
@@ -1,70 +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.virtualbox.statements;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.scriptbuilder.domain.OsFamily;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Sets the ipaddress using ssh. Used for host-only networking
- */
-public class SetIpAddress implements Statement {
-
-   private String script;
-
-   public SetIpAddress(NetworkInterfaceCard networkInterfaceCard) {
-      String ipAddress = networkInterfaceCard.getNetworkAdapter().getStaticIp();
-      checkNotNull(ipAddress, "ip address");
-      int slot = (int) networkInterfaceCard.getSlot();
-      String iface = null;
-      switch (slot) {
-         case 0:
-            iface = "eth0";
-            break;
-         case 1:
-            iface = "eth1";
-            break;
-         case 2:
-            iface = "eth2";
-            break;
-         case 3:
-            iface = "eth3";
-            break;
-         default:
-            throw new IllegalArgumentException("slot must be 0,1,2,3 (was: " + slot + ")");
-      }
-      script = String.format("ifconfig %s %s;", iface, ipAddress);
-   }
-
-   @Override
-   public Iterable<String> functionDependencies(OsFamily family) {
-      return ImmutableList.of();
-   }
-
-   @Override
-   public String render(OsFamily family) {
-      if (checkNotNull(family, "family") == OsFamily.WINDOWS)
-         throw new UnsupportedOperationException("windows not yet implemented");
-      return script;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Statements.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Statements.java b/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Statements.java
deleted file mode 100644
index 6f27be6..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/statements/Statements.java
+++ /dev/null
@@ -1,36 +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.virtualbox.statements;
-
-import org.jclouds.scriptbuilder.ScriptBuilder;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-/**
- * VboxManage statements used in shell scripts .
- */
-public class Statements {
-
-   /**
-    * Extract the IP address from the specified vm and stores the IP address into the variable {@code FOUND_IP_ADDRESS} if successful.
-    * 
-    * @param vmname
-    *           - the vm name
-    */
-   public static Statement exportIpAddressFromVmNamed(String vmName) {
-      return ScriptBuilder.call("exportIpAddressFromVmNamed", vmName);
-   }
- }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/util/IMediumAttachments.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/util/IMediumAttachments.java b/virtualbox/src/main/java/org/jclouds/virtualbox/util/IMediumAttachments.java
deleted file mode 100644
index d9a2652..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/util/IMediumAttachments.java
+++ /dev/null
@@ -1,41 +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.virtualbox.util;
-
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IMediumAttachment;
-
-import com.google.common.base.Function;
-
-public class IMediumAttachments {
-   static enum ToMedium implements Function<IMediumAttachment, IMedium> {
-      INSTANCE;
-      @Override
-      public IMedium apply(IMediumAttachment arg0) {
-         return arg0.getMedium();
-      }
-
-      @Override
-      public String toString() {
-         return "toMedium()";
-      }
-   };
-
-   public static Function<IMediumAttachment, IMedium> toMedium() {
-      return ToMedium.INSTANCE;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineController.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineController.java b/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineController.java
deleted file mode 100644
index c1f2623..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineController.java
+++ /dev/null
@@ -1,262 +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.virtualbox.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.virtualbox.domain.ExecutionType;
-import org.jclouds.virtualbox.functions.LaunchMachineIfNotAlreadyRunning;
-import org.virtualbox_4_2.AdditionsFacilityStatus;
-import org.virtualbox_4_2.AdditionsFacilityType;
-import org.virtualbox_4_2.AdditionsRunLevelType;
-import org.virtualbox_4_2.IAdditionsFacility;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-
-/**
- * Utilities to manage VirtualBox machine life cycle.
- */
-
-@Singleton
-public class MachineController {
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final MachineUtils machineUtils;
-   private final ExecutionType executionType;
-
-   @Inject
-   public MachineController(Supplier<VirtualBoxManager> manager, MachineUtils machineUtils, ExecutionType executionType) {
-      this.manager = manager;
-      this.machineUtils = machineUtils;
-      this.executionType = executionType;
-   }
-
-   public ISession ensureMachineIsLaunched(String vmName) {
-      ISession session = null;
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      while (!machine.getState().equals(MachineState.Running)) {
-         try {
-            session = machineUtils.applyForMachine(vmName, new LaunchMachineIfNotAlreadyRunning(manager.get(),
-                  executionType, ""));
-         } catch (RuntimeException e) {
-            if (e.getMessage().contains(
-                  "org.virtualbox_4_2.VBoxException: VirtualBox error: The given session is busy (0x80BB0007)")) {
-               throw e;
-            } else if (e.getMessage().contains("VirtualBox error: The object is not ready")) {
-               continue;
-            } else {
-               throw e;
-            }
-         }
-      }
-
-      String guestAdditionsInstalled = machineUtils.sharedLockMachineAndApplyToSession(vmName,
-            new Function<ISession, String>() {
-               @Override
-               public String apply(ISession session) {
-                  retry(new FacilitiesPredicate(session), 15, 3, SECONDS).apply(4);
-                  String guestAdditionsInstalled = session.getConsole().getGuest().getAdditionsVersion();
-                  return guestAdditionsInstalled;
-               }
-
-            });
-      if (!Strings.nullToEmpty(guestAdditionsInstalled).isEmpty()) {
-         logger.debug("<< guest additions(%s) installed on vm(%s)", guestAdditionsInstalled, vmName);
-         waitVBoxServiceIsActive(vmName);
-      } else {
-         logger.debug("<< guest additions not available on(%s)", vmName);
-      }
-      return checkNotNull(session, "session");
-   }
-
-   public ISession ensureMachineHasPowerDown(String vmName) {
-      ISession session = machineUtils.sharedLockMachineAndApplyToSession(vmName, new Function<ISession, ISession>() {
-         @Override
-         public ISession apply(ISession session) {
-            IProgress powerdownIProgress = session.getConsole().powerDown();
-            powerdownIProgress.waitForCompletion(-1);
-            return session;
-         }
-      });
-      return checkNotNull(session, "session");
-   }
-
-   /**
-    * if machine supports ACPI it can be shutdown gently - not powerdown()
-    * http://askubuntu.com/questions/82015/shutting-down-ubuntu-server-running-in-headless-virtualbox
-    */
-   public ISession ensureMachineIsShutdown(String vmName) {
-      ISession session = machineUtils.sharedLockMachineAndApplyToSession(vmName, new Function<ISession, ISession>() {
-               @Override
-               public ISession apply(ISession session) {
-                  session.getConsole().powerButton();
-                  return session;
-               }
-            });        
-      checkState(
-            retry(new MachineStatePredicate(manager.get().getVBox(), vmName), 15, 3, SECONDS).apply(
-                  MachineState.PoweredOff), "vm(%s) is not shutdown correctly", vmName);
-      return checkNotNull(session, "session");
-   }
-
-   public void ensureMachineIsPaused(String vmName) {
-      while (!manager.get().getVBox().findMachine(vmName).getState().equals(MachineState.Paused)) {
-         try {
-            machineUtils.lockSessionOnMachineAndApply(vmName, LockType.Shared, new Function<ISession, Void>() {
-               @Override
-               public Void apply(ISession session) {
-                  session.getConsole().pause();
-                  return null;
-               }
-            });
-         } catch (RuntimeException e) {
-            // sometimes the machine might be powered of between the while
-            // test and the call to
-            // lockSessionOnMachineAndApply
-            if (e.getMessage().contains("Invalid machine state: Paused")) {
-               return;
-            } else if (e.getMessage().contains("VirtualBox error: The object is not ready")) {
-               continue;
-            } else {
-               throw e;
-            }
-         }
-      }
-   }
-
-   public void ensureMachineIsResumed(String vmName) {
-      while (!manager.get().getVBox().findMachine(vmName).getState().equals(MachineState.Running)) {
-         try {
-            machineUtils.lockSessionOnMachineAndApply(vmName, LockType.Shared, new Function<ISession, Void>() {
-               @Override
-               public Void apply(ISession session) {
-                  session.getConsole().resume();
-                  return null;
-               }
-            });
-         } catch (RuntimeException e) {
-            // sometimes the machine might be powered of between the while
-            // test and the call to lockSessionOnMachineAndApply
-            if (e.getMessage().contains("Invalid machine state: Resumed")) {
-               return;
-            } else if (e.getMessage().contains("VirtualBox error: The object is not ready")) {
-               continue;
-            } else {
-               throw e;
-            }
-         }
-      }
-   }
-
-   private void waitVBoxServiceIsActive(final String vmName) {
-      machineUtils.sharedLockMachineAndApplyToSession(vmName, new Function<ISession, Void>() {
-
-         @Override
-         public Void apply(ISession session) {
-            checkState(
-                  retry(new AdditionsStatusPredicate(session), 10, 2, SECONDS).apply(AdditionsRunLevelType.Userland),
-                  "timed out waiting for additionsRunLevelType to be %s", AdditionsRunLevelType.Userland);
-            checkState(retry(new FacilitiesPredicate(session), 15, 3, SECONDS).apply(4),
-                  "timed out waiting for 4 running facilities");
-            Optional<IAdditionsFacility> vboxServiceFacility = Optional.absent();
-            while (!vboxServiceFacility.isPresent()) {
-               List<IAdditionsFacility> facilities = session.getConsole().getGuest().getFacilities();
-               vboxServiceFacility = Iterables.tryFind(facilities, new Predicate<IAdditionsFacility>() {
-                  @Override
-                  public boolean apply(IAdditionsFacility additionsFacility) {
-                     return additionsFacility.getType().equals(AdditionsFacilityType.VBoxService)
-                           && additionsFacility.getStatus().equals(AdditionsFacilityStatus.Active);
-                  }
-               });
-            }
-            logger.debug("<< virtualbox service ready on vm(%s)", vmName);
-            return null;
-         }
-      });
-   }
-   
-   private static class AdditionsStatusPredicate implements Predicate<AdditionsRunLevelType> {
-      private final ISession session;
-      
-      AdditionsStatusPredicate(ISession session) {
-         this.session = session;
-      }
-      
-      @Override
-      public boolean apply(AdditionsRunLevelType input) {
-         return session.getConsole().getGuest().getAdditionsStatus(input);
-      }
-   }
-   
-   private static class FacilitiesPredicate implements Predicate<Integer> {
-      private final ISession session;
-      
-      FacilitiesPredicate(ISession session) {
-         this.session = session;
-      }
-      
-      @Override
-      public boolean apply(Integer input) {
-         return session.getConsole().getGuest().getFacilities().size() == input;
-      }
-   }
-   
-   private static class MachineStatePredicate implements Predicate<MachineState> {
-      private final IVirtualBox virtualBox;
-      private final String vmName;
-      
-      MachineStatePredicate(IVirtualBox virtualBox, String vmName) {
-         this.virtualBox = virtualBox;
-         this.vmName = vmName;
-      }
-      
-      @Override
-      public boolean apply(MachineState input) {
-         MachineState state = virtualBox.findMachine(vmName).getState();
-         return state.equals(input);
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineNameOrIdAndNicSlot.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineNameOrIdAndNicSlot.java b/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineNameOrIdAndNicSlot.java
deleted file mode 100644
index 04a6abe..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineNameOrIdAndNicSlot.java
+++ /dev/null
@@ -1,131 +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.virtualbox.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-
-import com.google.common.base.Objects;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-
-
-/**
- * An immutable representation of a MachineNameOrId and NIC port.
- *
- * <p>Example usage:
- * <pre>
- * MachineNameOrIdAndNicSlot mp = MachineNameOrIdAndNicSlot.fromString("myMachine:1");
- * hp.getMachineNameOrId();  // returns "myMachine"
- * hp.getSlot();      // returns 1
- * hp.toString();     // returns "myMachine:1"
- * </pre>
- */
-public final class MachineNameOrIdAndNicSlot {
-
-  private static final String SEPARATOR = ":";
-
-/** IMachine name or id*/
-  private final String machineNameOrId;
-
-  /** Validated NIC slot number in the range [0..3] */
-  private final long slot;
-
-  private MachineNameOrIdAndNicSlot(String machineNameOrId, long slot) {
-    this.machineNameOrId = machineNameOrId;
-    this.slot = slot;
-  }
-
-  public String getMachineNameOrId() {
-    return machineNameOrId;
-  }
-
-  public boolean hasSlot() {
-    return slot >= 0;
-  }
-
-  public long getSlot() {
-    checkState(hasSlot());
-    return slot;
-  }
-  
-  public String getSlotText() {
-     checkState(hasSlot());
-     return String.valueOf(slot);
-   }  
-
-  public static MachineNameOrIdAndNicSlot fromParts(String machineNameOrId, long slot) {
-    checkArgument(isValidSlot(slot));
-    return new MachineNameOrIdAndNicSlot(checkNotNull(machineNameOrId, "machineNameOrId"), slot);
-  }
-
-   public static MachineNameOrIdAndNicSlot fromString(String machineNameOrIdAndNicSlotString) {
-      Iterable<String> splittedString = Splitter.on(SEPARATOR).split(machineNameOrIdAndNicSlotString);
-      checkState(Iterables.size(splittedString) == 2);
-      String machineNameOrId = Strings.nullToEmpty(Iterables.get(splittedString, 0));
-      String nicSlotString = Strings.nullToEmpty(Iterables.get(splittedString, 1));
-      checkArgument(!nicSlotString.startsWith("+"), "Unparseable slot number: %s", nicSlotString);
-      try {
-         long slot = Long.parseLong(nicSlotString);
-         checkArgument(isValidSlot(slot), "Slot number out of range: %s", nicSlotString);
-         return new MachineNameOrIdAndNicSlot(machineNameOrId, slot);
-      } catch (NumberFormatException e) {
-         throw new IllegalArgumentException("Unparseable slot number: " + nicSlotString);
-      }
-   }
-
-  public MachineNameOrIdAndNicSlot withDefaultSlot(int defaultSlot) {
-    checkArgument(isValidSlot(defaultSlot));
-    if (hasSlot() || slot == defaultSlot) {
-      return this;
-    }
-    return new MachineNameOrIdAndNicSlot(machineNameOrId, defaultSlot);
-  }
-
-  @Override
-  public boolean equals(Object other) {
-    if (this == other) {
-      return true;
-    }
-    if (other instanceof MachineNameOrIdAndNicSlot) {
-       MachineNameOrIdAndNicSlot that = (MachineNameOrIdAndNicSlot) other;
-      return Objects.equal(this.machineNameOrId, that.machineNameOrId)
-          && this.slot == that.slot;
-    }
-    return false;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(machineNameOrId, slot);
-  }
-
-  @Override
-  public String toString() {
-     return Objects.toStringHelper(this)
-     .add("machineNameOrId", machineNameOrId)
-     .add("nicSlot", slot)
-     .toString();
-  }
-
-  private static boolean isValidSlot(long slot) {
-    return slot >= 0l && slot <= 3l;
-  }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineUtils.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineUtils.java b/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineUtils.java
deleted file mode 100644
index f4bae13..0000000
--- a/virtualbox/src/main/java/org/jclouds/virtualbox/util/MachineUtils.java
+++ /dev/null
@@ -1,280 +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.virtualbox.util;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.Uninterruptibles;
-import com.google.inject.Inject;
-import org.jclouds.compute.callables.RunScriptOnNode;
-import org.jclouds.compute.callables.RunScriptOnNode.Factory;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.options.RunScriptOptions;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.util.Throwables2;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.SessionState;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.util.concurrent.TimeUnit;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.util.Predicates2.retry;
-
-/**
- * Utilities for executing functions on a VirtualBox machine.
- */
-
-@Singleton
-public class MachineUtils {
-   public static final String IP_V4_ADDRESS_PATTERN = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
-            + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
-            + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
-   
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   private final Supplier<VirtualBoxManager> manager;
-   private final Factory scriptRunner;
-   
-
-   @Inject
-   public MachineUtils(Supplier<VirtualBoxManager> manager, RunScriptOnNode.Factory scriptRunner) {
-      this.manager = manager;
-      this.scriptRunner = scriptRunner;
-   }
-
-   public ListenableFuture<ExecResponse> runScriptOnNode(NodeMetadata metadata, Statement statement,
-            RunScriptOptions options) {
-      return scriptRunner.submit(metadata, statement, options);
-   }
-
-   /**
-    * Locks the machine and executes the given function using the machine matching the given id.
-    * Since the machine is locked it is possible to perform some modifications to the IMachine.
-    * <p/>
-    * Unlocks the machine before returning.
-    * 
-    * @param machineId
-    *           the id of the machine
-    * @param function
-    *           the function to execute
-    * @return the result from applying the function to the machine.
-    */
-   public <T> T writeLockMachineAndApply(final String machineId, final Function<IMachine, T> function) {
-      return lockSessionOnMachineAndApply(machineId, LockType.Write, new Function<ISession, T>() {
-
-         @Override
-         public T apply(ISession session) {
-            return function.apply(session.getMachine());
-         }
-
-         @Override
-         public String toString() {
-            return function.toString();
-         }
-
-      });
-   }
-
-   /**
-    * Locks the machine and executes the given function using the machine matching the given id. The
-    * machine is write locked and modifications to the session that reflect on the machine can be
-    * done safely.
-    * <p/>
-    * Unlocks the machine before returning.
-    * 
-    * @param machineId
-    *           the id of the machine
-    * @param function
-    *           the function to execute
-    * @return the result from applying the function to the machine.
-    */
-   public <T> T writeLockMachineAndApplyToSession(final String machineId, final Function<ISession, T> function) {
-      return lockSessionOnMachineAndApply(machineId, LockType.Write, function);
-   }
-
-   /**
-    * Locks the machine and executes the given function using the machine matching the given id. The
-    * machine is read locked, which means that settings can be read safely (but not changed) by
-    * function.
-    * <p/>
-    * Unlocks the machine before returning.
-    * 
-    * @param machineId
-    *           the id of the machine
-    * @param function
-    *           the function to execute
-    * @return the result from applying the function to the machine.
-    */
-   public <T> T sharedLockMachineAndApply(final String machineId, final Function<IMachine, T> function) {
-      return lockSessionOnMachineAndApply(machineId, LockType.Shared, new Function<ISession, T>() {
-
-         @Override
-         public T apply(ISession session) {
-            return function.apply(session.getMachine());
-         }
-
-         @Override
-         public String toString() {
-            return function.toString();
-         }
-
-      });
-   }
-
-   /**
-    * Locks the machine and executes the given function to the session using the machine matching
-    * the given id. The machine is read locked, which means that settings can be read safely (but
-    * not changed) by function.
-    * <p/>
-    * Unlocks the machine before returning.
-    * 
-    * @param machineId
-    *           the id of the machine
-    * @param function
-    *           the function to execute
-    * @return the result from applying the function to the machine.
-    */
-   public <T> T sharedLockMachineAndApplyToSession(final String machineId, final Function<ISession, T> function) {
-      return lockSessionOnMachineAndApply(machineId, LockType.Shared, function);
-   }
-
-   /**
-    * Locks the machine and executes the given function using the current session. Since the machine
-    * is locked it is possible to perform some modifications to the IMachine.
-    * <p/>
-    * Unlocks the machine before returning.
-    * 
-    * Tries to obtain a lock 15 times before giving up waiting 1 sec between tries. When no machine
-    * is found null is returned.
-    * 
-    * @param type
-    *           the kind of lock to use when initially locking the machine.
-    * @param machineId
-    *           the id of the machine
-    * @param function
-    *           the function to execute
-    * @return the result from applying the function to the session.
-    */
-   protected <T> T lockSessionOnMachineAndApply(String machineId, LockType type, Function<ISession, T> function) {
-      int retries = 15;
-      ISession session = checkNotNull(lockSession(machineId, type, retries), "session");
-      try {
-         return function.apply(session);
-      } catch (VBoxException e) {
-         throw new RuntimeException(String.format("error applying %s to %s with %s lock: %s", function, machineId,
-                  type, e.getMessage()), e);
-      } finally {
-         // this is a workaround for shared lock type, where session state is not updated immediately
-         if (type == LockType.Shared) {
-            Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
-         }
-         if (session.getState().equals(SessionState.Locked)) {
-            session.unlockMachine();
-         } 
-         if (!session.getState().equals(SessionState.Unlocked)) {
-            checkSessionIsUnlocked(session, 5, 3L, TimeUnit.SECONDS);
-         }
-      }
-   }
-
-   private ISession lockSession(String machineId, LockType type, int retries) {
-      int count = 0;
-      IMachine immutableMachine = manager.get().getVBox().findMachine(machineId);
-      ISession session;
-      while (true) {
-         try {
-            session = manager.get().getSessionObject();
-            immutableMachine.lockMachine(session, type);
-            break;
-         } catch (VBoxException e) {
-            VBoxException vbex = Throwables2.getFirstThrowableOfType(e, VBoxException.class);
-            if (vbex != null && machineNotFoundException(vbex)) {
-               return null;
-            }
-            count++;
-            logger.debug("Could not lock machine (try %d of %d). Error: %s", count, retries, e.getMessage());
-            if (count == retries) {
-               throw new RuntimeException(String.format("error locking %s with %s lock: %s", machineId, type,
-                        e.getMessage()), e);
-            }
-            Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
-         }
-      }
-      checkState(session.getState().equals(SessionState.Locked));
-      return checkNotNull(session, "session");
-   }
-
-   /**
-    * @param machineId
-    * @param function
-    * @return
-    */
-   public <T> T applyForMachine(final String machineId, final Function<IMachine, T> function) {
-      final IMachine immutableMachine = manager.get().getVBox().findMachine(machineId);
-      return new Function<IMachine, T>() {
-         @Override
-         public T apply(IMachine machine) {
-            return function.apply(machine);
-         }
-
-         @Override
-         public String toString() {
-            return function.toString();
-         }
-      }.apply(immutableMachine);
-   }
-
-   public static boolean machineNotFoundException(VBoxException e) {
-      return e.getMessage().contains("VirtualBox error: Could not find a registered machine named ")
-               || e.getMessage().contains("Could not find a registered machine with UUID {");
-   }
-
-   private void checkSessionIsUnlocked(ISession session, int attempts, long period, TimeUnit timeUnit) {
-      checkState(
-            retry(new SessionStatePredicate(session), attempts * period, period, timeUnit).apply(SessionState.Unlocked),
-            "timed out or number of retries(%s) reached waiting for session to be unlocked", attempts);
-   }
-
-   private static class SessionStatePredicate implements Predicate<SessionState> {
-      private final ISession session;
-      
-      SessionStatePredicate(ISession session) {
-         this.session = session;
-      }
-      
-      @Override
-      public boolean apply(SessionState input) {
-         return session.getState().equals(input);
-      }
-   }
-
-}