Issue 247: loosened terremark constraints and tested vapp configuration

This commit is contained in:
Adrian Cole 2010-05-10 10:53:38 -07:00
parent d034a737b1
commit 7363ae6e87
11 changed files with 174 additions and 73 deletions

View File

@ -18,12 +18,19 @@
*/ */
package org.jclouds.compute.predicates; package org.jclouds.compute.predicates;
import com.google.common.base.Predicate; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.util.Utils.checkNotEmpty;
import java.util.Set;
import javax.annotation.Nullable;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeState; import org.jclouds.compute.domain.NodeState;
import javax.annotation.Nullable; import com.google.common.base.Predicate;
import static org.jclouds.util.Utils.checkNotEmpty; import com.google.common.collect.Sets;
/** /**
* Container for node filters (predicates). * Container for node filters (predicates).
@ -36,10 +43,33 @@ import static org.jclouds.util.Utils.checkNotEmpty;
public class NodePredicates { public class NodePredicates {
/** /**
* Return nodes with specified tag. * Return nodes with the specific ids Note: returns all nodes, regardless of the state.
* Note: returns all nodes, regardless of the state.
* *
* @param tag tag to match the items * @param ids
* ids of the resources
* @return predicate
*/
public static Predicate<ComputeMetadata> withIds(String... ids) {
checkNotNull(ids, "ids must be defined");
final Set<String> search = Sets.newHashSet(ids);
return new Predicate<ComputeMetadata>() {
@Override
public boolean apply(@Nullable ComputeMetadata nodeMetadata) {
return search.contains(nodeMetadata.getId());
}
@Override
public String toString() {
return "withIds(" + search + ")";
}
};
}
/**
* Return nodes with specified tag. Note: returns all nodes, regardless of the state.
*
* @param tag
* tag to match the items
* @return predicate * @return predicate
*/ */
public static Predicate<NodeMetadata> withTag(final String tag) { public static Predicate<NodeMetadata> withTag(final String tag) {
@ -49,12 +79,19 @@ public class NodePredicates {
public boolean apply(@Nullable NodeMetadata nodeMetadata) { public boolean apply(@Nullable NodeMetadata nodeMetadata) {
return tag.equals(nodeMetadata.getTag()); return tag.equals(nodeMetadata.getTag());
} }
@Override
public String toString() {
return "withTag(" + tag + ")";
}
}; };
} }
/** /**
* Return nodes with specified tag that are in the RUNNING state. * Return nodes with specified tag that are in the RUNNING state.
* @param tag tag to match the items *
* @param tag
* tag to match the items
* @return predicate * @return predicate
*/ */
public static Predicate<NodeMetadata> activeWithTag(final String tag) { public static Predicate<NodeMetadata> activeWithTag(final String tag) {
@ -62,7 +99,13 @@ public class NodePredicates {
return new Predicate<NodeMetadata>() { return new Predicate<NodeMetadata>() {
@Override @Override
public boolean apply(@Nullable NodeMetadata nodeMetadata) { public boolean apply(@Nullable NodeMetadata nodeMetadata) {
return tag.equals(nodeMetadata.getTag()) && nodeMetadata.getState() == NodeState.RUNNING; return tag.equals(nodeMetadata.getTag())
&& nodeMetadata.getState() == NodeState.RUNNING;
}
@Override
public String toString() {
return "activeWithTag(" + tag + ")";
} }
}; };
} }
@ -75,6 +118,11 @@ public class NodePredicates {
public boolean apply(@Nullable NodeMetadata nodeMetadata) { public boolean apply(@Nullable NodeMetadata nodeMetadata) {
return nodeMetadata.getState() == NodeState.RUNNING; return nodeMetadata.getState() == NodeState.RUNNING;
} }
@Override
public String toString() {
return "ACTIVE";
}
}; };
/** /**
@ -85,6 +133,11 @@ public class NodePredicates {
public boolean apply(@Nullable NodeMetadata nodeMetadata) { public boolean apply(@Nullable NodeMetadata nodeMetadata) {
return nodeMetadata.getState() == NodeState.TERMINATED; return nodeMetadata.getState() == NodeState.TERMINATED;
} }
@Override
public String toString() {
return "TERMINATED";
}
}; };
} }

View File

@ -76,7 +76,7 @@ public class InstantiateVAppTemplateOptions {
} }
public InstantiateVAppTemplateOptions memory(long megabytes) { public InstantiateVAppTemplateOptions memory(long megabytes) {
checkArgument(megabytes % 512 == 0, "megabytes must be in an increment of 512"); checkArgument(megabytes >= 1, "megabytes must be positive");
this.memorySizeMegabytes = megabytes + ""; this.memorySizeMegabytes = megabytes + "";
return this; return this;
} }

View File

@ -85,11 +85,6 @@ public class InstantiateVAppTemplateOptionsTest {
assertEquals(options.getMemorySizeMegabytes(), "512"); assertEquals(options.getMemorySizeMegabytes(), "512");
} }
@Test(expectedExceptions = IllegalArgumentException.class)
public void testRamStaticWrong() {
memory(511);
}
@Test @Test
public void testDisk() { public void testDisk() {
InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions(); InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();

View File

@ -19,9 +19,9 @@
package org.jclouds.vcloud.terremark.domain; package org.jclouds.vcloud.terremark.domain;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static org.jclouds.util.Utils.checkNotEmpty;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -37,62 +37,41 @@ public class VAppConfiguration {
private List<Long> disks = Lists.newArrayList(); private List<Long> disks = Lists.newArrayList();
private List<Integer> disksToDelete = Lists.newArrayList(); private List<Integer> disksToDelete = Lists.newArrayList();
public static final Pattern NAME_PATTERN = Pattern.compile("^[a-zA-Z][-a-zA-Z0-9]+");
/** /**
* The vApp name has the following requirements: Name can use uppercase and/or lowercase letters. * The vApp name
* Name can contain numbers or hyphens (-). Name may only begin with a letter. A maximum of 15
* characters are allowed
* *
*/ */
public VAppConfiguration changeNameTo(String name) { public VAppConfiguration changeNameTo(String name) {
checkArgument( checkNotEmpty(name, "name must be specified");
NAME_PATTERN.matcher(name).matches(),
"Name can use uppercase and/or lowercase letters, numbers or hyphens (-). Name may only begin with a letter.");
checkArgument(name.length() <= 15, "A maximum of 15 characters are allowed.");
this.name = name; this.name = name;
return this; return this;
} }
/** /**
* the number of virtual CPUs. You can set this to 1, 2, 4, or 8. * the number of virtual CPUs.
*/ */
public VAppConfiguration changeProcessorCountTo(int cpus) { public VAppConfiguration changeProcessorCountTo(int cpus) {
checkArgument(cpus == 1 || cpus == 2 || cpus == 4 || cpus == 8, checkArgument(cpus >= 1, "cpu count must be positive");
"cpu count must be in 1,2,4,8");
this.processorCount = cpus; this.processorCount = cpus;
return this; return this;
} }
/** /**
* number of MB of memory. This should be either 512 or a multiple of 1024 (1 GB). * number of MB of memory.
*/ */
public VAppConfiguration changeMemoryTo(long megabytes) { public VAppConfiguration changeMemoryTo(long megabytes) {
checkArgument(megabytes == 512 || megabytes % 1024 == 0, checkArgument(megabytes >= 1, "megabytes must be positive");
"memory must be 512 or an interval of 1024");
checkArgument(megabytes <= 16384, "memory must be no more than 16GB");
this.memory = megabytes; this.memory = megabytes;
return this; return this;
} }
/** /**
* To define a new disk, all you need to define is the size of the disk. The allowed values are a * To define a new disk, all you need to define is the size of the disk. The allowed values are a
* multiple of 1048576. <br/> * multiple of 1048576.
* For example: <br/>
* 1048576 (1 GB) <br/>
* 2097152 (2 GB) <br/>
* 3145728 (3 GB) <br/>
* 4194304 (4 GB) <br/>
* 5242880 (5 GB) <br/>
* ... <br/>
* 524288000 (500 GB) <br/>
* You can have a total of 15 disks. Each disk can contain up to 500 GB of storage.
*/ */
public VAppConfiguration addDisk(long kilobytes) { public VAppConfiguration addDisk(long kilobytes) {
checkArgument(kilobytes > 0, "kilobytes must be positive");
checkArgument(kilobytes % 1048576 == 0, "disk must be an interval of 1048576"); checkArgument(kilobytes % 1048576 == 0, "disk must be an interval of 1048576");
checkArgument(kilobytes >= 25 *1048576, "disk must be at least 25GB");
checkArgument(kilobytes <= 524288000, "disk must be no more than 500GB");
checkArgument(disks.size() < 14, "you can only add up to 14 disks for a total of 15");
this.disks.add(kilobytes); this.disks.add(kilobytes);
return this; return this;
} }

