use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainVmResourceTest method testImportAsNewEntity.
@Test
public void testImportAsNewEntity() throws Exception {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(GUIDS[2].toString());
org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
cluster.setId(GUIDS[1].toString());
setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
doTestImport(storageDomain, cluster, false, true);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainVmResourceTest method testImportNotFound.
@Test
public void testImportNotFound() throws Exception {
Action action = new Action();
action.setStorageDomain(new StorageDomain());
action.getStorageDomain().setId(GUIDS[2].toString());
action.setCluster(new org.ovirt.engine.api.model.Cluster());
action.getCluster().setId(GUIDS[1].toString());
setUpGetEntityExpectations(StorageDomainType.ImportExport, STORAGE_DOMAIN_ID, true);
try {
resource.doImport(action);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyNotFoundException(wae);
}
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method doTestAddStorageDomain.
public void doTestAddStorageDomain(int idx, Host host, boolean existing) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "VdsId" }, new Object[] { ADDRESSES[idx] + ":" + PATHS[idx], STORAGE_TYPES_MAPPED[idx], GUIDS[0] }, true, true, GUIDS[idx].toString()));
setUpGetEntityExpectations(QueryType.GetStorageServerConnectionById, StorageServerConnectionQueryParametersBase.class, new String[] { "ServerConnectionId" }, new Object[] { GUIDS[idx].toString() }, setUpStorageServerConnection(idx));
setUpGetEntityExpectations(QueryType.GetExistingStorageDomainList, GetExistingStorageDomainListParameters.class, new String[] { "Id", "StorageType", "StorageDomainType", "Path" }, new Object[] { GUIDS[0], STORAGE_TYPES_MAPPED[idx], TYPES_MAPPED[idx], ADDRESSES[idx] + ":" + PATHS[idx] }, getExistingStorageDomains(existing));
setUpCreationExpectations(!existing ? ActionType.AddNFSStorageDomain : ActionType.AddExistingFileStorageDomain, StorageDomainManagementParameter.class, new String[] {}, new Object[] {}, true, true, GUIDS[idx], QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[idx] }, getEntity(idx));
StorageDomain model = getModel(idx);
model.setHost(host);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof StorageDomain);
verifyModel((StorageDomain) response.getEntity(), idx);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddStorageDomainNoHost.
@Test
public void testAddStorageDomainNoHost() throws Exception {
setUriInfo(setUpBasicUriExpectations());
StorageDomain model = getModel(0);
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "StorageDomain", "add", "host.id|name");
}
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddIscsiStorageDomainAssumingConnection.
@Test
public void testAddIscsiStorageDomainAssumingConnection() throws Exception {
StorageDomain model = getIscsi();
Host host = new Host();
host.setId(GUIDS[0].toString());
model.setHost(host);
for (LogicalUnit lun : model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits()) {
lun.setAddress(null);
lun.setTarget(null);
}
setUriInfo(setUpBasicUriExpectations());
setUpGetEntityExpectations(QueryType.GetDeviceList, GetDeviceListQueryParameters.class, new String[] { "Id", "StorageType" }, new Object[] { GUIDS[0], org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI }, "this return value isn't used");
List<LUNs> luns = setUpLuns();
setUpGetEntityExpectations(QueryType.GetLunsByVgId, GetLunsByVgIdParameters.class, new String[] { "VgId" }, new Object[] { GUIDS[GUIDS.length - 1].toString() }, luns);
setUpCreationExpectations(ActionType.AddSANStorageDomain, AddSANStorageDomainParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[0], QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getIscsiEntity());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof StorageDomain);
verifyIscsi((StorageDomain) response.getEntity());
}
Aggregations