3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.vaadin
.presenter
;
12 import java
.sql
.SQLException
;
13 import java
.util
.Collection
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.junit
.Assert
;
17 import org
.junit
.BeforeClass
;
18 import org
.junit
.Test
;
19 import org
.unitils
.dbunit
.annotation
.DataSet
;
21 import com
.vaadin
.data
.Item
;
23 import eu
.etaxonomy
.cdm
.vaadin
.CdmVaadinBaseTest
;
24 import eu
.etaxonomy
.cdm
.vaadin
.container
.CdmSQLContainer
;
25 import eu
.etaxonomy
.cdm
.vaadin
.container
.LeafNodeTaxonContainer
;
33 public class StatusPresenterTest
extends CdmVaadinBaseTest
{
35 private static final Logger logger
= Logger
.getLogger(StatusPresenterTest
.class);
37 private static StatusPresenter sp
;
40 public static void init() {
41 sp
= new StatusPresenter(null);
45 public void testLoadTaxa() throws SQLException
{
46 LeafNodeTaxonContainer container
= sp
.loadTaxa(11);
47 Collection
<?
> propIds
= container
.getContainerPropertyIds();
48 Collection
<?
> itemIds
= container
.getItemIds();
49 for(Object itemId
: itemIds
) {
50 Item item
= container
.getItem(itemId
);
51 // column names need to be uppercase for h2 in the test environment
52 //String taxon = (String)item.getItemProperty("TAXON").getValue();
53 //logger.info("taxon : " + taxon);
55 Assert
.assertEquals(3,itemIds
.size());
59 public void testLoadClassifications() throws SQLException
{
60 CdmSQLContainer container
= sp
.loadClassifications();
61 Collection
<?
> itemIds
= container
.getItemIds();
62 String
[] uuids
= {"6595638e-4993-421a-9fe5-76b09d94f36a", "1ef8aada-de72-4023-bbe1-14465b6bc60d"};
64 for(Object itemId
: itemIds
) {
65 Item item
= container
.getItem(itemId
);
67 String uuid
= (String
)item
.getItemProperty("UUID").getValue();
68 Assert
.assertEquals(uuids
[count
], uuid
);
69 String titleCache
= (String
)item
.getItemProperty("TITLECACHE").getValue();
70 logger
.info("titleCache : " + titleCache
);