Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IUserRoleListService


public class CachingUserRoleListServiceDecoratorTest {

  @Test
  public void testGetAllRoles() throws Exception {
    IUserRoleListService mockService = mock( IUserRoleListService.class );
    when( mockService.getAllRoles() ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getAllRoles();
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here


    verify( mockService, times( 1 ) ).getAllRoles();
  }

  @Test
  public void testGetSystemRoles() throws Exception {
    IUserRoleListService mockService = mock( IUserRoleListService.class );
    when( mockService.getSystemRoles() ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getSystemRoles();
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here

  private ITenant tenant = mock( ITenant.class );

  @Test
  public void testGetRolesForUser() throws Exception {

    IUserRoleListService mockService = mock( IUserRoleListService.class );

    when( mockService.getRolesForUser( tenant, "joe" ) ).thenReturn( Arrays.asList( "foo", "bar" ) );
    when( mockService.getRolesForUser( tenant, "admin" ) ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getRolesForUser( tenant, "joe" );
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here

  }

  @Test
  public void testGetAllUsers() throws Exception {

    IUserRoleListService mockService = mock( IUserRoleListService.class );
    when( mockService.getAllUsers() ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getAllUsers();
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here

  }

  @Test
  public void testGetAllRoles1() throws Exception {

    IUserRoleListService mockService = mock( IUserRoleListService.class );
    when( mockService.getAllRoles( tenant ) ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getAllRoles( tenant );
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here

  }

  @Test
  public void testGetUsersInRole() throws Exception {

    IUserRoleListService mockService = mock( IUserRoleListService.class );
    when( mockService.getUsersInRole( tenant, "ceo" ) ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getUsersInRole( tenant, "ceo" );
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here

  }

  @Test
  public void testGetAllUsers1() throws Exception {

    IUserRoleListService mockService = mock( IUserRoleListService.class );
    when( mockService.getAllUsers( tenant ) ).thenReturn( Arrays.asList( "foo", "bar" ) );


    CachingUserRoleListServiceDecorator decorator = new CachingUserRoleListServiceDecorator( mockService );
    List<String> allRoles = decorator.getAllUsers( tenant );
    assertArrayEquals( "does not match", new String[] { "foo", "bar" }, allRoles.toArray() );
View Full Code Here

    }
  }

  @Test
  public void testGetUsers() {
    IUserRoleListService service = mock( IUserRoleListService.class );
    doReturn( service ).when( userRoleListService ).getUserRoleListService();

    List<String> users = new ArrayList<String>();
    users.add( "admin" );
    users.add( "joe" );
View Full Code Here

  public void testDoGetRoles() {
    List<String> roles = new ArrayList<String>();
    roles.add( "ROLE1" );
    roles.add( "ROLE2" );

    IUserRoleListService userRoleListService1 = mock( IUserRoleListService.class );

    doReturn( userRoleListService1 ).when( userRoleListService ).getUserRoleListService();
    doReturn( roles ).when( userRoleListService1 ).getAllRoles();

    RoleListWrapper roleListWrapper = userRoleListService.getRoles();
View Full Code Here

    List<String> roles = new ArrayList<String>();
    roles.add( "ROLE1" );
    roles.add( "ROLE2" );
    roles.add( "ADMIN_ROLE" );

    IUserRoleListService userRoleListService1 = mock( IUserRoleListService.class );
    doReturn( userRoleListService1 ).when( userRoleListService ).getUserRoleListService();
    doReturn( roles ).when( userRoleListService1 ).getAllRoles();

    ArrayList<String> extraRoles = new ArrayList<String>();
    extraRoles.add( "EXTRA_ROLE1" );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IUserRoleListService

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.