use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithChangedComponent.
@Test
public void compareBranchWithChangedComponent() 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(MAIN, branch);
assertThat(compare.getDetails()).containsOnly(RevisionCompareDetail.componentChange(Operation.CHANGE, rev2.getContainerId(), rev2.getObjectId()), RevisionCompareDetail.propertyChange(Operation.CHANGE, rev2.getObjectId(), "field1", "field1", "field1Changed"));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionCompareTest method compareBranchWithDeletedComponent.
@Test
public void compareBranchWithDeletedComponent() throws Exception {
indexRevision(MAIN, new RevisionData(STORAGE_KEY1, "field1", "field2"));
final String branch = createBranch(MAIN, "a");
deleteRevision(branch, RevisionData.class, STORAGE_KEY1);
final RevisionCompare compare = index().compare(MAIN, branch);
assertThat(compare.getDetails()).hasSize(1);
final RevisionCompareDetail detail = compare.getDetails().iterator().next();
assertThat(detail.getOp()).isEqualTo(Operation.REMOVE);
assertThat(detail.getObject()).isEqualTo(ROOT);
assertThat(detail.getComponent()).isEqualTo(ObjectId.of(DOC_TYPE, STORAGE_KEY1));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class BranchBaseQueryTest method readBaseOfBranchWithNewComponents.
@Test
public void readBaseOfBranchWithNewComponents() throws Exception {
final RevisionData data = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, data);
final String branch = createBranch(MAIN, "a");
indexRevision(branch, new RevisionData(STORAGE_KEY2, "field1Other", "field2Other"));
final Iterable<RevisionData> hits = search(branch + RevisionIndex.BASE_REF_CHAR, Query.select(RevisionData.class).where(Expressions.matchAll()).build());
assertThat(hits).containsOnly(data);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class BranchBaseQueryTest method readBaseOfBranchWithDeletedComponents.
@Test
public void readBaseOfBranchWithDeletedComponents() throws Exception {
final RevisionData data = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, data);
final String branch = createBranch(MAIN, "a");
deleteRevision(MAIN, RevisionData.class, STORAGE_KEY1);
final Iterable<RevisionData> hits = search(branch + RevisionIndex.BASE_REF_CHAR, Query.select(RevisionData.class).where(Expressions.matchAll()).build());
assertThat(hits).containsOnly(data);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class BranchBaseQueryTest method readBaseOfBranch.
@Test
public void readBaseOfBranch() throws Exception {
final RevisionData data = new RevisionData(STORAGE_KEY1, "field1", "field2");
indexRevision(MAIN, data);
final String branch = createBranch(MAIN, "a");
final Iterable<RevisionData> hits = search(branch + RevisionIndex.BASE_REF_CHAR, Query.select(RevisionData.class).where(Expressions.matchAll()).build());
assertThat(hits).containsOnly(data);
}
Aggregations