예제 #1
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeWithNoOtherChanges() throws Exception {
    remove.setChild(ssa);
    remove.mergeInto(delta, NOW);

    assertEquals("Remove should have been added", 1, delta.getChanges().size());
    assertSame(remove, delta.getChanges().get(0));
    assertEquals("Updated date not set", NOW, remove.getUpdatedDate());
  }
예제 #2
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeWithEquivalentRemovePresent() throws Exception {
    Remove expectedRemove = Remove.create(ssb);
    delta.addChange(expectedRemove);

    remove.setChild(ssb);
    remove.mergeInto(delta, NOW);

    assertEquals("Duplicate remove should not have been added", 1, delta.getChanges().size());
    assertEquals(expectedRemove, delta.getChanges().get(0));
  }
예제 #3
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeWithEquivalentAddPresent() throws Exception {
    delta.addChange(Add.create(ssc, 2));

    remove.setChild(ssc);
    remove.mergeInto(delta, NOW);

    assertEquals("Remove should have canceled add", 0, delta.getChanges().size());
  }
예제 #4
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeWithReorderAloneDoesNotCancelReorder() throws Exception {
    delta.addChange(Reorder.create(ssa, 0, 1));

    remove.setChild(ssa);
    remove.mergeInto(delta, NOW);

    assertEquals("Remove should not have canceled anything", 2, delta.getChanges().size());
  }
예제 #5
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeWithAddFollowedByReorderCancelsBoth() throws Exception {
    delta.addChange(Add.create(ssc, 2));
    Reorder.create(ssc, 2, 1).mergeInto(delta, NOW);

    remove.setChild(ssc);
    remove.mergeInto(delta, NOW);

    assertEquals("Remove should have canceled add and reorder", 0, delta.getChanges().size());
  }
예제 #6
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeTwoIntoDeltaWithIndexesThenRemoveOne() throws Exception {
    StudySegment retained0 = setId(17, new StudySegment());
    StudySegment retained1 = setId(18, new StudySegment());
    StudySegment retained2 = setId(19, new StudySegment());
    delta.addChange(Add.create(retained0, 2));
    delta.addChange(Add.create(ssc, 3));
    delta.addChange(Add.create(retained1, 4));
    delta.addChange(Add.create(retained2, 5));

    remove.setChild(ssc);
    remove.mergeInto(delta, NOW);
    assertEquals("Wrong number of changes in delta", 3, delta.getChanges().size());
    Add add0 = (Add) delta.getChanges().get(0);
    Add add1 = (Add) delta.getChanges().get(1);
    Add add2 = (Add) delta.getChanges().get(2);
    assertAdd("Index for earlier retained add updated", retained0, 2, add0);
    assertChangeTime("Unchanged add time incorrectly updated", null, add0);
    assertAdd("Index for later retained add not updated", retained1, 3, add1);
    assertChangeTime("Updated add time not updated", NOW, add1);
    assertAdd("Index for later retained add not updated", retained2, 4, add2);
    assertChangeTime("Updated add time not updated", NOW, add2);
  }
예제 #7
0
파일: RemoveTest.java 프로젝트: NCIP/psc
  public void testMergeWithChildNotInNode() throws Exception {
    remove.setChild(ssc);
    remove.mergeInto(delta, NOW);

    assertEquals("Remove should not have been added", 0, delta.getChanges().size());
  }