use of org.obiba.opal.core.domain.taxonomy.Taxonomy in project mica2 by obiba.
the class TaxonomyConfigServiceTest method merge_taxonomy_with_one_missing_vocabulary.
@Test
public void merge_taxonomy_with_one_missing_vocabulary() {
Taxonomy tax001 = new Taxonomy("tax001");
tax001.addVocabulary(createVocabulary("voc001", null, null));
Taxonomy tax002 = new Taxonomy("tax002");
new TaxonomyConfigService().mergeVocabulariesTerms(tax001, tax002);
assert tax001.hasVocabulary("voc001");
}
use of org.obiba.opal.core.domain.taxonomy.Taxonomy in project mica2 by obiba.
the class TaxonomyConfigServiceTest method merge_taxonomy_with_one_having_extra_vocabulary.
@Test
public void merge_taxonomy_with_one_having_extra_vocabulary() {
Taxonomy tax001 = new Taxonomy("tax001");
Taxonomy tax002 = new Taxonomy("tax002");
tax002.addVocabulary(createVocabulary("voc002", null, null));
new TaxonomyConfigService().mergeVocabulariesTerms(tax001, tax002);
assert tax001.hasVocabulary("voc002");
}
use of org.obiba.opal.core.domain.taxonomy.Taxonomy in project mica2 by obiba.
the class TaxonomyConfigServiceTest method validateTaxonomyDuplicateAlias.
@Test(expected = VocabularyDuplicateAliasException.class)
public void validateTaxonomyDuplicateAlias() {
Taxonomy taxonomy = new Taxonomy("tax001");
taxonomy.addVocabulary(createVocabulary("voc001", null, AttributeBuilder.newBuilder().field("tax.voc").alias("tax-voc").build()));
taxonomy.addVocabulary(createVocabulary("voc002", null, AttributeBuilder.newBuilder().field("tax.voc").alias("tax-voc").build()));
new TaxonomyConfigService().validateTaxonomy(taxonomy);
}
use of org.obiba.opal.core.domain.taxonomy.Taxonomy in project mica2 by obiba.
the class TaxonomyConfigServiceTest method validateRangeTaxonomyWithoutTermsAndRange.
@Test
public void validateRangeTaxonomyWithoutTermsAndRange() {
Taxonomy taxonomy = new Taxonomy("tax001");
taxonomy.addVocabulary(createVocabulary("voc001", null, AttributeBuilder.newBuilder().field("tax.voc").alias("tax-voc-range").type("integer").build()));
new TaxonomyConfigService().validateTaxonomy(taxonomy);
}
use of org.obiba.opal.core.domain.taxonomy.Taxonomy in project mica2 by obiba.
the class TaxonomyConfigServiceTest method validateRangeTaxonomyWithTerms.
@Test
public void validateRangeTaxonomyWithTerms() {
Taxonomy taxonomy = new Taxonomy("tax001");
taxonomy.addVocabulary(createVocabulary("voc001", createTerms("term001", "term002"), AttributeBuilder.newBuilder().field("tax.voc").alias("tax-voc-range").range("true").build()));
new TaxonomyConfigService().validateTaxonomy(taxonomy);
}
Aggregations