use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method addNewMemberToNewDescription.
@Test
public void addNewMemberToNewDescription() {
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member = simpleMember(fsn.getId(), referringRefSetId);
stageNew(fsn);
stageNew(member);
process(processor);
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).memberOf(Collections.singleton(referringRefSetId)).activeMemberOf(Collections.singleton(referringRefSetId)).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expectedDoc, currentDoc);
assertEquals(0, processor.getChangedMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method deleteOneMemberFromMultipleMembersOfDescription.
@Test
public void deleteOneMemberFromMultipleMembersOfDescription() {
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member1 = simpleMember(fsn.getId(), referringRefSetId);
final SnomedRefSetMemberIndexEntry member2 = simpleMember(fsn.getId(), referringRefSetId);
initRevisions(SnomedDescriptionIndexEntry.builder(fsn).memberOf(ImmutableList.of(referringRefSetId, referringRefSetId)).activeMemberOf(ImmutableList.of(referringRefSetId, referringRefSetId)).build(), member1, member2);
stageRemove(member1);
process(processor);
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).memberOf(Collections.singleton(referringRefSetId)).activeMemberOf(Collections.singleton(referringRefSetId)).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expectedDoc, currentDoc);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method changeDescriptionCaseSignificance.
@Test
public void changeDescriptionCaseSignificance() throws Exception {
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
initRevisions(fsn);
stageChange(fsn, SnomedDescriptionIndexEntry.builder(fsn).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build());
process(processor);
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expectedDoc, currentDoc);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class RelationshipChangeProcessorTest method deleteMemberOfExistingRelationship.
@Test
public void deleteMemberOfExistingRelationship() {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member = simpleMember(relationship.getId(), referringRefSetId);
initRevisions(SnomedRelationshipIndexEntry.builder(relationship).memberOf(ImmutableList.of(referringRefSetId)).activeMemberOf(ImmutableList.of(referringRefSetId)).build(), member);
stageRemove(member);
process(processor);
final SnomedRelationshipIndexEntry expectedDoc = SnomedRelationshipIndexEntry.builder(relationship).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expectedDoc, currentDoc);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class RelationshipChangeProcessorTest method deleteOneMemberFromMultipleMembersOfRelationship.
@Test
public void deleteOneMemberFromMultipleMembersOfRelationship() {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member1 = simpleMember(relationship.getId(), referringRefSetId);
final SnomedRefSetMemberIndexEntry member2 = simpleMember(relationship.getId(), referringRefSetId);
initRevisions(SnomedRelationshipIndexEntry.builder(relationship).memberOf(ImmutableList.of(referringRefSetId, referringRefSetId)).activeMemberOf(ImmutableList.of(referringRefSetId, referringRefSetId)).build(), member1, member2);
stageRemove(member1);
process(processor);
final SnomedRelationshipIndexEntry expectedDoc = SnomedRelationshipIndexEntry.builder(relationship).memberOf(Collections.singleton(referringRefSetId)).activeMemberOf(Collections.singleton(referringRefSetId)).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expectedDoc, currentDoc);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
Aggregations