use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithRevertedChanges.
@Test
public void compareBranchWithRevertedChanges() throws Exception {
RevisionData rev1 = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, rev1);
final String branch = createBranch(MAIN, "a");
// change storageKey1 component then revert the change
RevisionData changed = new RevisionData(STORAGE_KEY1, "field1", "field2Changed");
indexChange(branch, rev1, changed);
// this actually reverts the prev. change, via a new revision
indexChange(branch, changed, rev1);
final RevisionCompare compare = index().compare(MAIN, branch);
assertThat(compare.getDetails()).containsOnly(RevisionCompareDetail.componentChange(Operation.CHANGE, rev1.getContainerId(), rev1.getObjectId()));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexSearchTest method searchWithPrefix.
@Test
public void searchWithPrefix() throws Exception {
final RevisionData first = new RevisionData(STORAGE_KEY1, "pref1Field1", "field2");
final RevisionData second = new RevisionData(STORAGE_KEY2, "pref2Field1", "field2");
indexRevision(MAIN, first, second);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.prefixMatch("field1", "pref1")).build();
final Iterable<RevisionData> matches = search(MAIN, query);
assertThat(matches).hasSize(1);
assertThat(matches).containsOnly(first);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexSearchTest method searchMatchNone.
@Test
public void searchMatchNone() throws Exception {
final RevisionData first = new RevisionData(STORAGE_KEY1, "field1", "field2");
final RevisionData second = new RevisionData(STORAGE_KEY2, "field1", "field2");
indexRevision(MAIN, first, second);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.matchNone()).build();
final Iterable<RevisionData> matches = search(MAIN, query);
assertThat(matches).hasSize(0);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexSearchTest method searchWithMatchTextAny.
@Test
public void searchWithMatchTextAny() {
final RevisionData first = new RevisionData(STORAGE_KEY1, "a", "field2");
final RevisionData second = new RevisionData(STORAGE_KEY2, "b", "field2");
indexRevision(MAIN, first, second);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.matchTextAny("field1.text", "a b")).build();
final Iterable<RevisionData> matches = search(MAIN, query);
assertThat(matches).hasSize(2);
assertThat(matches).containsAll(Lists.newArrayList(first, second));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexSearchTest method searchMatchAll.
@Test
public void searchMatchAll() throws Exception {
final RevisionData first = new RevisionData(STORAGE_KEY1, "field1", "field2");
final RevisionData second = new RevisionData(STORAGE_KEY2, "field1", "field2");
indexRevision(MAIN, first, second);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.matchAll()).build();
final Iterable<RevisionData> matches = search(MAIN, query);
assertThat(matches).hasSize(2);
assertThat(matches).containsOnly(first, second);
}
Aggregations