Package org.springside.examples.miniweb.entity.account

Examples of org.springside.examples.miniweb.entity.account.Authority


  }

  public static Authority getRandomAuthority() {
    String authName = DataUtils.randomName("Authority");

    Authority authority = new Authority();
    authority.setName(authName);

    return authority;
  }
View Full Code Here


  }

  public static List<Authority> getDefaultAuthorityList() {
    if (defaultAuthorityList == null) {
      defaultAuthorityList = Lists.newArrayList();
      defaultAuthorityList.add(new Authority(1L, "浏览用户"));
      defaultAuthorityList.add(new Authority(2L, "修改用户"));
      defaultAuthorityList.add(new Authority(3L, "浏览角色"));
      defaultAuthorityList.add(new Authority(4L, "修改角色"));
    }
    return defaultAuthorityList;
  }
View Full Code Here

    //准备数据
    String authName = "foo";
    User user = AccountData.getRandomUser();
    Role role = AccountData.getRandomRole();
    user.getRoleList().add(role);
    Authority auth = new Authority();
    auth.setName(authName);
    role.getAuthorityList().add(auth);

    //录制脚本
    EasyMock.expect(mockAccountManager.findUserByLoginName(user.getLoginName())).andReturn(user);
    control.replay();

    //执行测试
    UserDetails userDetails = userDetailService.loadUserByUsername(user.getLoginName());

    //校验结果
    assertEquals(user.getLoginName(), userDetails.getUsername());
    assertEquals(user.getPassword(), userDetails.getPassword());
    assertEquals(1, userDetails.getAuthorities().size());
    assertEquals(new GrantedAuthorityImpl(auth.getPrefixedName()), userDetails.getAuthorities().iterator().next());
  }
View Full Code Here

TOP

Related Classes of org.springside.examples.miniweb.entity.account.Authority

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.