bye bye Derby tests, only use mariadb via container
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
1249763aad
commit
389f46c826
|
@ -26,9 +26,7 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<mariadb.enabled>false</mariadb.enabled>
|
||||
</systemPropertyVariables>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -54,16 +52,6 @@
|
|||
<artifactId>test-sessions-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbytools</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
|
@ -112,9 +100,9 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
<systemPropertyVariables>
|
||||
<mariadb.docker.version>${mariadb.docker.version}</mariadb.docker.version>
|
||||
<mariadb.enabled>true</mariadb.enabled>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
@ -47,14 +47,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*/
|
||||
public class JdbcTestHelper
|
||||
{
|
||||
public static final boolean USE_MARIADB = Boolean.getBoolean("mariadb.enabled");
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JdbcTestHelper.class);
|
||||
private static final Logger MARIADB_LOG = LoggerFactory.getLogger("org.eclipse.jetty.server.session.MariaDbLogs");
|
||||
|
||||
public static String DRIVER_CLASS = "org.apache.derby.jdbc.EmbeddedDriver";
|
||||
public static String DEFAULT_CONNECTION_URL = "jdbc:derby:memory:sessions;create=true";
|
||||
public static String DEFAULT_SHUTDOWN_URL = "jdbc:derby:memory:sessions;drop=true";
|
||||
public static String DRIVER_CLASS;
|
||||
public static String DEFAULT_CONNECTION_URL;
|
||||
|
||||
public static final int STALE_INTERVAL = 1;
|
||||
|
||||
public static final String EXPIRY_COL = "extime";
|
||||
|
@ -76,8 +74,6 @@ public class JdbcTestHelper
|
|||
static final String MARIA_DB_PASSWORD = "pacific_ale";
|
||||
|
||||
static
|
||||
{
|
||||
if (USE_MARIADB)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -104,7 +100,6 @@ public class JdbcTestHelper
|
|||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -113,29 +108,11 @@ public class JdbcTestHelper
|
|||
|
||||
public static void shutdown(String connectionUrl)
|
||||
throws Exception
|
||||
{
|
||||
if (USE_MARIADB)
|
||||
{
|
||||
try (Connection connection = getConnection())
|
||||
{
|
||||
connection.prepareStatement("truncate table " + TABLE).executeUpdate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (connectionUrl == null)
|
||||
connectionUrl = DEFAULT_SHUTDOWN_URL;
|
||||
|
||||
try
|
||||
{
|
||||
DriverManager.getConnection(connectionUrl);
|
||||
}
|
||||
catch (SQLException expected)
|
||||
{
|
||||
if (!"08006".equals(expected.getSQLState()))
|
||||
{
|
||||
throw expected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DatabaseAdaptor buildDatabaseAdaptor()
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.server.session;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
|
@ -29,7 +28,6 @@ import org.junit.jupiter.api.AfterEach;
|
|||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.eclipse.jetty.server.session.JdbcTestHelper.USE_MARIADB;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
|
Loading…
Reference in New Issue