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
.Ignore
;
19 import org
.junit
.Test
;
20 import org
.unitils
.dbunit
.annotation
.DataSet
;
22 import com
.vaadin
.data
.Item
;
24 import eu
.etaxonomy
.cdm
.vaadin
.CdmVaadinBaseTest
;
25 import eu
.etaxonomy
.cdm
.vaadin
.container
.CdmSQLContainer
;
26 import eu
.etaxonomy
.cdm
.vaadin
.container
.LeafNodeTaxonContainer
;
27 import eu
.etaxonomy
.cdm
.vaadin
.view
.IStatusComposite
;
35 public class StatusPresenterTest
extends CdmVaadinBaseTest
{
37 private static final Logger logger
= Logger
.getLogger(StatusPresenterTest
.class);
39 private static StatusPresenter sp
;
42 public static void init() {
43 sp
= new StatusPresenter(new MockStatusComposite());
47 public void testLoadTaxa() throws SQLException
{
48 LeafNodeTaxonContainer container
= sp
.loadTaxa(11);
49 Collection
<?
> propIds
= container
.getContainerPropertyIds();
50 Collection
<?
> itemIds
= container
.getItemIds();
51 for(Object itemId
: itemIds
) {
52 Item item
= container
.getItem(itemId
);
53 // column names need to be uppercase for h2 in the test environment
54 //String taxon = (String)item.getItemProperty("TAXON").getValue();
55 //logger.info("taxon : " + taxon);
57 Assert
.assertEquals(3,itemIds
.size());
62 public void testLoadClassifications() throws SQLException
{
63 CdmSQLContainer container
= sp
.loadClassifications();
64 Collection
<?
> itemIds
= container
.getItemIds();
65 String
[] uuids
= {"6595638e-4993-421a-9fe5-76b09d94f36a", "1ef8aada-de72-4023-bbe1-14465b6bc60d"};
67 for(Object itemId
: itemIds
) {
68 Item item
= container
.getItem(itemId
);
70 String uuid
= (String
)item
.getItemProperty("UUID").getValue();
71 Assert
.assertEquals(uuids
[count
], uuid
);
72 String titleCache
= (String
)item
.getItemProperty("TITLECACHE").getValue();
73 logger
.info("titleCache : " + titleCache
);
79 public static class MockStatusComposite
implements IStatusComposite
{
82 * @see eu.etaxonomy.cdm.vaadin.view.IStatusComposite#setListener(eu.etaxonomy.cdm.vaadin.view.IStatusComposite.StatusComponentListener)
85 public void setListener(StatusComponentListener listener
) {
86 // TODO Auto-generated method stub