use of com.b2international.index.revision.Revision in project snow-owl by b2ihealthcare.
the class PreferredDescriptionPreCommitHookTest method updateTermOfConceptFsn.
@Test
public void updateTermOfConceptFsn() throws Exception {
final SnomedConceptDocument concept = concept().build();
final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
initRevisions(docWithDefaults(concept).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build(), fsn);
stageChange(fsn, SnomedDescriptionIndexEntry.builder(fsn).term("Term (changed)").build());
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).semanticTags(ImmutableSortedSet.of("changed")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), "Term (changed)", Concepts.REFSET_LANGUAGE_TYPE_UK))).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 inactivateFsnOfConcept.
@Test
public void inactivateFsnOfConcept() throws Exception {
final SnomedConceptDocument concept = concept().build();
final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
initRevisions(docWithDefaults(concept).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build(), fsn);
stageChange(fsn, SnomedDescriptionIndexEntry.builder(fsn).active(false).build());
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).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 indexNewFsnForExistingConcept.
@Test
public void indexNewFsnForExistingConcept() throws Exception {
final SnomedConceptDocument concept = concept().build();
initRevisions(docWithDefaults(concept).build());
final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
stageNew(fsn);
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();
assertEquals(1, processor.getChangedMappings().size());
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 removeFsnFromExistingConcept.
@Test
public void removeFsnFromExistingConcept() throws Exception {
final SnomedConceptDocument concept = concept().build();
final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
initRevisions(docWithDefaults(concept).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build(), fsn);
stageRemove(fsn);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).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 TaxonomyPreCommitHookTest method indexOrphanConceptWithIconId_ShouldGetItsIconId.
@Test
public void indexOrphanConceptWithIconId_ShouldGetItsIconId() throws Exception {
final SnomedConceptDocument concept = concept().build();
availableImages.add(concept.getId());
stageNew(concept);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).iconId(concept.getId()).build();
final Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expected, actual);
assertEquals(0, processor.getChangedMappings().size());
assertEquals(0, processor.getDeletions().size());
}
Aggregations