Skip to content

Commit 8bac4f3

Browse files
authored
Merge pull request #22 from paleolimbot/complex-types
feat: Support complex and datetime types in WherobotsResultSet
2 parents 66a1731 + 85808b1 commit 8bac4f3

5 files changed

Lines changed: 612 additions & 62 deletions

File tree

lib/build.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
plugins {
10-
id 'com.github.johnrengelman.shadow' version '8.1.1'
10+
id 'com.gradleup.shadow' version '8.3.10'
1111
id 'java-library'
1212
id 'net.thebugmc.gradle.sonatype-central-portal-publisher' version '1.2.4'
1313
id 'signing'
@@ -59,8 +59,9 @@ dependencies {
5959
implementation 'io.github.resilience4j:resilience4j-retry:2.2.0'
6060
implementation 'org.slf4j:slf4j-simple:2.0.13'
6161
// Test dependencies
62-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
63-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
62+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.12.2'
63+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.12.2'
64+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2'
6465
testImplementation 'org.mockito:mockito-core:5.11.0'
6566
testImplementation 'org.mockito:mockito-junit-jupiter:5.11.0'
6667
}
@@ -91,6 +92,13 @@ signing {
9192

9293
test {
9394
useJUnitPlatform()
95+
jvmArgs += ["--add-opens=java.base/java.nio=ALL-UNNAMED"]
96+
["WHEROBOTS_API_KEY", "WHEROBOTS_HOST", "WHEROBOTS_SHUTDOWN_AFTER_INACTIVE_SECONDS"].each { key ->
97+
def val = System.getenv(key)
98+
if (val != null) {
99+
environment key, val
100+
}
101+
}
94102
}
95103

96104
// Run this task with `./gradlew runSmokeTest -Papikey=<your_api_key>`

lib/src/main/java/com/wherobots/db/jdbc/WherobotsJdbcDriver.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class WherobotsJdbcDriver implements Driver {
3535
public static final String VERSION_PROP = "version";
3636
public static final String SESSION_TYPE_PROP = "sessionType";
3737
public static final String FORCE_NEW_PROP = "forceNew";
38+
public static final String SHUTDOWN_AFTER_INACTIVE_SECONDS_PROP = "shutdownAfterInactiveSeconds";
3839
public static final String WS_URI_PROP = "wsUri";
3940

4041
// Results format; one of {@link DataFormat}
@@ -108,6 +109,12 @@ public Connection connect(String url, Properties info) throws SQLException {
108109
forceNew = Boolean.parseBoolean(forceNewStr);
109110
}
110111

112+
Integer shutdownAfterInactiveSeconds = null;
113+
String shutdownStr = info.getProperty(SHUTDOWN_AFTER_INACTIVE_SECONDS_PROP);
114+
if (StringUtils.isNotBlank(shutdownStr)) {
115+
shutdownAfterInactiveSeconds = Integer.parseInt(shutdownStr);
116+
}
117+
111118
Map<String, String> headers = new HashMap<>(getAuthHeaders(info));
112119
headers.putAll(getUserAgentHeader());
113120
WherobotsSession session;
@@ -128,6 +135,7 @@ public Connection connect(String url, Properties info) throws SQLException {
128135
version,
129136
sessionType,
130137
forceNew,
138+
shutdownAfterInactiveSeconds,
131139
headers
132140
);
133141
}

0 commit comments

Comments
 (0)