184 |
184 |
@DataSet(value="/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml"),
|
185 |
185 |
@DataSet(value="DistributionAggregationTest.xml"),
|
186 |
186 |
})
|
187 |
|
public void test_ignore() throws JvmLimitsException {
|
|
187 |
public void test_ignore(){
|
188 |
188 |
PresenceAbsenceTerm endemic = PresenceAbsenceTerm.ENDEMIC_FOR_THE_RELEVANT_AREA();
|
189 |
189 |
addDistributions(
|
190 |
190 |
T_LAPSANA_COMMUNIS_ALPINA_UUID,
|
... | ... | |
238 |
238 |
@DataSet(value="/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml"),
|
239 |
239 |
@DataSet(value="DistributionAggregationTest.xml"),
|
240 |
240 |
})
|
241 |
|
public void testArea_area() throws JvmLimitsException {
|
|
241 |
public void testArea_area() {
|
242 |
242 |
|
243 |
243 |
Set<Distribution> distributions_LCA = new HashSet<>();
|
244 |
244 |
|
... | ... | |
246 |
246 |
distributions_LCA.add(newDistribution(book_a, yug_ko, PresenceAbsenceTerm.NATIVE(), "2")); // NATIVE should succeed
|
247 |
247 |
distributions_LCA.add(newDistribution(book_a, yug_bh, PresenceAbsenceTerm.INTRODUCED(), "3"));
|
248 |
248 |
distributions_LCA.add(newDistribution(book_a, yug_ma, PresenceAbsenceTerm.NATIVE(), "4")); // NATIVE should succeed
|
249 |
|
|
250 |
|
addDistributions(
|
251 |
|
T_LAPSANA_COMMUNIS_ALPINA_UUID,
|
252 |
|
distributions_LCA
|
253 |
|
);
|
|
249 |
addDistributions(T_LAPSANA_COMMUNIS_ALPINA_UUID, distributions_LCA);
|
254 |
250 |
|
255 |
251 |
Taxon lapsana_communis_alpina = (Taxon) taxonService.load(T_LAPSANA_COMMUNIS_ALPINA_UUID);
|
256 |
252 |
assertEquals(1, lapsana_communis_alpina.getDescriptions().size());
|
... | ... | |
314 |
310 |
|
315 |
311 |
//test
|
316 |
312 |
Taxon lapsana_communis = (Taxon) taxonService.load(T_LAPSANA_COMMUNIS_UUID);
|
317 |
|
assertEquals("Lapsana communis alpina must have 2 Descriptions, 1 with original data, 1 with aggregated data", 2, lapsana_communis.getDescriptions().size());
|
|
313 |
assertEquals("Lapsana communis alpina must have 2 Descriptions, 1 with original data, 1 with aggregated data",
|
|
314 |
2, lapsana_communis.getDescriptions().size());
|
318 |
315 |
|
319 |
316 |
Taxon lapsana = (Taxon) taxonService.load(T_LAPSANA_UUID);
|
320 |
|
assertEquals("Lapsana must have 1 Description with only aggregated data (original data does not exist)", 1, lapsana.getDescriptions().size());
|
|
317 |
assertEquals("Lapsana must have 1 Description with only aggregated data (original data does not exist)",
|
|
318 |
1, lapsana.getDescriptions().size());
|
321 |
319 |
TaxonDescription lapsanaAggregatedDescription = lapsana.getDescriptions().iterator().next();
|
322 |
320 |
assertTrue(lapsanaAggregatedDescription.isAggregatedDistribution());
|
323 |
321 |
assertEquals(3, lapsanaAggregatedDescription.getElements().size());
|
... | ... | |
417 |
415 |
}
|
418 |
416 |
}
|
419 |
417 |
assertEquals("All three expected areas should have been found before", numExpectedFound, 3);
|
420 |
|
|
421 |
418 |
}
|
422 |
419 |
|
423 |
420 |
private boolean sourceExists(Set<DescriptionElementSource> sources, Reference ref, String microCitation) {
|
... | ... | |
429 |
426 |
}
|
430 |
427 |
return false;
|
431 |
428 |
}
|
|
429 |
|
432 |
430 |
private boolean sourceExists(Set<DescriptionElementSource> sources, ICdmTarget target) {
|
433 |
431 |
for (DescriptionElementSource source:sources){
|
434 |
432 |
if (CdmUtils.nullSafeEqual(source.getCdmSource(), target) &&
|
... | ... | |
494 |
492 |
*
|
495 |
493 |
* This test relies on {@link #testArea_rank_and_area_1()}
|
496 |
494 |
* an makes assertions only on the alternative source references
|
497 |
|
* @throws JvmLimitsException
|
498 |
495 |
*/
|
499 |
496 |
@Test
|
500 |
497 |
@DataSets({
|
... | ... | |
502 |
499 |
@DataSet(value="/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml"),
|
503 |
500 |
@DataSet(value="DistributionAggregationTest.xml"),
|
504 |
501 |
})
|
505 |
|
public void testArea_rank_and_area_3() throws JvmLimitsException {
|
|
502 |
public void testArea_rank_and_area_3() {
|
506 |
503 |
|
507 |
504 |
Set<Distribution> distributions_LCA = new HashSet<>();
|
508 |
505 |
distributions_LCA.add(newDistribution(book_a, yug_ko, PresenceAbsenceTerm.NATIVE(), "1"));
|
... | ... | |
548 |
545 |
* result of the aggregation (see https://dev.e-taxonomy.eu/redmine/issues/4366#comment:12)
|
549 |
546 |
*
|
550 |
547 |
* This test relies on {@link #testArea_rank_and_area_1()}
|
551 |
|
* an makes assertions only on the alternative source references
|
552 |
|
* @throws JvmLimitsException
|
|
548 |
* and makes assertions only on the alternative source references
|
553 |
549 |
*/
|
554 |
550 |
@Test
|
555 |
551 |
@Ignore
|
... | ... | |
558 |
554 |
@DataSet(value="/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml"),
|
559 |
555 |
@DataSet(value="DistributionAggregationTest.xml"),
|
560 |
556 |
})
|
561 |
|
public void testArea_rank_and_area_4() throws JvmLimitsException {
|
|
557 |
public void testArea_rank_and_area_4() {
|
562 |
558 |
|
563 |
559 |
Set<Distribution> distributions_LCA = new HashSet<>();
|
564 |
560 |
distributions_LCA.add(newDistribution(book_a, yug_ko, PresenceAbsenceTerm.NATIVE(), "1"));
|
565 |
|
|
566 |
|
addDistributions(
|
567 |
|
T_LAPSANA_COMMUNIS_ALPINA_UUID,
|
568 |
|
distributions_LCA
|
569 |
|
);
|
|
561 |
addDistributions(T_LAPSANA_COMMUNIS_ALPINA_UUID, distributions_LCA);
|
570 |
562 |
|
571 |
563 |
Set<Distribution> distributions_LC = new HashSet<>();
|
572 |
564 |
distributions_LC.add(newDistribution(book_a, yug, PresenceAbsenceTerm.NATIVE(), "2")); // should succeed
|
573 |
|
|
574 |
|
addDistributions(
|
575 |
|
T_LAPSANA_COMMUNIS_UUID,
|
576 |
|
distributions_LC
|
577 |
|
);
|
|
565 |
addDistributions(T_LAPSANA_COMMUNIS_UUID, distributions_LC);
|
578 |
566 |
|
579 |
567 |
TaxonNodeFilter filter = TaxonNodeFilter.NewInstance(null, null, null, null, null, lowerRank.getUuid(), upperRank.getUuid());
|
580 |
568 |
DistributionAggregationConfiguration config = DistributionAggregationConfiguration.NewInstance(
|
cleanup