}
}
@Test
public void testNoMatchMondrianOneToOneUserRoleListMapper() throws Exception {
final MondrianOneToOneUserRoleListMapper mapper = new MondrianOneToOneUserRoleListMapper();
mapper.setFailOnEmptyRoleList( true );
try {
SecurityHelper.getInstance().runAsUser( "admin", new Callable<String[]>() {
@Override
public String[] call() throws Exception {
return mapper.mapConnectionRoles( PentahoSessionHolder.getSession(), "SteelWheelsRoles" );
}
} );
Assert.fail();
} catch ( PentahoAccessControlException e ) {
// No op.
}
mapper.setFailOnEmptyRoleList( false );
try {
String[] roles = SecurityHelper.getInstance().runAsUser( "simplebob", new Callable<String[]>() {
@Override
public String[] call() throws Exception {
return mapper.mapConnectionRoles( PentahoSessionHolder.getSession(), "SteelWheelsRoles" );
}
} );
Assert.assertArrayEquals( new String[] { "Role1", "Role2" }, roles );
} catch ( PentahoAccessControlException e ) {
Assert.fail( e.getMessage() );