Package org.pentaho.platform.security.userroledao.ws

Examples of org.pentaho.platform.security.userroledao.ws.IUserRoleWebService


    Assert.assertEquals( 1, roles.length );
  }

  @Test
  public void testGetUsersForRole() throws UserRoleException {
    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoRole roleObj = new ProxyPentahoRole( "testRole1" );
    try {
      service.getUsersForRole( roleObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    ProxyPentahoUser[] userObjs = service.getUsersForRole( roleObj );

    Assert.assertEquals( 1, userObjs.length );
  }
View Full Code Here


  @Test
  public void testSetRoles() throws UserRoleException {
    UserRoleDaoMock userRoleDao = PentahoSystem.get( UserRoleDaoMock.class, USER_ROLE_DAO_TXN, null );

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoUser userObj = new ProxyPentahoUser();
    userObj.setName( "test1" );

    ProxyPentahoRole[] rolesObj = new ProxyPentahoRole[1];
    rolesObj[0] = new ProxyPentahoRole( "testRole2" );

    try {
      service.setRoles( userObj, rolesObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    userRoleDao.getUserRoles( null, "test1" );
    Assert.assertEquals( "testRole1", userRoleDao.getUserRoles( null, "test1" ).get( 0 ).getName() );

    service.setRoles( userObj, rolesObj );

    Assert.assertEquals( "testRole2", userRoleDao.getUserRoles( null, "test1" ).get( 0 ).getName() );
  }
View Full Code Here

  @Test
  public void testSetUsers() throws UserRoleException {
    UserRoleDaoMock userRoleDao = PentahoSystem.get( UserRoleDaoMock.class, USER_ROLE_DAO_TXN, null );

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoRole roleObj = new ProxyPentahoRole( "testRole1" );

    ProxyPentahoUser[] usersObj = new ProxyPentahoUser[1];
    usersObj[0] = new ProxyPentahoUser();
    usersObj[0].setName( "test2" );

    try {
      service.setUsers( roleObj, usersObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    Assert.assertEquals( "test1", userRoleDao.getRoleMembers( null, "testRole1" ).get( 0 ).getUsername() );

    service.setUsers( roleObj, usersObj );

    Assert.assertEquals( "test2", userRoleDao.getRoleMembers( null, "testRole1" ).get( 0 ).getUsername() );
  }
View Full Code Here

  @Test
  public void testUpdateUser() throws UserRoleException {
    UserRoleDaoMock userRoleDao = PentahoSystem.get( UserRoleDaoMock.class, USER_ROLE_DAO_TXN, null );

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoUser userObj = new ProxyPentahoUser();
    userObj.setName( "test1" );
    userObj.setDescription( "testUpdateUser" );
    userObj.setPassword( "newpass" );

    try {
      service.updateUser( userObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    Assert.assertEquals( "test", userRoleDao.getUser( null, "test1" ).getDescription() );

    service.updateUser( userObj );

    Assert.assertEquals( "testUpdateUser", userRoleDao.getUser( null, "test1" ).getDescription() );
  }
View Full Code Here

  @Test
  public void testUpdateRoleObject() throws UserRoleException {
    UserRoleDaoMock userRoleDao = PentahoSystem.get( UserRoleDaoMock.class, USER_ROLE_DAO_TXN, null );

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoRole roleObj = new ProxyPentahoRole( "testRole1" );
    roleObj.setDescription( "testUpdateRoleObject" );

    try {
      service.updateRoleObject( roleObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    Assert.assertEquals( "test role", userRoleDao.getRole( null, "testRole1" ).getDescription() );

    service.updateRoleObject( roleObj );

    Assert.assertEquals( "testUpdateRoleObject", userRoleDao.getRole( null, "testRole1" ).getDescription() );
  }
View Full Code Here

  @Test
  public void testUpdateRole() throws UserRoleException {
    UserRoleDaoMock userRoleDao = PentahoSystem.get( UserRoleDaoMock.class, USER_ROLE_DAO_TXN, null );

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoRole roleObj = new ProxyPentahoRole( "testRole1" );
    roleObj.setDescription( "testUpdateRoleObject" );
    List<String> usernames = new ArrayList<String>();
    try {
      service.updateRole( "testRole1", "testUpdateRoleObject", usernames );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    Assert.assertEquals( "test role", userRoleDao.getRole( null, "testRole1" ).getDescription() );

    service.updateRole( "testRole1", "testUpdateRoleObject", usernames );

    Assert.assertEquals( "testUpdateRoleObject", userRoleDao.getRole( null, "testRole1" ).getDescription() );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.security.userroledao.ws.IUserRoleWebService

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.