Merge pull request #2595 from johnktims/sql-server-tests

Run tests against SQL Server
This commit is contained in:
John Tims 2020-05-28 05:24:43 -06:00 committed by GitHub
commit 520bd24a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 20 deletions

View File

@ -23,7 +23,7 @@ jobs:
target: [test-without-scala, test-scala, test-hibernate-5]
include:
- target: test-without-scala
containers: db2 mysql postgresql mongo
containers: db2 mysql postgresql mongo sqlserver
maven-args: --activate-profiles all,travis,examples --projects !querydsl-scala
- target: test-scala
@ -31,7 +31,7 @@ jobs:
maven-args: --activate-profiles all,travis --projects querydsl-scala --resume-from querydsl-scala
- target: test-hibernate-5
containers: db2 mysql postgresql mongo
containers: db2 mysql postgresql mongo sqlserver
maven-args: --activate-profiles jpa,hibernate5,travis,examples --projects !querydsl-jpa-codegen
runs-on: ubuntu-latest
@ -46,7 +46,11 @@ jobs:
- name: Start test databases
if: ${{ matrix.containers }}
run: cd travis/ && docker-compose up --detach ${{ matrix.containers }} && time docker-compose up block-until-healthy
run: |
cd travis/ &&\
docker-compose up --detach ${{ matrix.containers }} &&\
docker ps &&\
time docker-compose up block-until-healthy
- name: Initialize cache
uses: actions/cache@v1

View File

@ -695,7 +695,6 @@
com.querydsl.core.testutil.Performance,
com.querydsl.core.testutil.ReportingOnly,
com.querydsl.core.testutil.SQLServer,
com.querydsl.core.testutil.Teradata,
com.querydsl.core.testutil.Oracle,
com.querydsl.core.testutil.CUBRID,

View File

@ -605,6 +605,7 @@ public abstract class AbstractJPATest {
@Test
@NoEclipseLink
@ExcludeIn(SQLSERVER)
public void distinct_orderBy() {
QCat cat = QCat.cat;
List<Tuple> result = query().select(cat.id, cat.mate.id)
@ -1514,7 +1515,7 @@ public abstract class AbstractJPATest {
@Test
@NoBatooJPA
@ExcludeIn(ORACLE)
@ExcludeIn({ORACLE, SQLSERVER})
public void substring2() {
QCompany company = QCompany.company;
StringExpression name = company.name;
@ -1678,6 +1679,7 @@ public abstract class AbstractJPATest {
@Test
@NoEclipseLink @NoOpenJPA @NoBatooJPA
@ExcludeIn(SQLSERVER)
public void test() {
Cat kitten = savedCats.get(0);
Cat noKitten = savedCats.get(savedCats.size() - 1);

View File

@ -48,6 +48,7 @@ public class ParsingTest extends AbstractQueryTest {
}
@Test
@ExcludeIn(SQLSERVER)
public void beforeAndAfter() throws RecognitionException, TokenStreamException {
ComparableExpression<java.util.Date> ed = catalog.effectiveDate;
query()

View File

@ -236,9 +236,9 @@
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.dialect" value="com.querydsl.jpa.support.QSQLServer2008Dialect" />
<property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://localhost:1433/querydsl" />
<property name="hibernate.connection.username" value="querydsl" />
<property name="hibernate.connection.password" value="querydsl" />
<property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://localhost:1433/tempdb" />
<property name="hibernate.connection.username" value="sa" />
<property name="hibernate.connection.password" value="Password1!" />
<!-- <property name="hibernate.show_sql" value="true"/> -->
<property name="hibernate.flushMode" value="FLUSH_AUTO" />
<property name="hibernate.hbm2ddl.auto" value="update" />

View File

@ -1,9 +1,9 @@
## MSSQL
hibernate.dialect=com.querydsl.jpa.support.QSQLServer2008Dialect
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/querydsl
hibernate.connection.username=querydsl
hibernate.connection.password=querydsl
hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/tempdb
hibernate.connection.username=sa
hibernate.connection.password=Password1!
## Common properties
#hibernate.show_sql=true

View File

@ -22,6 +22,10 @@ import org.junit.rules.TemporaryFolder;
import com.querydsl.sql.Connections;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
public abstract class ExportBaseTest {
@Rule
@ -37,6 +41,8 @@ public abstract class ExportBaseTest {
exporter.setTargetFolder(folder.getRoot());
exporter.setNamingStrategy(namingStrategy);
exporter.export(Connections.getConnection().getMetaData());
assertThat(folder.getRoot().listFiles().length, is(greaterThan(0)));
}
protected String getSchemaPattern() {

View File

@ -27,4 +27,8 @@ public class ExportMSSQLTest extends ExportBaseTest {
Connections.initSQLServer();
}
@Override
protected String getSchemaPattern() {
return "sys";
}
}

View File

@ -138,10 +138,10 @@ public final class Connections {
private static Connection getSQLServer() throws ClassNotFoundException, SQLException {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Properties props = new Properties();
props.put("user", "querydsl");
props.put("password", "querydsl");
props.put("user", "sa");
props.put("password", "Password1!");
props.put("sendTimeAsDatetime", "false");
String url = "jdbc:jtds:sqlserver://localhost:1433/querydsl";
String url = "jdbc:jtds:sqlserver://localhost:1433/tempdb";
// return DriverManager.getConnection(url, "querydsl", "querydsl");
return DriverManager.getConnection(url, props);
}

View File

@ -1177,7 +1177,7 @@ public class SelectBase extends AbstractBaseTest {
}
@Test
@ExcludeIn(FIREBIRD) // FIXME
@ExcludeIn({FIREBIRD, SQLSERVER}) // FIXME
public void math2() {
math(Expressions.constant(0.5));
}
@ -2119,7 +2119,7 @@ public class SelectBase extends AbstractBaseTest {
}
@Test
@ExcludeIn({DB2, DERBY})
@ExcludeIn({DB2, DERBY, SQLSERVER})
public void groupConcat() {
List<String> expected = ImmutableList.of("Mike,Mary", "Joe,Peter,Steve,Jim", "Jennifer,Helen,Daisy,Barbara");
if (Connections.getTarget() == POSTGRESQL) {
@ -2133,7 +2133,7 @@ public class SelectBase extends AbstractBaseTest {
}
@Test
@ExcludeIn({DB2, DERBY})
@ExcludeIn({DB2, DERBY, SQLSERVER})
public void groupConcat2() {
List<String> expected = ImmutableList.of("Mike-Mary", "Joe-Peter-Steve-Jim", "Jennifer-Helen-Daisy-Barbara");
if (Connections.getTarget() == POSTGRESQL) {

View File

@ -6,6 +6,8 @@ services:
depends_on:
db2:
condition: service_healthy
sqlserver:
condition: service_healthy
mysql:
image: mysql:5.6.38
@ -61,10 +63,24 @@ services:
- ARCHIVE_LOGS=false
- AUTOCONFIG=false
healthcheck:
test: ["CMD", "/opt/ibm/db2/V11.5/bin/db2", "CONNECT", "TO", "sample"]
test: /opt/ibm/db2/V11.5/bin/db2 CONNECT TO $$DBNAME
interval: 5s
timeout: 180s
start_period: 180s
timeout: 240s
start_period: 240s
sqlserver:
image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=Password1!
- MSSQL_PID=Express
ports:
- "1433:1433"
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$$SA_PASSWORD" -Q "SELECT 1" || exit 1
interval: 5s
timeout: 60s
start_period: 60s
firebird:
image: jacobalberty/firebird:2.5.6-ss