use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddIscsiStorageDomain.
@Test
public void testAddIscsiStorageDomain() throws Exception {
StorageDomain model = getIscsi();
Host host = new Host();
host.setId(GUIDS[0].toString());
model.setHost(host);
setUriInfo(setUpActionExpectations(ActionType.ConnectStorageToVds, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "VdsId" }, new Object[] { ADDRESSES[0], GUIDS[0] }, true, true, GUIDS[0].toString()));
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");
setUpGetEntityExpectations(QueryType.GetLunsByVgId, GetLunsByVgIdParameters.class, new String[] { "VgId" }, new Object[] { GUIDS[GUIDS.length - 1].toString() }, setUpLuns());
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());
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendHostResourceTest method testUpdateWithClusterId.
@Test
public void testUpdateWithClusterId() throws Exception {
setUpGetEntityExpectations(3);
setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[1], GUIDS[0] }, true, true, new ActionReturnValue(), false));
setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true));
org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
cluster.setId(GUIDS[1].toString());
Host host = getModel(0);
host.setCluster(cluster);
verifyModel(resource.update(host), 0);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendHostResourceTest method testStatisticalQuery.
@Test
public void testStatisticalQuery() throws Exception {
VDS entity = setUpStatisticalExpectations();
@SuppressWarnings("unchecked") BackendStatisticsResource<Host, VDS> statisticsResource = (BackendStatisticsResource<Host, VDS>) resource.getStatisticsResource();
assertNotNull(statisticsResource);
verifyQuery(statisticsResource.getQuery(), entity);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendHostsResourceTest method testAddHostClusterById.
@Test
public void testAddHostClusterById() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AddVds, AddVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true, GUIDS[0], QueryType.GetVdsByVdsId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
Host model = getModel(0);
model.setCluster(new Cluster());
model.getCluster().setId(GUIDS[1].toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Host);
verifyModel((Host) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendHostsResourceTest method testAddHostClusterByName.
@Test
public void testAddHostClusterByName() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, setUpCluster(GUIDS[1]));
setUpCreationExpectations(ActionType.AddVds, AddVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true, GUIDS[0], QueryType.GetVdsByVdsId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
Host model = getModel(0);
model.setCluster(new Cluster());
model.getCluster().setName(NAMES[1]);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Host);
verifyModel((Host) response.getEntity(), 0);
}
Aggregations