Revision c8e2d1bc
cleanup
cdmlib-test/src/main/java/eu/etaxonomy/cdm/database/DataBaseTablePrinter.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.database; |
11 | 10 |
|
12 | 11 |
import java.io.ByteArrayOutputStream; |
... | ... | |
41 | 40 |
import org.dbunit.ext.h2.H2DataTypeFactory; |
42 | 41 |
import org.springframework.beans.factory.annotation.Autowired; |
43 | 42 |
import org.springframework.stereotype.Component; |
43 |
import org.unitils.dbunit.util.MultiSchemaXmlDataSetReader; |
|
44 | 44 |
|
45 | 45 |
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest; |
46 |
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest; |
|
46 | 47 |
import eu.etaxonomy.cdm.test.unitils.FlatFullXmlWriter; |
47 | 48 |
|
48 | 49 |
/** |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/database/TestingTermVocabularyDao.java | ||
---|---|---|
26 | 26 |
/** |
27 | 27 |
* @author a.mueller |
28 | 28 |
* @since 05.11.2015 |
29 |
* |
|
30 | 29 |
*/ |
31 | 30 |
@Repository |
32 | 31 |
public class TestingTermVocabularyDao { |
33 |
private static final Logger logger = Logger.getLogger(TestingTermVocabularyDao.class); |
|
34 | 32 |
|
33 |
private static final Logger logger = Logger.getLogger(TestingTermVocabularyDao.class); |
|
35 | 34 |
|
36 | 35 |
@Autowired |
37 | 36 |
private SessionFactory factory; |
... | ... | |
53 | 52 |
} |
54 | 53 |
} |
55 | 54 |
|
56 |
|
|
57 | 55 |
public void setSessionFactory(SessionFactory sessionFactory) { |
58 | 56 |
this.factory = sessionFactory; |
59 | 57 |
} |
... | ... | |
64 | 62 |
Session session = factory.getCurrentSession(); |
65 | 63 |
return session; |
66 | 64 |
} |
67 |
|
|
68 | 65 |
} |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/CdmIntegrationTest.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.test.integration; |
11 | 10 |
|
12 | 11 |
import java.io.FileNotFoundException; |
... | ... | |
26 | 25 |
import org.dbunit.database.DatabaseConnection; |
27 | 26 |
import org.dbunit.database.IDatabaseConnection; |
28 | 27 |
import org.dbunit.dataset.filter.ITableFilterSimple; |
28 |
import org.dbunit.dataset.xml.FlatXmlDataSet; |
|
29 | 29 |
import org.dbunit.ext.h2.H2DataTypeFactory; |
30 | 30 |
import org.h2.tools.Server; |
31 | 31 |
import org.junit.Before; |
... | ... | |
33 | 33 |
import org.springframework.transaction.support.DefaultTransactionDefinition; |
34 | 34 |
import org.unitils.UnitilsJUnit4; |
35 | 35 |
import org.unitils.database.annotations.TestDataSource; |
36 |
import org.unitils.dbunit.util.MultiSchemaXmlDataSetReader; |
|
36 | 37 |
import org.unitils.orm.hibernate.annotation.HibernateSessionFactory; |
37 | 38 |
import org.unitils.spring.annotation.SpringApplicationContext; |
38 | 39 |
import org.unitils.spring.annotation.SpringBeanByType; |
39 | 40 |
|
40 | 41 |
import eu.etaxonomy.cdm.database.DataBaseTablePrinter; |
41 | 42 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
43 |
import eu.etaxonomy.cdm.test.unitils.FlatFullXmlWriter; |
|
42 | 44 |
|
43 | 45 |
/** |
44 | 46 |
* Abstract base class for integration testing a spring / hibernate application using |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/CdmTransactionalIntegrationTest.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.test.integration; |
11 | 10 |
|
12 | 11 |
import org.apache.log4j.Level; |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/CdmTransactionalIntegrationTestWithSecurity.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package eu.etaxonomy.cdm.test.integration; |
2 | 10 |
|
3 | 11 |
import org.apache.log4j.Logger; |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/HSQLDialect.java | ||
---|---|---|
5 | 5 |
* |
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 |
*/ |
|
9 |
|
|
8 |
*/ |
|
10 | 9 |
package eu.etaxonomy.cdm.test.integration; |
11 | 10 |
|
12 | 11 |
import java.sql.Types; |
13 | 12 |
|
14 | 13 |
public class HSQLDialect extends org.hibernate.dialect.HSQLDialect { |
15 |
|
|
14 |
|
|
16 | 15 |
public HSQLDialect() { |
17 | 16 |
super(); |
18 |
registerColumnType(Types.BIT, "boolean");
|
|
17 |
registerColumnType(Types.BIT, "boolean"); |
|
19 | 18 |
} |
20 | 19 |
|
21 | 20 |
} |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/SecurityExceptionUtils.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package eu.etaxonomy.cdm.test.integration; |
2 | 10 |
|
3 | 11 |
import org.springframework.security.access.AccessDeniedException; |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/unitils/CleanSweepInsertLoadStrategy.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package eu.etaxonomy.cdm.test.unitils; |
2 | 10 |
|
3 | 11 |
import static org.unitils.thirdparty.org.apache.commons.io.IOUtils.closeQuietly; |
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/unitils/FlatFullXmlWriter.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* |
|
3 |
*/ |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
4 | 9 |
package eu.etaxonomy.cdm.test.unitils; |
5 | 10 |
|
6 | 11 |
import java.io.IOException; |
... | ... | |
19 | 24 |
import org.dbunit.util.xml.XmlWriter; |
20 | 25 |
import org.slf4j.Logger; |
21 | 26 |
import org.slf4j.LoggerFactory; |
27 |
import org.unitils.dbunit.util.MultiSchemaXmlDataSetReader; |
|
22 | 28 |
|
23 | 29 |
/** |
24 | 30 |
* This is a variant of the {@link org.dbunit.dataset.xml.FlatXmlWriter}, which in |
... | ... | |
32 | 38 |
* @version $Revision: 859 $ $Date: 2008-11-02 12:50:23 +0100 (dom, 02 nov 2008) $ |
33 | 39 |
* @since 1.5.5 (Apr 19, 2003) |
34 | 40 |
*/ |
35 |
public class FlatFullXmlWriter implements IDataSetConsumer |
|
36 |
{ |
|
41 |
public class FlatFullXmlWriter implements IDataSetConsumer{ |
|
37 | 42 |
|
38 | 43 |
/** |
39 | 44 |
* Logger for this class |
... | ... | |
49 | 54 |
private String _systemId = null; |
50 | 55 |
private boolean writeNullValues = true; |
51 | 56 |
|
52 |
public FlatFullXmlWriter(OutputStream out) throws IOException |
|
53 |
{ |
|
57 |
public FlatFullXmlWriter(OutputStream out) throws IOException { |
|
54 | 58 |
this(out, null, true); |
55 | 59 |
} |
56 | 60 |
|
57 |
public FlatFullXmlWriter(OutputStream out, boolean writeNullValues) throws IOException |
|
58 |
{ |
|
61 |
public FlatFullXmlWriter(OutputStream out, boolean writeNullValues) throws IOException { |
|
59 | 62 |
this(out, null, writeNullValues); |
60 | 63 |
} |
61 | 64 |
|
... | ... | |
66 | 69 |
* @throws UnsupportedEncodingException |
67 | 70 |
*/ |
68 | 71 |
public FlatFullXmlWriter(OutputStream outputStream, String encoding, boolean writeNullValues) |
69 |
throws UnsupportedEncodingException |
|
70 |
{ |
|
72 |
throws UnsupportedEncodingException { |
|
71 | 73 |
_xmlWriter = new XmlWriter(outputStream, encoding); |
72 | 74 |
_xmlWriter.enablePrettyPrint(true); |
73 | 75 |
this.writeNullValues = writeNullValues; |
74 | 76 |
} |
75 | 77 |
|
76 |
public FlatFullXmlWriter(Writer writer) |
|
77 |
{ |
|
78 |
public FlatFullXmlWriter(Writer writer){ |
|
78 | 79 |
_xmlWriter = new XmlWriter(writer); |
79 | 80 |
_xmlWriter.enablePrettyPrint(true); |
80 | 81 |
} |
81 | 82 |
|
82 |
public FlatFullXmlWriter(Writer writer, String encoding) |
|
83 |
{ |
|
83 |
public FlatFullXmlWriter(Writer writer, String encoding){ |
|
84 | 84 |
_xmlWriter = new XmlWriter(writer, encoding); |
85 | 85 |
_xmlWriter.enablePrettyPrint(true); |
86 | 86 |
} |
87 | 87 |
|
88 |
public void setIncludeEmptyTable(boolean includeEmptyTable) |
|
89 |
{ |
|
88 |
public void setIncludeEmptyTable(boolean includeEmptyTable){ |
|
90 | 89 |
_includeEmptyTable = includeEmptyTable; |
91 | 90 |
} |
92 | 91 |
|
93 |
public void setDocType(String systemId) |
|
94 |
{ |
|
92 |
public void setDocType(String systemId){ |
|
95 | 93 |
_systemId = systemId; |
96 | 94 |
} |
97 | 95 |
|
... | ... | |
101 | 99 |
* <code>false</code> otherwise. |
102 | 100 |
* @since 2.4 |
103 | 101 |
*/ |
104 |
public void setPrettyPrint(boolean enabled) |
|
105 |
{ |
|
102 |
public void setPrettyPrint(boolean enabled){ |
|
106 | 103 |
_xmlWriter.enablePrettyPrint(enabled); |
107 | 104 |
} |
108 | 105 |
|
... | ... | |
111 | 108 |
* @param dataSet The {@link IDataSet} to be written |
112 | 109 |
* @throws DataSetException |
113 | 110 |
*/ |
114 |
public void write(IDataSet dataSet) throws DataSetException |
|
115 |
{ |
|
111 |
public void write(IDataSet dataSet) throws DataSetException{ |
|
116 | 112 |
logger.debug("write(dataSet={}) - start", dataSet); |
117 | 113 |
|
118 | 114 |
DataSetProducerAdapter provider = new DataSetProducerAdapter(dataSet); |
... | ... | |
124 | 120 |
// IDataSetConsumer interface |
125 | 121 |
|
126 | 122 |
@Override |
127 |
public void startDataSet() throws DataSetException |
|
128 |
{ |
|
123 |
public void startDataSet() throws DataSetException{ |
|
129 | 124 |
logger.debug("startDataSet() - start"); |
130 | 125 |
|
131 | 126 |
try |
... | ... | |
141 | 136 |
} |
142 | 137 |
|
143 | 138 |
@Override |
144 |
public void endDataSet() throws DataSetException |
|
145 |
{ |
|
139 |
public void endDataSet() throws DataSetException{ |
|
146 | 140 |
logger.debug("endDataSet() - start"); |
147 | 141 |
|
148 | 142 |
try |
... | ... | |
157 | 151 |
} |
158 | 152 |
|
159 | 153 |
@Override |
160 |
public void startTable(ITableMetaData metaData) throws DataSetException |
|
161 |
{ |
|
154 |
public void startTable(ITableMetaData metaData) throws DataSetException{ |
|
162 | 155 |
logger.debug("startTable(metaData={}) - start", metaData); |
163 | 156 |
|
164 | 157 |
_activeMetaData = metaData; |
... | ... | |
166 | 159 |
} |
167 | 160 |
|
168 | 161 |
@Override |
169 |
public void endTable() throws DataSetException |
|
170 |
{ |
|
162 |
public void endTable() throws DataSetException{ |
|
171 | 163 |
logger.debug("endTable() - start"); |
172 | 164 |
|
173 | 165 |
if (_includeEmptyTable && _activeRowCount == 0) |
... | ... | |
187 | 179 |
} |
188 | 180 |
|
189 | 181 |
@Override |
190 |
public void row(Object[] values) throws DataSetException |
|
191 |
{ |
|
182 |
public void row(Object[] values) throws DataSetException{ |
|
192 | 183 |
logger.debug("row(values={}) - start", values); |
193 | 184 |
|
194 | 185 |
try |
... | ... | |
230 | 221 |
_activeRowCount++; |
231 | 222 |
_xmlWriter.endElement(); |
232 | 223 |
} |
233 |
catch (IOException e) |
|
234 |
{ |
|
224 |
catch (IOException e){ |
|
235 | 225 |
throw new DataSetException(e); |
236 | 226 |
} |
237 | 227 |
} |
cdmlib-test/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package org.hibernate.cfg; |
2 | 10 |
|
3 | 11 |
|
cdmlib-test/src/main/java/org/hibernate/dialect/H2CorrectedDialectTest.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 org.hibernate.dialect; |
11 | 10 |
|
12 | 11 |
import java.sql.Types; |
Also available in: Unified diff