Search in sources :

Example 11 with JdbcUserRoleListService

use of org.pentaho.platform.plugin.services.security.userrole.jdbc.JdbcUserRoleListService in project pentaho-platform by pentaho.

the class JdbcUserRoleListServiceTest method testGetAllAuthoritiesWithRolePrefix.

@Test
public void testGetAllAuthoritiesWithRolePrefix() throws Exception {
    JdbcUserRoleListService dao = makePopulatedJdbcUserRoleListService();
    // $NON-NLS-1$
    dao.setAllAuthoritiesQuery("SELECT DISTINCT(AUTHORITY) AS AUTHORITY FROM AUTHORITIES ORDER BY 1");
    // $NON-NLS-1$
    dao.setRolePrefix("ARBITRARY_PREFIX_");
    dao.afterPropertiesSet();
    List<String> auths = dao.getAllRoles();
    // $NON-NLS-1$
    assertTrue("Authorities list should not be empty", auths.size() > 0);
    for (String role : auths) {
        // $NON-NLS-1$
        System.out.println("Authority with prefix: " + role);
    }
}
Also used : JdbcUserRoleListService(org.pentaho.platform.plugin.services.security.userrole.jdbc.JdbcUserRoleListService) Test(org.junit.Test)

Aggregations

JdbcUserRoleListService (org.pentaho.platform.plugin.services.security.userrole.jdbc.JdbcUserRoleListService)11 Test (org.junit.Test)10 ITenant (org.pentaho.platform.api.mt.ITenant)5 Tenant (org.pentaho.platform.core.mt.Tenant)5 ArrayList (java.util.ArrayList)1