use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionPurgeTest method purgeChildBranchDoesNotPurgeParentRevisions.
@Test
@Ignore
public void purgeChildBranchDoesNotPurgeParentRevisions() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2"));
createBranch(MAIN, "a");
index().purge("MAIN/a", Purge.ALL);
final Iterable<RevisionData> revisions = searchRaw(Query.select(RevisionData.class).where(Expressions.exactMatch(Revision.Fields.ID, STORAGE_KEY1)).limit(Integer.MAX_VALUE).build());
assertEquals(2, Iterables.size(revisions));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionPurgeTest method purgeMainWithTwoRevisionsAndABranch.
@Test
@Ignore
public void purgeMainWithTwoRevisionsAndABranch() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
createBranch(MAIN, "a");
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2"));
index().purge(MAIN, Purge.ALL);
// both revisions should still remain, because the "MAIN/a" requires the first one
final Iterable<RevisionData> revisions = searchRaw(Query.select(RevisionData.class).where(Expressions.exactMatch(Revision.Fields.ID, STORAGE_KEY1)).limit(Integer.MAX_VALUE).build());
assertEquals(2, Iterables.size(revisions));
final RevisionData actualOnMAIN = getRevision(MAIN, RevisionData.class, STORAGE_KEY1);
assertDocEquals(new RevisionData(STORAGE_KEY1, "field1Changed", "field2"), actualOnMAIN);
final RevisionData actualOnChild = getRevision("MAIN/a", RevisionData.class, STORAGE_KEY1);
assertDocEquals(new RevisionData(STORAGE_KEY1, "field1", "field2"), actualOnChild);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexTest method updateRevision.
@Test
public void updateRevision() throws Exception {
indexRevision();
final RevisionData data = new RevisionData(STORAGE_KEY1, "field1Changed", "field2Changed");
indexRevision(MAIN, data);
assertEquals(data, getRevision(MAIN, RevisionData.class, STORAGE_KEY1));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexTest method updateRevisionShadowsRevisionOnParent.
@Test
public void updateRevisionShadowsRevisionOnParent() throws Exception {
indexRevision();
final String childBranch = createBranch(MAIN, "a");
// put updated revision to child branch
final RevisionData data = new RevisionData(STORAGE_KEY1, "field1Changed", "field2Changed");
indexRevision(childBranch, data);
// lookup by storageKey on child should return new revision
assertEquals(data, getRevision(childBranch, RevisionData.class, STORAGE_KEY1));
final RevisionData expectedRevisionOnMain = new RevisionData(STORAGE_KEY1, "field1", "field2");
final RevisionData actualRevisionOnMain = getRevision(MAIN, RevisionData.class, STORAGE_KEY1);
assertEquals(expectedRevisionOnMain, actualRevisionOnMain);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexTest method divergedBranchContentShouldBeAccessibleBasedOnSegments.
@Test
public void divergedBranchContentShouldBeAccessibleBasedOnSegments() throws Exception {
updateRevisionShadowsRevisionOnParent();
// put new revision to MAIN
final RevisionData data = new RevisionData(STORAGE_KEY1, "field1ChangedOnMain", "field2ChangedOnMain");
indexRevision(MAIN, data);
// lookup by storageKey on child should return new revision
assertEquals(data, getRevision(MAIN, RevisionData.class, STORAGE_KEY1));
// child branch still has his own updated revision
final RevisionData expectedRevisionOnChild = new RevisionData(STORAGE_KEY1, "field1Changed", "field2Changed");
final RevisionData actualRevisionOnChild = getRevision("MAIN/a", RevisionData.class, STORAGE_KEY1);
assertEquals(expectedRevisionOnChild, actualRevisionOnChild);
}
Aggregations