Project

General

Profile

Download (2.86 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2015 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10
package eu.etaxonomy.cdm.vaadin.presenter;
11

    
12
import java.sql.SQLException;
13
import java.util.Collection;
14

    
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;
21

    
22
import com.vaadin.data.Item;
23

    
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;
28

    
29
/**
30
 * @author cmathew
31
 * @date 10 Mar 2015
32
 *
33
 */
34
@DataSet
35
public class StatusPresenterTest extends CdmVaadinBaseTest {
36

    
37
    private static final Logger logger = Logger.getLogger(StatusPresenterTest.class);
38

    
39
    private static StatusPresenter sp;
40

    
41
    @BeforeClass
42
    public static void init() {
43
        sp = new StatusPresenter(new MockStatusComposite());
44
    }
45

    
46
    @Test
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);
56
        }
57
        Assert.assertEquals(3,itemIds.size());
58
    }
59

    
60
    @Ignore
61
    @Test
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"};
66
        int count = 0;
67
        for(Object itemId : itemIds) {
68
            Item item = container.getItem(itemId);
69

    
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);
74
            count++;
75

    
76
        }
77
    }
78

    
79
    public static class MockStatusComposite implements IStatusComposite {
80

    
81
        /* (non-Javadoc)
82
         * @see eu.etaxonomy.cdm.vaadin.view.IStatusComposite#setListener(eu.etaxonomy.cdm.vaadin.view.IStatusComposite.StatusComponentListener)
83
         */
84
        @Override
85
        public void setListener(StatusComponentListener listener) {
86
            // TODO Auto-generated method stub
87

    
88
        }
89

    
90
    }
91
}
    (1-1/1)