use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexSearchTest method searchWithMatchTextFuzzy.
@Test
public void searchWithMatchTextFuzzy() {
final RevisionData data = new RevisionData(STORAGE_KEY1, "abcd", "efgh");
indexRevision(MAIN, data);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.matchTextFuzzy("field1.text", "aacd")).build();
final Iterable<RevisionData> matches = search(MAIN, query);
assertThat(matches).hasSize(1);
assertThat(matches).containsOnly(data);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class SingleDocumentRevisionIndexSearchTest method searchDifferentRevisions.
@Test
public void searchDifferentRevisions() throws Exception {
final RevisionData first = new RevisionData(STORAGE_KEY1, "field1", "field2");
final RevisionData second = new RevisionData(STORAGE_KEY2, "field1Changed", "field2");
indexRevision(MAIN, first, second);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.exactMatch("field1", "field1")).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 searchMultipleRevisions.
@Test
public void searchMultipleRevisions() throws Exception {
final RevisionData first = new RevisionData(STORAGE_KEY1, "field1", "field2");
final RevisionData second = new RevisionData(STORAGE_KEY1, "field1", "field2Changed");
indexRevision(MAIN, first, second);
final Query<RevisionData> query = Query.select(RevisionData.class).where(Expressions.exactMatch("field1", "field1")).build();
final Iterable<RevisionData> matches = search(MAIN, query);
// only second version should match, the first revision should be unaccessible without timestamp
assertThat(matches).hasSize(1);
assertThat(matches).containsOnly(second);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionPurgeTest method purgeBranchWithSingleRevision.
@Test
@Ignore
public void purgeBranchWithSingleRevision() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
index().purge(MAIN, Purge.ALL);
// the revision should be still there
assertNotNull(getRevision(MAIN, RevisionData.class, STORAGE_KEY1));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionPurgeTest method purgeBranchWithTwoRevisionsOfDocument.
@Test
@Ignore
public void purgeBranchWithTwoRevisionsOfDocument() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1Changed", "field2"));
index().purge(MAIN, Purge.ALL);
// only the most recent revision should be available
final Iterable<RevisionData> revisions = searchRaw(Query.select(RevisionData.class).where(Expressions.exactMatch(Revision.Fields.ID, STORAGE_KEY1)).limit(Integer.MAX_VALUE).build());
assertEquals(1, Iterables.size(revisions));
final RevisionData actual = Iterables.getOnlyElement(revisions);
assertDocEquals(new RevisionData(STORAGE_KEY1, "field1Changed", "field2"), actual);
}
Aggregations