use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionBranchMergeTest method movedPropertyChange_AppliedOnBothSides.
@Test
public void movedPropertyChange_AppliedOnBothSides() throws Exception {
// index the document fixture on MAIN
indexRevision(MAIN, NEW_DATA);
final String oldParent = createBranch(MAIN, "oldParent");
final String oldBranch = createBranch(oldParent, "move");
// index change in doc in another field
RevisionData updatedOnOnBranch = NEW_DATA.toBuilder().terms(List.of("term")).build();
indexChange(oldBranch, NEW_DATA, updatedOnOnBranch);
// index a change on MAIN after creating the old branches and old change
indexChange(MAIN, NEW_DATA, NEW_DATA.toBuilder().derivedField("change").build());
// create new parent and target move branch
final String newParent = createBranch(MAIN, "newParent");
final String newBranch = createBranch(newParent, "move");
// initial sync produces empty commit but an actual change in the doc
branching().prepareMerge(oldBranch, newBranch).squash(false).merge();
RevisionData afterFirstSync = getRevision(newBranch, RevisionData.class, STORAGE_KEY1);
assertEquals("change", afterFirstSync.getDerivedField());
assertEquals(List.of("term"), afterFirstSync.getTerms());
// represent the same change as the one made on newParent
indexChange(oldBranch, updatedOnOnBranch, updatedOnOnBranch.toBuilder().derivedField("change").build());
// second sync
branching().prepareMerge(oldBranch, newBranch).squash(false).merge();
// single revision exists with the desired values
RevisionData actual = getRevision(newBranch, RevisionData.class, STORAGE_KEY1);
assertEquals("change", actual.getDerivedField());
assertEquals(List.of("term"), afterFirstSync.getTerms());
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionBranchMergeTest method mergeChildBranchThenDeleteShouldNotAffectSearches.
@Test
public void mergeChildBranchThenDeleteShouldNotAffectSearches() throws Exception {
final String branchA = createBranch(MAIN, "a");
indexRevision(branchA, NEW_DATA);
branching().prepareMerge(branchA, MAIN).merge();
branching().delete(branchA);
RevisionData rev = getRevision(MAIN, RevisionData.class, NEW_DATA.getId());
assertNotNull(rev);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithNewComponent_BaseWithNewComponent_Reverse.
@Test
public void compareBranchWithNewComponent_BaseWithNewComponent_Reverse() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
final String branch = createBranch(MAIN, "a");
indexRevision(branch, new RevisionData(STORAGE_KEY2, "field1", "field2"));
final RevisionCompare compare = index().compare(branch, MAIN);
assertThat(compare.getDetails()).isEmpty();
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithDeletedComponent_Reverse.
@Test
public void compareBranchWithDeletedComponent_Reverse() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
final String branch = createBranch(MAIN, "a");
deleteRevision(branch, RevisionData.class, STORAGE_KEY1);
final RevisionCompare compare = index().compare(branch, MAIN);
assertThat(compare.getDetails()).isEmpty();
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareChangeOnMainSinceBranchBasePoint_Reverse.
@Test
public void compareChangeOnMainSinceBranchBasePoint_Reverse() throws Exception {
final RevisionData rev1 = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, rev1);
final String branch = createBranch(MAIN, "a");
indexRevision(branch, new RevisionData(STORAGE_KEY2, "field1", "field2"));
final RevisionData rev2 = new RevisionData(STORAGE_KEY1, "field1Changed", "field2");
indexChange(MAIN, rev1, rev2);
final RevisionCompare compare = index().compare(branch, MAIN);
assertThat(compare.getDetails()).containsOnly(RevisionCompareDetail.componentChange(Operation.CHANGE, rev2.getContainerId(), rev2.getObjectId()), RevisionCompareDetail.propertyChange(Operation.CHANGE, rev2.getObjectId(), "field1", "field1", "field1Changed"));
}
Aggregations