Package eu.scape_project.pw.idp.model

Examples of eu.scape_project.pw.idp.model.IdpRole


        TypedQuery<IdpRole> query = mock(TypedQuery.class);
        @SuppressWarnings("unchecked")
        TypedQuery<IdpRole> parameterQuery = mock(TypedQuery.class);
        when(em.createQuery("SELECT r from IdpRole r WHERE rolename = :rolename", IdpRole.class)).thenReturn(query);
        when(query.setParameter(anyString(), anyObject())).thenReturn(parameterQuery);
        IdpRole authenticatedRole = new IdpRole();
        authenticatedRole.setRoleName("authenticated");
        when(parameterQuery.getSingleResult()).thenReturn(authenticatedRole);
        userManager.setEntityManager(em);

        // -- test --
        IdpUser submittedUser = new IdpUser();
View Full Code Here


     *            User to add.
     */
    public void addUser(IdpUser user) {
        // Set standard role

        IdpRole role = null;
        List<IdpRole> standardRoles = em
            .createQuery("SELECT r from IdpRole r WHERE rolename = :rolename", IdpRole.class)
            .setParameter("rolename", STANDARD_ROLE_NAME).getResultList();
        if (standardRoles.size() == 1) {
            role = standardRoles.get(0);
        } else {
            role = new IdpRole();
            role.setRoleName(STANDARD_ROLE_NAME);
            em.persist(role);
            log.warn("Standard role not found, added standard role {}.", STANDARD_ROLE_NAME);
        }

        List<IdpRole> roles = user.getRoles();
View Full Code Here

TOP

Related Classes of eu.scape_project.pw.idp.model.IdpRole

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.