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

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


    System.setProperty( "com.sun.xml.ws.monitoring.registrationDebug", "FINE" );
    System.setProperty( "com.sun.xml.ws.monitoring.runtimeDebug", "true" );
    Service service =
        Service.create( new URL( "http://localhost:8080/pentaho/webservices/userRoleService?wsdl" ), new QName(
            "http://www.pentaho.org/ws/1.0", "userRoleService" ) );
    IUserRoleWebService userRoleWebService = service.getPort( IUserRoleWebService.class );
    ( (BindingProvider) userRoleWebService ).getRequestContext().put( BindingProvider.USERNAME_PROPERTY, "admin" );
    ( (BindingProvider) userRoleWebService ).getRequestContext().put( BindingProvider.PASSWORD_PROPERTY, "password" );
    // accept cookies to maintain session on server
    ( (BindingProvider) userRoleWebService ).getRequestContext().put( BindingProvider.SESSION_MAINTAIN_PROPERTY, true );

    UserRoleSecurityInfo info = userRoleWebService.getUserRoleSecurityInfo();

    // should be Authenticated
    System.out.println( info.getDefaultRoles().get( 0 ) );

  }
View Full Code Here


    return new UserRoleWebService();
  }

  @Test
  public void testGetUserRoleSecurityInfo() throws Exception {
    IUserRoleWebService service = getUserRoleWebService();

    try {
      service.getUserRoleSecurityInfo();
      Assert.fail();
    } catch ( UserRoleException e ) {
      // should this be 0001, not admin?
      Assert.assertTrue( e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    UserRoleSecurityInfo info = service.getUserRoleSecurityInfo();

    Assert.assertNotNull( info );
    Assert.assertEquals( 2, info.getRoles().size() );
    Assert.assertEquals( 2, info.getUsers().size() );
    Assert.assertEquals( 2, info.getAssignments().size() );
View Full Code Here

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

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoRole role = new ProxyPentahoRole( "role" );
    role.setDescription( "testing" );
    try {
      service.createRole( role );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    service.createRole( role );

    // the last role should have the same name and description
    IPentahoRole roleVerified = userRoleDao.getRole( null, "role" );
    Assert.assertNotNull( roleVerified );
    Assert.assertEquals( "role", roleVerified.getName() );
View Full Code Here

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

    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoUser user = new ProxyPentahoUser();
    user.setName( "test" );
    user.setEnabled( true );
    user.setPassword( "test" );
    user.setDescription( "testing" );
    try {
      service.createUser( user );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    service.createUser( user );

    // the last role should have the same name and description
    IPentahoUser userVerified = userRoleDao.getUser( null, "test" );
    Assert.assertNotNull( userVerified );
    Assert.assertEquals( "test", userVerified.getUsername() );
View Full Code Here

    Assert.assertEquals( "testing", userVerified.getDescription() );
  }

  @Test
  public void testGetUsers() throws Exception {
    IUserRoleWebService service = getUserRoleWebService();
    try {
      service.getUsers();
      Assert.fail();
    } catch ( UserRoleException e ) {
      // should this be 0001, not admin?
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    ProxyPentahoUser[] userObjs = service.getUsers();

    Assert.assertNotNull( userObjs );
    Assert.assertEquals( 2, userObjs.length );

  }
View Full Code Here

  }

  @Test
  public void testGetRoles() throws Exception {
    IUserRoleWebService service = getUserRoleWebService();
    try {
      service.getRoles();
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    ProxyPentahoRole[] roleObjs = service.getRoles();

    Assert.assertNotNull( roleObjs );
    Assert.assertEquals( 2, roleObjs.length );

  }
View Full Code Here

  }

  @Test
  public void testGetUser() throws Exception {
    IUserRoleWebService service = getUserRoleWebService();
    try {
      service.getUser( null );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    ProxyPentahoUser userObj = service.getUser( "test1" );

    Assert.assertNotNull( userObj );
    Assert.assertEquals( "test1", userObj.getName() );

  }
View Full Code Here

  }

  @Test
  public void testDeleteRoles() throws Exception {
    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoRole[] rolesObj = new ProxyPentahoRole[1];
    rolesObj[0] = new ProxyPentahoRole( "testRole1" );
    try {
      service.deleteRoles( rolesObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    service.deleteRoles( rolesObj );

    Assert.assertEquals( 1, roles.size() );
  }
View Full Code Here

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

  @Test
  public void testDeleteUsers() throws Exception {
    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoUser[] usersObj = new ProxyPentahoUser[1];
    usersObj[0] = new ProxyPentahoUser();
    usersObj[0].setName( "test1" );
    try {
      service.deleteUsers( usersObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    service.deleteUsers( usersObj );

    Assert.assertEquals( 1, users.size() );
  }
View Full Code Here

    Assert.assertEquals( 1, users.size() );
  }

  @Test
  public void testGetRolesForUser() throws UserRoleException {
    IUserRoleWebService service = getUserRoleWebService();
    ProxyPentahoUser userObj = new ProxyPentahoUser();
    userObj.setName( "test1" );
    try {
      service.getRolesForUser( userObj );
      Assert.fail();
    } catch ( UserRoleException e ) {
      Assert.assertTrue( "ERROR_0001 not found in " + e.getMessage(), e.getMessage().indexOf( "ERROR_0001" ) >= 0 );
    }

    isAdmin = true;

    ProxyPentahoRole[] roles = service.getRolesForUser( userObj );

    Assert.assertEquals( 1, roles.length );
  }
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.