Project

General

Profile

« Previous | Next » 

Revision 3908fcfb

Added by Cherian Mathew about 9 years ago

test classes and datasets for status editor

View differences:

.gitattributes
114 114
src/test/java/eu/etaxonomy/cdm/remote/config/LoggingConfigurer.java -text
115 115
src/test/java/eu/etaxonomy/cdm/vaadin/CdmVaadinBaseTest.java -text
116 116
src/test/java/eu/etaxonomy/cdm/vaadin/container/CdmSQLContainerTest.java -text
117
src/test/java/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenterTest.java -text
117 118
src/test/java/eu/etaxonomy/cdm/vaadin/ui/NavigatorTestUI.java -text
118 119
src/test/java/eu/etaxonomy/cdm/vaadin/util/CdmSpringContextHelperTest.java -text
119 120
src/test/java/eu/etaxonomy/cdm/vaadin/view/NaviTestView.java -text
......
128 129
src/test/resources/eu/etaxonomy/cdm/vaadin/PUBLIC.xsd -text
129 130
src/test/resources/eu/etaxonomy/cdm/vaadin/container/CdmSQLContainerTest.xml -text
130 131
src/test/resources/eu/etaxonomy/cdm/vaadin/dataset.xsd -text
132
src/test/resources/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenterTest.xml -text
131 133
src/test/resources/eu/etaxonomy/cdm/vaadin/util/CdmSpringContextHelperTest.xml -text
132 134
src/test/resources/h2/cdmTest.h2.db -text
133 135
src/test/resources/log4j.properties -text
src/test/java/eu/etaxonomy/cdm/vaadin/container/CdmSQLContainerTest.java
1 1
package eu.etaxonomy.cdm.vaadin.container;
2 2

  
3
import java.sql.SQLException;
3 4
import java.util.Collection;
4 5

  
5 6
import org.apache.log4j.Logger;
......
14 15

  
15 16

  
16 17
@DataSet
17
public class CdmSQLContainerTest extends CdmVaadinBaseTest {	
18
	
18
public class CdmSQLContainerTest extends CdmVaadinBaseTest {
19

  
19 20
	private static final Logger logger = Logger.getLogger(CdmSQLContainerTest.class);
20
	
21
	@Test	
22
	public void testTaxonContainer() {
21

  
22
	@Test
23
	public void testTaxonContainer() throws SQLException {
23 24
		CdmSpringContextHelper helper = CdmSpringContextHelper.newInstance();
24 25
		// FIXME : Need to figure out how to get the db connection username / password
25 26
		//         to initialise the container. Hard coded for now
26
		CdmSQLContainer csc = CdmSQLContainer.newInstance("TaxonBase", "sa","");		
27
		CdmSQLContainer csc = CdmSQLContainer.newInstance("TaxonBase");
27 28
		Collection<?> propIds = csc.getContainerPropertyIds();
28 29
		Collection<?> itemIds = csc.getItemIds();
29 30
		for(Object itemId : itemIds) {
30 31
			Item item = csc.getItem(itemId);
31 32
			// column names need to be uppercase for h2 in the test environment
32
			String uuid = (String)item.getItemProperty("UUID").getValue();		
33
			String uuid = (String)item.getItemProperty("UUID").getValue();
33 34
		}
34 35
		Assert.assertEquals(itemIds.size(),38);
35 36
	}
36 37

  
38
	@Test
39
	public void testTaxonomicStatus() {
40

  
41
	}
42

  
37 43

  
38 44
}
src/test/java/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenterTest.java
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.Test;
19
import org.unitils.dbunit.annotation.DataSet;
20

  
21
import com.vaadin.data.Item;
22

  
23
import eu.etaxonomy.cdm.vaadin.CdmVaadinBaseTest;
24
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer;
25
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer;
26

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

  
35
    private static final Logger logger = Logger.getLogger(StatusPresenterTest.class);
36

  
37
    private static StatusPresenter sp;
38

  
39
    @BeforeClass
40
    public static void init() {
41
        sp = new StatusPresenter(null);
42
    }
43

  
44
    @Test
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);
54
        }
55
        Assert.assertEquals(3,itemIds.size());
56
    }
57

  
58
    @Test
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"};
63
        int count = 0;
64
        for(Object itemId : itemIds) {
65
            Item item = container.getItem(itemId);
66

  
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);
71
            count++;
72

  
73
        }
74
    }
