mirror of https://github.com/apache/jclouds.git
Issue 112: added expiryTime to task
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2656 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
63073ae3f4
commit
b85dbd8109
|
@ -39,7 +39,8 @@ public interface Task extends Comparable<Task> {
|
|||
Date getStartTime();
|
||||
|
||||
Date getEndTime();
|
||||
|
||||
|
||||
Date getExpiryTime();
|
||||
/**
|
||||
* A link to the vDC in which the task was started
|
||||
*/
|
||||
|
|
|
@ -112,6 +112,8 @@ public class TaskImpl implements Task {
|
|||
private final Date startTime;
|
||||
@Nullable
|
||||
private final Date endTime;
|
||||
@Nullable
|
||||
private final Date expiryTime;
|
||||
private final NamedResource owner;
|
||||
@Nullable
|
||||
private final NamedResource result;
|
||||
|
@ -119,13 +121,14 @@ public class TaskImpl implements Task {
|
|||
private final Error error;
|
||||
|
||||
public TaskImpl(String id, URI location, TaskStatus status, Date startTime,
|
||||
@Nullable Date endTime, NamedResource owner,
|
||||
@Nullable Date endTime,@Nullable Date expiryTime, NamedResource owner,
|
||||
@Nullable NamedResource result, Error error) {
|
||||
this.id = checkNotNull(id, "id");
|
||||
this.location = checkNotNull(location, "location");
|
||||
this.status = checkNotNull(status, "status");
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.expiryTime = expiryTime;
|
||||
this.owner = owner;
|
||||
this.result = result;
|
||||
this.error = error;
|
||||
|
@ -173,13 +176,12 @@ public class TaskImpl implements Task {
|
|||
int result = 1;
|
||||
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
|
||||
result = prime * result + ((error == null) ? 0 : error.hashCode());
|
||||
result = prime * result + ((expiryTime == null) ? 0 : expiryTime.hashCode());
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
result = prime * result + ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result + ((owner == null) ? 0 : owner.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.result == null) ? 0 : this.result.hashCode());
|
||||
result = prime * result
|
||||
+ ((startTime == null) ? 0 : startTime.hashCode());
|
||||
result = prime * result + ((this.result == null) ? 0 : this.result.hashCode());
|
||||
result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
|
||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
@ -203,6 +205,11 @@ public class TaskImpl implements Task {
|
|||
return false;
|
||||
} else if (!error.equals(other.error))
|
||||
return false;
|
||||
if (expiryTime == null) {
|
||||
if (other.expiryTime != null)
|
||||
return false;
|
||||
} else if (!expiryTime.equals(other.expiryTime))
|
||||
return false;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
|
@ -243,4 +250,8 @@ public class TaskImpl implements Task {
|
|||
+ result + ", startTime=" + startTime + ", status=" + status + "]";
|
||||
}
|
||||
|
||||
public Date getExpiryTime() {
|
||||
return expiryTime;
|
||||
}
|
||||
|
||||
}
|
|
@ -209,4 +209,9 @@ public class VDCImpl implements VDC {
|
|||
public int compareTo(NamedResource o) {
|
||||
return (this == o) ? 0 : getId().compareTo(o.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + ", name=" + name + ", description=" + description + "]";
|
||||
}
|
||||
}
|
|
@ -48,13 +48,13 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
|
|||
private TaskStatus status;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private Date expiryTime;
|
||||
private Task task;
|
||||
private Error error;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
|
||||
@Inject
|
||||
public TaskHandler(DateService dateService) {
|
||||
this.dateService = dateService;
|
||||
|
@ -73,9 +73,10 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
|
|||
status = TaskStatus.fromValue(attributes.getValue(attributes.getIndex("status")));
|
||||
if (attributes.getIndex("startTime") != -1)
|
||||
startTime = parseDate(attributes, "startTime");
|
||||
if (attributes.getIndex("endTime") != -1) {
|
||||
if (attributes.getIndex("endTime") != -1)
|
||||
endTime = parseDate(attributes, "endTime");
|
||||
}
|
||||
if (attributes.getIndex("expiryTime") != -1)
|
||||
expiryTime = parseDate(attributes, "expiryTime");
|
||||
} else if (qName.equals("Owner")) {
|
||||
owner = Utils.newNamedResource(attributes);
|
||||
} else if (qName.equals("Link") && attributes.getIndex("rel") != -1
|
||||
|
@ -89,14 +90,14 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
|
|||
}
|
||||
|
||||
private Date parseDate(Attributes attributes, String attribute) {
|
||||
String toParse =attributes.getValue(attributes.getIndex(attribute));
|
||||
String toParse = attributes.getValue(attributes.getIndex(attribute));
|
||||
try {
|
||||
return dateService.iso8601DateParse(toParse);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof ParseException) {
|
||||
try {
|
||||
if (!toParse.endsWith("Z"))
|
||||
toParse+="Z";
|
||||
toParse += "Z";
|
||||
return dateService.iso8601SecondsDateParse(toParse);
|
||||
} catch (RuntimeException ex) {
|
||||
logger.error(e, "error parsing date");
|
||||
|
@ -111,7 +112,8 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
|
|||
@Override
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||
if (qName.equalsIgnoreCase("Task")) {
|
||||
this.task = new TaskImpl(taskLink.getId(), taskLink.getLocation(), status, startTime, endTime, owner, result, error);
|
||||
this.task = new TaskImpl(taskLink.getId(), taskLink.getLocation(), status, startTime,
|
||||
endTime, expiryTime, owner, result, error);
|
||||
taskLink = null;
|
||||
status = null;
|
||||
startTime = null;
|
||||
|
|
|
@ -53,9 +53,9 @@ public class VCloudClientLiveTest {
|
|||
assertNotNull(response);
|
||||
assertNotNull(response.getId());
|
||||
assertNotNull(account);
|
||||
assert response.getCatalogs().size() >=1;
|
||||
assert response.getTasksLists().size() >=1;
|
||||
assert response.getVDCs().size() >=1;
|
||||
assert response.getCatalogs().size() >= 1;
|
||||
assert response.getTasksLists().size() >= 1;
|
||||
assert response.getVDCs().size() >= 1;
|
||||
assertEquals(connection.getOrganization(response.getId()), response);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class VCloudClientLiveTest {
|
|||
assertNotNull(response.getLocation());
|
||||
assertNotNull(response.getResourceEntities());
|
||||
assertNotNull(response.getAvailableNetworks());
|
||||
assertEquals(connection.getVDC(response.getId()), response);
|
||||
assertEquals(connection.getVDC(response.getId()).getId(), response.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -138,8 +138,10 @@ public class VCloudClientLiveTest {
|
|||
assertNotNull(response);
|
||||
assertNotNull(response.getLocation());
|
||||
assertNotNull(response.getTasks());
|
||||
Task task = response.getTasks().last();
|
||||
assertEquals(connection.getTask(task.getId()).getLocation(), task.getLocation());
|
||||
if (response.getTasks().size() > 0) {
|
||||
Task task = response.getTasks().last();
|
||||
assertEquals(connection.getTask(task.getId()).getLocation(), task.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -53,30 +53,18 @@ public class TaskHandlerTest extends BaseHandlerTest {
|
|||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/task.xml");
|
||||
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class))
|
||||
.parse(is);
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
|
||||
|
||||
Task expects = new TaskImpl(
|
||||
"3299",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
|
||||
TaskStatus.SUCCESS,
|
||||
dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
|
||||
dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"),
|
||||
new NamedResourceImpl(
|
||||
"1",
|
||||
"VDC Name",
|
||||
VCloudMediaType.VDC_XML,
|
||||
URI
|
||||
Task expects = new TaskImpl("3299", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
|
||||
TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
|
||||
dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"), null,
|
||||
new NamedResourceImpl("1", "VDC Name", VCloudMediaType.VDC_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
|
||||
new NamedResourceImpl(
|
||||
"4012",
|
||||
"Server1",
|
||||
VCloudMediaType.VAPP_XML,
|
||||
URI
|
||||
new NamedResourceImpl("4012", "Server1", VCloudMediaType.VAPP_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")
|
||||
|
||||
), null
|
||||
), null
|
||||
|
||||
);
|
||||
assertEquals(result, expects);
|
||||
|
@ -86,14 +74,11 @@ public class TaskHandlerTest extends BaseHandlerTest {
|
|||
public void testSelf() {
|
||||
InputStream is = getClass().getResourceAsStream("/task-self.xml");
|
||||
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class))
|
||||
.parse(is);
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
|
||||
|
||||
Task expects = new TaskImpl(
|
||||
"d188849-78",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"),
|
||||
TaskStatus.QUEUED, null, null, null, null, null);
|
||||
Task expects = new TaskImpl("d188849-78", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"),
|
||||
TaskStatus.QUEUED, null, null, null, null, null, null);
|
||||
assertEquals(result, expects);
|
||||
|
||||
}
|
||||
|
@ -101,45 +86,34 @@ public class TaskHandlerTest extends BaseHandlerTest {
|
|||
public void testApplyInputStream2() {
|
||||
InputStream is = getClass().getResourceAsStream("/task-hosting.xml");
|
||||
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class))
|
||||
.parse(is);
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
|
||||
|
||||
Task expects = new TaskImpl(
|
||||
"d188849-72",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-72"),
|
||||
TaskStatus.RUNNING,
|
||||
dateService.iso8601SecondsDateParse("2001-01-01T05:00:00Z"),
|
||||
null,
|
||||
new NamedResourceImpl(
|
||||
"188849",
|
||||
"188849",
|
||||
VCloudMediaType.VDC_XML,
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")),
|
||||
null, null);
|
||||
Task expects = new TaskImpl("97806", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/97806"), TaskStatus.SUCCESS,
|
||||
dateService.iso8601SecondsDateParse("2010-01-14T20:04:51Z"), dateService
|
||||
.iso8601SecondsDateParse("2010-01-14T20:05:02Z"), dateService
|
||||
.iso8601SecondsDateParse("2010-01-15T20:05:02Z"),
|
||||
|
||||
new NamedResourceImpl("188849-96", "188849-96", VCloudMediaType.VAPP_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96")), null,
|
||||
null);
|
||||
assertEquals(result, expects);
|
||||
|
||||
}
|
||||
|
||||
public void testError() {
|
||||
InputStream is = getClass().getResourceAsStream("/task-error.xml");
|
||||
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class))
|
||||
.parse(is);
|
||||
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
|
||||
|
||||
Task expects = new TaskImpl(
|
||||
"23",
|
||||
URI.create("http://10.150.4.49/api/v0.8/task/23"),
|
||||
TaskStatus.ERROR,
|
||||
dateService.iso8601SecondsDateParse("2009-12-07T19:05:02Z"),
|
||||
dateService.iso8601SecondsDateParse("2009-12-10T14:40:32Z"),
|
||||
new NamedResourceImpl("1", "APIOrg", VCloudMediaType.ORG_XML, URI
|
||||
.create("http://10.150.4.49/api/v0.8/org/1")),
|
||||
new NamedResourceImpl("1", "testapp1", VCloudMediaType.VAPP_XML,
|
||||
URI.create("http://10.150.4.49/api/v0.8/vapp/1")),
|
||||
new TaskImpl.ErrorImpl("Error processing job", "500",
|
||||
" Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00"));
|
||||
Task expects = new TaskImpl("23", URI.create("http://10.150.4.49/api/v0.8/task/23"),
|
||||
TaskStatus.ERROR, dateService.iso8601SecondsDateParse("2009-12-07T19:05:02Z"),
|
||||
dateService.iso8601SecondsDateParse("2009-12-10T14:40:32Z"), null,
|
||||
new NamedResourceImpl("1", "APIOrg", VCloudMediaType.ORG_XML, URI
|
||||
.create("http://10.150.4.49/api/v0.8/org/1")), new NamedResourceImpl("1",
|
||||
"testapp1", VCloudMediaType.VAPP_XML, URI
|
||||
.create("http://10.150.4.49/api/v0.8/vapp/1")),
|
||||
new TaskImpl.ErrorImpl("Error processing job", "500",
|
||||
" Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00"));
|
||||
assertEquals(result, expects);
|
||||
|
||||
}
|
||||
|
|
|
@ -60,24 +60,30 @@ public class TasksListHandlerTest extends BaseHandlerTest {
|
|||
TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"));
|
||||
Task task1 = new TaskImpl("3300", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"),
|
||||
TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"),
|
||||
dateService.iso8601DateParse("2009-08-24T21:30:32.63Z"), new NamedResourceImpl("1",
|
||||
"VDC Name", VCloudMediaType.VDC_XML,
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
|
||||
Task task1 = new TaskImpl(
|
||||
"3300",
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"),
|
||||
TaskStatus.SUCCESS,
|
||||
dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"),
|
||||
dateService.iso8601DateParse("2009-08-24T21:30:32.63Z"),
|
||||
null,
|
||||
new NamedResourceImpl("1", "VDC Name", VCloudMediaType.VDC_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
|
||||
new NamedResourceImpl("4012", "Server1", VCloudMediaType.VAPP_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")),null);
|
||||
Task task2 = new TaskImpl("3299", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
|
||||
TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
|
||||
dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"), new NamedResourceImpl("1",
|
||||
"VDC Name", VCloudMediaType.VDC_XML,
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")),
|
||||
null);
|
||||
Task task2 = new TaskImpl(
|
||||
"3299",
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
|
||||
TaskStatus.SUCCESS,
|
||||
dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
|
||||
dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"),
|
||||
null,
|
||||
new NamedResourceImpl("1", "VDC Name", VCloudMediaType.VDC_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
|
||||
new NamedResourceImpl("4012", "Server1", VCloudMediaType.VAPP_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")
|
||||
), null
|
||||
);
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")),
|
||||
null);
|
||||
assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2));
|
||||
assertEquals(
|
||||
result.getTasksByResult(),
|
||||
|
|
|
@ -48,14 +48,14 @@ import com.google.common.collect.ListMultimap;
|
|||
*/
|
||||
@Test(groups = "unit", testName = "vcloud.VAppHandlerTest")
|
||||
public class VAppHandlerTest extends BaseHandlerTest {
|
||||
@Test(enabled=false)
|
||||
@Test(enabled = false)
|
||||
public void testHosting() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/vapp-hosting.xml");
|
||||
|
||||
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
|
||||
|
||||
ListMultimap<String, InetAddress> networkToAddresses = ImmutableListMultimap
|
||||
.<String, InetAddress> of("Network 1", InetAddress.getByName("204.12.59.147"));
|
||||
.<String, InetAddress> of("Network 1", InetAddress.getByName("204.12.11.167"));
|
||||
|
||||
VirtualSystem system = new VirtualSystem(0, "Virtual Hardware Family", "SimpleVM", "vmx-07");
|
||||
|
||||
|
@ -76,28 +76,27 @@ public class VAppHandlerTest extends BaseHandlerTest {
|
|||
null, "20971520", null, 0, 3, null, 20971520, "byte * 2^20"))
|
||||
.build();
|
||||
|
||||
VApp expects = new VAppImpl("188849-74", "188849-74", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-74"), VAppStatus.ON,
|
||||
new Long(20971520),null,
|
||||
networkToAddresses, null, system, resourceAllocations);
|
||||
VApp expects = new VAppImpl("188849-96", "188849-96", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96"), VAppStatus.OFF,
|
||||
new Long(20971520), null, networkToAddresses, null, system, resourceAllocations);
|
||||
|
||||
assertEquals(result, expects);
|
||||
}
|
||||
|
||||
public void testInstantiated() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/instantiatedvapp.xml");
|
||||
|
||||
VApp result = factory.create(
|
||||
injector.getInstance(VAppHandler.class)).parse(is);
|
||||
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
|
||||
|
||||
VApp expects = new VAppImpl("10", "centos53", URI
|
||||
.create("http://10.150.4.49/api/v0.8/vApp/10"),
|
||||
VAppStatus.RESOLVED, 123456789l, new NamedResourceImpl("4", null,
|
||||
"application/vnd.vmware.vcloud.vdc+xml", URI
|
||||
.create("http://10.150.4.49/api/v0.8/vdc/4")),
|
||||
ImmutableListMultimap.<String, InetAddress> of(),
|
||||
null, null, ImmutableSet.<ResourceAllocation>of());
|
||||
VApp expects = new VAppImpl("10", "centos53", URI
|
||||
.create("http://10.150.4.49/api/v0.8/vApp/10"), VAppStatus.RESOLVED, 123456789l,
|
||||
new NamedResourceImpl("4", null, "application/vnd.vmware.vcloud.vdc+xml", URI
|
||||
.create("http://10.150.4.49/api/v0.8/vdc/4")), ImmutableListMultimap
|
||||
.<String, InetAddress> of(), null, null, ImmutableSet
|
||||
.<ResourceAllocation> of());
|
||||
assertEquals(result, expects);
|
||||
}
|
||||
|
||||
// TODO why does this fail?
|
||||
@Test(enabled = false)
|
||||
public void testDefault() throws UnknownHostException {
|
||||
|
@ -106,7 +105,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
|
|||
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
|
||||
|
||||
ListMultimap<String, InetAddress> networkToAddresses = ImmutableListMultimap
|
||||
.<String, InetAddress> of();
|
||||
.<String, InetAddress> of();
|
||||
|
||||
VirtualSystem system = new VirtualSystem(0, "Virtual Hardware Family", "Oracle", "vmx-07");
|
||||
|
||||
|
@ -121,21 +120,21 @@ public class VAppHandlerTest extends BaseHandlerTest {
|
|||
new ResourceAllocation(3, "SCSI Controller 0", "SCSI Controller",
|
||||
ResourceType.SCSI_CONTROLLER, "lsilogic", null, 0, null, null,
|
||||
null, 1, null)).add(
|
||||
new ResourceAllocation(8, "Network Adapter 1", "PCNet32 ethernet adapter on \"Internal\" network",
|
||||
new ResourceAllocation(8, "Network Adapter 1",
|
||||
"PCNet32 ethernet adapter on \"Internal\" network",
|
||||
ResourceType.ETHERNET_ADAPTER, "PCNet32", null, null, 7, null,
|
||||
true, 1, null)).add(
|
||||
true, 1, null)).add(
|
||||
new ResourceAllocation(9, "Hard Disk 1", null, ResourceType.DISK_DRIVE,
|
||||
null, "104857", null, 0, 3, null, 104857, "byte * 2^20"))
|
||||
.build();
|
||||
null, "104857", null, 0, 3, null, 104857, "byte * 2^20")).build();
|
||||
|
||||
VApp expects = new VAppImpl("4", "Oracle", URI
|
||||
.create("http://10.150.4.49/api/v0.8/vApp/4"), VAppStatus.ON,
|
||||
new Long(104857), new NamedResourceImpl("32", null,
|
||||
"application/vnd.vmware.vcloud.vdc+xml", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")),
|
||||
networkToAddresses, "Other Linux (32-bit)", system, resourceAllocations);
|
||||
VApp expects = new VAppImpl("4", "Oracle", URI.create("http://10.150.4.49/api/v0.8/vApp/4"),
|
||||
VAppStatus.ON, new Long(104857),
|
||||
new NamedResourceImpl("32", null, "application/vnd.vmware.vcloud.vdc+xml", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")),
|
||||
networkToAddresses, "Other Linux (32-bit)", system, resourceAllocations);
|
||||
|
||||
assertEquals(result, expects);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Task href="https://vcloud.safesecureweb.com/api/v0.8/task/d188849-72"
|
||||
xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:common="http://www.vmware.com/vcloud/common"
|
||||
<Task href="https://vcloud.safesecureweb.com/api/v0.8/task/97806" xmlns="http://www.vmware.com/vcloud/v0.8"
|
||||
xmlns:common="http://www.vmware.com/vcloud/common"
|
||||
xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/task
|
||||
https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd
|
||||
http://www.vmware.com/vcloud/common
|
||||
https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" status="running"
|
||||
startTime="2001-01-01T05:00:00Z">
|
||||
<Link rel="task:cancel" href="https://vcloud.safesecureweb.com/api/v0.8/task/d188849-72/action/cancel" />
|
||||
<Owner href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
|
||||
type="application/vnd.vmware.vcloud.vdc+xml" name="188849" />
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
status="success" startTime="2010-01-14T20:04:51Z" endTime="2010-01-14T20:05:02Z" expiryTime="2010-01-15T20:05:02Z">
|
||||
|
||||
<Owner href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96" type="application/vnd.vmware.vcloud.vApp+xml" name="188849-96" />
|
||||
</Task>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VApp href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-74"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" name="188849-74"
|
||||
status="4" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 vapp.xsd"
|
||||
<VApp href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" name="188849-96"
|
||||
status="2" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 vapp.xsd"
|
||||
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns="http://www.vmware.com/vcloud/v0.8"
|
||||
xmlns:vmw="http://www.vmware.com/schema/ovf"
|
||||
xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
|
||||
|
@ -11,7 +11,7 @@
|
|||
<NetworkConnectionSection>
|
||||
<Info xmlns="http://schemas.dmtf.org/ovf/envelope/1">Network Information about the vApp</Info>
|
||||
<NetworkConnection Network="Network 1">
|
||||
<IpAddress>204.12.59.147</IpAddress>
|
||||
<IpAddress>204.12.11.167</IpAddress>
|
||||
</NetworkConnection>
|
||||
</NetworkConnectionSection>
|
||||
|
||||
|
@ -232,5 +232,4 @@
|
|||
xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
|
||||
</Item>
|
||||
</VirtualHardwareSection>
|
||||
</VApp>
|
||||
|
||||
</VApp>
|
|
@ -53,10 +53,10 @@ import com.google.inject.internal.ImmutableMap;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = false, sequential = true, testName = "vcloud.HostingDotComVCloudClientLiveTest")
|
||||
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.HostingDotComVCloudClientLiveTest")
|
||||
public class HostingDotComVCloudComputeClientLiveTest {
|
||||
HostingDotComVCloudComputeClient client;
|
||||
HostingDotComVCloudClient tmClient;
|
||||
HostingDotComVCloudClient hostingClient;
|
||||
|
||||
private String id;
|
||||
private InetAddress privateAddress;
|
||||
|
@ -79,11 +79,12 @@ public class HostingDotComVCloudComputeClientLiveTest {
|
|||
Image.RHEL_53,
|
||||
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).put(
|
||||
Image.UBUNTU_90, new Expectation(4194304, "Ubuntu Linux (64-bit)")).put(
|
||||
Image.UBUNTU_JEOS_90, new Expectation(4194304, "Ubuntu Linux (32-bit)")).build();
|
||||
Image.UBUNTU_JEOS_90, new Expectation(4194304, "Ubuntu Linux (32-bit)"))
|
||||
.build();
|
||||
|
||||
private Predicate<InetAddress> addressTester;
|
||||
|
||||
@Test
|
||||
@Test(enabled = true)
|
||||
public void testPowerOn() throws InterruptedException, ExecutionException, TimeoutException,
|
||||
IOException {
|
||||
Image toTest = Image.CENTOS_53;
|
||||
|
@ -97,7 +98,7 @@ public class HostingDotComVCloudComputeClientLiveTest {
|
|||
id = client.start(serverName, toTest, processorCount, memory, disk, properties).get("id");
|
||||
Expectation expectation = expectationMap.get(toTest);
|
||||
|
||||
VApp vApp = tmClient.getVApp(id);
|
||||
VApp vApp = hostingClient.getVApp(id);
|
||||
verifyConfigurationOfVApp(vApp, serverName, expectation.os, processorCount, memory,
|
||||
expectation.hardDisk);
|
||||
assertEquals(vApp.getStatus(), VAppStatus.ON);
|
||||
|
@ -110,7 +111,7 @@ public class HostingDotComVCloudComputeClientLiveTest {
|
|||
return serverName;
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testPowerOn")
|
||||
@Test(dependsOnMethods = "testPowerOn", enabled = true)
|
||||
public void testGetAnyPrivateAddress() {
|
||||
privateAddress = client.getAnyPrivateAddress(id);
|
||||
assert !addressTester.apply(privateAddress);
|
||||
|
@ -150,7 +151,7 @@ public class HostingDotComVCloudComputeClientLiveTest {
|
|||
new HostingDotComVCloudPropertiesBuilder(account, key).relaxSSLHostname().build())
|
||||
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
||||
client = injector.getInstance(HostingDotComVCloudComputeClient.class);
|
||||
tmClient = injector.getInstance(HostingDotComVCloudClient.class);
|
||||
hostingClient = injector.getInstance(HostingDotComVCloudClient.class);
|
||||
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<InetAddress>>() {
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ParseTaskFromLocationHeader implements Function<HttpResponse, Task>
|
|||
if (location != null) {
|
||||
String taskId = location.substring(location.lastIndexOf('/') + 1);
|
||||
return new TaskImpl(taskId, URI.create(location), TaskStatus.QUEUED, new Date(), null,
|
||||
null, null, null);
|
||||
null, null, null, null);
|
||||
} else {
|
||||
throw new HttpResponseException("no uri in headers or content", null, from);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue