Package info.galleria.domain

Examples of info.galleria.domain.Group


  }
 
  @Test
  public void testCreateGroup() throws Exception
  {
    Group group  = new Group(TEST_GROUP_ID);
   
    //Execute
    repository.create(group);
   
    //Verify
    em.flush();
    em.clear();
    Group actualGroup = em.find(Group.class, TEST_GROUP_ID);
    assertEquals(group, actualGroup);
  }
View Full Code Here


  {
    //Setup
    User user = new User(TEST_USER_ID, TEST_PASSWORD);
    em.persist(user);
   
    Group group = new Group(TEST_GROUP_ID);
    em.persist(group);
   
    em.flush();
    em.clear();
    logger.info("Flushed the persistence context after creating the user and group.");
   
    //Execute
    group.addToUsers(user);
    group = repository.modify(group);
    em.flush();
    em.clear();
    logger.info("Flushed the persistence context after attaching the user to the group.");
   
    //Verify
    Group actualGroup = em.find(Group.class, TEST_GROUP_ID);
    assertEquals(group, actualGroup);
    assertTrue(actualGroup.getUsers().contains(user));
  }
View Full Code Here

 
  @Test
  public void testDeleteGroup() throws Exception
  {
    //Setup
    Group group = new Group(TEST_GROUP_ID);
    em.persist(group);
    em.flush();
    em.clear();
   
    //Execute
    repository.delete(group);
    em.flush();
    em.clear();
   
    //Verify
    Group actualGroup = em.find(Group.class, TEST_GROUP_ID);
    assertNull(actualGroup);
  }
View Full Code Here

 
  @Test
  public void testFindGroupById() throws Exception
  {
    //Setup
    Group group = new Group(TEST_GROUP_ID);
    em.persist(group);
    em.flush();
    em.clear();
   
    //Execute
    Group actualGroup = repository.findById(TEST_GROUP_ID);
   
    //Verify
    assertEquals(group, actualGroup);
  }
View Full Code Here

 
  @Test
  public void testFindAllGroups() throws Exception
  {
    //Setup
    Group firstGroup = new Group(TEST_GROUP_ID);
    Group secondGroup = new Group("Group #2");
    em.persist(firstGroup);
    em.persist(secondGroup);
    em.flush();
    em.clear();
   
View Full Code Here

  }

  @Test
  public void testCreateDefaultGroup() throws Exception
  {
    Group registeredUsersGroup = groupService.getOrCreateRegisteredUsersGroup();
    assertNotNull(registeredUsersGroup);
  }
View Full Code Here

  }

  @Test
  public void testGetDefaultGroup() throws Exception
  {
    Group registeredUsersGroup = groupService.getOrCreateRegisteredUsersGroup();
    Group secondGroup = groupService.getOrCreateRegisteredUsersGroup();

    assertNotNull(registeredUsersGroup);
    assertNotNull(secondGroup);
    assertEquals(registeredUsersGroup, secondGroup);
  }
View Full Code Here

 
  @Test
  public void testModifyUserAddGroup() throws Exception
  {
    //Setup
    Group group = new Group(TEST_GROUP_ID);
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    em.persist(group);
    em.persist(user);
   
    em.flush();
View Full Code Here

 
  @Test
  public void testModifyUserRemoveGroup() throws Exception
  {
    //Setup
    Group group = new Group(TEST_GROUP_ID);
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    user.addToGroups(group);
    em.persist(group);
    em.persist(user);
   
    em.flush();
    em.clear();
   
    //Execute
    user.removeFromGroups(group);
    user = repository.modify(user);
    em.flush();
    em.clear();
   
    //Verify
    User actualUser = em.find(User.class, TEST_USER_ID);
    Group actualGroup = em.find(Group.class, TEST_GROUP_ID);
    assertEquals(user, actualUser);
    assertFalse(actualUser.getGroups().contains(group));
    assertEquals(group, actualGroup);
  }
View Full Code Here

  /**
   * @see GroupService#getOrCreateRegisteredUsersGroup()
   */
  public Group getOrCreateRegisteredUsersGroup()
  {
    Group defaultGroup = groupRepository.findById(REGISTERED_USERS_GROUP_NAME);
    if (defaultGroup == null)
    {
      defaultGroup = createRegisteredUsersGroup();
      return defaultGroup;
    }
View Full Code Here

TOP

Related Classes of info.galleria.domain.Group

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.