}
}
@Test
public void testGetAllAuthorities1ForTenant() {
ITenant defaultTenant = new Tenant( "/pentaho/tenant0", true );
login( "suzy", defaultTenant );
SearchControls con1 = new SearchControls();
con1.setReturningAttributes( new String[] { "cn" } ); //$NON-NLS-1$
LdapSearchParamsFactory paramsFactory =
new LdapSearchParamsFactoryImpl( "ou=roles", "(objectClass=organizationalRole)", con1 ); //$NON-NLS-1$//$NON-NLS-2$
Transformer one = new SearchResultToAttrValueList( "cn" ); //$NON-NLS-1$
Transformer two = new StringToGrantedAuthority();
Transformer[] transformers = { one, two };
Transformer transformer = new ChainedTransformer( transformers );
LdapSearch rolesSearch = new GenericLdapSearch( getContextSource(), paramsFactory, transformer );
DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();
userRoleListService.setAllAuthoritiesSearch( rolesSearch );
List res = userRoleListService.getAllRoles( defaultTenant );
assertTrue( res.contains( "ROLE_CTO" ) ); //$NON-NLS-1$
assertTrue( res.contains( "ROLE_CEO" ) ); //$NON-NLS-1$
if ( logger.isDebugEnabled() ) {
logger.debug( "results of getAllAuthorities1(): " + res ); //$NON-NLS-1$
}
try {
userRoleListService.getAllRoles( new Tenant( "/pentaho", true ) );
} catch ( UnsupportedOperationException uoe ) {
assertNotNull( uoe );
}
}