Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAchim Loerke2012-10-19 11:57:17 +0000
committerAchim Loerke2012-10-19 11:57:17 +0000
commit820ca944a15f3abd1cef372d07dd71ee55d69ea5 (patch)
treec350a546212e164a43e0f667d87e8fab93923fdc /org.eclipse.jubula.client.core
parente656858c505ded3a68c81a6bcdcc9e827053356a (diff)
downloadorg.eclipse.jubula.core-820ca944a15f3abd1cef372d07dd71ee55d69ea5.tar.gz
org.eclipse.jubula.core-820ca944a15f3abd1cef372d07dd71ee55d69ea5.tar.xz
org.eclipse.jubula.core-820ca944a15f3abd1cef372d07dd71ee55d69ea5.zip
Added support for database dependent configuration
The BatchWriting doesn't work on all DBs or require special parameters to get the best results. To do this the DB dependent DatabaseConnectionInfo (sub) classes now have methods to supply the values. Parameters were removed from the persistence.xml file to allow for a DB specific configuarion.
Diffstat (limited to 'org.eclipse.jubula.client.core')
-rw-r--r--org.eclipse.jubula.client.core/META-INF/persistence.xml8
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/DatabaseConnectionInfo.java25
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/Persistor.java5
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/MySQLConnectionInfo.java6
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/OracleConnectionInfo.java14
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/PostGreSQLConnectionInfo.java6
6 files changed, 57 insertions, 7 deletions
diff --git a/org.eclipse.jubula.client.core/META-INF/persistence.xml b/org.eclipse.jubula.client.core/META-INF/persistence.xml
index 69fa6b036..5ec5a27b5 100644
--- a/org.eclipse.jubula.client.core/META-INF/persistence.xml
+++ b/org.eclipse.jubula.client.core/META-INF/persistence.xml
@@ -78,13 +78,7 @@
https://bugs.eclipse.org/bugs/show_bug.cgi?id=379221
-->
<property name="eclipselink.jpql.parser" value="org.eclipse.persistence.queries.ANTLRQueryBuilder"/>
- <!-- Since writing of test results involves lots of insert/update statements a batch writing
- might speed things up -->
- <property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
- <!-- for very large batches the size might be increased from the default 100 to whatever
- seems meaningful -->
- <property name="eclipselink.jdbc.batch-writing.size" value="1000"/>
- </properties>
+ </properties>
</persistence-unit>
</persistence>
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/DatabaseConnectionInfo.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/DatabaseConnectionInfo.java
index aebc5677c..f4dc4055e 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/DatabaseConnectionInfo.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/DatabaseConnectionInfo.java
@@ -14,6 +14,9 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Properties;
+import org.eclipse.persistence.config.BatchWriting;
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+
/**
*
* @author BREDEX GmbH
@@ -90,4 +93,26 @@ public abstract class DatabaseConnectionInfo {
public void removePropertyChangeListener(PropertyChangeListener l) {
m_propChangeSupport.removePropertyChangeListener(l);
}
+
+ /**
+ * Get a configuration parameter. This method is intended to be overwritten
+ * in DB specific subclasses.
+ * @return the batch writing value. EclipseLinks default is "None".
+ */
+ public String getBatchWriting() {
+ return BatchWriting.DEFAULT;
+ }
+
+ /**
+ * Get a configuration parameter. This method is intended to be overwritten
+ * in DB specific subclasses.
+ * @return the batch writing size value. EclipseLinks default depends on
+ * the kind of BatchWriting. Null should be interpreted as "Don't use the value,
+ * stick to the default". The return value is a String because it is used in
+ * a properties map.
+ */
+
+ public String getBatchWritingSize() {
+ return null;
+ }
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/Persistor.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/Persistor.java
index 80879fdad..068b3393f 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/Persistor.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/Persistor.java
@@ -1154,6 +1154,11 @@ public class Persistor {
properties.put(PersistenceUnitProperties.JDBC_URL,
StringUtils.defaultString(url,
connectionInfo.getConnectionUrl()));
+ properties.put(PersistenceUnitProperties.BATCH_WRITING, connectionInfo.getBatchWriting());
+ String batchWritingSize = connectionInfo .getBatchWritingSize();
+ if (batchWritingSize != null) {
+ properties.put(PersistenceUnitProperties.BATCH_WRITING_SIZE, batchWritingSize);
+ }
return new PersistenceProvider().createEntityManagerFactory(
DEFAULT_PU_NAME,
properties);
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/MySQLConnectionInfo.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/MySQLConnectionInfo.java
index 4d6f2c020..9f13c2272 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/MySQLConnectionInfo.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/MySQLConnectionInfo.java
@@ -11,6 +11,7 @@
package org.eclipse.jubula.client.core.preferences.database;
import org.eclipse.jubula.tools.constants.StringConstants;
+import org.eclipse.persistence.config.BatchWriting;
/**
*
@@ -51,4 +52,9 @@ public class MySQLConnectionInfo extends AbstractHostBasedConnectionInfo {
public String getDriverClassName() {
return DRIVER_CLASS_NAME;
}
+
+ @Override
+ public String getBatchWriting() {
+ return BatchWriting.Buffered;
+ }
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/OracleConnectionInfo.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/OracleConnectionInfo.java
index 789775071..27c37a7a8 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/OracleConnectionInfo.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/OracleConnectionInfo.java
@@ -12,6 +12,7 @@ package org.eclipse.jubula.client.core.preferences.database;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jubula.tools.constants.StringConstants;
+import org.eclipse.persistence.config.BatchWriting;
/**
*
@@ -29,6 +30,9 @@ public class OracleConnectionInfo extends AbstractHostBasedConnectionInfo {
*/
public static final String JDBC_PRE = "jdbc:oracle:thin:@"; //$NON-NLS-1$
+ /** do batch writes in large chunks */
+ private static final String ORACLE_BATCH_WRITING_SIZE = "1000";
+
/**
* Constructor
*/
@@ -51,4 +55,14 @@ public class OracleConnectionInfo extends AbstractHostBasedConnectionInfo {
public String getDriverClassName() {
return DRIVER_CLASS_NAME;
}
+
+ @Override
+ public String getBatchWriting() {
+ return BatchWriting.OracleJDBC;
+ }
+
+ @Override
+ public String getBatchWritingSize() {
+ return ORACLE_BATCH_WRITING_SIZE;
+ }
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/PostGreSQLConnectionInfo.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/PostGreSQLConnectionInfo.java
index a5b3c48e8..662d20ab3 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/PostGreSQLConnectionInfo.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/preferences/database/PostGreSQLConnectionInfo.java
@@ -11,6 +11,7 @@
package org.eclipse.jubula.client.core.preferences.database;
import org.eclipse.jubula.tools.constants.StringConstants;
+import org.eclipse.persistence.config.BatchWriting;
/**
*
@@ -51,4 +52,9 @@ public class PostGreSQLConnectionInfo extends AbstractHostBasedConnectionInfo {
public String getDriverClassName() {
return DRIVER_CLASS_NAME;
}
+
+ @Override
+ public String getBatchWriting() {
+ return BatchWriting.JDBC;
+ }
}

Back to the top