issue 384: NetworkSpec refactored - Adrian comments addressed

This commit is contained in:
andreaturli 2012-03-02 23:41:38 +00:00
parent 01fa802dd7
commit 6e8b985a18
7 changed files with 11 additions and 11 deletions

View File

@ -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.<RedirectRule>copyOf(checkNotNull(redirectRules, "redirectRules"));
this.redirectRules = ImmutableSet.<RedirectRule>copyOf(redirectRules);
}
public static Builder builder() {
@ -57,7 +58,7 @@ public class NetworkAdapter {
private NetworkAttachmentType networkAttachmentType;
private String macAddress;
private Set<RedirectRule> redirectRules;
private Set<RedirectRule> redirectRules = Sets.newLinkedHashSet();
/**
*
@ -116,7 +117,6 @@ public class NetworkAdapter {
return new NetworkAdapter(networkAttachmentType, macAddress,
redirectRules);
}
}
public NetworkAttachmentType getNetworkAttachmentType() {

View File

@ -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() {

View File

@ -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();

View File

@ -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<ISession, Void>() {
@Override

View File

@ -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()

View File

@ -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();

View File

@ -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)