use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendAttachedStorageDomainsResourceTest method testAddByName.
@Test
public void testAddByName() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpGetConnection(1);
setUpEntityQueryExpectations(QueryType.GetStorageDomainByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[0] }, getEntityStatic(0));
setUpCreationExpectations(ActionType.AttachStorageDomainToPool, AttachStorageDomainToPoolParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, true, true, null, QueryType.GetStorageDomainByIdAndStoragePoolId, StorageDomainAndPoolQueryParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, getEntity(0));
StorageDomain model = new StorageDomain();
model.setName(NAMES[0]);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof StorageDomain);
verifyModel((StorageDomain) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendAttachedStorageDomainsResourceTest method testAddIncompleteParameters.
@Test
public void testAddIncompleteParameters() throws Exception {
StorageDomain model = new StorageDomain();
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "StorageDomain", "add", "id|name");
}
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendAttachedStorageDomainsResourceTest method testAdd.
@Test
public void testAdd() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpGetConnection(1);
setUpCreationExpectations(ActionType.AttachStorageDomainToPool, AttachStorageDomainToPoolParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, true, true, null, QueryType.GetStorageDomainByIdAndStoragePoolId, StorageDomainAndPoolQueryParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, getEntity(0));
StorageDomain model = new StorageDomain();
model.setId(GUIDS[0].toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof StorageDomain);
verifyModel((StorageDomain) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendDiskResourceTest method testExport.
@Test
public void testExport() throws Exception {
setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[] { "ImageGroupID", "DestinationDomainId" }, new Object[] { DISK_ID, GUIDS[3] }, true, true, null, null, true));
Action action = new Action();
action.setStorageDomain(new StorageDomain());
action.getStorageDomain().setId(GUIDS[3].toString());
verifyActionResponse(resource.export(action));
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendDiskResourceTest method setUpParams.
private Action setUpParams(boolean byName) {
Action action = new Action();
StorageDomain sd = new StorageDomain();
if (byName) {
sd.setName(NAMES[2]);
} else {
sd.setId(GUIDS[3].toString());
}
action.setStorageDomain(sd);
return action;
}
Aggregations