75
}
src/test/resources/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenterTest.xml
1
<?xml version="1.0" encoding="UTF-8"?><!--
2
  generated by Jailer 4.3, Tue Mar 10 14:42:57 CET 2015 from cmathew@cmbgbm-t530
3
  
4
  Extraction Model:  all rows from Classification (extractionmodel/by-example/SbE-Classification-14-42-42-331.csv)
5
  Database URL:      jdbc:mysql://127.0.0.1:3306/local-redlist
6
  Database User:     root
7
  
8
  Exported Rows:     27
9
      Classification                 2
10
      DefinedTermBase                2
11
      TaxonBase                      7
12
      TaxonNameBase                  7
13
      TaxonNode                      9
14
  
15
--><dataset>
16
  <TaxonNode id="11" created="2015-03-09 15:48:30.0" uuid="38f9a5e6-1a5c-4eae-8c63-3311a3102417" updated="2015-03-09 15:48:42.0" countchildren="4" sortindex="-1" treeindex="#t11#11#" createdby_id="10" updatedby_id="10" classification_id="11"/>
17
  <TaxonNode id="12" created="2015-03-09 15:49:25.0" uuid="70d6a47f-ec64-4e7e-9d92-299323adfdad" updated="2015-03-09 15:49:25.0" countchildren="0" sortindex="0" treeindex="#t11#11#12#" createdby_id="10" updatedby_id="10" classification_id="11" parent_id="11" taxon_id="10"/>
18
  <TaxonNode id="13" created="2015-03-09 15:51:14.0" uuid="8fe0c988-e1dd-4022-87e7-fe89f1f688db" updated="2015-03-09 15:51:14.0" countchildren="0" sortindex="1" treeindex="#t11#11#13#" createdby_id="10" updatedby_id="10" classification_id="11" parent_id="11" taxon_id="13"/>
19
  <TaxonNode id="14" created="2015-03-09 15:51:25.0" uuid="9d300433-a944-4768-b983-22e0236e716b" updated="2015-03-09 15:51:25.0" countchildren="0" sortindex="2" treeindex="#t11#11#14#" createdby_id="10" updatedby_id="10" classification_id="11" parent_id="11" taxon_id="14"/>
20
  <TaxonNode id="15" created="2015-03-09 15:52:08.0" uuid="ac4c95a7-640c-4910-8033-0a62b340e2a2" updated="2015-03-09 15:52:24.0" countchildren="3" sortindex="-1" treeindex="#t12#15#" createdby_id="10" updatedby_id="10" classification_id="12"/>
21
  <TaxonNode id="16" created="2015-03-09 15:52:42.0" uuid="33fb366c-1845-49ec-b5ae-9fb169a4aded" updated="2015-03-09 15:52:42.0" countchildren="0" sortindex="0" treeindex="#t12#15#16#" createdby_id="10" updatedby_id="10" classification_id="12" parent_id="15" taxon_id="16"/>
22
  <TaxonNode id="17" created="2015-03-09 15:53:23.0" uuid="e804ca8b-3520-41fd-8146-a93181ed57e4" updated="2015-03-09 15:53:23.0" countchildren="0" sortindex="1" treeindex="#t12#15#17#" createdby_id="10" updatedby_id="10" classification_id="12" parent_id="15" taxon_id="19"/>
23
  <TaxonNode id="18" created="2015-03-09 15:53:32.0" uuid="5c43f991-c4ad-414b-a4f3-2d6a26ff1ccf" updated="2015-03-09 15:53:32.0" countchildren="0" sortindex="2" treeindex="#t12#15#18#" createdby_id="10" updatedby_id="10" classification_id="12" parent_id="15" taxon_id="20"/>
24
  <TaxonNode id="20" created="2015-03-10 13:40:31.0" uuid="6a6ee4dd-5727-47ba-a53d-3a985623dd93" updated="2015-03-10 13:40:31.0" countchildren="0" sortindex="3" treeindex="#t11#11#20#" createdby_id="10" updatedby_id="10" classification_id="11" parent_id="11" taxon_id="30"/>
25

  
26
  <TaxonNameBase DTYPE="BotanicalName" id="10" created="2015-03-09 15:49:22.0" uuid="9c0b6c13-562e-4642-9494-58dbcedf45f4" updated="2015-03-09 15:49:25.0" protectedtitlecache="false" titleCache="Taxon A" parsingproblem="0" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="A" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="10" rank_id="790" combinationauthorteam_id="10"/>
