aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/PurgeDeletedResourcesTest.java2
-rw-r--r--pom.xml5
-rw-r--r--sonar-core/pom.xml5
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dialect/DialectRepository.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dialect/HsqlDb.java50
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/dialect/HsqlDbTest.java32
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java47
-rw-r--r--sonar-core/src/test/java/org/sonar/persistence/HsqlDatabase.java99
-rw-r--r--sonar-plugin-api/pom.xml5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java5
-rw-r--r--sonar-testing-harness/pom.xml4
11 files changed, 22 insertions, 234 deletions
diff --git a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/PurgeDeletedResourcesTest.java b/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/PurgeDeletedResourcesTest.java
index a912f142b6a..40cbed111db 100644
--- a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/PurgeDeletedResourcesTest.java
+++ b/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/purges/PurgeDeletedResourcesTest.java
@@ -32,8 +32,6 @@ public class PurgeDeletedResourcesTest extends AbstractDbUnitTestCase {
setupData("sharedFixture", "purgeDeletedResources");
final Connection c = getConnection().getConnection();
- // TODO Godin: next line was here with HSQL
- //c.prepareStatement("SET REFERENTIAL_INTEGRITY FALSE; ").execute();
c.prepareStatement("delete from projects where id=3").executeUpdate();
c.commit();
diff --git a/pom.xml b/pom.xml
index 88d890f962d..30525de0f3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -882,11 +882,6 @@
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.10</version>
- </dependency>
- <dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
diff --git a/sonar-core/pom.xml b/sonar-core/pom.xml
index dba6c874164..bf523da6e2c 100644
--- a/sonar-core/pom.xml
+++ b/sonar-core/pom.xml
@@ -132,11 +132,6 @@
<artifactId>dbunit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
<!--
JDBC drivers for MyBatis integration tests.
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dialect/DialectRepository.java b/sonar-core/src/main/java/org/sonar/jpa/dialect/DialectRepository.java
index aa025b056e4..80394a8834a 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/dialect/DialectRepository.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/dialect/DialectRepository.java
@@ -88,6 +88,6 @@ public final class DialectRepository {
}
private static List<Dialect> getSupportedDialects() {
- return Arrays.asList(new Derby(), new HsqlDb(), new MySql(), new Oracle(), new PostgreSql(), new MsSql());
+ return Arrays.asList(new Derby(), new MySql(), new Oracle(), new PostgreSql(), new MsSql());
}
}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dialect/HsqlDb.java b/sonar-core/src/main/java/org/sonar/jpa/dialect/HsqlDb.java
deleted file mode 100644
index 4a7d2d2bc20..00000000000
--- a/sonar-core/src/main/java/org/sonar/jpa/dialect/HsqlDb.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.jpa.dialect;
-
-import org.apache.commons.lang.StringUtils;
-import org.hibernate.dialect.HSQLDialect;
-
-/**
- * @since 1.12
- */
-public class HsqlDb implements Dialect {
-
- public String getId() {
- return "hsqldb";
- }
-
- public String getActiveRecordDialectCode() {
- return "hsqldb";
- }
-
- public String getActiveRecordJdbcAdapter() {
- return "jdbc";
- }
-
- public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
- return HSQLDialect.class;
- }
-
- public boolean matchesJdbcURL(String jdbcConnectionURL) {
- return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:hsqldb:");
- }
-
-}
diff --git a/sonar-core/src/test/java/org/sonar/jpa/dialect/HsqlDbTest.java b/sonar-core/src/test/java/org/sonar/jpa/dialect/HsqlDbTest.java
deleted file mode 100644
index 440500dae08..00000000000
--- a/sonar-core/src/test/java/org/sonar/jpa/dialect/HsqlDbTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.jpa.dialect;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import org.junit.Test;
-
-public class HsqlDbTest {
- @Test
- public void matchesJdbcURL() {
- assertThat(new HsqlDb().matchesJdbcURL("jdbc:hsqldb:hsql:foo"), is(true));
- assertThat(new HsqlDb().matchesJdbcURL("jdbc:hsql:foo"), is(false));
- }
-}
diff --git a/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java b/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
index 4bc3dd8f681..da7b2fca1c7 100644
--- a/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
+++ b/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
@@ -19,26 +19,19 @@
*/
package org.sonar.jpa.test;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.apache.commons.io.IOUtils;
import org.dbunit.Assertion;
import org.dbunit.DataSourceDatabaseTester;
import org.dbunit.DatabaseUnitException;
import org.dbunit.IDatabaseTester;
-import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.*;
import org.dbunit.dataset.filter.DefaultColumnFilter;
import org.dbunit.dataset.xml.FlatXmlDataSet;
-import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
import org.sonar.api.database.DatabaseSession;
import org.sonar.jpa.dao.DaoFacade;
import org.sonar.jpa.dao.MeasuresDao;
@@ -48,11 +41,18 @@ import org.sonar.jpa.session.DatabaseSessionFactory;
import org.sonar.jpa.session.DefaultDatabaseConnector;
import org.sonar.jpa.session.JpaDatabaseSession;
import org.sonar.jpa.session.MemoryDatabaseConnector;
-import org.sonar.persistence.*;
+import org.sonar.persistence.Database;
+import org.sonar.persistence.InMemoryDatabase;
+import org.sonar.persistence.MyBatis;
-public abstract class AbstractDbUnitTestCase {
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.sql.ResultSet;
+import java.sql.SQLException;
- private static final boolean USE_HSQL = false;
+import static org.junit.Assert.fail;
+
+public abstract class AbstractDbUnitTestCase {
private DefaultDatabaseConnector dbConnector;
private JpaDatabaseSession session;
@@ -64,11 +64,7 @@ public abstract class AbstractDbUnitTestCase {
@Before
public void startDatabase() throws Exception {
- if (USE_HSQL) {
- database = new HsqlDatabase();
- } else {
- database = new InMemoryDatabase();
- }
+ database = new InMemoryDatabase();
database.start();
myBatis = new MyBatis(database);
@@ -156,19 +152,8 @@ public abstract class AbstractDbUnitTestCase {
databaseTester.setDataSet(compositeDataSet);
connection = databaseTester.getConnection();
- if (USE_HSQL) {
- connection.getConnection().prepareStatement("set referential_integrity FALSE").execute(); // HSQL DB
- DatabaseConfig config = connection.getConfig();
- config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
- }
-
DatabaseOperation.CLEAN_INSERT.execute(connection, databaseTester.getDataSet());
-
- if (USE_HSQL) {
- connection.getConnection().prepareStatement("set referential_integrity TRUE").execute(); // HSQL DB
- } else {
- resetDerbySequence(compositeDataSet);
- }
+ resetDerbySequence(compositeDataSet);
} catch (Exception e) {
throw translateException("Could not setup DBUnit data", e);
@@ -194,7 +179,7 @@ public abstract class AbstractDbUnitTestCase {
}
protected final void checkTables(String testName, String... tables) {
- checkTables(testName, new String[] {}, tables);
+ checkTables(testName, new String[]{}, tables);
}
protected final void checkTables(String testName, String[] excludedColumnNames, String... tables) {
diff --git a/sonar-core/src/test/java/org/sonar/persistence/HsqlDatabase.java b/sonar-core/src/test/java/org/sonar/persistence/HsqlDatabase.java
deleted file mode 100644
index 13137509f49..00000000000
--- a/sonar-core/src/test/java/org/sonar/persistence/HsqlDatabase.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.persistence;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.dbcp.BasicDataSourceFactory;
-import org.hibernate.cfg.Environment;
-import org.sonar.jpa.dialect.Derby;
-import org.sonar.jpa.dialect.Dialect;
-import org.sonar.jpa.dialect.HsqlDb;
-import org.sonar.jpa.session.CustomHibernateConnectionProvider;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
-
-/**
- * In-memory database used for Hibernate unit tests only. For information MyBatis tests use Derby.
- *
- * @since 2.12
- */
-public class HsqlDatabase implements Database {
-
- private BasicDataSource datasource;
-
- public HsqlDatabase start() {
- startDatabase();
- return this;
- }
-
- void startDatabase() {
- try {
- Properties properties = new Properties();
- properties.put("driverClassName", "org.hsqldb.jdbcDriver");
- properties.put("username", "sa");
- properties.put("password", "");
- properties.put("url", "jdbc:hsqldb:mem:sonar");
-
- properties.put("maxActive", "3");
- properties.put("maxIdle", "3");
- datasource = (BasicDataSource) BasicDataSourceFactory.createDataSource(properties);
-
- } catch (Exception e) {
- throw new IllegalStateException("Fail to start HSQL", e);
- }
- }
-
- public HsqlDatabase stop() {
- try {
- if (datasource != null) {
- datasource.close();
- }
- DriverManager.getConnection("jdbc:derby:memory:sonar;drop=true");
-
- } catch (SQLException e) {
- // silently ignore stop failure
- }
- return this;
- }
-
- public DataSource getDataSource() {
- return datasource;
- }
-
- public Dialect getDialect() {
- return new HsqlDb();
- }
-
- public String getSchema() {
- return null;
- }
-
- public Properties getHibernateProperties() {
- Properties properties = new Properties();
- properties.put("hibernate.hbm2ddl.auto", "create-drop");
- properties.put(Environment.DIALECT, getDialect().getHibernateDialectClass().getName());
- properties.put(Environment.CONNECTION_PROVIDER, CustomHibernateConnectionProvider.class.getName());
- return properties;
- }
-}
diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml
index c6dd85a848f..5c400a14bf8 100644
--- a/sonar-plugin-api/pom.xml
+++ b/sonar-plugin-api/pom.xml
@@ -176,11 +176,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-servlet-tester</artifactId>
<scope>test</scope>
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
index 97d9bd3004f..ebfddc3bd28 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
@@ -44,6 +44,11 @@ public interface DatabaseProperties {
String PROP_EMBEDDED_DATA_DIR = "sonar.embeddedDatabase.dataDir";
String DIALECT_DERBY = "derby";
+
+ /**
+ * @deprecated not supported anymore since v.2.13.
+ */
+ @Deprecated
String DIALECT_HSQLDB = "hsqldb";
String DIALECT_MYSQL = "mysql";
String DIALECT_POSTGRESQL = "postgresql";
diff --git a/sonar-testing-harness/pom.xml b/sonar-testing-harness/pom.xml
index 42f240e03c9..4185c8c0ce6 100644
--- a/sonar-testing-harness/pom.xml
+++ b/sonar-testing-harness/pom.xml
@@ -60,10 +60,6 @@
</exclusions>
</dependency>
<dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- </dependency>
- <dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${project.version}</version>