Skip to content

Commit 3083452

Browse files
authored
Merge pull request #17 from picoded/eugene/mysql8-support
Eugene/mysql8 support
2 parents ed01df4 + ec43c31 commit 3083452

9 files changed

Lines changed: 183 additions & 31 deletions

File tree

.github/workflows/gradle-build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Core Test & Binary Build
2+
on:
3+
push:
4+
branches: [ master, eugene/* ]
5+
pull_request:
6+
branches: [ master ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Init submodules
13+
run: ./git-init-submodules.sh
14+
- name: Set up JDK 1.8
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 1.8
18+
- name: Cache Gradle packages
19+
uses: actions/cache@v2
20+
with:
21+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/build.gradle') }}
22+
path: |
23+
~/.gradle/caches
24+
~/.gradle/wrapper
25+
- name: Setup gradle binaries
26+
run: ./gradlew
27+
- name: Pull dependencies libs, and perform initial compile
28+
run: ./gradlew src
29+
- name: Run unit tests
30+
run: ./gradlew test
31+
- name: Run the build
32+
run: ./gradlew build
33+
- name: Archive code coverage results
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: code-coverage-report
37+
path: |
38+
build/reports/**/*
39+
build/test-results/**/*
40+
build/jacoco/**/*
41+
- name: Archive binary files
42+
uses: actions/upload-artifact@v2
43+
with:
44+
name: binary-libs
45+
path: |
46+
build/libs/**/*

.github/workflows/gradle.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/mysql-5-7.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: MySql 5.7 Support Test
2+
on:
3+
push:
4+
branches: [ master, eugene/* ]
5+
pull_request:
6+
branches: [ master ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
services:
12+
mysql:
13+
image: mysql:5.7
14+
env:
15+
MYSQL_DATABASE: JAVACOMMONS
16+
MYSQL_USER: JAVACOMMONS
17+
MYSQL_PASSWORD: JAVACOMMONS
18+
MYSQL_ROOT_PASSWORD: ROOTPASSWD
19+
ports:
20+
- 3306:3306
21+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
22+
23+
steps:
24+
- uses: actions/checkout@v1
25+
- name: Init submodules
26+
run: ./git-init-submodules.sh
27+
- name: Set up JDK 1.8
28+
uses: actions/setup-java@v1
29+
with:
30+
java-version: 1.8
31+
- name: Cache Gradle packages
32+
uses: actions/cache@v2
33+
with:
34+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/build.gradle') }}
35+
path: |
36+
~/.gradle/caches
37+
~/.gradle/wrapper
38+
- name: Setup gradle binaries
39+
run: ./gradlew
40+
- name: Pull dependencies libs, and perform initial compile
41+
run: ./gradlew src
42+
- name: Run unit tests
43+
run: ./gradlew test -Ptest_mysql
44+
- name: Archive code coverage results
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: code-coverage-report
48+
path: |
49+
build/reports/**/*
50+
build/test-results/**/*
51+
build/jacoco/**/*

.github/workflows/mysql-8.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: MySql 8.0 Support Test
2+
on:
3+
push:
4+
branches: [ master, eugene/* ]
5+
pull_request:
6+
branches: [ master ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
services:
12+
mysql:
13+
image: mysql:8.0
14+
env:
15+
MYSQL_DATABASE: JAVACOMMONS
16+
MYSQL_USER: JAVACOMMONS
17+
MYSQL_PASSWORD: JAVACOMMONS
18+
MYSQL_ROOT_PASSWORD: ROOTPASSWD
19+
ports:
20+
- 3306:3306
21+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
22+
23+
steps:
24+
- uses: actions/checkout@v1
25+
- name: Init submodules
26+
run: ./git-init-submodules.sh
27+
- name: Set up JDK 1.8
28+
uses: actions/setup-java@v1
29+
with:
30+
java-version: 1.8
31+
- name: Cache Gradle packages
32+
uses: actions/cache@v2
33+
with:
34+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/build.gradle') }}
35+
path: |
36+
~/.gradle/caches
37+
~/.gradle/wrapper
38+
- name: Setup gradle binaries
39+
run: ./gradlew
40+
- name: Pull dependencies libs, and perform initial compile
41+
run: ./gradlew src
42+
- name: Run unit tests
43+
run: ./gradlew test -Ptest_mysql
44+
- name: Archive code coverage results
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: code-coverage-report
48+
path: |
49+
build/reports/**/*
50+
build/test-results/**/*
51+
build/jacoco/**/*

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ test/tmp
3434
# Include back .gitignore
3535
#
3636
!.gitignore
37-
!.travis.yml
37+
!.travis.yml
38+
!.github/
39+
!.github/workflows/*

build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ plugins {
1313
// id "com.github.onslip.gradle-one-jar" version "1.0.5"
1414

1515
// Shadow plugin used to build the shade jar
16-
id 'com.github.johnrengelman.plugin-shadow' version '2.0.2'
16+
id 'com.github.johnrengelman.shadow' version '2.0.4'
1717

1818
// jacoco code coverage for test
1919
id 'jacoco'
@@ -92,7 +92,7 @@ dependencies {
9292

9393
// api files("./lib/jsql/ojdbc6.jar") // for oracle
9494
api "org.xerial:sqlite-jdbc:3.25.2" // for sqlite
95-
api "mysql:mysql-connector-java:6.0.6" // for mysql
95+
api "mysql:mysql-connector-java:8.0.26" // for mysql
9696

9797
// Newer MSSQL connection (THIS DOES NOT WORK)
9898
// api "com.microsoft.sqlserver:mssql-jdbc:7.2.1.jre8" // for mssql
@@ -266,6 +266,12 @@ test {
266266
// As our test tends to be io-blocked rather then cpu
267267
// we will run more tests in parallels
268268
maxParallelForks = (Runtime.runtime.availableProcessors() * 2) as int
269+
270+
// We clamp this to 12 threads, because the high volume of SQL test
271+
// can currently cause connection errors on the test servers
272+
if( maxParallelForks > 12 ) {
273+
maxParallelForks = 12;
274+
}
269275
}
270276

271277
// Set up the number of tests per fork

src/main/java/picoded/dstack/connector/jsql/HikaricpUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public static HikariDataSource mysql(GenericConvertMap config) {
217217
}
218218

219219
// Setup the configured connection URL + DB
220-
hconfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
220+
// hconfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
221221

222222
hconfig.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + name);
223223

@@ -233,7 +233,7 @@ public static HikariDataSource mysql(GenericConvertMap config) {
233233
config.getBoolean("cachePrepStmts", true) //
234234
);
235235
hconfig.addDataSourceProperty("prepStmtCacheSize", //
236-
config.getInt("prepStmtCacheSize", 250) //
236+
config.getInt("prepStmtCacheSize", 500) //
237237
);
238238
hconfig.addDataSourceProperty("prepStmtCacheSqlLimit", //
239239
config.getInt("prepStmtCacheSqlLimit", 2048) //

src/test/java/picoded/dstack/jsql/JSqlTestConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private static boolean isLocalPortInUse(int port) {
6161
//-------------------------------//
6262
// Default Credentials for MYSQL //
6363
//-------------------------------//
64-
static private String MYSQL_HOST = "demodb-mysql.picoded-dev.com";
64+
static private String MYSQL_HOST = "localhost";
6565
static private String MYSQL_DATA = "JAVACOMMONS";
6666
static private String MYSQL_USER = "JAVACOMMONS";
6767
static private String MYSQL_PASS = "JAVACOMMONS";
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package picoded.dstack.jsql.mysql;
2+
3+
// Test depends
4+
import picoded.dstack.*;
5+
import picoded.dstack.jsql.*;
6+
import picoded.dstack.connector.jsql.*;
7+
import picoded.dstack.struct.simple.*;
8+
9+
public class JSql_DataObjectMap_Mysql_test extends JSql_DataObjectMap_test {
10+
11+
// To override for implementation
12+
//-----------------------------------------------------
13+
14+
/// Note that this SQL connector constructor
15+
/// is to be overriden for the various backend
16+
/// specific test cases
17+
public JSql jsqlConnection() {
18+
return JSqlTestConnection.mysql();
19+
}
20+
21+
}

0 commit comments

Comments
 (0)