diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java index faa4d361bd..49108d3d0f 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkAdapter.java @@ -29,6 +29,7 @@ import org.virtualbox_4_1.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. @@ -46,7 +47,7 @@ public class NetworkAdapter { this.networkAttachmentType = checkNotNull(networkAttachmentType, "networkAttachmentType"); this.macAddress = macAddress; - this.redirectRules = ImmutableSet.copyOf(checkNotNull(redirectRules, "redirectRules")); + this.redirectRules = ImmutableSet.copyOf(redirectRules); } public static Builder builder() { @@ -57,7 +58,7 @@ public class NetworkAdapter { private NetworkAttachmentType networkAttachmentType; private String macAddress; - private Set redirectRules; + private Set redirectRules = Sets.newLinkedHashSet(); /** * @@ -116,7 +117,6 @@ public class NetworkAdapter { return new NetworkAdapter(networkAttachmentType, macAddress, redirectRules); } - } public NetworkAttachmentType getNetworkAttachmentType() { diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java index db22bab81e..427ec8b096 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/domain/NetworkInterfaceCard.java @@ -32,7 +32,7 @@ public class NetworkInterfaceCard { public NetworkInterfaceCard(long slot, NetworkAdapter networkAdapter, String hostInterfaceName) { this.slot = checkNotNull(slot, "slot"); this.networkAdapter = checkNotNull(networkAdapter, "networkAdapter"); - this.hostInterfaceName = checkNotNull(hostInterfaceName, "hostInterfaceName"); + this.hostInterfaceName = hostInterfaceName; } public static Builder builder() { diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java index e250beac3b..8d3def7ceb 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java @@ -105,7 +105,7 @@ public class CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends .builder().addNetworkAdapter(networkAdapter).build(); NetworkSpec networkSpec = NetworkSpec.builder() - .addNIC1(networkInterfaceCard).build(); + .addNIC(0L, networkInterfaceCard).build(); sourceMachineSpec = MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec) .network(networkSpec).build(); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index 93e96d24a0..7cf0c0d389 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -118,7 +118,7 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { .builder().addNetworkAdapter(networkAdapter).build(); NetworkSpec networkSpec = NetworkSpec.builder() - .addNIC1(networkInterfaceCard).build(); + .addNIC(0L, networkInterfaceCard).build(); masterSpec = MasterSpec .builder() @@ -213,8 +213,8 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { } private void ensureMachineHasPowerDown(String vmName) { - while (manager.get().getVBox().findMachine(vmName).getState() - .equals(MachineState.RUNNING)) { + while (!manager.get().getVBox().findMachine(vmName).getState() + .equals(MachineState.POWERED_OFF)) { machineUtils.lockSessionOnMachineAndApply(vmName, LockType.Shared, new Function() { @Override diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java index 698016f1e2..d496d0c71e 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java @@ -76,7 +76,7 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends .builder().addNetworkAdapter(networkAdapter).build(); NetworkSpec networkSpec = NetworkSpec.builder() - .addNIC1(networkInterfaceCard).build(); + .addNIC(0L, networkInterfaceCard).build(); MasterSpec machineSpec = MasterSpec .builder() diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java index e9c74e3780..6ddc77e3d2 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/GuestAdditionsInstallerLiveTest.java @@ -101,7 +101,7 @@ public class GuestAdditionsInstallerLiveTest extends .builder().addNetworkAdapter(networkAdapter).build(); NetworkSpec networkSpec = NetworkSpec.builder() - .addNIC1(networkInterfaceCard).build(); + .addNIC(0L, networkInterfaceCard).build(); sourceMachineSpec = MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec) .network(networkSpec).build(); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java index 7013989d2c..7bb8efd845 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java @@ -98,7 +98,7 @@ public class IMachinePredicatesLiveTest extends BaseVirtualBoxClientLiveTest { .builder().addNetworkAdapter(networkAdapter).build(); NetworkSpec networkSpec = NetworkSpec.builder() - .addNIC1(networkInterfaceCard).build(); + .addNIC(0L, networkInterfaceCard).build(); VmSpec clonedVmSpec = VmSpec.builder().id(cloneName).name(cloneName) .memoryMB(512).cleanUpMode(CleanupMode.Full)