use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method deleteAcceptableLanguageMember.
@Test
public void deleteAcceptableLanguageMember() throws Exception {
// create description as dirty
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), ImmutableMap.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE));
final SnomedRefSetMemberIndexEntry acceptableInUs = langMember(fsn.getId(), Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US);
final SnomedRefSetMemberIndexEntry preferredInUk = langMember(fsn.getId(), Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_UK);
// index current revisions, so change processor can find them (both the description and the members)
initRevisions(fsn, acceptableInUs, preferredInUk);
stageRemove(acceptableInUs);
process(processor);
// expected that the new doc will have only the preferred acceptability
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).acceptabilityMap(Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED)).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expectedDoc, currentDoc);
// XXX the deleted member handled by another processor
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method changeLanguageMemberAcceptability.
@Test
public void changeLanguageMemberAcceptability() throws Exception {
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), ImmutableMap.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE));
final SnomedRefSetMemberIndexEntry acceptableInUk = langMember(fsn.getId(), Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_UK);
initRevisions(fsn, acceptableInUk);
// make the change
stageChange(acceptableInUk, SnomedRefSetMemberIndexEntry.builder(acceptableInUk).field(SnomedRf2Headers.FIELD_ACCEPTABILITY_ID, Acceptability.PREFERRED.getConceptId()).build());
process(processor);
assertEquals(1, processor.getChangedMappings().size());
// description doc must be reindexed with change acceptabilityMap
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).acceptabilityMap(Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED)).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.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method deleteMemberOfDescription.
@Test
public void deleteMemberOfDescription() {
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member = simpleMember(fsn.getId(), referringRefSetId);
initRevisions(SnomedDescriptionIndexEntry.builder(fsn).memberOf(Collections.singleton(referringRefSetId)).activeMemberOf(Collections.singleton(referringRefSetId)).build(), member);
stageRemove(member);
process(processor);
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).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.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry in project snow-owl by b2ihealthcare.
the class DescriptionChangeProcessorTest method deletePreferredLanguageMember.
@Test
public void deletePreferredLanguageMember() throws Exception {
// create description as dirty
final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), ImmutableMap.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE));
final SnomedRefSetMemberIndexEntry acceptableInUs = langMember(fsn.getId(), Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US);
final SnomedRefSetMemberIndexEntry preferredInUk = langMember(fsn.getId(), Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_UK);
// index current revisions, so change processor can find them (both the description and the members)
initRevisions(fsn, acceptableInUs, preferredInUk);
stageRemove(preferredInUk);
process(processor);
// expected that the new doc will have only the preferred acceptability
final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).acceptabilityMap(Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE)).build();
final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expectedDoc, currentDoc);
// XXX the deleted member handled by another processor
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry 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());
}
Aggregations