27
  <TaxonNameBase DTYPE="BotanicalName" id="13" created="2015-03-09 15:51:11.0" uuid="fb76b9cb-29d2-4986-a327-19d1d003159a" updated="2015-03-09 15:51:14.0" protectedtitlecache="false" titleCache="Taxon B" fullTitleCache="Taxon B" parsingproblem="0" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="B" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="12" rank_id="790" combinationauthorteam_id="11"/>
28
  <TaxonNameBase DTYPE="BotanicalName" id="14" created="2015-03-09 15:51:24.0" uuid="a21d5e7c-e8b5-4395-b83b-a219877e80eb" updated="2015-03-09 15:51:25.0" protectedtitlecache="false" titleCache="Taxon C" parsingproblem="0" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="C" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="13" rank_id="790" combinationauthorteam_id="12"/>
29
  <TaxonNameBase DTYPE="BotanicalName" id="16" created="2015-03-09 15:52:34.0" uuid="81444d5e-122f-46aa-9bee-d7c0ba52f8d6" updated="2015-03-09 15:52:42.0" protectedtitlecache="false" titleCache="Taxon A" parsingproblem="0" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="A" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="14" rank_id="790" combinationauthorteam_id="13"/>
30
  <TaxonNameBase DTYPE="BotanicalName" id="19" created="2015-03-09 15:53:21.0" uuid="fddf69fa-4f25-4d10-b693-1a9d5d7bbd5c" updated="2015-03-09 15:53:23.0" protectedtitlecache="false" titleCache="Taxon B" fullTitleCache="Taxon B" parsingproblem="0" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="B" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="16" rank_id="790" combinationauthorteam_id="14"/>
31
  <TaxonNameBase DTYPE="BotanicalName" id="20" created="2015-03-09 15:53:30.0" uuid="9e644031-9190-4a4f-94bb-fc1f6066bbab" updated="2015-03-09 15:53:32.0" protectedtitlecache="false" titleCache="Taxon C" parsingproblem="0" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="C" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="17" rank_id="790" combinationauthorteam_id="15"/>
32
  <TaxonNameBase DTYPE="BotanicalName" id="30" created="2015-03-10 13:40:30.0" uuid="b1b9abf0-72a6-4a2e-8bd1-3ef189f5b3e9" updated="2015-03-10 13:40:31.0" protectedtitlecache="false" titleCache="Taxon D" fullTitleCache="Taxon D" parsingproblem="1" problemends="5" problemstarts="0" protectedfulltitlecache="false" authorshipcache="D" binomhybrid="false" genusoruninomial="Taxon" hybridformula="false" monomhybrid="false" namecache="Taxon" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" createdby_id="10" updatedby_id="10" homotypicalgroup_id="20" rank_id="800" combinationauthorteam_id="20"/>
33

  
34
  <Classification id="11" created="2015-03-09 15:48:30.0" uuid="6595638e-4993-421a-9fe5-76b09d94f36a" updated="2015-03-09 15:48:42.0" protectedtitlecache="false" titleCache="Classification1" createdby_id="10" updatedby_id="10" name_id="11" rootnode_id="11"/>
35
  <Classification id="12" created="2015-03-09 15:52:08.0" uuid="1ef8aada-de72-4023-bbe1-14465b6bc60d" updated="2015-03-09 15:52:24.0" protectedtitlecache="false" titleCache="Classification2" createdby_id="10" updatedby_id="10" name_id="12" rootnode_id="15"/>
36

  
37
  <TaxonBase DTYPE="Taxon" id="10" created="2015-03-09 15:49:22.0" uuid="666b484f-dc1e-4578-b404-86bc6d2e47fa" updated="2015-03-09 15:49:25.0" protectedtitlecache="false" titleCache="Taxon A sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="10"/>
38
  <TaxonBase DTYPE="Taxon" id="13" created="2015-03-09 15:51:11.0" uuid="77e7d93e-75c6-4dd4-850d-7b5809654378" updated="2015-03-09 15:51:14.0" protectedtitlecache="false" titleCache="Taxon B sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="13"/>
39
  <TaxonBase DTYPE="Taxon" id="14" created="2015-03-09 15:51:24.0" uuid="b38d0d73-9a20-4894-99bb-2148ee6b10d0" updated="2015-03-09 15:51:25.0" protectedtitlecache="false" titleCache="Taxon C sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="14"/>
40
  <TaxonBase DTYPE="Taxon" id="16" created="2015-03-09 15:52:34.0" uuid="eaac797e-cac7-4649-97cf-c7b580076895" updated="2015-03-09 15:52:42.0" protectedtitlecache="false" titleCache="Taxon A sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="16"/>
