mirror of https://github.com/apache/jclouds.git
issue 384: NetworkSpec refactored - Adrian comments addressed
This commit is contained in:
parent
01fa802dd7
commit
6e8b985a18
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue