コード例 #1
0
ファイル: AmendmentTest.java プロジェクト: NCIP/psc
  public void testCloneDeepClonesDeltas() throws Exception {
    Amendment src = Fixtures.createAmendment(null, DateTools.createDate(2008, Calendar.JUNE, 22));
    src.addDelta(Delta.createDeltaFor(new Study()));

    Amendment clone = src.clone();
    assertEquals("Wrong number of cloned changes", 1, clone.getDeltas().size());
    assertNotSame("Deltas not deep cloned", src.getDeltas().get(0), clone.getDeltas().get(0));
  }
コード例 #2
0
ファイル: AmendmentTest.java プロジェクト: NCIP/psc
 public void testSetMemOnlyRecursiveToDeltas() throws Exception {
   Amendment amendment =
       Fixtures.createAmendment(null, DateTools.createDate(2008, Calendar.JUNE, 22));
   amendment.addDelta(Delta.createDeltaFor(new Study()));
   amendment.setMemoryOnly(true);
   assertTrue(amendment.getDeltas().get(0).isMemoryOnly());
 }
コード例 #3
0
ファイル: AmendmentTest.java プロジェクト: NCIP/psc
  public void testUpdatedDateIsMaxAcrossDeltas() throws Exception {
    a3.addDelta(Delta.createDeltaFor(new Epoch(), PropertyChange.create("name", "A", "B")));
    a3.addDelta(Delta.createDeltaFor(new Epoch(), Add.create(new StudySegment())));
    a3.getDeltas()
        .get(0)
        .getChanges()
        .get(0)
        .setUpdatedDate(DateTools.createDate(2005, Calendar.MAY, 3));
    a3.getDeltas()
        .get(1)
        .getChanges()
        .get(0)
        .setUpdatedDate(DateTools.createDate(2005, Calendar.MAY, 4));

    assertDayOfDate(2005, Calendar.MAY, 4, a3.getUpdatedDate());
  }
コード例 #4
0
ファイル: AmendmentTest.java プロジェクト: NCIP/psc
  public void testDeepEqualsWithMismatchedChanges() throws Exception {
    Amendment a = new Amendment();
    a.getDeltas()
        .add(
            setGridId(
                "D1",
                Delta.createDeltaFor(
                    setGridId("PC1", new PlannedCalendar()),
                    Add.create(setGridId("E1", new Epoch())))));
    Amendment b = new Amendment();
    b.getDeltas()
        .add(
            setGridId(
                "D1",
                Delta.createDeltaFor(
                    setGridId("PC1", new PlannedCalendar()),
                    Remove.create(setGridId("E1", new Epoch())))));

    assertChildDifferences(
        a.deepEquals(b),
        new String[] {"delta for planned calendar PC1"},
        "add of epoch:E1 replaced by remove of epoch:E1");
  }
コード例 #5
0
ファイル: AmendmentTest.java プロジェクト: NCIP/psc
  public void testLastModifiedDatePrefersReleasedDateIfNoDeltas() throws Exception {
    a3.setReleasedDate(DateTools.createDate(2007, Calendar.OCTOBER, 20));
    a3.getDeltas().clear();

    assertDayOfDate(2007, Calendar.OCTOBER, 20, a3.getLastModifiedDate());
  }
コード例 #6
0
ファイル: AmendmentTest.java プロジェクト: NCIP/psc
 private void ensureUpdatedDate(Amendment expectedAmendment, Date expectedDate) {
   expectedAmendment.getDeltas().clear();
   Delta<?> delta = Delta.createDeltaFor(new Epoch(), PropertyChange.create("name", "A", "B"));
   delta.getChanges().get(0).setUpdatedDate(expectedDate);
   expectedAmendment.addDelta(delta);
 }