Package gwtappcontainer.shared.apis

Examples of gwtappcontainer.shared.apis.APIResponse


      AdminAPI api = new AdminAPI();
      api.setGateKeeper(mockGateKeeper);
     
      User user = UserServiceFactory.getUserService().getCurrentUser();
      String role = "dummy_" + UUID.randomUUID();
      APIResponse resp = api.addRole(role, user);
      assertTrue(resp.statusCode == Status.SUCCESS);
     
      userServiceHelper.setEnvIsLoggedIn(false);
      user = UserServiceFactory.getUserService().getCurrentUser();
      assertTrue(null == user);
View Full Code Here


      api.setGateKeeper(mockGateKeeper);
     
      //2. add a role
      User user = UserServiceFactory.getUserService().getCurrentUser();
      String role = "testdummy";
      APIResponse resp = api.addRole(role, user);
      assertTrue("add should give insufficient permission error",
          resp.statusCode == Status.ERROR_INSUFFICIENT_PERMISSION);
     
      //3. rename a role
      resp = api.renameRole(role, role + "_new", user);
View Full Code Here

    }
   
    public User loginWithPrivilege(String privilege) {
           
      SecurityAPI api = new SecurityAPI();
      @SuppressWarnings("unused")
    APIResponse response = api.addPrivilege(privilege, loginAsSuperUser());
     
      //delete user if exists and add it again
      response = api.deleteUser(email, loginAsSuperUser());
           
View Full Code Here

  @Test
  public void ensureValidUserReturnsTrueForValidUser() {
       
    AdminAPI adminApi = new AdminAPI();
    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

  public void canViewRolesByEmail() {
    helper.loginAsDeveloper();
    User user = UserServiceFactory.getUserService().getCurrentUser();
   
    AdminAPI api = new AdminAPI();
    APIResponse resp = api.getRolesForUser(user.getEmail());
   
    assertTrue(resp.statusCode == Status.SUCCESS);
   
    UserProp prop = (UserProp) resp.object;
   
View Full Code Here

  public void canViewRolesForLoggedInUser() {
    helper.loginAsPortalAdmin();
    User user = UserServiceFactory.getUserService().getCurrentUser();
   
    AdminAPI api = new AdminAPI();
    APIResponse resp = api.getRolesForLoggedInUser(user);
   
    assertTrue(resp.statusCode == Status.SUCCESS);
   
    UserProp prop = (UserProp) resp.object;
   
View Full Code Here

    String email = user.getEmail();
   
    helper.logout();
   
    AdminAPI api = new AdminAPI();
    APIResponse resp = api.getRolesForUser(email);
   
    assertTrue(resp.statusCode == Status.SUCCESS);
   
    UserProp prop = (UserProp) resp.object;
   
View Full Code Here

   
    AdminAPI api = new AdminAPI();
    User user = UserServiceFactory.getUserService().getCurrentUser();
   
    assertTrue(null == user);
    APIResponse resp = api.getRolesForLoggedInUser(user);
   
    assertTrue(resp.statusCode == Status.ERROR_LOGIN_REQUIRED);
  }
View Full Code Here

    adminApi.addUser(email, helper.loginAsPortalAdmin());
   
    //2. assign role
    User user = helper.loginAsPortalAdmin();
    String role = Role.PORTAL_READONLY.toString();
    APIResponse resp = adminApi.assignRoleToUser(email, role, user);        
   
    assertTrue(resp.statusCode == Status.SUCCESS);
   
    //ensure role is correctly added
    UserProp prop = (UserProp) adminApi.getRolesForUser(email).object;   
View Full Code Here

    adminApi.addUser(email, helper.loginAsPortalAdmin());
   
    //2. assign
    //developer
    String role = Role.PORTAL_READONLY.toString();   
    APIResponse response = adminApi.assignRoleToUser(email, role,
      helper.loginAsDeveloper());
    assertTrue(response.statusCode == Status.ERROR_INSUFFICIENT_PERMISSION);
   
   
    //portal user
    response = adminApi.assignRoleToUser(email, role,
      helper.loginAsPortalUser());
    assertTrue(response.statusCode == Status.ERROR_INSUFFICIENT_PERMISSION);
   
   
    //portal readonly   
    response = adminApi.assignRoleToUser(email, role,
      helper.loginAsPortalReadOnly());
    assertTrue(response.statusCode == Status.ERROR_INSUFFICIENT_PERMISSION);
   
   
    UserProp prop = (UserProp) adminApi.getRolesForUser(email).object;   
    assertTrue(false == Util.isRolePresent(prop.roles, role));
   
    //3. unassign
    //developer   
    APIResponse resp = adminApi.unassignRoleToUser(email, role,
        helper.loginAsDeveloper());
    assertTrue(resp.statusCode == Status.ERROR_INSUFFICIENT_PERMISSION);
   
    //portal user
    resp = adminApi.unassignRoleToUser(email, role,
View Full Code Here

TOP

Related Classes of gwtappcontainer.shared.apis.APIResponse

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.