Add mariadb and postgresql tests

This commit is contained in:
Travis Burtrum 2018-05-15 22:41:02 -04:00
parent 1d6f71918c
commit 30599a15fd
5 changed files with 26 additions and 10 deletions

View File

@ -2,6 +2,18 @@ language: java
sudo: false sudo: false
dist: trusty dist: trusty
services:
- postgresql
addons:
mariadb: '10.2'
before_script:
- psql -c 'create database test_db;' -U postgres || travis_terminate 1;
- mysql -u root -e 'CREATE DATABASE IF NOT EXISTS test_db;' || travis_terminate 1;
script: mvn test -B '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root'
matrix: matrix:
include: include:
- env: JDK='OpenJDK 6' - env: JDK='OpenJDK 6'

View File

@ -128,7 +128,7 @@ public interface JdbcMapper extends Closeable {
public enum DatabaseType { public enum DatabaseType {
DEFAULT(null, null), DEFAULT(null, null),
STANDARD("number", "text"), STANDARD("numeric", "text"),
ORACLE("ARRAY_NUM_TYPE", "ARRAY_STR_TYPE"); ORACLE("ARRAY_NUM_TYPE", "ARRAY_STR_TYPE");
public final String arrayNumberTypeName, arrayStringTypeName; public final String arrayNumberTypeName, arrayStringTypeName;

View File

@ -24,7 +24,7 @@ public class ArrayInList implements InList {
} }
public ArrayInList() { public ArrayInList() {
this("number", "text"); this("numeric", "text");
} }
protected String columnAppend(final String columnName) { protected String columnAppend(final String columnName) {

View File

@ -58,7 +58,10 @@ public class QueryMapperQmDao implements QmDao {
static { static {
Collection<Class<?>> no = new ArrayList<Class<?>>(); Collection<Class<?>> no = new ArrayList<Class<?>>();
for(final String connectionClassName : new String[]{ for(final String connectionClassName : new String[]{
"org.hsqldb.jdbc.JDBCConnection", "org.apache.derby.impl.jdbc.EmbedConnection", "org.sqlite.jdbc3.JDBC3Connection" "org.apache.derby.impl.jdbc.EmbedConnection"
, "org.hsqldb.jdbc.JDBCConnection"
, "org.sqlite.jdbc3.JDBC3Connection"
, "org.mariadb.jdbc.MariaDbConnection"
// h2 doesn't support this with java6 either... // h2 doesn't support this with java6 either...
/*IFJAVA6_START /*IFJAVA6_START
, "org.h2.jdbc.JdbcConnection" , "org.h2.jdbc.JdbcConnection"

View File

@ -32,14 +32,15 @@ import static org.junit.Assert.assertNull;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class QueryMapperTest { public class QueryMapperTest {
public static final Person fieldPerson1 = new FieldPerson(1, new Date(0), "First", "Person"); private static final long birthDateMillis = 1000; // this used to be 0 but mysql TIMESTAMP can only represent '1970-01-01 00:00:01' not '1970-01-01 00:00:00', nice! o_O
public static final Boss fieldBoss1 = new FieldBoss(2, new Date(0), "Second", "Person", "Finance", "Second"); public static final Person fieldPerson1 = new FieldPerson(1, new Date(birthDateMillis), "First", "Person");
public static final Boss fieldBoss2 = new FieldBoss(3, new Date(0), "Third", "Person", "Finance", null); public static final Boss fieldBoss1 = new FieldBoss(2, new Date(birthDateMillis), "Second", "Person", "Finance", "Second");
public static final Boss fieldBoss3 = new FieldBoss(4, new Date(0), null, "Person", "Finance", "Fourth"); public static final Boss fieldBoss2 = new FieldBoss(3, new Date(birthDateMillis), "Third", "Person", "Finance", null);
public static final Person fieldPerson2 = new FieldPerson(5, new Date(0), "Second", "Person"); public static final Boss fieldBoss3 = new FieldBoss(4, new Date(birthDateMillis), null, "Person", "Finance", "Fourth");
public static final Person fieldPerson3 = new FieldPerson(6, new Date(0), "Third", "Person"); public static final Person fieldPerson2 = new FieldPerson(5, new Date(birthDateMillis), "Second", "Person");
public static final Person fieldPerson3 = new FieldPerson(6, new Date(birthDateMillis), "Third", "Person");
public static final Person fieldPerson1NullName = new FieldPerson(1, new Date(0), null, null); public static final Person fieldPerson1NullName = new FieldPerson(1, new Date(birthDateMillis), null, null);
public static final Person[] people = new Person[]{fieldPerson1, fieldPerson2, fieldPerson3}; public static final Person[] people = new Person[]{fieldPerson1, fieldPerson2, fieldPerson3};
public static final Boss[] bosses = new Boss[]{fieldBoss1, fieldBoss2, fieldBoss3}; public static final Boss[] bosses = new Boss[]{fieldBoss1, fieldBoss2, fieldBoss3};