41
  <TaxonBase DTYPE="Taxon" id="19" created="2015-03-09 15:53:21.0" uuid="5004a8e7-b907-4744-b67e-44ccb057ab3b" updated="2015-03-09 15:53:23.0" protectedtitlecache="false" titleCache="Taxon B sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="19"/>
42
  <TaxonBase DTYPE="Taxon" id="20" created="2015-03-09 15:53:30.0" uuid="3d71c8b8-3bec-4f5f-ba23-6f9d55ef84e9" updated="2015-03-09 15:53:32.0" protectedtitlecache="false" titleCache="Taxon C sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="20"/>
43
  <TaxonBase DTYPE="Taxon" id="30" created="2015-03-10 13:40:30.0" uuid="5f713f69-e03e-4a11-8a55-700fbbf44805" updated="2015-03-10 13:40:31.0" protectedtitlecache="false" titleCache="Taxon D sec. ???" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="10" updatedby_id="10" name_id="30"/>
44

  
45
  <DefinedTermBase DTYPE="Rank" id="790" created="2015-03-09 15:44:33.0" uuid="b301f787-f319-4ccc-a10f-b4ed3b99a86d" updated="2015-03-09 15:44:33.0" protectedtitlecache="false" titleCache="Species" termType="RK" uri="" idinvocabulary="sp." orderindex="44" rankclass="SP" vocabulary_id="15"/>
46
  <DefinedTermBase DTYPE="Rank" id="800" created="2015-03-09 15:44:33.0" uuid="1b11c34c-48a8-4efa-98d5-84f7f66ef43a" updated="2015-03-09 15:44:33.0" protectedtitlecache="false" titleCache="Genus" termType="RK" uri="" idinvocabulary="gen." orderindex="34" rankclass="GE" vocabulary_id="15"/>
47

  
48
  
49
</dataset>
src/test/resources/log4j.properties
16 16
### *** CDM *** ###
17 17

  
18 18
log4j.logger.eu.etaxonomy.cdm = info
19
log4j.logger.jdbc.sqlonly=DEBUG, stdout
20
log4j.logger.jdbc.connection=DEBUG, stdout
src/test/resources/unitils.properties
57 57

  
58 58
# H2 #
59 59
#
60
database.driverClassName=org.h2.Driver
61
#database.driverClassName=com.p6spy.engine.spy.P6SpyDriver
62
database.url=jdbc:h2:mem:cdm;MVCC=TRUE;IGNORECASE=TRUE
63
#database.url=jdbc:h2:file:~/.h2/cdm;MVCC=TRUE;AUTO_SERVER=TRUE
60
database.driverClassName=com.p6spy.engine.spy.P6SpyDriver
61
database.url=jdbc:p6spy:h2:mem:cdm;MVCC=TRUE;IGNORECASE=TRUE;ALIAS_COLUMN_NAME=TRUE;DATABASE_TO_UPPER=false;
62
#database.url=jdbc:p6spy:h2:file:h2/cdmTest;MVCC=TRUE;IGNORECASE=TRUE;ALIAS_COLUMN_NAME=TRUE;AUTO_SERVER=TRUE;DATABASE_TO_UPPER=false;
63
#database.driverClassName=org.h2.Driver
64
#database.url=jdbc:h2:mem:cdm;MVCC=TRUE;IGNORECASE=TRUE
64 65
database.dialect=h2
65 66
dbMaintainer.script.fileExtensions=h2.sql
66 67
database.userName=sa
67 68
database.password=
68 69
database.schemaNames=PUBLIC
69 70
org.dbunit.dataset.datatype.IDataTypeFactory.implClassName.h2=org.dbunit.ext.h2.H2DataTypeFactory
71
org.dbunit.database.IMetadataHandler.implClassName=org.dbunit.database.DefaultMetadataHandler
70 72
#org.dbunit.dataset.datatype.IDataTypeFactory.implClassName=org.dbunit.ext.h2.H2DataTypeFactory
71
org.unitils.core.dbsupport.DbSupport.implClassName.h2=eu.etaxonomy.cdm.database.H2DbSupport
73
#org.unitils.core.dbsupport.DbSupport.implClassName.h2=eu.etaxonomy.cdm.database.H2DbSupport
74
org.unitils.core.dbsupport.DbSupport.implClassName.h2=org.unitils.core.dbsupport.H2DbSupport
72 75
database.storedIndentifierCase.h2=auto
73 76
database.identifierQuoteString.h2=auto
74 77

  

Also available in: Unified diff