use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddExistingStorageDomain.
@Test
public void testAddExistingStorageDomain() throws Exception {
Host host = new Host();
host.setId(GUIDS[0].toString());
doTestAddStorageDomain(1, host, true);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method doTestBadCnxAdd.
private void doTestBadCnxAdd(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "VdsId" }, new Object[] { ADDRESSES[0] + ":" + PATHS[0], STORAGE_TYPES_MAPPED[0], GUIDS[0] }, valid, success, GUIDS[0].toString(), true));
StorageDomain model = getModel(0);
model.setHost(new Host());
model.getHost().setId(GUIDS[0].toString());
try {
collection.add(model);
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendStatisticsResourceTest method getPrototype.
static Statistic getPrototype(String name) {
Statistic statistic = new Statistic();
statistic.setName(name);
statistic.setId(UUID.nameUUIDFromBytes(statistic.getName().getBytes()).toString());
statistic.setUnit(StatisticUnit.BYTES);
statistic.setKind(StatisticKind.GAUGE);
Value value = new Value();
statistic.setValues(new Values());
statistic.setType(ValueType.INTEGER);
statistic.getValues().getValues().add(value);
statistic.setHost(new Host());
statistic.getHost().setId(GUIDS[2].toString());
return statistic;
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendStorageServerConnectionResourceTest method testRemove.
@Test
public void testRemove() throws Exception {
setUpGetEntityExpectations();
Host host = new Host();
host.setId(GUIDS[1].toString());
StorageServerConnections connection = new StorageServerConnections();
connection.setId(GUIDS[3].toString());
connection.setConnection("/data1");
UriInfo uriInfo = setUpActionExpectations(ActionType.RemoveStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection", "VdsId" }, new Object[] { connection, GUIDS[1] }, true, true, false);
uriInfo = addMatrixParameterExpectations(uriInfo, BackendStorageServerConnectionResource.HOST, GUIDS[1].toString());
setUriInfo(uriInfo);
verifyRemove(resource.remove());
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendStorageServerConnectionResourceTest method testRemoveValidateFail.
@Test
public void testRemoveValidateFail() throws Exception {
setUpGetEntityExpectations();
Host host = new Host();
host.setId(GUIDS[1].toString());
StorageServerConnections connection = new StorageServerConnections();
connection.setId(GUIDS[3].toString());
connection.setConnection("/data1");
UriInfo uriInfo = setUpActionExpectations(ActionType.RemoveStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection", "VdsId" }, new Object[] { connection, GUIDS[1] }, false, false, false);
uriInfo = addMatrixParameterExpectations(uriInfo, BackendStorageServerConnectionResource.HOST, GUIDS[1].toString());
setUriInfo(uriInfo);
try {
resource.remove();
} catch (WebApplicationException wae) {
assertNotNull(wae.getResponse());
assertEquals(400, wae.getResponse().getStatus());
}
}
Aggregations