View File

@ -182,7 +182,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest<TerremarkVClo
InstantiateVAppTemplateOptions.class, 0).getClass()); InstantiateVAppTemplateOptions.class, 0).getClass());
GeneratedHttpRequest<TerremarkVCloudAsyncClient> httpMethod = processor.createRequest(method, GeneratedHttpRequest<TerremarkVCloudAsyncClient> httpMethod = processor.createRequest(method,
"1", "name", 3 + "", TerremarkInstantiateVAppTemplateOptions.Builder.processorCount( "1", "name", 3 + "", TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(
1).memory(512).inRow("row").inGroup("group").withPassword("password") 2).memory(512).inRow("row").inGroup("group").withPassword("password")
.inNetwork(URI.create("http://network"))); .inNetwork(URI.create("http://network")));
assertRequestLineEquals(httpMethod, assertRequestLineEquals(httpMethod,

View File

@ -71,6 +71,7 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -176,7 +177,15 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
// determine the cheapest configuration size // determine the cheapest configuration size
SortedSet<ComputeOptions> sizeOptions = tmClient.getComputeOptionsOfCatalogItem(itemId); SortedSet<ComputeOptions> sizeOptions = tmClient.getComputeOptionsOfCatalogItem(itemId);
ComputeOptions cheapestOption = sizeOptions.first();
ComputeOptions cheapestOption = Iterables.find(sizeOptions, new Predicate<ComputeOptions>() {
@Override
public boolean apply(ComputeOptions arg0) {
return arg0.getProcessorCount() == 2;
}
});
// create an options object to collect the configuration we want. // create an options object to collect the configuration we want.
TerremarkInstantiateVAppTemplateOptions instantiateOptions = processorCount( TerremarkInstantiateVAppTemplateOptions instantiateOptions = processorCount(
@ -363,8 +372,8 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
vApp = tmClient.getVApp(vApp.getId()); vApp = tmClient.getVApp(vApp.getId());
Task task = tmClient.configureVApp(vApp, changeNameTo("eduardo").changeMemoryTo(1024) Task task = tmClient.configureVApp(vApp, changeNameTo("eduardo").changeMemoryTo(1536)
.changeProcessorCountTo(2).addDisk(25 * 1048576).addDisk(25 * 1048576)); .changeProcessorCountTo(1).addDisk(25 * 1048576).addDisk(25 * 1048576));
assert successTester.apply(task.getId()); assert successTester.apply(task.getId());
@ -373,10 +382,10 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
assertEquals( assertEquals(
Iterables.getOnlyElement( Iterables.getOnlyElement(
vApp.getResourceAllocationByType().get(ResourceType.PROCESSOR)) vApp.getResourceAllocationByType().get(ResourceType.PROCESSOR))
.getVirtualQuantity(), 2); .getVirtualQuantity(), 1);
assertEquals(Iterables.getOnlyElement( assertEquals(Iterables.getOnlyElement(
vApp.getResourceAllocationByType().get(ResourceType.MEMORY)).getVirtualQuantity(), vApp.getResourceAllocationByType().get(ResourceType.MEMORY)).getVirtualQuantity(),
1024); 1536);
assertEquals(vApp.getResourceAllocationByType().get(ResourceType.DISK_DRIVE).size(), 3); assertEquals(vApp.getResourceAllocationByType().get(ResourceType.DISK_DRIVE).size(), 3);
assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId()); assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId());
@ -473,8 +482,8 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user"); account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key"); String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
Injector injector = new TerremarkVCloudContextBuilder("terremark", Injector injector = new TerremarkVCloudContextBuilder("terremark",
new TerremarkVCloudPropertiesBuilder( account, key).build()).withModules(new Log4JLoggingModule(), new TerremarkVCloudPropertiesBuilder(account, key).build()).withModules(
new JschSshClientModule()).buildInjector(); new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
connection = tmClient = injector.getInstance(TerremarkVCloudClient.class); connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);

View File

@ -69,9 +69,8 @@ public class BindVAppConfigurationToXmlPayloadTest {
}); });
public void testChangeName() throws IOException { public void testChangeName() throws IOException {
VAppImpl vApp = new VAppImpl("4213", "MyAppServer6", VAppImpl vApp = new VAppImpl("4213", "MyAppServer6", URI
URI .create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"),
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"),
VAppStatus.OFF, 4194304l, null, ImmutableListMultimap.<String, InetAddress> of(), VAppStatus.OFF, 4194304l, null, ImmutableListMultimap.<String, InetAddress> of(),
null, null, ImmutableSortedSet.of(new ResourceAllocation(1, "n/a", null, null, null, ImmutableSortedSet.of(new ResourceAllocation(1, "n/a", null,
ResourceType.PROCESSOR, null, null, null, null, null, null, 2, null), ResourceType.PROCESSOR, null, null, null, null, null, null, 2, null),
@ -85,7 +84,9 @@ public class BindVAppConfigurationToXmlPayloadTest {
"roberto"); "roberto");
Multimap<String, String> headers = Multimaps.synchronizedMultimap(HashMultimap Multimap<String, String> headers = Multimaps.synchronizedMultimap(HashMultimap
.<String, String> create()); .<String, String> create());
VAppConfiguration config = new VAppConfiguration().changeNameTo("roberto"); VAppConfiguration config = new VAppConfiguration().changeNameTo("roberto");
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn(new Object[] { vApp, config }).atLeastOnce(); expect(request.getArgs()).andReturn(new Object[] { vApp, config }).atLeastOnce();
@ -103,25 +104,26 @@ public class BindVAppConfigurationToXmlPayloadTest {
} }
public void testRemoveDisk() throws IOException { public void testRemoveDisk() throws IOException {
VAppImpl vApp = new VAppImpl("4213", "MyAppServer6", VAppImpl vApp = new VAppImpl("4213", "MyAppServer6", URI
URI .create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"),
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"),
VAppStatus.OFF, 4194304l, null, ImmutableListMultimap.<String, InetAddress> of(), VAppStatus.OFF, 4194304l, null, ImmutableListMultimap.<String, InetAddress> of(),
null, null, ImmutableSortedSet.of(new ResourceAllocation(1, "n/a", null, null, null, ImmutableSortedSet.of(new ResourceAllocation(1, "n/a", null,
ResourceType.PROCESSOR, null, null, null, null, null, null, 2, null), ResourceType.PROCESSOR, null, null, null, null, null, null, 2, null),
new ResourceAllocation(2, "n/a", null, ResourceType.MEMORY, null, null, new ResourceAllocation(2, "n/a", null, ResourceType.MEMORY, null, null,
null, null, null, null, 1024, null), new ResourceAllocation(9, null, null, null, null, 1024, null), new ResourceAllocation(9,
"n/a", null, ResourceType.DISK_DRIVE, null, "1048576", null, 0, "n/a", null, ResourceType.DISK_DRIVE, null, "1048576", null, 0,
null, null, 209152, null),new ResourceAllocation(9, null, null, 209152, null), new ResourceAllocation(9, "n/a", null,
"n/a", null, ResourceType.DISK_DRIVE, null, "1048576", null, 1, ResourceType.DISK_DRIVE, null, "1048576", null, 1, null, null,
null, null, 209152, null))); 209152, null)));
String expected = Utils.toStringAndClose( String expected = Utils.toStringAndClose(
getClass().getResourceAsStream("/terremark/configureVApp.xml")).replace("eduardo", getClass().getResourceAsStream("/terremark/configureVApp.xml")).replace("eduardo",
"MyAppServer6"); "MyAppServer6");
Multimap<String, String> headers = Multimaps.synchronizedMultimap(HashMultimap Multimap<String, String> headers = Multimaps.synchronizedMultimap(HashMultimap
.<String, String> create()); .<String, String> create());
VAppConfiguration config = new VAppConfiguration().deleteDiskWithAddressOnParent(1); VAppConfiguration config = new VAppConfiguration().deleteDiskWithAddressOnParent(1);
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn(new Object[] { vApp, config }).atLeastOnce(); expect(request.getArgs()).andReturn(new Object[] { vApp, config }).atLeastOnce();
@ -138,4 +140,71 @@ public class BindVAppConfigurationToXmlPayloadTest {
verify(request); verify(request);
} }
public void testChangeCPUCountTo4() throws IOException {
VAppImpl vApp = new VAppImpl("4213", "eduardo", URI
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"),
VAppStatus.OFF, 4194304l, null, ImmutableListMultimap.<String, InetAddress> of(),
null, null, ImmutableSortedSet.of(new ResourceAllocation(1, "n/a", null,
ResourceType.PROCESSOR, null, null, null, null, null, null, 4, null),
new ResourceAllocation(2, "n/a", null, ResourceType.MEMORY, null, null,
null, null, null, null, 1024, null), new ResourceAllocation(9,
"n/a", null, ResourceType.DISK_DRIVE, null, "1048576", null, 0,
null, null, 209152, null)));
String expected = Utils.toStringAndClose(getClass().getResourceAsStream(
"/terremark/configureVApp4.xml"));
Multimap<String, String> headers = Multimaps.synchronizedMultimap(HashMultimap
.<String, String> create());
VAppConfiguration config = new VAppConfiguration().changeProcessorCountTo(4);
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn(new Object[] { vApp, config }).atLeastOnce();
expect(request.getFirstHeaderOrNull("Content-Type")).andReturn(null).atLeastOnce();
expect(request.getHeaders()).andReturn(headers).atLeastOnce();
request.setPayload(expected);
replay(request);
BindVAppConfigurationToXmlPayload binder = injector
.getInstance(BindVAppConfigurationToXmlPayload.class);
Map<String, String> map = Maps.newHashMap();
binder.bindToRequest(request, map);
verify(request);
}
public void testChangeMemoryTo1536() throws IOException {
VAppImpl vApp = new VAppImpl("4213", "MyAppServer6", URI
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"),
VAppStatus.OFF, 4194304l, null, ImmutableListMultimap.<String, InetAddress> of(),
null, null, ImmutableSortedSet.of(new ResourceAllocation(1, "n/a", null,
ResourceType.PROCESSOR, null, null, null, null, null, null, 2, null),
new ResourceAllocation(2, "n/a", null, ResourceType.MEMORY, null, null,
null, null, null, null, 1536, null), new ResourceAllocation(9,
"n/a", null, ResourceType.DISK_DRIVE, null, "1048576", null, 0,
null, null, 209152, null)));
String expected = Utils.toStringAndClose(
getClass().getResourceAsStream("/terremark/configureVApp.xml")).replace("eduardo",
"MyAppServer6").replace("1024", "1536");
Multimap<String, String> headers = Multimaps.synchronizedMultimap(HashMultimap
.<String, String> create());
VAppConfiguration config = new VAppConfiguration().changeMemoryTo(1536);
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn(new Object[] { vApp, config }).atLeastOnce();
expect(request.getFirstHeaderOrNull("Content-Type")).andReturn(null).atLeastOnce();
expect(request.getHeaders()).andReturn(headers).atLeastOnce();
request.setPayload(expected);
replay(request);
BindVAppConfigurationToXmlPayload binder = injector
.getInstance(BindVAppConfigurationToXmlPayload.class);
Map<String, String> map = Maps.newHashMap();
binder.bindToRequest(request, map);
verify(request);
}
} }

View File

@ -75,7 +75,7 @@ public class TerremarkBindInstantiateVAppTemplateParamsToXmlPayloadTest {
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn( expect(request.getArgs()).andReturn(
new Object[] { TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(1) new Object[] { TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(2)
.memory(512).inRow("row").inGroup("group").withPassword( .memory(512).inRow("row").inGroup("group").withPassword(
"password").inNetwork(URI.create("http://network")) }) "password").inNetwork(URI.create("http://network")) })
.atLeastOnce(); .atLeastOnce();

View File

@ -122,11 +122,6 @@ public class TerremarkInstantiateVAppTemplateOptionsTest {
assertEquals(options.getMemorySizeMegabytes(), "512"); assertEquals(options.getMemorySizeMegabytes(), "512");
} }
@Test(expectedExceptions = IllegalArgumentException.class)
public void testMegabytesStaticWrong() {
memory(511);
}
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testDiskSizeKilobytes() { public void testDiskSizeKilobytes() {
TerremarkInstantiateVAppTemplateOptions options = new TerremarkInstantiateVAppTemplateOptions(); TerremarkInstantiateVAppTemplateOptions options = new TerremarkInstantiateVAppTemplateOptions();

View File

@ -1 +1 @@
<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="name" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><VAppTemplate href="http://catalogItem/3"/><InstantiationParams><ProductSection xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q1="http://www.vmware.com/vcloud/v0.8"><Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="group" ovf:value="group"/><Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="password" ovf:value="password"/><Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="row" ovf:value="row"/></ProductSection><VirtualHardwareSection xmlns:q1="http://www.vmware.com/vcloud/v0.8"><Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</VirtualQuantity></Item><Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512</VirtualQuantity></Item></VirtualHardwareSection><NetworkConfigSection><NetworkConfig name="name"><Features><FenceMode>allowInOut</FenceMode><Dhcp>false</Dhcp></Features><NetworkAssociation href="http://network"/></NetworkConfig></NetworkConfigSection></InstantiationParams></InstantiateVAppTemplateParams> <InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="name" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><VAppTemplate href="http://catalogItem/3"/><InstantiationParams><ProductSection xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q1="http://www.vmware.com/vcloud/v0.8"><Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="group" ovf:value="group"/><Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="password" ovf:value="password"/><Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="row" ovf:value="row"/></ProductSection><VirtualHardwareSection xmlns:q1="http://www.vmware.com/vcloud/v0.8"><Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</VirtualQuantity></Item><Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512</VirtualQuantity></Item></VirtualHardwareSection><NetworkConfigSection><NetworkConfig name="name"><Features><FenceMode>allowInOut</FenceMode><Dhcp>false</Dhcp></Features><NetworkAssociation href="http://network"/></NetworkConfig></NetworkConfigSection></InstantiationParams></InstantiateVAppTemplateParams>

View File

@ -0,0 +1 @@
<VApp xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="eduardo" size="4194304" status="2" type="application/vnd.vmware.vcloud.vApp+xml" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Section xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q2="http://www.vmware.com/vcloud/v1" xsi:type="VirtualHardwareSection_Type"><Info>Virtual Hardware</Info><Item><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</VirtualQuantity></Item><Item><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1024</VirtualQuantity></Item><Item><AddressOnParent xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">0</AddressOnParent><HostResource xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1048576</HostResource><InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">9</InstanceID><ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">17</ResourceType><VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">209152</VirtualQuantity></Item></Section></VApp>