Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/WikiWordStoreSchema.java |
— | — | @@ -13,10 +13,13 @@ |
14 | 14 | |
15 | 15 | import de.brightbyte.db.DatabaseAgendaPersistor; |
16 | 16 | import de.brightbyte.db.DatabaseField; |
| 17 | +import de.brightbyte.db.DatabaseHints; |
17 | 18 | import de.brightbyte.db.DatabaseSchema; |
18 | 19 | import de.brightbyte.db.DatabaseTable; |
| 20 | +import de.brightbyte.db.DefaultSqlDialect; |
19 | 21 | import de.brightbyte.db.EntityTable; |
20 | 22 | import de.brightbyte.db.KeyType; |
| 23 | +import de.brightbyte.db.MySqlDialect; |
21 | 24 | import de.brightbyte.db.ReferenceField; |
22 | 25 | import de.brightbyte.util.PersistenceException; |
23 | 26 | import de.brightbyte.wikiword.ConceptType; |
— | — | @@ -78,13 +81,40 @@ |
79 | 82 | |
80 | 83 | private DatasetIdentifier dataset; |
81 | 84 | |
| 85 | + public static DatabaseHints makeHints(TweakSet tweaks, boolean useFlushQueue) { |
| 86 | + DatabaseHints hints = new DatabaseHints(); |
| 87 | + |
| 88 | + if (useFlushQueue) hints.setHint(HINT_JOB_QUEUE_CAPACITY, tweaks.getTweak("dbstore.backgroundFlushQueue", 4)); //XXX: doc tweak! |
| 89 | + |
| 90 | + hints.setHint(MySqlDialect.HINT_EXPLAIN_SQL_THREASHOLD, tweaks.getTweak("dbstore.explainSQLThreashold", 0)); |
| 91 | + hints.setHint(DefaultSqlDialect.HINT_SLOW_SQL_THREASHOLD, tweaks.getTweak("dbstore.slowSQLThreashold", 0)); |
| 92 | + hints.setHint(DefaultSqlDialect.HINT_TRACE_SQL, tweaks.getTweak("dbstore.traceSQL", false)); |
| 93 | + |
| 94 | + String sqlMode = tweaks.getTweak("dbstore.sqlMode", null); |
| 95 | + if (sqlMode!=null) hints.setHint(MySqlDialect.HINT_SQL_MODE, sqlMode); |
| 96 | + |
| 97 | + hints.setHint(HINT_MAX_STATEMENT_SIZE, tweaks.getTweak("dbstore.maxStatementSize", -1)); |
| 98 | + hints.setHint(HINT_BUFFER_SCALE, tweaks.getTweak("dbstore.insertionBufferFactor", 16)); |
| 99 | + |
| 100 | + int groupLen = tweaks.getTweak("dbstore.groupConcatMaxLen", -1); |
| 101 | + if (groupLen>0) hints.setHint(MySqlDialect.HINT_GROUP_CONCAT_MAX_LEN, groupLen); |
| 102 | + |
| 103 | + String dbengine = tweaks.getTweak("dbstore.engine", "MyISAM"); |
| 104 | + String defaultTableAttributes = "ENGINE="+dbengine+" CHARSET utf8 COLLATE utf8_bin"; |
| 105 | + defaultTableAttributes = tweaks.getTweak("dbstore.table.attributes", defaultTableAttributes); |
| 106 | + |
| 107 | + hints.setHint(HINT_DEFAULT_TABLE_ATTRIBUTES, defaultTableAttributes); |
| 108 | + |
| 109 | + return hints; |
| 110 | + } |
| 111 | + |
82 | 112 | public WikiWordStoreSchema(DatasetIdentifier dataset, Connection connection, TweakSet tweaks, boolean useFlushQueue) throws SQLException { |
83 | | - super(dataset.getDbPrefix(), connection, useFlushQueue ? tweaks.getTweak("dbstore.backgroundFlushQueue", 4) : 0 ); //XXX: doc tweak! |
| 113 | + super(dataset.getDbPrefix(), connection, makeHints(tweaks, useFlushQueue) ); |
84 | 114 | init(dataset, tweaks); |
85 | 115 | } |
86 | 116 | |
87 | 117 | public WikiWordStoreSchema(DatasetIdentifier dataset, DataSource connectionInfo, TweakSet tweaks, boolean useFlushQueue) throws SQLException { |
88 | | - super(dataset.getDbPrefix(), connectionInfo, useFlushQueue ? tweaks.getTweak("dbstore.backgroundFlushQueue", 4) : 0); //XXX: doc tweak! |
| 118 | + super(dataset.getDbPrefix(), connectionInfo, makeHints(tweaks, useFlushQueue) ); |
89 | 119 | init(dataset, tweaks); |
90 | 120 | } |
91 | 121 | |
— | — | @@ -92,22 +122,6 @@ |
93 | 123 | this.setLogLevel(tweaks.getTweak("dbstore.logLevel", LOG_INFO)); |
94 | 124 | |
95 | 125 | this.dataset = dataset; |
96 | | - this.setExplainSQLThreashold(tweaks.getTweak("dbstore.explainSQLThreashold", 0)); |
97 | | - this.setSlowSQLThreashold(tweaks.getTweak("dbstore.slowSQLThreashold", 0)); |
98 | | - this.setTraceSQL(tweaks.getTweak("dbstore.traceSQL", false)); |
99 | | - |
100 | | - this.setMaxStatementSize(tweaks.getTweak("dbstore.maxStatementSize", -1)); |
101 | | - |
102 | | - this.setBufferScale(tweaks.getTweak("dbstore.insertionBufferFactor", 16)); |
103 | | - |
104 | | - String sqlMode = tweaks.getTweak("dbstore.sqlMode", null); |
105 | | - if (sqlMode!=null) this.setSqlMode(sqlMode); |
106 | | - |
107 | | - String dbengine = tweaks.getTweak("dbstore.engine", "MyISAM"); |
108 | | - String defaultTableAttributes = "ENGINE="+dbengine+" CHARSET utf8 COLLATE utf8_bin"; |
109 | | - defaultTableAttributes = tweaks.getTweak("dbstore.table.attributes", defaultTableAttributes); |
110 | | - |
111 | | - this.setDefaultTableAttributes(defaultTableAttributes); |
112 | 126 | this.useBinaryText = tweaks.getTweak("dbstore.useBinaryText", true); |
113 | 127 | |
114 | 128 | logTable = DatabaseAgendaPersistor.makeTableSpec(this, "log"); |
Index: trunk/WikiWord/WikiWordBuilder/src/test/java/de/brightbyte/wikiword/builder/ValidateImport.java |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | |
254 | 254 | String prefix = tweaks.getTweak("prefix", "TEST"); |
255 | 255 | if (prefix!=null && prefix.length()>0) prefix += "_"; |
256 | | - database = new DatabaseSchema(prefix, dataSource, 0); |
| 256 | + database = new DatabaseSchema(prefix, dataSource, null); |
257 | 257 | |
258 | 258 | //-------------------- |
259 | 259 | String dir = args.getStringOption("dir", null); |
Index: trunk/WikiWord/WikiWordIntegrator/.classpath |
— | — | @@ -15,9 +15,9 @@ |
16 | 16 | <attribute name="javadoc_location" value="http://www.beanshell.org/javadoc/"/> |
17 | 17 | </attributes> |
18 | 18 | </classpathentry> |
19 | | - <classpathentry kind="var" path="M2_REPO/org/dbunit/dbunit/2.4.4/dbunit-2.4.4.jar"> |
| 19 | + <classpathentry kind="var" path="M2_REPO/org/dbunit/dbunit/2.4.4/dbunit-2.4.4.jar" sourcepath="/M2_REPO/org/dbunit/dbunit/2.4.4/dbunit-2.4.4-sources.jar"> |
20 | 20 | <attributes> |
21 | | - <attribute name="javadoc_location" value="http://www.dbunit.org/apidocs/"/> |
| 21 | + <attribute name="javadoc_location" value="jar:file:/home/daniel/.m2/repository/org/dbunit/dbunit/2.4.4/dbunit-2.4.5-javadoc.jar!/"/> |
22 | 22 | </attributes> |
23 | 23 | </classpathentry> |
24 | 24 | <classpathentry kind="output" path="bin"/> |
Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/IntegratorAppTestBase.java |
— | — | @@ -3,6 +3,8 @@ |
4 | 4 | import java.io.IOException; |
5 | 5 | import java.net.URL; |
6 | 6 | |
| 7 | +import org.dbunit.operation.DatabaseOperation; |
| 8 | + |
7 | 9 | import de.brightbyte.db.testing.DatabaseTestBase; |
8 | 10 | import de.brightbyte.wikiword.DatasetIdentifier; |
9 | 11 | import de.brightbyte.wikiword.TweakSet; |
— | — | @@ -12,6 +14,11 @@ |
13 | 15 | public IntegratorAppTestBase(String name) { |
14 | 16 | super(name); |
15 | 17 | } |
| 18 | + |
| 19 | + protected DatabaseOperation getSetUpOperation() throws Exception |
| 20 | + { |
| 21 | + return DatabaseOperation.NONE; |
| 22 | + } |
16 | 23 | |
17 | 24 | public TweakSet loadTweakSet() throws IOException { |
18 | 25 | URL url = requireAuxilliaryFileURL("test-tweaks.properties"); |