use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendEntityAssignedPermissionsResourceTest method testAddIncompletePermission.
@Test
public void testAddIncompletePermission() throws Exception {
Permission model = new Permission();
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(GUIDS[2].toString());
model.setRole(new Role());
model.getRole().setId(GUIDS[3].toString());
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Permission", "add", "user|group.id");
}
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendClustersResourceTest method getModel.
static org.ovirt.engine.api.model.Cluster getModel(int index) {
org.ovirt.engine.api.model.Cluster model = new org.ovirt.engine.api.model.Cluster();
model.setName(NAMES[index]);
model.setDescription(DESCRIPTIONS[index]);
model.setDataCenter(new DataCenter());
model.setCpu(new Cpu());
model.getCpu().setType("Intel Xeon");
return model;
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendDataCenterNetworksResourceTest method testAddNetwork.
@Test
public void testAddNetwork() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
null, QueryType.GetNetworksByDataCenterId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DATA_CENTER_ID }, asList(getEntity(0)));
Network model = getModel(0);
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(DATA_CENTER_ID.toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Network);
verifyModel((Network) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.DataCenter in project ovirt-engine by oVirt.
the class BackendDataCenterNetworksResourceTest method doTestBadAddNetwork.
private void doTestBadAddNetwork(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, valid, success));
Network model = getModel(0);
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(DATA_CENTER_ID.toString());
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 BackendDataCenterResourceTest method testConflictedUpdate.
@Test
public void testConflictedUpdate() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpGetEntityExpectations(1);
DataCenter model = getModel(1);
model.setId(GUIDS[1].toString());
try {
resource.update(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyImmutabilityConstraint(wae);
}
}
Aggregations