use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendDataCentersResourceTest method doTestBadAddDataCenter.
private void doTestBadAddDataCenter(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddEmptyStoragePool, StoragePoolManagementParameter.class, new String[] {}, new Object[] {}, valid, success));
DataCenter model = getModel(0);
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendDataCentersResourceTest method testAddDataCenter.
@Test
public void testAddDataCenter() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpVersionExpectations(0);
setUpCreationExpectations(ActionType.AddEmptyStoragePool, StoragePoolManagementParameter.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetStoragePoolById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
DataCenter model = getModel(0);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof DataCenter);
verifyModel((DataCenter) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendGroupAssignedPermissionsResourceTest method getModel.
@Override
protected Permission getModel() {
Permission model = new Permission();
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(GUIDS[2].toString());
model.setRole(new Role());
model.getRole().setId(GUIDS[3].toString());
return model;
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendUserAssignedPermissionsResourceTest method getModel.
@Override
protected Permission getModel() {
Permission model = new Permission();
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(GUIDS[2].toString());
model.setRole(new Role());
model.getRole().setId(GUIDS[3].toString());
return model;
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class IscsiBondMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.IscsiBond.class, to = IscsiBond.class)
public static IscsiBond map(org.ovirt.engine.core.common.businessentities.IscsiBond from, IscsiBond to) {
IscsiBond iscsiBond = (to != null) ? to : new IscsiBond();
DataCenter dataCenter = new DataCenter();
dataCenter.setId(from.getStoragePoolId().toString());
iscsiBond.setDataCenter(dataCenter);
iscsiBond.setName(from.getName());
iscsiBond.setDescription(from.getDescription());
if (from.getId() != null) {
iscsiBond.setId(from.getId().toString());
}
Networks networks = new Networks();
for (Guid id : from.getNetworkIds()) {
Network network = new Network();
network.setId(id.toString());
networks.getNetworks().add(network);
}
iscsiBond.setNetworks(networks);
StorageConnections connections = new StorageConnections();
for (String id : from.getStorageConnectionIds()) {
StorageConnection conn = new StorageConnection();
conn.setId(id);
connections.getStorageConnections().add(conn);
}
iscsiBond.setStorageConnections(connections);
return iscsiBond;
}
Aggregations