You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2022/07/08 12:48:55 UTC
[turbine-core] 02/04: Remove unused HSQLDB class and dependency
This is an automated email from the ASF dual-hosted git repository.
tv pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/turbine-core.git
commit 9d6441fb9c143b053124c6ec3cd26c4fe1b5b42e
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Fri Jul 8 14:45:26 2022 +0200
Remove unused HSQLDB class and dependency
---
pom.xml | 6 --
src/test/org/apache/turbine/test/HsqlDB.java | 115 ---------------------------
2 files changed, 121 deletions(-)
diff --git a/pom.xml b/pom.xml
index 43d8013f..78783401 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1104,12 +1104,6 @@
<version>2.3.3</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>2.5.1</version>
- <scope>test</scope>
- </dependency>
<!-- testcontainer minimal shared resources -->
<dependency>
<groupId>org.apache.fulcrum</groupId>
diff --git a/src/test/org/apache/turbine/test/HsqlDB.java b/src/test/org/apache/turbine/test/HsqlDB.java
deleted file mode 100644
index cdfb1aed..00000000
--- a/src/test/org/apache/turbine/test/HsqlDB.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.apache.turbine.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hsqldb.jdbcDriver;
-
-public class HsqlDB
-{
- private Connection connection = null;
- private static Log log = LogFactory.getLog(HsqlDB.class);
-
- public HsqlDB(String uri, String loadFile)
- throws Exception
- {
- Class.forName(jdbcDriver.class.getName());
-
- this.connection = DriverManager.getConnection(uri, "sa", "");
-
- if (StringUtils.isNotEmpty(loadFile))
- {
- loadSqlFile(loadFile);
- }
- }
-
- public Connection getConnection()
- {
- return connection;
- }
-
- public void close()
- {
- try
- {
- connection.close();
- }
- catch (Exception e)
- {
- // ignore
- }
- }
-
- private void loadSqlFile(String fileName)
- throws Exception
- {
- try (Statement statement = connection.createStatement())
- {
- String commands = getFileContents(fileName);
-
- for (int targetPos = commands.indexOf(';'); targetPos > -1; targetPos = commands.indexOf(';'))
- {
- String cmd = commands.substring(0, targetPos + 1).trim();
-
- if (cmd.startsWith("--"))
- {
- // comment
- int lineend = commands.indexOf('\n');
- if (lineend > -1)
- {
- targetPos = lineend - 1;
- }
- }
- else
- {
- try
- {
- statement.execute(cmd);
- }
- catch (SQLException sqle)
- {
- log.warn("Statement: " + cmd + ": " + sqle.getMessage());
- }
- }
-
- commands = commands.substring(targetPos + 2);
- }
- }
- }
-
- private String getFileContents(String fileName)
- throws Exception
- {
- byte[] bytes = Files.readAllBytes(Paths.get(fileName));
-
- return new String(bytes, StandardCharsets.ISO_8859_1);
- }
-}
-