use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method addNewMemberToExistingDescription.
@Test
public void addNewMemberToExistingDescription() {
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
initRevisions(fsn);
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member = simpleMember(fsn.getId(), referringRefSetId);
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.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 addNewDescriptionWithoutLanguageMembers.
@Test
public void addNewDescriptionWithoutLanguageMembers() throws Exception {
SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
stageNew(fsn);
process(processor);
assertEquals(1, processor.getNewMappings().size());
Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(fsn, actual);
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 RelationshipChangeProcessorTest method addNewMemberToExistingRelationship.
@Test
public void addNewMemberToExistingRelationship() {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member = simpleMember(relationship.getId(), referringRefSetId);
initRevisions(relationship);
stageNew(member);
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());
}
use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class RelationshipChangeProcessorTest method changedRelationshipGroup.
@Test
public void changedRelationshipGroup() throws Exception {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
initRevisions(relationship);
stageChange(relationship, SnomedRelationshipIndexEntry.builder(relationship).relationshipGroup(relationship.getRelationshipGroup() + 1).build());
process(processor);
final SnomedRelationshipIndexEntry expected = SnomedRelationshipIndexEntry.builder(relationship).relationshipGroup(relationship.getRelationshipGroup() + 1).build();
final Revision actual = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expected, actual);
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 PreferredDescriptionPreCommitHookTest method indexConceptWithFsnAndDefinition.
@Test
public void indexConceptWithFsnAndDefinition() throws Exception {
final SnomedConceptDocument concept = concept().build();
final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
final SnomedDescriptionIndexEntry definition = definition(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
stageNew(concept);
stageNew(fsn);
stageNew(definition);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).semanticTags(ImmutableSortedSet.of("semantic tag")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build();
final Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expected, actual);
assertEquals(0, processor.getChangedMappings().size());
assertEquals(0, processor.getDeletions().size());
}
Aggregations