Project

General

Profile

« Previous | Next » 

Revision 379eb203

Added by Andreas Müller over 3 years ago

cleanup

View differences:

cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/description/DescriptionDaoHibernateImplTest.java
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9

  
10 9
package eu.etaxonomy.cdm.persistence.dao.hibernate.description;
11 10

  
12 11
import static org.junit.Assert.assertEquals;
......
101 100
//		printDataSet(System.err, TABLE_NAMES);
102 101
    }
103 102

  
104

  
105 103
    @Test
106 104
    public void testCountByDistribution() {
107 105
//		printDataSet(System.err, TABLE_NAMES);
......
266 264
        DescriptionBase<?> description = descriptionDao.findByUuid(uuid);
267 265
        assert description != null : "description must exist";
268 266

  
269
        List<String> propertyPaths = new ArrayList<String>();
267
        List<String> propertyPaths = new ArrayList<>();
270 268
        propertyPaths.add("multilanguageText");
271 269
        propertyPaths.add("media");
272 270
        propertyPaths.add("feature");
......
360 358
        assert taxonSphingidae != null : "taxon must exist";
361 359

  
362 360
        // 1.
363

  
364 361
        List<DescriptionElementBase> elements1 = descriptionDao.getDescriptionElementForTaxon(
365 362
                taxonSphingidae.getUuid() , null, null, null, 0, null);
366 363

  
......
368 365
        assertEquals("getDescriptionElementForTaxon should return 1 elements",1,elements1.size());
369 366

  
370 367
        // 2.
371

  
372 368
        List<DescriptionElementBase> elements2 = descriptionDao.getDescriptionElementForTaxon(
373 369
                taxonSphingidae.getUuid() , null, DescriptionElementBase.class, null, 0, null);
374 370

  
......
376 372
        assertTrue("getDescriptionElementForTaxon should be empty",elements2.isEmpty());
377 373

  
378 374
        // 3.
379

  
380 375
        List<Distribution> elements3 = descriptionDao.getDescriptionElementForTaxon(
381 376
                taxonSphingidae.getUuid() , null, Distribution.class, null, 0, null);
382 377

  
......
402 397
//		printDataSet(System.err, new String[]{"TAXONBASE"});
403 398

  
404 399
        assertTrue(true);
405

  
406 400
    }
407 401

  
408 402
    //see #2592
......
419 413
        description.addScope(scope);
420 414

  
421 415
        this.descriptionDao.saveOrUpdate(description);
422

  
423 416
    }
424 417

  
425 418
    @Test
......
527 520
        Assert.assertNotNull("Third taxon should exist", thirdTaxon);
528 521
        Assert.assertEquals("There should be 6 descriptions in the database", 6, this.descriptionDao.count());
529 522

  
530

  
531 523
        //set parameter
532 524
        Set<MarkerType> markerTypes = null;
533 525
        Integer pageSize = null;
......
565 557
        //check deduplication
566 558
        mediaList = this.descriptionDao.listTaxonDescriptionMedia(null, false, markerTypes, pageSize, pageNumber, propertyPaths);
567 559
        Assert.assertEquals("media list size for any taxon without filter on image galleries should be 3", 3, mediaList.size());
568

  
569
//        System.out.println(mediaList);
570 560
    }
571 561

  
572 562
    @Test
......
616 606
        //check deduplication
617 607
        mediaCount = this.descriptionDao.countTaxonDescriptionMedia(null, false, markerTypes);
618 608
        Assert.assertEquals("media list size for any taxon without filter on image galleries should be 3", 3, mediaCount);
619

  
620 609
    }
621 610

  
622 611
    @Test
623
//    @DataSet
624 612
    @DataSets({
625 613
        @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="/eu/etaxonomy/cdm/database/ClearDB_with_Terms_DataSet.xml"),
626 614
        @DataSet(value="/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml"),
......
628 616
    })
629 617
    public void testListNamedAreasInUse(){
630 618

  
631
        Collection<TermDto> list = null;
632

  
633 619
        DefinedTermBase<?> antarctica = definedTermDao.load(antarcticaUuid);
634 620
        antarctica.getRepresentations().add(Representation.NewInstance("Antarktis", "Antarktis", "An", Language.GERMAN()));
635 621
        definedTermDao.saveOrUpdate(antarctica);
636 622
        commitAndStartNewTransaction(null);
637 623

  
638
        list = descriptionDao.listNamedAreasInUse(false, null, null);
624
        Collection<TermDto> list = descriptionDao.listNamedAreasInUse(false, null, null);
639 625
        Assert.assertEquals(3, list.size());
640

  
641 626
    }
642 627

  
643 628
    @Test
......
645 630
    // @Ignore // the first query in listNamedAreasInUse is for some reason not working with h2
646 631
    public void testListNamedAreasInUseWithParents(){
647 632

  
648
        Collection<TermDto> list = null;
649

  
650
        list = descriptionDao.listNamedAreasInUse(true, null, null);
633
        Collection<TermDto> list = descriptionDao.listNamedAreasInUse(true, null, null);
651 634
        Assert.assertEquals(3, list.size());
652

  
653 635
    }
654 636

  
655

  
656 637
    @Override
657 638
    public void createTestDataSet() throws FileNotFoundException {}
658

  
659

  
660 639
}

Also available in: Unified diff