Project

General

Profile

« Previous | Next » 

Revision f600798d

Added by Andreas Müller over 1 year ago

cleanup

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/SpecimenOrObservationBase.java
375 375
     * Returns the {@link SpecimenDescription specimen descriptions} which act as an image gallery
376 376
     * and which this specimen is part of.
377 377
     * @see #getDescriptions()
378
     * @return
379 378
     */
380 379
    @Transient
381 380
    public Set<SpecimenDescription> getSpecimenDescriptionImageGallery() {
......
392 391

  
393 392
    /**
394 393
     * Adds a new description to this specimen or observation
395
     * @param description
396 394
     */
397 395
    @Override
398 396
    public void addDescription(DescriptionBase description) {
......
405 403

  
406 404
    /**
407 405
     * Removes a specimen from a description (removes a description from this specimen)
408
     * @param description
409 406
     */
410 407
    @Override
411 408
    public void removeDescription(DescriptionBase description) {
......
415 412
        }
416 413
    }
417 414

  
418

  
419 415
    public Set<DerivationEvent> getDerivationEvents() {
420 416
        if(derivationEvents == null) {
421 417
            this.derivationEvents = new HashSet<>();
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/OriginalSourceBase.java
255 255
	@Override
256 256
	public OriginalSourceBase clone() throws CloneNotSupportedException{
257 257

  
258
	    @SuppressWarnings("unchecked")
259 258
        OriginalSourceBase result = (OriginalSourceBase)super.clone();
260 259

  
261 260
		Set<ExternalLink> links = new HashSet<>();
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/description/DistributionAggregationConfiguration.java
57 57
    }
58 58

  
59 59
    public static DistributionAggregationConfiguration NewInstance(List<AggregationMode> aggregationModes, List<UUID> superAreas,
60
            TaxonNodeFilter filter, TermTree<PresenceAbsenceTerm> statusOrder,  IProgressMonitor monitor){
60
            TaxonNodeFilter filter, TermTree<PresenceAbsenceTerm> statusOrder, IProgressMonitor monitor){
61 61

  
62 62
        DistributionAggregationConfiguration result = new DistributionAggregationConfiguration(aggregationModes, superAreas, filter, monitor);
63 63
        result.setStatusOrder(statusOrder);
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/description/DistributionAggregationTest.java
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(
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/CdmTransactionalIntegrationTest.java
370 370
     */
371 371
    protected void commitAndStartNewTransaction(final String[] tableNames) {
372 372
        commit();
373
        if(logger.isEnabledFor(Level.DEBUG)){
373
        if(tableNames != null && logger.isEnabledFor(Level.DEBUG)){
374 374
            printDataSet(System.out, tableNames);
375 375
//          careful, the following will overwrite existing files:
376 376
//          writeDbUnitDataSetFile(tableNames);

Also available in: Unified diff