use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithChangedComponent_Reverse.
@Test
public void compareBranchWithChangedComponent_Reverse() throws Exception {
RevisionData rev1 = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, rev1);
final String branch = createBranch(MAIN, "a");
RevisionData rev2 = new RevisionData(STORAGE_KEY1, "field1Changed", "field2");
indexChange(branch, rev1, rev2);
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 compareBranchWithChangedThenDeleted.
@Test
public void compareBranchWithChangedThenDeleted() throws Exception {
final RevisionData rev = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, rev);
final String branch = createBranch(MAIN, "a");
RevisionData changed = new RevisionData(STORAGE_KEY1, "field1", "field2Changed");
indexChange(branch, rev, changed);
deleteRevision(branch, RevisionData.class, STORAGE_KEY1);
final RevisionCompare compare = index().compare(MAIN, branch);
assertThat(compare.getDetails()).hasSize(1);
assertThat(compare.getTotalAdded()).isEqualTo(0);
assertThat(compare.getTotalChanged()).isEqualTo(0);
assertThat(compare.getTotalRemoved()).isEqualTo(1);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithNewThenDeleted.
@Test
public void compareBranchWithNewThenDeleted() throws Exception {
final String branch = createBranch(MAIN, "a");
indexRevision(branch, new RevisionData(STORAGE_KEY1, "field1", "field2"));
deleteRevision(branch, RevisionData.class, STORAGE_KEY1);
final RevisionCompare compare = index().compare(MAIN, branch);
assertThat(compare.getDetails()).isEmpty();
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionPurgeTest method purgeLatestPurgesOnlyMostRecentSegment.
@Test
@Ignore
public void purgeLatestPurgesOnlyMostRecentSegment() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2"));
createBranch(MAIN, "a");
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2Changed"));
index().purge(MAIN, Purge.LATEST);
final Iterable<RevisionData> revisions = searchRaw(Query.select(RevisionData.class).where(Expressions.exactMatch(Revision.Fields.ID, STORAGE_KEY1)).limit(Integer.MAX_VALUE).build());
assertEquals(3, Iterables.size(revisions));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionPurgeTest method purgeHistoryPurgesHistoricalSegments.
@Test
@Ignore
public void purgeHistoryPurgesHistoricalSegments() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2"));
createBranch(MAIN, "a");
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2Changed"));
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Latest", "field2Latest"));
index().purge(MAIN, Purge.HISTORY);
final Iterable<RevisionData> revisions = searchRaw(Query.select(RevisionData.class).where(Expressions.exactMatch(Revision.Fields.ID, STORAGE_KEY1)).limit(Integer.MAX_VALUE).build());
assertEquals(3, Iterables.size(revisions));
int revisionsInSegment0 = 0;
int revisionsInSegment2 = 0;
// for (Data rev : revisions) {
// if (rev.getSegmentId() == 0) {
// revisionsInSegment0++;
// } else if (rev.getSegmentId() == 2) {
// revisionsInSegment2++;
// } else {
// throw new AssertionFailedError("Unexpected segment ID: " + rev.getSegmentId());
// }
// }
assertEquals(1, revisionsInSegment0);
assertEquals(2, revisionsInSegment2);
}
Aggregations