Package gwtappcontainer.server.apis.admin

Examples of gwtappcontainer.server.apis.admin.GateKeeper


  }
 
  @Test
  public void ensureRoleReturnsTrueForExistingRole() {
       
    GateKeeper gateKeeper = new GateKeeper();
    User user = helper.loginAsDeveloper();
    assertTrue(gateKeeper.ensureRole(user, Role.DEVELOPER, Role.PORTAL_ADMIN));
   
    assertTrue(gateKeeper.ensureRole(user, Role.DEVELOPER.toString(),
        Role.PORTAL_READONLY.toString()));   
  }
View Full Code Here


  }
 
  @Test
  public void ensureRoleThrowsExceptionForNonExistingRole() {
   
    GateKeeper gateKeeper = new GateKeeper();
    User user = helper.loginAsDeveloper();
   
    try {
      gateKeeper.ensureRole(user, Role.PORTAL_ADMIN);
    } catch (APIException e) {
      assertTrue(e.statusCode == Status.ERROR_INSUFFICIENT_PERMISSION);
      return;
    }
     
View Full Code Here

    assertTrue(false);
  }
 
  @Test
  public void ensureRoleThrowsExceptionIfNotLoggedIn() {
    GateKeeper gateKeeper = new GateKeeper();
       
    try {
      gateKeeper.ensureRole(null, Role.PORTAL_READONLY.toString());
    } catch (APIException e) {
      assertTrue(e.statusCode == Status.ERROR_LOGIN_REQUIRED);
      return;
    }
     
View Full Code Here

    String email = "test_" + UUID.randomUUID() + "@example.com";
    APIResponse resp = adminApi.addUser(email, helper.loginAsPortalAdmin());
    assertTrue(resp.statusCode == Status.SUCCESS);
   
    User user = helper.loginAs(email);
    GateKeeper gateKeeper = new GateKeeper();
    assertTrue(gateKeeper.ensureValidUser(user));     
  }
View Full Code Here

 
  @Test
  public void ensureValidUserThrowsExceptionForInvalidUser() {           
    String email = "test_" + UUID.randomUUID() + "@example.com"
    User user = helper.loginAs(email);
    GateKeeper gateKeeper = new GateKeeper();
   
    try {
      gateKeeper.ensureValidUser(user);
    } catch (APIException e) {
      assertTrue(e.statusCode == Status.ERROR_INVALID_USER);
      return;
    }
   
View Full Code Here

  }
 
  @Test
  public void ensureValidUserWithoutLoggingThrowsAuthenticationException() {           
   
    GateKeeper gateKeeper = new GateKeeper();
   
    try {
      gateKeeper.ensureValidUser(null);
    } catch (APIException e) {
      assertTrue(e.statusCode == Status.ERROR_LOGIN_REQUIRED);
      return;
    }
   
View Full Code Here

TOP

Related Classes of gwtappcontainer.server.apis.admin.GateKeeper

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.