Ejemplo n.º 1
0
  @Test
  public void testCreateGroupFromCommittee() throws Exception {
    String id = groupService.create(group);
    groupService.addAggregation(committee, group);

    Group fromDb = groupService.findById(id);
    assertEquals(group.getGroupName(), fromDb.getGroupName());
    Aggregation aggregation = fromDb.getAggregations().iterator().next();
    assertNotNull(aggregation);
    assertEquals(
        committee.getAggregationMembers().size(), aggregation.getAggregationMembers().size());
  }
Ejemplo n.º 2
0
  @Test
  public void testAddAggregation() throws Exception {
    groupService.create(group);
    groupService.addAggregation(committee, group);

    Group fromDb = groupService.findById(group.getId());
    assertEquals(1, fromDb.getAggregations().size());
    Aggregation aggregation = fromDb.getAggregations().iterator().next();
    assertEquals(group.getGroupName(), aggregation.getGroups().iterator().next().getGroupName());
  }
Ejemplo n.º 3
0
  @Test
  public void testCreateGroupFromMultipleAggregations() throws Exception {
    String id = groupService.create(group);
    groupService.addAggregation(committee, group);
    group = groupService.findById(group.getId());
    groupService.addAggregation(organization, group);
    group = groupService.findById(group.getId());
    groupService.addAggregation(event, group);
    group = groupService.findById(group.getId());
    contactService.addToGroup(topLevel, group);

    Group fromDb = groupService.findById(id);
    assertEquals(group.getGroupName(), fromDb.getGroupName());
    assertEquals(3, group.getAggregations().size());
    Set<Contact> allAggregationMembers = new HashSet<>();
    for (Aggregation aggregation : group.getAggregations()) {
      for (Contact c : aggregation.getAggregationMembers()) {
        allAggregationMembers.add(c);
      }
    }
    assertEquals(2, allAggregationMembers.size());
    assertEquals(1, group.getTopLevelMembers().size());
  }