Package ma.glasnost.orika.test.community.issue21

Examples of ma.glasnost.orika.test.community.issue21.Authority


    user2Id = getSession().save(user2);

    group.addUser(user1);
    group.addUser(user2);

    Authority adminAuthority = new Authority("admin");
    adminAuthotityId = getSession().save(adminAuthority);

    DefaultMapperFactory.Builder builder = new DefaultMapperFactory.Builder();
    builder.unenhanceStrategy(new HibernateUnenhanceStrategy());
    builder.compilerStrategy(new EclipseJdtCompilerStrategy());
View Full Code Here


    User user1 = (User) getSession().load(User.class, user1Id);
    UserDto userDto1 = mapperFacade.map(user1, UserDto.class);

    log.debug("\n\n old userTO = " + userDto1);

    Authority authority = (Authority) getSession().load(Authority.class,
        adminAuthotityId);
    AuthorityDto authorityDto = mapperFacade.map(authority,
        AuthorityDto.class);
    assertFalse(userDto1.getAuthorities().contains(authorityDto));
View Full Code Here

    User user1 = (User) getSession().load(User.class, user1Id);
    UserDto userDto1 = mapperFacade.map(user1, UserDto.class);

    log.debug("\n\n old userTO = " + userDto1);

    Authority authority = (Authority) getSession().load(Authority.class,
        adminAuthotityId);
    AuthorityDto authorityDto = mapperFacade.map(authority,
        AuthorityDto.class);
    assertTrue(userDto1.getAuthorities().contains(authorityDto));
View Full Code Here

    log.debug("\n\n old userTO = " + userDto1);

    Authority authority = (Authority) getSession().load(Authority.class,
        adminAuthotityId);
    AuthorityDto authorityDto = mapperFacade.map(authority,
        AuthorityDto.class);
    assertFalse(userDto1.getAuthorities().contains(authorityDto));

    userDto1.getAuthorities().add(authorityDto);
    Assert.assertNotNull(user1);
View Full Code Here

    log.debug("\n\n old userTO = " + userDto1);

    Authority authority = (Authority) getSession().load(Authority.class,
        adminAuthotityId);
    AuthorityDto authorityDto = mapperFacade.map(authority,
        AuthorityDto.class);
    assertTrue(userDto1.getAuthorities().contains(authorityDto));

    userDto1.getAuthorities().remove(authorityDto);
    Assert.assertNotNull(user1);
View Full Code Here

  @Before
  public void init() {
    UserGroup group = new UserGroup("main");
    groupId = getSession().save(group);

    User user1 = new User("User1");
    user1Id = getSession().save(user1);

    User user2 = new User("user2");
    user2Id = getSession().save(user2);

    group.addUser(user1);
    group.addUser(user2);
View Full Code Here

    getSession().clear();
  }

  @Test
  public void testMapUser() {
    User user1 = (User) getSession().load(User.class, user1Id);
    User user2 = (User) getSession().load(User.class, user2Id);
    assertNotNull(user1);
    for (int i = 0; i < 100; i++) {
      UserDto userDto1 = mapperFacade.map(user1, UserDto.class);
      assertEquals(userDto1.getName(), user1.getName());

      UserDto userDto2 = mapperFacade.map(user2, UserDto.class);
      assertEquals(userDto2.getName(), user2.getName());

      assertTrue(user1.getGroup().getUsers().contains(user2));
    }
  }
View Full Code Here

    getSession().clear();
    removeAuthority();
  }

  private void addAuthority() {
    User user1 = (User) getSession().load(User.class, user1Id);
    UserDto userDto1 = mapperFacade.map(user1, UserDto.class);

    log.debug("\n\n old userTO = " + userDto1);

    Authority authority = (Authority) getSession().load(Authority.class,
        adminAuthotityId);
    AuthorityDto authorityDto = mapperFacade.map(authority,
        AuthorityDto.class);
    assertFalse(userDto1.getAuthorities().contains(authorityDto));

    userDto1.getAuthorities().add(authorityDto);
    Assert.assertNotNull(user1);
    mapperFacade.map(userDto1, user1, TypeFactory.valueOf(UserDto.class),
        TypeFactory.valueOf(User.class));

    assertTrue(user1.getAuthorities().contains(authority));
  }
View Full Code Here

    assertTrue(user1.getAuthorities().contains(authority));
  }

  private void removeAuthority() {
    User user1 = (User) getSession().load(User.class, user1Id);
    UserDto userDto1 = mapperFacade.map(user1, UserDto.class);

    log.debug("\n\n old userTO = " + userDto1);

    Authority authority = (Authority) getSession().load(Authority.class,
        adminAuthotityId);
    AuthorityDto authorityDto = mapperFacade.map(authority,
        AuthorityDto.class);
    assertTrue(userDto1.getAuthorities().contains(authorityDto));

    userDto1.getAuthorities().remove(authorityDto);
    Assert.assertNotNull(user1);
    mapperFacade.map(userDto1, user1, TypeFactory.valueOf(UserDto.class),
        TypeFactory.valueOf(User.class));

    assertFalse(user1.getAuthorities().contains(authority));
  }
View Full Code Here

  private void removeGroup() {
    UserGroup group = (UserGroup) getSession().load(UserGroup.class,
        groupId);

    User user1 = (User) getSession().load(User.class, user1Id);

    assertTrue(group.getUsers().contains(user1));

    UserDto userDto1 = mapperFacade.map(user1, UserDto.class);
View Full Code Here

TOP

Related Classes of ma.glasnost.orika.test.community.issue21.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.