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.base.Objects;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a network adapter in VirtualBox.
|
* Represents a network adapter in VirtualBox.
|
||||||
|
@ -46,7 +47,7 @@ public class NetworkAdapter {
|
||||||
this.networkAttachmentType = checkNotNull(networkAttachmentType,
|
this.networkAttachmentType = checkNotNull(networkAttachmentType,
|
||||||
"networkAttachmentType");
|
"networkAttachmentType");
|
||||||
this.macAddress = macAddress;
|
this.macAddress = macAddress;
|
||||||
this.redirectRules = ImmutableSet.<RedirectRule>copyOf(checkNotNull(redirectRules, "redirectRules"));
|
this.redirectRules = ImmutableSet.<RedirectRule>copyOf(redirectRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
|
@ -57,7 +58,7 @@ public class NetworkAdapter {
|
||||||
|
|
||||||
private NetworkAttachmentType networkAttachmentType;
|
private NetworkAttachmentType networkAttachmentType;
|
||||||
private String macAddress;
|
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,
|
return new NetworkAdapter(networkAttachmentType, macAddress,
|
||||||
redirectRules);
|
redirectRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkAttachmentType getNetworkAttachmentType() {
|
public NetworkAttachmentType getNetworkAttachmentType() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class NetworkInterfaceCard {
|
||||||
public NetworkInterfaceCard(long slot, NetworkAdapter networkAdapter, String hostInterfaceName) {
|
public NetworkInterfaceCard(long slot, NetworkAdapter networkAdapter, String hostInterfaceName) {
|
||||||
this.slot = checkNotNull(slot, "slot");
|
this.slot = checkNotNull(slot, "slot");
|
||||||
this.networkAdapter = checkNotNull(networkAdapter, "networkAdapter");
|
this.networkAdapter = checkNotNull(networkAdapter, "networkAdapter");
|
||||||
this.hostInterfaceName = checkNotNull(hostInterfaceName, "hostInterfaceName");
|
this.hostInterfaceName = hostInterfaceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends
|
||||||
.builder().addNetworkAdapter(networkAdapter).build();
|
.builder().addNetworkAdapter(networkAdapter).build();
|
||||||
|
|
||||||
NetworkSpec networkSpec = NetworkSpec.builder()
|
NetworkSpec networkSpec = NetworkSpec.builder()
|
||||||
.addNIC1(networkInterfaceCard).build();
|
.addNIC(0L, networkInterfaceCard).build();
|
||||||
sourceMachineSpec = MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec)
|
sourceMachineSpec = MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec)
|
||||||
.network(networkSpec).build();
|
.network(networkSpec).build();
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||||
.builder().addNetworkAdapter(networkAdapter).build();
|
.builder().addNetworkAdapter(networkAdapter).build();
|
||||||
|
|
||||||
NetworkSpec networkSpec = NetworkSpec.builder()
|
NetworkSpec networkSpec = NetworkSpec.builder()
|
||||||
.addNIC1(networkInterfaceCard).build();
|
.addNIC(0L, networkInterfaceCard).build();
|
||||||
|
|
||||||
masterSpec = MasterSpec
|
masterSpec = MasterSpec
|
||||||
.builder()
|
.builder()
|
||||||
|
@ -213,8 +213,8 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureMachineHasPowerDown(String vmName) {
|
private void ensureMachineHasPowerDown(String vmName) {
|
||||||
while (manager.get().getVBox().findMachine(vmName).getState()
|
while (!manager.get().getVBox().findMachine(vmName).getState()
|
||||||
.equals(MachineState.RUNNING)) {
|
.equals(MachineState.POWERED_OFF)) {
|
||||||
machineUtils.lockSessionOnMachineAndApply(vmName, LockType.Shared,
|
machineUtils.lockSessionOnMachineAndApply(vmName, LockType.Shared,
|
||||||
new Function<ISession, Void>() {
|
new Function<ISession, Void>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends
|
||||||
.builder().addNetworkAdapter(networkAdapter).build();
|
.builder().addNetworkAdapter(networkAdapter).build();
|
||||||
|
|
||||||
NetworkSpec networkSpec = NetworkSpec.builder()
|
NetworkSpec networkSpec = NetworkSpec.builder()
|
||||||
.addNIC1(networkInterfaceCard).build();
|
.addNIC(0L, networkInterfaceCard).build();
|
||||||
|
|
||||||
MasterSpec machineSpec = MasterSpec
|
MasterSpec machineSpec = MasterSpec
|
||||||
.builder()
|
.builder()
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class GuestAdditionsInstallerLiveTest extends
|
||||||
.builder().addNetworkAdapter(networkAdapter).build();
|
.builder().addNetworkAdapter(networkAdapter).build();
|
||||||
|
|
||||||
NetworkSpec networkSpec = NetworkSpec.builder()
|
NetworkSpec networkSpec = NetworkSpec.builder()
|
||||||
.addNIC1(networkInterfaceCard).build();
|
.addNIC(0L, networkInterfaceCard).build();
|
||||||
sourceMachineSpec = MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec)
|
sourceMachineSpec = MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec)
|
||||||
.network(networkSpec).build();
|
.network(networkSpec).build();
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class IMachinePredicatesLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||||
.builder().addNetworkAdapter(networkAdapter).build();
|
.builder().addNetworkAdapter(networkAdapter).build();
|
||||||
|
|
||||||
NetworkSpec networkSpec = NetworkSpec.builder()
|
NetworkSpec networkSpec = NetworkSpec.builder()
|
||||||
.addNIC1(networkInterfaceCard).build();
|
.addNIC(0L, networkInterfaceCard).build();
|
||||||
|
|
||||||
VmSpec clonedVmSpec = VmSpec.builder().id(cloneName).name(cloneName)
|
VmSpec clonedVmSpec = VmSpec.builder().id(cloneName).name(cloneName)
|
||||||
.memoryMB(512).cleanUpMode(CleanupMode.Full)
|
.memoryMB(512).cleanUpMode(CleanupMode.Full)
|
||||||
|
|
Loading…
Reference in New Issue