use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class CommitWatermarkTest method commitWatermarkHigh.
@Test
public void commitWatermarkHigh() throws Exception {
StagingArea staging = index().prepareCommit(MAIN);
for (int i = 0; i < 21; i++) {
staging.stageNew(new RevisionData(UUID.randomUUID().toString(), "1", "2"));
}
staging.commit(currentTime(), "test", "commitWatermarkHigh");
Assertions.assertThat(appender.list).extracting(ILoggingEvent::getFormattedMessage).contains("high commit watermark [20] exceeded in commit [MAIN - test - commitWatermarkHigh] number of changes: 21");
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class CommitWatermarkTest method commitWatermarkLow.
@Test
public void commitWatermarkLow() throws Exception {
StagingArea staging = index().prepareCommit(MAIN);
for (int i = 0; i < 11; i++) {
staging.stageNew(new RevisionData(UUID.randomUUID().toString(), "1", "2"));
}
staging.commit(currentTime(), "test", "commitWatermarkLow");
Assertions.assertThat(appender.list).extracting(ILoggingEvent::getFormattedMessage).contains("low commit watermark [10] exceeded in commit [MAIN - test - commitWatermarkLow] number of changes: 11");
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class HookTest method preCommitHook.
@Test
public void preCommitHook() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
withHook((Hooks.PreCommitHook) staging -> {
assertEquals(1L, staging.getNewObjects().count());
latch.countDown();
});
commit(MAIN, Collections.singleton(new RevisionData(STORAGE_KEY1, "field1", "field2")));
assertTrue(latch.await(1, TimeUnit.SECONDS));
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionBranchMergeTest method fastForwardMergeBranchWithChangedRevisionToParent.
@Test
public void fastForwardMergeBranchWithChangedRevisionToParent() throws Exception {
indexRevision(MAIN, NEW_DATA);
String child = createBranch(MAIN, "a");
// create a revision on child branch
indexChange(child, NEW_DATA, CHANGED_DATA);
branching().prepareMerge(child, MAIN).merge();
// after merge revision should be visible from MAIN branch
RevisionData afterMerge = getRevision(MAIN, RevisionData.class, STORAGE_KEY1);
assertDocEquals(CHANGED_DATA, afterMerge);
}
use of com.b2international.index.revision.RevisionFixtures.RevisionData in project snow-owl by b2ihealthcare.
the class RevisionBranchMergeTest method mergeOlderTagBranchToNewerBranch.
@Test
public void mergeOlderTagBranchToNewerBranch() throws Exception {
// create tagged/versioned data
final String oldParent = createBranch(MAIN, "oldParent");
indexRevision(oldParent, NEW_DATA);
final String tag = createBranch(oldParent, "tag");
RevisionData updatedAfterTag = NEW_DATA.toBuilder().terms(List.of("term")).build();
indexChange(oldParent, NEW_DATA, updatedAfterTag);
// index new change on MAIN
indexRevision(MAIN, NEW_DATA2);
final String target = createBranch(MAIN, "target");
assertNotNull("Failed to merge tag to target", branching().prepareMerge(tag, target).squash(false).merge());
RevisionData afterMerge = getRevision(target, RevisionData.class, STORAGE_KEY1);
assertDocEquals(NEW_DATA, afterMerge);
RevisionData existingDoc = getRevision(target, RevisionData.class, STORAGE_KEY2);
assertDocEquals(NEW_DATA2, existingDoc);
}
Aggregations