use of org.ovirt.engine.api.model.Permission in project ovirt-engine by oVirt.
the class BackendEntityAssignedPermissionsResourceTest method getModel.
@Override
protected Permission getModel() {
Permission model = new Permission();
model.setUser(new User());
model.getUser().setId(GUIDS[1].toString());
model.setRole(new Role());
model.getRole().setId(GUIDS[3].toString());
return model;
}
use of org.ovirt.engine.api.model.Permission 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.Permission in project ovirt-engine by oVirt.
the class BackendGroupAssignedPermissionsResourceTest method testAddIncompletePermission.
@Test
public void testAddIncompletePermission() throws Exception {
Permission model = new Permission();
model.setGroup(new Group());
model.getGroup().setId(GUIDS[1].toString());
model.setRole(new Role());
model.getRole().setId(GUIDS[3].toString());
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Permission", "add", "dataCenter|cluster|host|storageDomain|vm|vmPool|template.id");
}
}
use of org.ovirt.engine.api.model.Permission 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.Permission in project ovirt-engine by oVirt.
the class AbstractBackendAssignedPermissionsResourceTest method testAddPermission.
@Test
public void testAddPermission() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AddPermission, PermissionsOperationsParameters.class, new String[] { principalParameterName, "Permission.AdElementId", "Permission.ObjectId", "Permission.RoleId" }, new Object[] { GUIDS[1], chooseElementId(), chooseObjectId(), GUIDS[3] }, true, true, GUIDS[0], QueryType.GetPermissionById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
Permission model = getModel();
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Permission);
verifyModel((Permission) response.getEntity(), 0);
}
Aggregations