Search in sources :

Example 51 with RevisionData

use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.

the class BranchBaseQueryTest method readBaseOfMainBranch.

@Test(expected = IllegalArgumentException.class)
public void readBaseOfMainBranch() throws Exception {
    final RevisionData data = new RevisionData(STORAGE_KEY1, "field1", "field2");
    indexRevision(MAIN, data);
    final Iterable<RevisionData> hits = search(MAIN + RevisionIndex.BASE_REF_CHAR, Query.select(RevisionData.class).where(Expressions.matchAll()).build());
    assertThat(hits).isEmpty();
}
Also used : RevisionData(com.b2international.index.revision.RevisionFixtures.RevisionData) Test(org.junit.Test)

Example 52 with RevisionData

use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.

the class RevisionBranchAtTimestampQueryTest method branchAtExpression.

@Test
public void branchAtExpression() throws Exception {
    final RevisionData rev1 = new RevisionData(STORAGE_KEY1, "field1", "field2");
    final RevisionData rev2 = new RevisionData(STORAGE_KEY1, "field1Changed", "field2");
    long commit1 = commit(MAIN, Collections.singleton(rev1)).getTimestamp();
    long commit2 = commit(MAIN, Collections.singleton(rev2)).getTimestamp();
    ;
    assertDocEquals(rev2, getRevision(MAIN, RevisionData.class, STORAGE_KEY1));
    assertDocEquals(rev1, getRevision("MAIN@" + commit1, RevisionData.class, STORAGE_KEY1));
    assertDocEquals(rev2, getRevision("MAIN@" + commit2, RevisionData.class, STORAGE_KEY1));
    assertNull(getRevision("MAIN@0", RevisionData.class, STORAGE_KEY1));
}
Also used : RevisionData(com.b2international.index.revision.RevisionFixtures.RevisionData) Test(org.junit.Test)

Aggregations

RevisionData (com.b2international.index.revision.RevisionFixtures.RevisionData)52 Test (org.junit.Test)52 ComponentRevisionData (com.b2international.index.revision.RevisionFixtures.ComponentRevisionData)13 ContainerRevisionData (com.b2international.index.revision.RevisionFixtures.ContainerRevisionData)13 Ignore (org.junit.Ignore)6 Expression (com.b2international.index.query.Expression)2 ImmutableList (com.google.common.collect.ImmutableList)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 TimeUnit (java.util.concurrent.TimeUnit)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertTrue (org.junit.Assert.assertTrue)2