use of org.ovirt.engine.core.common.businessentities.RoleGroupMap in project ovirt-engine by oVirt.
the class RoleGroupMapDaoTest method testGetAllRoleGroupMaps.
/**
* Ensures the right mappings are returned.
*/
@Test
public void testGetAllRoleGroupMaps() {
List<RoleGroupMap> result = dao.getAllForRole(FixturesTool.ROLE_ID);
assertNotNull(result);
assertFalse(result.isEmpty());
for (RoleGroupMap map : result) {
assertEquals(FixturesTool.ROLE_ID, map.getRoleId());
}
}
use of org.ovirt.engine.core.common.businessentities.RoleGroupMap in project ovirt-engine by oVirt.
the class AttachActionGroupsToRoleCommandTest method testCheckGroupsCanBeAttachedAlreadyExists.
/* validate related tests */
@Test
public void testCheckGroupsCanBeAttachedAlreadyExists() {
RoleGroupMap map = new RoleGroupMap(getParams().getActionGroups().get(0), getParams().getRoleId());
mockGetAllForRole(Collections.singletonList(map));
List<String> messages = new ArrayList<>(1);
assertTrue("validate should fail", getCommand().checkIfGroupsCanBeAttached(messages));
assertEquals("wrong messages", EngineMessage.ERROR_CANNOT_ATTACH_ACTION_GROUP_TO_ROLE_ATTACHED.toString(), messages.get(0));
}
use of org.ovirt.engine.core.common.businessentities.RoleGroupMap in project ovirt-engine by oVirt.
the class RoleGroupMapDaoTest method testGetByActionGroupAndRole.
@Test
public void testGetByActionGroupAndRole() {
RoleGroupMap result = dao.getByActionGroupAndRole(existingRoleGroupMap.getActionGroup(), existingRoleGroupMap.getRoleId());
assertNotNull(result);
assertEquals(existingRoleGroupMap, result);
}
use of org.ovirt.engine.core.common.businessentities.RoleGroupMap in project ovirt-engine by oVirt.
the class RoleGroupMapDaoTest method testRemoveRoleGroupMap.
/**
* Ensures deleting a mapping works as expected.
*/
@Test
public void testRemoveRoleGroupMap() {
List<RoleGroupMap> before = dao.getAllForRole(FixturesTool.ROLE_ID);
// make sure we have things to delete first
assertFalse(before.isEmpty());
for (RoleGroupMap map : before) {
dao.remove(map.getActionGroup(), map.getRoleId());
}
List<RoleGroupMap> after = dao.getAllForRole(FixturesTool.ROLE_ID);
assertTrue(after.isEmpty());
}
use of org.ovirt.engine.core.common.businessentities.RoleGroupMap in project ovirt-engine by oVirt.
the class RoleGroupMapDaoTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getRoleGroupMapDao();
existingRoleGroupMap = dao.getByActionGroupAndRole(ActionGroup.RUN_VM, FixturesTool.ROLE_ID);
actionGroup = ActionGroup.CONNECT_TO_VM;
newRoleGroupMap = new RoleGroupMap(actionGroup, FixturesTool.ROLE_ID);
}
Aggregations