diff --git a/NOTICE.TXT b/NOTICE.TXT index 65e7702384610a2611cbef2131a4e17bda6fe303..5d2000a3ecef8c0af558db8b214036f6bb7778e1 100644 --- a/NOTICE.TXT +++ b/NOTICE.TXT @@ -112,7 +112,6 @@ This product uses software based on the Apache Software License like ----------------------------------------------------------------------- This product uses software based on the BSD License * antisamy (BSD license.) [https://www.owasp.org/index.php/Category:OWASP_AntiSamy_Project] -* HSQLDB (HSQLDB License, a BSD open source license) [http://hsqldb.org] * XStream (BSD style) [http://xstream.codehaus.org] * dom4j (BSD style license) [http://dom4j.sourceforge.net] * Mail (CDDL-1.0, BSD, GPL-2.0, GNU-Classpath) [http://kenai.com/projects/javamail] diff --git a/TESTING.README.LATEST b/TESTING.README.LATEST index 376dae48d5bb26aa61a7fdba5fc5bc060a33dcd0..8b1c7bc96208a376063e260c0047266a4a29e962 100644 --- a/TESTING.README.LATEST +++ b/TESTING.README.LATEST @@ -54,8 +54,11 @@ junit and integration tests in OpenOLAT 8 * Execute jUnit integration tests ----------------------------------------- -- junit integration tests with MySQL that load the framework to execute (execution time ca. 10-15m) - mvn clean test -Dwith-mysql +- junit integration tests that load the framework to execute (execution time ca. 10-15m) + - MySQL + mvn clean test -Dwith-mysql + - PostgreSQL + mvn clean test -Dwith-postgresql - The junit testresults can be found at target/surefire-reports/* Double click the xml files in Eclipse to display the results in the standards jUnit console diff --git a/pom.xml b/pom.xml index ae900cd80b8b87ce31a6b425e1f360c962b58c74..08c58b263e73b8e4e98e8da3f4eeae4c40813f3c 100644 --- a/pom.xml +++ b/pom.xml @@ -70,9 +70,8 @@ <!-- by default no tests are executed so far (April 2011). Use appropriate profiles and properties on the command line --> <skipTests>true</skipTests> <skipITs>true</skipITs> - <!-- properties to define the testing environment - values: hsql / mysql --> - <test.env>hsql</test.env> + <!-- properties to define the testing environment --> + <test.env>mysql</test.env> <!-- olat.local.properties to distinguish multiple single and cluster olat instances on a single machine--> <test.env.db.name>olattest</test.env.db.name> <test.env.db.user>olat</test.env.db.user> @@ -170,71 +169,6 @@ </plugins> </build> </profile> - - - <profile> - <id>hsqlunittests</id> - <activation> - <property> - <name>with-hsql</name> - </property> - </activation> - <properties> - <skipTests>false</skipTests> - <skipITs>true</skipITs> - <testFailureIgnore>false</testFailureIgnore> - <test.env.db.hibernate.ddl.auto>create</test.env.db.hibernate.ddl.auto> - <test.env>hsql</test.env> - </properties> - <build> - <plugins> - <plugin> - <!-- Documentation: http://maven.apache.org/plugins/maven-surefire-plugin/ --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.8.1</version> - <configuration> - <argLine>-XX:MaxPermSize=256m -Xmx1024m -Xms256m</argLine> - <systemPropertyVariables> - <java.io.tmpdir>${project.build.directory}/olatdata</java.io.tmpdir> - </systemPropertyVariables> - <testNGArtifactName>none:none</testNGArtifactName> - <includes> - <include>**/AllTestsOlatCoreJunit4.java</include> - <include>**/AllTestsJunit4.java</include> - </includes> - </configuration> - </plugin> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <version>2.4.3</version> - <executions> - <execution> - <id>copy-resources-4-unittests</id> - <!-- hook in to copy maven.build.properties to allow test and integration-test phase run properly --> - <phase>generate-test-resources</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/target/test-classes</outputDirectory> - <resources> - <resource> - <!-- place resources you like to get filtered an copied --> - <directory>src/test/profile/${test.env}</directory> - <includes> - <include>olat.local.properties</include> - </includes> - <filtering>true</filtering> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> <profile> <id>mysqlunittests</id> @@ -888,7 +822,7 @@ <overwrite>true</overwrite> <resources> <!-- olat.local.properties with different environments - typically meant for hsql / mysql / etc. --> + typically meant for mysql / postgresql / etc. --> <resource> <directory>src/test/profile/cluster/tomcat-one/lib</directory> <includes> @@ -2248,12 +2182,6 @@ <artifactId>lucene-core</artifactId> <version>3.0.2</version> </dependency> - <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>2.0.0</version> - <scope>test</scope> - </dependency> <!-- Spring dependencies --> <dependency> <groupId>org.springframework</groupId> diff --git a/src/main/java/org/olat/basesecurity/BaseSecurityManager.java b/src/main/java/org/olat/basesecurity/BaseSecurityManager.java index 146c8f5c250de144b159f3f77c3b015566be335c..d589e7224ad980020406214e0663ed662efef6c9 100644 --- a/src/main/java/org/olat/basesecurity/BaseSecurityManager.java +++ b/src/main/java/org/olat/basesecurity/BaseSecurityManager.java @@ -1211,9 +1211,8 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity { // append queries for user attributes if (login != null) { login = makeFuzzyQueryString(login); - if (login.contains("_") && (dbVendor.equals("hsqldb") || dbVendor.equals("oracle"))) { - //hsqldb needs special ESCAPE sequence to search for escaped strings - // fxdiff: + if (login.contains("_") && dbVendor.equals("oracle")) { + //oracle needs special ESCAPE sequence to search for escaped strings sb.append(" lower(ident.name) like :login ESCAPE '\\'"); } else if (dbVendor.equals("mysql")) { sb.append(" ident.name like :login"); @@ -1253,11 +1252,11 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity { sb.append(" user.properties['").append(key).append("'] like :").append(key).append("_value "); } else { sb.append(" lower(user.properties['").append(key).append("']) like :").append(key).append("_value "); - if(dbVendor.equals("hsqldb") || dbVendor.equals("oracle")) { + if(dbVendor.equals("oracle")) { sb.append(" escape '\\'"); } } - if(dbVendor.equals("hsqldb") || dbVendor.equals("oracle")) { + if(dbVendor.equals("oracle")) { sb.append(" escape '\\'"); } needsOr = true; @@ -1274,11 +1273,11 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity { sb.append(" user.properties['").append(key).append("'] like :").append(key).append("_value "); } else { sb.append(" lower(user.properties['").append(key).append("']) like :").append(key).append("_value "); - if(dbVendor.equals("hsqldb") || dbVendor.equals("oracle")) { + if(dbVendor.equals("oracle")) { sb.append(" escape '\\'"); } } - if(dbVendor.equals("hsqldb") || dbVendor.equals("oracle")) { + if(dbVendor.equals("oracle")) { sb.append(" escape '\\'"); } needsAnd = true; diff --git a/src/main/java/org/olat/core/commons/persistence/DBImpl.java b/src/main/java/org/olat/core/commons/persistence/DBImpl.java index aae2318a55e782851308c87f27de4bae981db09d..f582cb718957b62b80111b7b2807ba2a1f751d3d 100644 --- a/src/main/java/org/olat/core/commons/persistence/DBImpl.java +++ b/src/main/java/org/olat/core/commons/persistence/DBImpl.java @@ -881,7 +881,7 @@ public class DBImpl extends LogDelegator implements DB, Destroyable { @Override public void destroy() { //clean up registered drivers to prevent messages like - // The web application [/olat] registered the JBDC driver [org.hsqldb.jdbc.JDBCDriver] but failed to unregister... + // The web application [/olat] registered the JBDC driver [com.mysql.Driver] but failed to unregister... Enumeration<Driver> registeredDrivers = DriverManager.getDrivers(); while(registeredDrivers.hasMoreElements()) { try { diff --git a/src/main/java/org/olat/core/commons/persistence/HsqldbDriverManagerDataSourceWithShutdownHook.java b/src/main/java/org/olat/core/commons/persistence/HsqldbDriverManagerDataSourceWithShutdownHook.java deleted file mode 100644 index f6b0f26ca0e0024b1dd59db4ee2d0da8bceac3cc..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/commons/persistence/HsqldbDriverManagerDataSourceWithShutdownHook.java +++ /dev/null @@ -1,75 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.core.commons.persistence; - -import java.sql.Connection; -import java.sql.Statement; - -import org.olat.core.configuration.Destroyable; -import org.olat.core.logging.StartupException; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -/** - * Description:<br> - * hsqld needs special sql command for shutting down... - * - * <P> - * Initial Date: 29.01.2010 <br> - * @author guido - */ -public class HsqldbDriverManagerDataSourceWithShutdownHook extends DriverManagerDataSource implements Destroyable { - - /** - * @see org.olat.core.configuration.OLATModule#destroy() - */ - @Override - public void destroy() { - //no logger available any more at this time during shuthown - System.out.println("shutting down hsqldb"); - Statement sql = null; - try { - Connection con = getConnection(); - sql = con.createStatement(); - sql.execute("SHUTDOWN"); - sql.close(); - } catch (Exception e) { - System.out.println("Error while shutting down hsqldb:"+e.getMessage()); - } - } - - /** - * [spring] - * @param clusterMode - */ - public void setOlatClustering(String clusterMode) { - if (clusterMode.equals("Cluster")) { - String msg = "****************************************\n You cannot run OLAT in Cluster mode with the embedded hsqldb as it does not supports some features" + - " which are needed for clustering. For Clustering you need a database like mysql with innodb tables or similar \n************************************************"; - throw new StartupException(msg); - } - } - - -} diff --git a/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml b/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml index 823989e8d3e533eea8fca50301afc75ffd702888..bdd87aa107e01209ea5a898ce8b89ac7280acf04 100644 --- a/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml +++ b/src/main/java/org/olat/core/commons/persistence/_spring/databaseCorecontext.xml @@ -114,35 +114,6 @@ <property name="addMoreProperties" ref="c3p0HibernateProperties" /> </bean> -<bean id="hsqldbHibernateProperties" class="org.olat.core.commons.persistence.DBVendorHibernatePropertiesSimplification"> - <constructor-arg> - <props> - <!-- Using datasource of hibernate --> - <prop key="hibernate.connection.driver_class">org.hsqldb.jdbc.JDBCDriver</prop> - <prop key="hibernate.connection.url">jdbc:hsqldb:file:${java.io.tmpdir}/olatdata/database/${db.name}</prop> - <prop key="hibernate.connection.username">SA</prop> - <prop key="hibernate.connection.password"></prop> - <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> - </props> - </constructor-arg> - <property name="addMoreProperties" ref="commonHibernateProperties" /> -</bean> - -<bean id="testHibernateProperties" class="org.olat.core.commons.persistence.DBVendorHibernatePropertiesSimplification"> - <constructor-arg> - <props> - <!-- Using datasource of hibernate --> - <prop key="hibernate.connection.driver_class">org.hsqldb.jdbc.JDBCDriver</prop> - <prop key="hibernate.connection.url">jdbc:hsqldb:mem:${db.name}</prop> - <prop key="hibernate.connection.username">SA</prop> - <prop key="hibernate.connection.password"></prop> - <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> - </props> - </constructor-arg> - <property name="addMoreProperties" ref="commonHibernateProperties" /> -</bean> - - <bean id="postgresqlHibernateProperties" class="org.olat.core.commons.persistence.DBVendorHibernatePropertiesSimplification"> <constructor-arg> <props> @@ -231,31 +202,9 @@ </constructor-arg> </bean> - - - <!-- The following dataresources are referenced from the statisticContext.xml and upgradeContext.xml, but are not used in the SessionFactory! The SessionFactory's DB Connection is configured with the bean "${db.vendor}HibernateProperties".--> - - <!-- if you do not like the database in java.io.tmpdir you can either overwrite this bean with your own - or set java.io.tmpdir as VM arg like: java -Djava.io.tmpdir=/yourdir --> - <bean id="hsqldbDataSource" class="org.olat.core.commons.persistence.HsqldbDriverManagerDataSourceWithShutdownHook" lazy-init="true" destroy-method="destroy"> - <property name="driverClassName"><value>org.hsqldb.jdbc.JDBCDriver</value></property> - <property name="url"><value>jdbc:hsqldb:file:${java.io.tmpdir}/olatdata/database/${db.name}</value></property> - <property name="username" value="SA" /> - <property name="password" value="" /> - <property name="olatClustering" value="${cluster.mode}"/> <!-- when OLAT is started as cluster an exception will be thrown as hsqldb only supports the singlevm setup --> - </bean> - - <!-- this datasource is used for unit testing and is in memory only! --> - <bean id="testDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true"> - <property name="driverClassName"><value>org.hsqldb.jdbc.JDBCDriver</value></property> - <property name="url"><value>jdbc:hsqldb:mem:${db.name}</value></property> - <property name="username"><value>SA</value></property> - <property name="password"><value></value></property> - </bean> - <!-- The mysql datasource checks upon startup whether the tables are of type InnoDB, if not it will not start. If you have an other type of transactional tables just switch back the spring config to the normal org.springframework.jdbc.datasource.DriverManagerDataSource and the check is gone.--> <bean id="mysqlDataSource" class="org.olat.core.commons.persistence.InnoDBAwareDriverManagerDataSource" lazy-init="true" init-method="init"> diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_ar.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_ar.properties index f97c4ebaf026570918eef1c218cdf9a83f2fb3e1..c5bb1da5ee1bb94eed0aba0cc7e1e23b480290a7 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_ar.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_ar.properties @@ -2,4 +2,3 @@ main.menu.title=\u062A\u062B\u0628\u064A\u062A main.menu.title.alt=\u0628\u062F\u0621 \u062A\u0634\u063A\u064A\u0644 \u0623\u0648\u0644\u0627\u062A overwrite.properties.not.found=olat.local.properties \u0644\u0645 \u064A\u062A\u0645 \u0627\u0644\u0639\u062B\u0648\u0631 \u0639\u0644\u0649 \u0645\u0644\u0641 -show.hsqldb=Start DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_de.properties index 7d41181d017870218f334c87d359262c74e8ad56..a4f8683fc58a43530db094360a2beb2c87df050b 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_de.properties @@ -1,4 +1,3 @@ main.menu.title=Einrichten main.menu.title.alt=OLAT Start Parameter einrichten -overwrite.properties.not.found=Das olat.local.properties file wurde auf dem Klassenpfad nicht gefunden! -show.hsqldb=Start DB Manager GUI \ No newline at end of file +overwrite.properties.not.found=Das olat.local.properties file wurde auf dem Klassenpfad nicht gefunden! \ No newline at end of file diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_el.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_el.properties index 5f1e8ac7f390710053bb47003ad1dc64b0c625c6..620e743c8d23510be040538a4dc3d1b78e890fee 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_el.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_el.properties @@ -1,3 +1,2 @@ #Fri Sep 03 18:07:03 CEST 2010 -main.menu.title=\u0395\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 -show.hsqldb=\u0388\u03BD\u03B1\u03C1\u03BE\u03B7 \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD\u03C4\u03BF\u03C2 \u0394\u03B9\u03B1\u03C7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE \u0392\u03AC\u03C3\u03B7\u03C2 +main.menu.title=\u0395\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \ No newline at end of file diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_en.properties index af5e127daeda5a535900d8f98365779d7894b7d3..1e6dcdd25fa65393ae3547266c904c7686cd9aa9 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_en.properties @@ -2,4 +2,3 @@ main.menu.title=Setup main.menu.title.alt=Establish OLAT start parameter overwrite.properties.not.found=olat.local.properties file not found with this path\! -show.hsqldb=Start DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_fr.properties index 270292963c40f7359e01738cfebe229545de2958..72cf608beb7a09b62f784c09891f2266c0b56114 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_fr.properties @@ -2,4 +2,3 @@ main.menu.title=Configurer main.menu.title.alt=Configurer les param\u00E8tres de d\u00E9part de OLAT overwrite.properties.not.found=Le fichier olat.local.properties est introuvable sur le "classpath"\! -show.hsqldb=D\u00E9marrer DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_it.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_it.properties index 43dc03359825b7b74238b0e7f83e653732edf28e..1a12ee8aecf86779c962747a54a6545c161a1b6b 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_it.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_it.properties @@ -2,4 +2,3 @@ main.menu.title=Configurare main.menu.title.alt=Configurare i parametri di partenza di OLAT overwrite.properties.not.found=Il file olat.local.properties non \u00E8 stato trovato sul "classpath"\! -show.hsqldb=Avvio DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_jp.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_jp.properties index 75a6b0618eacb2469b4c41a30eedca1ff5db9d05..5c56d36b9faa586d31fb71a5195d8b4dcaaf3449 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_jp.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_jp.properties @@ -2,4 +2,3 @@ main.menu.title=\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7 main.menu.title.alt=OLAT\u958B\u59CB\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u8A2D\u5B9A\u3059\u308B overwrite.properties.not.found=\u3053\u306E\u30D1\u30B9\u306B\u306Folat.local.properties\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\! -show.hsqldb=DB\u30DE\u30CD\u30FC\u30B8\u30E3GUI\u3092\u958B\u59CB\u3059\u308B diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_nl_NL.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_nl_NL.properties index 4f5a85b1c8ddb5e0ebc57ef6180e98186fa5c13e..689be7aeff359cc12a1cad1498b950ff76d3d307 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_nl_NL.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_nl_NL.properties @@ -2,4 +2,3 @@ main.menu.title=Setup main.menu.title.alt=Breng OLAT start parameter tot stand overwrite.properties.not.found=olat.local.properties map niet gevonden met dit pad\! -show.hsqldb=Start DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pl.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pl.properties index 318f42d3249a2341329f3c48d054d2032acdd0cc..edb279e2720ff42e8024e020e9a960b8e1e97aee 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pl.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pl.properties @@ -2,4 +2,3 @@ main.menu.title=Ustawienia main.menu.title.alt=Ustawienia startowych parametr\u00F3w OLAT overwrite.properties.not.found=Nie odnaleziono pliku olat.local.properties w \u015Bcie\u017Cce z klasami\! -show.hsqldb=Start DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pt_BR.properties index 965ec33892227fa64d404cff3345e76c3080e4f9..59d18a9598e19f6a02c3cddea21f92254b780de6 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_pt_BR.properties @@ -2,4 +2,3 @@ main.menu.title=Configura\u00E7\u00E3o main.menu.title.alt=Par\u00E2metro de inicializa\u00E7\u00E3o do OLAT definido overwrite.properties.not.found=O arquivo olat.local.properties n\u00E3o foi encontrado no classpath\! -show.hsqldb=In\u00EDcio do DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_CN.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_CN.properties index 473ceacf752b2cabba8c7de37345cdd3087b0724..0ec8c030755db1eda42741e8bcb6dbd13f3dbab6 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_CN.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_CN.properties @@ -2,4 +2,3 @@ main.menu.title=\u542F\u52A8 main.menu.title.alt=\u5236\u5B9AOLAT\u5F00\u59CB\u53C2\u6570 overwrite.properties.not.found=\u672A\u5728\u6B64\u8DEF\u5F84\u4E2D\u627E\u5230olat.local.properties \u6587\u4EF6\uFF01 -show.hsqldb=\u5F00\u542F DB Manager GUI diff --git a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_TW.properties b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_TW.properties index eca11f79a6f4f6ff524e97086c17be518664c797..13f189038de16b176ee04887281adc663b8f3b2e 100644 --- a/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_TW.properties +++ b/src/main/java/org/olat/core/configuration/_i18n/LocalStrings_zh_TW.properties @@ -1,3 +1,2 @@ #Mon Sep 20 14:54:55 CEST 2010 main.menu.title=\u8A2D\u5B9A -show.hsqldb=\u555F\u52D5\u8CC7\u6599\u5EAB\u7BA1\u7406\u8005 GUI diff --git a/src/main/java/org/olat/course/statistic/HsqldbUnixTimeConverter.java b/src/main/java/org/olat/course/statistic/HsqldbUnixTimeConverter.java deleted file mode 100644 index dc1c44eedcfefc281a3beb98a534d1de89fe7f89..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/course/statistic/HsqldbUnixTimeConverter.java +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.course.statistic; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * Helper class for Hsqldb to convert a hsqldb TIMESTAMP field into 'UNIX milliseconds since 1970' - * <P> - * Initial Date: 02.03.2010 <br> - * @author Stefan - */ -public class HsqldbUnixTimeConverter { - - /** - * Usage: - * select "org.olat.course.statistic.HsqldbUnixTimeConverter.convertTimestampToUnixMillis"(convert(creationdate,varchar(100))) from o_loggingtable limit 1; - * @param o - * @return - */ - public static long convertTimestampToUnixMillis(String timestampString) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS"); - try { - Date d = sdf.parse(timestampString); - return (int) d.getTime(); - } catch (ParseException e) { - e.printStackTrace(System.out); - return 0; - } - } - -} diff --git a/src/main/java/org/olat/course/statistic/_spring/statisticContext.xml b/src/main/java/org/olat/course/statistic/_spring/statisticContext.xml index bf97de97791c931833fbc270e2fa9d946ea60b68..976e860dd5f111000957e8420a928b8d31be53fe 100644 --- a/src/main/java/org/olat/course/statistic/_spring/statisticContext.xml +++ b/src/main/java/org/olat/course/statistic/_spring/statisticContext.xml @@ -236,111 +236,9 @@ </bean> -<!-- HSQLDB: - +<!-- mysql : select businesspath,date(creationdate) day, count(*) cnt from o_loggingtable group by businesspath,day - hsqldb : select businesspath,convert(creationdate,date) d,count(*) cnt from o_loggingtable group by businesspath,d - --> - <bean id="statisticUpdateConfig_hsqldb" class="org.olat.course.statistic.StatisticUpdateConfig"> - <property name="updaters"> - <list> - <bean class="org.olat.course.statistic.StatisticUpdater" > - <property name="loggingName" value="DailyStatisticUpdater"/> - <property name="jdbcTemplate" ref="statisticsMysqlJdbcTemplate" /> - <property name="updateSQL"> - <list> - <value> - delete from o_stat_daily; - </value> - <value> - insert into o_stat_daily - (businesspath,resid,day,value) - (select businesspath, - convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), - convert(creationdate,date) d, - count(*) c - from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d); - </value> - </list> - </property> - - <property name="deleteSQL" value="delete from o_stat_daily;"/> - - </bean> - - <bean class="org.olat.course.statistic.StatisticUpdater" > - <property name="loggingName" value="WeeklyStatisticUpdater"/> - <property name="jdbcTemplate" ref="statisticsMysqlJdbcTemplate" /> - <property name="updateSQL"> - <list> - <!-- NOTE: week(date) seems broken in hsqldb currently - using an approximation instead: - select (dayofyear(now())-dayofweek(now()))/7 from o_loggingtable; --> - <value> - delete from o_stat_weekly; - </value> - <value> - insert into o_stat_weekly - (businesspath,resid,week,value) - (select businesspath, - convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), - year(creationdate)+ '-'+repeat('0',2-length(convert((dayofyear(creationdate)-dayofweek(creationdate))/7,varchar(7))))+convert((dayofyear(creationdate)-dayofweek(creationdate))/7,varchar(7)) d, - count(*) c - from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d); - </value> - </list> - </property> - <property name="deleteSQL" value="delete from o_stat_weekly;"/> - </bean> - - <bean class="org.olat.course.statistic.StatisticUpdater" > - <property name="loggingName" value="DayOfWeekStatisticUpdater"/> - <property name="jdbcTemplate" ref="statisticsMysqlJdbcTemplate" /> - <property name="updateSQL"> - <list> - <value> - delete from o_stat_dayofweek; - </value> - <value> - insert into o_stat_dayofweek - (businesspath,resid,day,value) - (select businesspath, - convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), - dayofweek(creationdate) d, - count(*) c - from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d); - </value> - </list> - </property> - <property name="deleteSQL" value="delete from o_stat_dayofweek;"/> - </bean> - - <bean class="org.olat.course.statistic.StatisticUpdater" > - <property name="loggingName" value="HourOfDayStatisticUpdater"/> - <property name="jdbcTemplate" ref="statisticsMysqlJdbcTemplate" /> - <property name="updateSQL"> - <list> - <value> - delete from o_stat_hourofday; - </value> - <value> - insert into o_stat_hourofday - (businesspath,resid,hour,value) - (select businesspath, - convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), - hour(creationdate) d, - count(*) c - from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d); - </value> - </list> - </property> - <property name="deleteSQL" value="delete from o_stat_hourofday;"/> - </bean> - - </list> - </property> - </bean> - <bean id="statisticUpdateConfig_test" class="org.olat.course.statistic.StatisticUpdateConfig" > <property name="updaters"> <list /> @@ -519,7 +417,6 @@ <!-- Postgres: mysql : select businesspath,date(creationdate) day, count(*) cnt from o_loggingtable group by businesspath,day - hsqldb : select businesspath,convert(creationdate,date) d,count(*) cnt from o_loggingtable group by businesspath,d --> <bean id="statisticUpdateConfig_postgresql" class="org.olat.course.statistic.StatisticUpdateConfig"> @@ -554,8 +451,6 @@ <property name="jdbcTemplate" ref="statisticsMysqlJdbcTemplate" /> <property name="updateSQL"> <list> - <!-- NOTE: week(date) seems broken in hsqldb currently - using an approximation instead: - select (dayofyear(now())-dayofweek(now()))/7 from o_loggingtable; --> <value> delete from o_stat_weekly; </value> @@ -637,9 +532,6 @@ </constructor-arg> <constructor-arg> <map> - <entry key="hsqldb"> - <value>select "org.olat.course.statistic.HsqldbUnixTimeConverter.convertTimestampToUnixMillis"(convert(creationdate,varchar(100))) from o_loggingtable limit 1;</value> - </entry> <entry key="mysql"> <value>select unix_timestamp(creationdate) from o_loggingtable limit 1;</value> </entry> diff --git a/src/main/java/org/olat/group/BusinessGroupManagerImpl.java b/src/main/java/org/olat/group/BusinessGroupManagerImpl.java index ed1997563e71132a1cf1ba039c03de998b9eece7..6e5883466c189fce2178535c69550e68bb161ffe 100644 --- a/src/main/java/org/olat/group/BusinessGroupManagerImpl.java +++ b/src/main/java/org/olat/group/BusinessGroupManagerImpl.java @@ -434,7 +434,7 @@ public class BusinessGroupManagerImpl extends BasicManager implements BusinessGr sb.append(" user.properties['").append(key).append("'] like :").append(var); } else { sb.append(" lower(user.properties['").append(key).append("']) like :").append(var); - if(dbVendor.equals("hsqldb") || dbVendor.equals("oracle")) { + if(dbVendor.equals("oracle")) { sb.append(" escape '\\'"); } } @@ -446,7 +446,7 @@ public class BusinessGroupManagerImpl extends BasicManager implements BusinessGr sb.append(" ").append(objName).append(".").append(attribute).append(" like :").append(var); } else { sb.append(" lower(").append(objName).append(".").append(attribute).append(") like :").append(var); - if(dbVendor.equals("hsqldb") || dbVendor.equals("oracle")) { + if(dbVendor.equals("oracle")) { sb.append(" escape '\\'"); } } diff --git a/src/main/java/org/olat/upgrade/UpgradeManagerImpl.java b/src/main/java/org/olat/upgrade/UpgradeManagerImpl.java index 4c8eb013df06ee32379d693d74a2aa197c7f8de0..d71617fd5860ea459ebc4c2710818b04fc147230 100644 --- a/src/main/java/org/olat/upgrade/UpgradeManagerImpl.java +++ b/src/main/java/org/olat/upgrade/UpgradeManagerImpl.java @@ -121,7 +121,6 @@ public class UpgradeManagerImpl extends UpgradeManager { //only run upgrades on mysql or postgresql if (dbVendor.contains("mysql")) dialect = "mysql"; else if (dbVendor.contains("postgresql")) dialect = "postgresql"; - else if (dbVendor.contains("hsqldb")) return; else return; Statement statement = null; diff --git a/src/main/resources/serviceconfig/olat.properties b/src/main/resources/serviceconfig/olat.properties index a0715b6e045e69552b019d62b25d3ff8e7391a84..95f943e6d57f9ec90646996600b2de11a59d0031 100644 --- a/src/main/resources/serviceconfig/olat.properties +++ b/src/main/resources/serviceconfig/olat.properties @@ -353,7 +353,7 @@ db.url.options.mysql=?useUnicode=true&characterEncoding=UTF-8 # enable database debugging (seldom required except for developers) db.show_sql=false -# validate, update, create, create-drop are valid entries. Default is update for use as developer setup with embedded hsqldb. +# validate, update, create, create-drop are valid entries. # set to validate or disable with empty value to not validate against your database. #db.hibernate.ddl.auto=update db.hibernate.ddl.auto= diff --git a/src/test/java/org/olat/course/statistic/HibernateUtil.java b/src/test/java/org/olat/course/statistic/HibernateUtil.java deleted file mode 100644 index 9b69b60b4224d96c2848a276b6927529d87650e4..0000000000000000000000000000000000000000 --- a/src/test/java/org/olat/course/statistic/HibernateUtil.java +++ /dev/null @@ -1,62 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.course.statistic; - -import org.hibernate.*; -import org.hibernate.cfg.Configuration; - -/** - * From: http://www.theserverside.com/tt/articles/article.tss?l=UnitTesting - * <P> - * Initial Date: 02.03.2010 <br> - * @author Stefan - */ -public class HibernateUtil { - - private static SessionFactory factory; - - public static synchronized Session getSession() { - if (factory == null) { - factory = new Configuration().configure().buildSessionFactory(); - } - return factory.openSession(); - } - - public static void setSessionFactory(SessionFactory factory) { - HibernateUtil.factory = factory; - } - - public static void save(Object stat) { - Session session = getSession(); - Transaction transaction = session.beginTransaction(); - try { - session.save(stat); - transaction.commit(); - } - finally { - session.close(); - } - } -} diff --git a/src/test/java/org/olat/course/statistic/daily/TestDailyStatHsqldbSchema.java b/src/test/java/org/olat/course/statistic/daily/TestDailyStatHsqldbSchema.java deleted file mode 100644 index b81aa0c18f85c249c3308c8186a0bfad842c0bc7..0000000000000000000000000000000000000000 --- a/src/test/java/org/olat/course/statistic/daily/TestDailyStatHsqldbSchema.java +++ /dev/null @@ -1,97 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.course.statistic.daily; - -import java.sql.Connection; -import java.sql.Statement; -import java.util.Date; - -import junit.framework.TestCase; - -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; -import org.olat.course.statistic.HibernateUtil; - -public class TestDailyStatHsqldbSchema extends TestCase { - - @Override - protected void setUp() throws Exception { - Configuration config = new Configuration(). - setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"). - setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"). - setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:baseball"). - setProperty("hibernate.connection.username", "sa"). - setProperty("hibernate.connection.password", ""). - setProperty("hibernate.connection.pool_size", "1"). - setProperty("hibernate.connection.autocommit", "true"). - setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider"). - setProperty("hibernate.hbm2ddl.auto", "create-drop"). - setProperty("hibernate.show_sql", "true"). - addClass(DailyStat.class); - - HibernateUtil.setSessionFactory(config.buildSessionFactory()); - - // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably) -/* Runnable r = new Runnable() { - @Override - public void run() { - org.hsqldb.util.DatabaseManagerSwing.main(new String[0]); - } - }; - Thread th = new Thread(r); - th.setDaemon(true); - th.start(); -*/ } - - - public void testHibernateSave() throws Exception { - DailyStat ds = new DailyStat(); - ds.setBusinessPath("test businesspath"); - ds.setDay(new Date()); - ds.setResId(100); - ds.setValue(1); - HibernateUtil.save(ds); - } - - public void testRawInsert() throws Exception { - Session session = HibernateUtil.getSession(); - try { - Connection connection = session.connection(); - Statement statement = connection.createStatement(); - try { - statement.executeUpdate("insert into o_stat_daily (businesspath,resid,day,value) values ('businesspath',101,now(),202)"); - connection.commit(); - } - finally { - statement.close(); - } - } - finally { - session.close(); - } - - } - -} diff --git a/src/test/java/org/olat/course/statistic/dayofweek/TestDayOfWeekStatHsqldbSchema.java b/src/test/java/org/olat/course/statistic/dayofweek/TestDayOfWeekStatHsqldbSchema.java deleted file mode 100644 index 56c3deb1c0730d3911d1984d88c1520783f93207..0000000000000000000000000000000000000000 --- a/src/test/java/org/olat/course/statistic/dayofweek/TestDayOfWeekStatHsqldbSchema.java +++ /dev/null @@ -1,98 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.course.statistic.dayofweek; - -import java.sql.Connection; -import java.sql.Statement; -import java.util.Date; - -import junit.framework.TestCase; - -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; -import org.olat.course.statistic.HibernateUtil; -import org.olat.course.statistic.daily.DailyStat; - -public class TestDayOfWeekStatHsqldbSchema extends TestCase { - - @Override - protected void setUp() throws Exception { - Configuration config = new Configuration(). - setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"). - setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"). - setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:baseball"). - setProperty("hibernate.connection.username", "sa"). - setProperty("hibernate.connection.password", ""). - setProperty("hibernate.connection.pool_size", "1"). - setProperty("hibernate.connection.autocommit", "true"). - setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider"). - setProperty("hibernate.hbm2ddl.auto", "create-drop"). - setProperty("hibernate.show_sql", "true"). - addClass(DayOfWeekStat.class); - - HibernateUtil.setSessionFactory(config.buildSessionFactory()); - - // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably) -/* Runnable r = new Runnable() { - @Override - public void run() { - org.hsqldb.util.DatabaseManagerSwing.main(new String[0]); - } - }; - Thread th = new Thread(r); - th.setDaemon(true); - th.start(); -*/ } - - - public void testHibernateSave() throws Exception { - DayOfWeekStat ds = new DayOfWeekStat(); - ds.setBusinessPath("test businesspath"); - ds.setDay(1); - ds.setResId(100); - ds.setValue(1); - HibernateUtil.save(ds); - } - - public void testRawInsert() throws Exception { - Session session = HibernateUtil.getSession(); - try { - Connection connection = session.connection(); - Statement statement = connection.createStatement(); - try { - statement.executeUpdate("insert into o_stat_dayofweek (businesspath,resid,day,value) values ('businesspath',101,2,202)"); - connection.commit(); - } - finally { - statement.close(); - } - } - finally { - session.close(); - } - - } - -} diff --git a/src/test/java/org/olat/course/statistic/hourofday/TestDayOfWeekStatHsqldbSchema.java b/src/test/java/org/olat/course/statistic/hourofday/TestDayOfWeekStatHsqldbSchema.java deleted file mode 100644 index 1f6574f8e3ae51af9b133c0b381e8cc0b8a3a487..0000000000000000000000000000000000000000 --- a/src/test/java/org/olat/course/statistic/hourofday/TestDayOfWeekStatHsqldbSchema.java +++ /dev/null @@ -1,97 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.course.statistic.hourofday; - -import java.sql.Connection; -import java.sql.Statement; - -import junit.framework.TestCase; - -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; -import org.olat.course.statistic.HibernateUtil; -import org.olat.course.statistic.dayofweek.DayOfWeekStat; - -public class TestDayOfWeekStatHsqldbSchema extends TestCase { - - @Override - protected void setUp() throws Exception { - Configuration config = new Configuration(). - setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"). - setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"). - setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:baseball"). - setProperty("hibernate.connection.username", "sa"). - setProperty("hibernate.connection.password", ""). - setProperty("hibernate.connection.pool_size", "1"). - setProperty("hibernate.connection.autocommit", "true"). - setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider"). - setProperty("hibernate.hbm2ddl.auto", "create-drop"). - setProperty("hibernate.show_sql", "true"). - addClass(HourOfDayStat.class); - - HibernateUtil.setSessionFactory(config.buildSessionFactory()); - - // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably) -/* Runnable r = new Runnable() { - @Override - public void run() { - org.hsqldb.util.DatabaseManagerSwing.main(new String[0]); - } - }; - Thread th = new Thread(r); - th.setDaemon(true); - th.start(); -*/ } - - - public void testHibernateSave() throws Exception { - HourOfDayStat ds = new HourOfDayStat(); - ds.setBusinessPath("test businesspath"); - ds.setHour(20); - ds.setResId(100); - ds.setValue(1); - HibernateUtil.save(ds); - } - - public void testRawInsert() throws Exception { - Session session = HibernateUtil.getSession(); - try { - Connection connection = session.connection(); - Statement statement = connection.createStatement(); - try { - statement.executeUpdate("insert into o_stat_hourofday (businesspath,resid,hour,value) values ('businesspath',101,2,202)"); - connection.commit(); - } - finally { - statement.close(); - } - } - finally { - session.close(); - } - - } - -} diff --git a/src/test/java/org/olat/course/statistic/weekly/TestWeeklyStatHsqldbSchema.java b/src/test/java/org/olat/course/statistic/weekly/TestWeeklyStatHsqldbSchema.java deleted file mode 100644 index 1af2d19f232994e38585d47b2d7483e3ae8ea9e1..0000000000000000000000000000000000000000 --- a/src/test/java/org/olat/course/statistic/weekly/TestWeeklyStatHsqldbSchema.java +++ /dev/null @@ -1,98 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <p> -* Licensed under the Apache License, Version 2.0 (the "License"); <br> -* you may not use this file except in compliance with the License.<br> -* You may obtain a copy of the License at -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <p> -* Unless required by applicable law or agreed to in writing,<br> -* software distributed under the License is distributed on an "AS IS" BASIS, <br> -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> -* See the License for the specific language governing permissions and <br> -* limitations under the License. -* <p> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.course.statistic.weekly; - -import java.sql.Connection; -import java.sql.Statement; -import java.util.Date; - -import junit.framework.TestCase; - -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; -import org.olat.course.statistic.HibernateUtil; -import org.olat.course.statistic.daily.DailyStat; - -public class TestWeeklyStatHsqldbSchema extends TestCase { - - @Override - protected void setUp() throws Exception { - Configuration config = new Configuration(). - setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"). - setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"). - setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:baseball"). - setProperty("hibernate.connection.username", "sa"). - setProperty("hibernate.connection.password", ""). - setProperty("hibernate.connection.pool_size", "1"). - setProperty("hibernate.connection.autocommit", "true"). - setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider"). - setProperty("hibernate.hbm2ddl.auto", "create-drop"). - setProperty("hibernate.show_sql", "true"). - addClass(WeeklyStat.class); - - HibernateUtil.setSessionFactory(config.buildSessionFactory()); - - // uncomment the following if you want to launch a the dbmanager gui (while debugging through this class probably) -/* Runnable r = new Runnable() { - @Override - public void run() { - org.hsqldb.util.DatabaseManagerSwing.main(new String[0]); - } - }; - Thread th = new Thread(r); - th.setDaemon(true); - th.start(); -*/ } - - - public void testHibernateSave() throws Exception { - WeeklyStat ds = new WeeklyStat(); - ds.setBusinessPath("test businesspath"); - ds.setWeek("2010-03"); - ds.setResId(100); - ds.setValue(1); - HibernateUtil.save(ds); - } - - public void testRawInsert() throws Exception { - Session session = HibernateUtil.getSession(); - try { - Connection connection = session.connection(); - Statement statement = connection.createStatement(); - try { - statement.executeUpdate("insert into o_stat_weekly (businesspath,resid,week,value) values ('businesspath',101,'2010-03',202)"); - connection.commit(); - } - finally { - statement.close(); - } - } - finally { - session.close(); - } - - } - -} diff --git a/src/test/java/org/olat/properties/PropertyTest.java b/src/test/java/org/olat/properties/PropertyTest.java index 217309f2d1324a081ce1902b2a8acb0bee75f68f..35fa296a95876847a1b78cd419f7c99c10a3c3f0 100644 --- a/src/test/java/org/olat/properties/PropertyTest.java +++ b/src/test/java/org/olat/properties/PropertyTest.java @@ -289,7 +289,7 @@ public class PropertyTest extends OlatTestCase implements OLATResourceable { /** * testFloatValues - * THIS test does only success when you run it against hsqldb or mysql with FLOAT(65,30). FLOAT(65,30) is mysql specific and if you let hibernate generate + * THIS test does only success when you run it against mysql with FLOAT(65,30). FLOAT(65,30) is mysql specific and if you let hibernate generate * the tables automatic it will result in FLOAT only and this test will fail. So this means that you have to populate the tables yourself via the sql file. */ @Test public void testFloatValues() { diff --git a/src/test/java/org/olat/resource/lock/pessimistic/PLockTest.java b/src/test/java/org/olat/resource/lock/pessimistic/PLockTest.java index 033f0d6672bcd8ad6522fbb9c0b68fbfa9177643..ce88e87fe5907d4707cf62c7617fe294c81815b2 100644 --- a/src/test/java/org/olat/resource/lock/pessimistic/PLockTest.java +++ b/src/test/java/org/olat/resource/lock/pessimistic/PLockTest.java @@ -57,9 +57,6 @@ public class PLockTest extends OlatTestCase { @Test public void testReentrantLock() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - long start = System.currentTimeMillis(); String asset = "p1"; // make sure the lock is created first @@ -89,16 +86,7 @@ public class PLockTest extends OlatTestCase { * */ @Test public void testReentrantLock2Threads() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - - - - - long start = System.currentTimeMillis(); final String asset = "p1-2"; - final int thread1Running = 0; - final int thread2Running = 0; // make sure the lock is created first PLock pc = PessimisticLockManager.getInstance().findOrPersistPLock(asset); @@ -177,9 +165,8 @@ public class PLockTest extends OlatTestCase { } @Test public void testLockWaitTimout() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - assumeTrue(!isPostgresqlConfigured());//no lock timeout on postgres + //Ignore Test if DB is PostgreSQL. PostgreSQL has not lock timeout + assumeTrue(!isPostgresqlConfigured()); System.out.println("testing if holding a lock timeouts"); // make sure all three row entries for the locks are created, otherwise the system-wide locking @@ -256,11 +243,6 @@ public class PLockTest extends OlatTestCase { } @Test public void testSingleRowLockingSupported() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - - - System.out.println("testing if one lock only locks the given row and not the complete table (test whether the database supports rowlocking)"); // make sure both row entries for the locks are created, otherwise the system-wide locking // applied on lock-row-creation cannot support row-level-locking by definition. @@ -295,11 +277,6 @@ public class PLockTest extends OlatTestCase { } @Test public void testNestedLockingSupported() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - - - System.out.println("testing if nested locking is supported"); // make sure all three row entries for the locks are created, otherwise the system-wide locking // applied on lock-row-creation cannot support row-level-locking by definition. @@ -340,11 +317,6 @@ public class PLockTest extends OlatTestCase { } @Test public void testDeadLockTimeout() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - - - System.out.println("testing if deadlock detection and handling is supported"); // make sure all three row entries for the locks are created, otherwise the system-wide locking // applied on lock-row-creation cannot support row-level-locking by definition. @@ -429,11 +401,6 @@ public class PLockTest extends OlatTestCase { @Test public void testPerf() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - - - System.out.println("testing what the throughput is for the pessimistic locking"); // test what the throughput is for the pessimistic locking. // take 500 threads (created and started with no delay (as fast as the vm can) trying to acquire a plock on 20 different olatresourceables. @@ -526,12 +493,6 @@ public class PLockTest extends OlatTestCase { } @Test public void testSync() { - //Ignore Test if DB is HSQLDB. HSQLDB does not support LockMode.UPGRADE, which is a prerequisite for testing PessimisticLockManager - assumeTrue(!getHsqlDbConfigured()); - - - - System.out.println("testing enrollment"); // ------------------ now check with lock ------------------- // create a group diff --git a/src/test/java/org/olat/test/OlatTestCase.java b/src/test/java/org/olat/test/OlatTestCase.java index 5c4c5fb8c88232494150c73bfa3dc789e3fdf583..7c32081628bb26b2c4beb37417544db30ecc87f7 100644 --- a/src/test/java/org/olat/test/OlatTestCase.java +++ b/src/test/java/org/olat/test/OlatTestCase.java @@ -90,7 +90,6 @@ import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; }) public abstract class OlatTestCase extends AbstractJUnit4SpringContextTests { - private static boolean hsqlDBConfigured = false; private static boolean postgresqlConfigured = false; private static boolean started = false;; @@ -127,7 +126,6 @@ public abstract class OlatTestCase extends AbstractJUnit4SpringContextTests { }; String connectionURL = (String)properties.get("hibernate.connection.url"); - hsqlDBConfigured = connectionURL != null && connectionURL.toLowerCase().indexOf("hsqldb") > 0; postgresqlConfigured = connectionURL != null && connectionURL.toLowerCase().indexOf("postgres") > 0; @@ -169,10 +167,6 @@ public abstract class OlatTestCase extends AbstractJUnit4SpringContextTests { * * @return */ - protected boolean getHsqlDbConfigured(){ - return hsqlDBConfigured; - } - protected boolean isPostgresqlConfigured() { return postgresqlConfigured; } diff --git a/src/test/profile/hsql/olat.local.properties b/src/test/profile/hsql/olat.local.properties deleted file mode 100644 index 9cd2c66e7eb178462f86304bbaef5f8973abf890..0000000000000000000000000000000000000000 --- a/src/test/profile/hsql/olat.local.properties +++ /dev/null @@ -1,54 +0,0 @@ -######################### -# -# This olat.local.properties file is only used when running junit tests! (Unit tests run in its own classpath environment) -# Use this file to set properties that affect or are a prerequisite for your tests. -# -######################### -tomcat.id=2 - -db.vendor=test -defaultlang=de -db.show_sql=false -#force use of java.io.tmpDir for unit tests -archive.dir= -log.dir= -folder.root= - -instance.id=${test.env.instance.id} - -generate.index.at.startup=false - -# for UserTest -keepUserEmailAfterDeletion=true -keepUserLoginAfterDeletion=true - -# do not run upgrades and scheduled jobs and such -cluster.singleton.services = disabled -jmx.rmi.port=${test.env.jmx.rmi.port.0} - -# SingleVM jms.broker.url -jms.broker.url=vm://embedded?broker.persistent=false -search.broker.url=vm://embedded?broker.persistent=false -codepoint.jms.broker.url=vm://embedded?broker.persistent=false -# Cluster (remote) jms.broker.url -#jms.broker.url=failover:(tcp://localhost:${test.env.jms.broker.port}?wireFormat.maxInactivityDuration=0) -#search.broker.url=failover:(tcp://localhost:${test.env.jms.broker.port}?wireFormat.maxInactivityDuration=0) -#codepoint.jms.broker.url=failover:(tcp://localhost:${test.env.jms.broker.port}?wireFormat.maxInactivityDuration=0) - - -# enable/disable codepoint/breakpoint framework -codepoint_server.enabled=true -smtp.host=testing - -# -# -# if you like to run your tests against mysql just uncomment the following. Please do not commit it! -# - -#db.vendor=mysql -# -# -#db.name=olattest -#db.user=olat -#db.pass=olat -db.hibernate.ddl.auto=create