You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/09/23 05:08:47 UTC
[shardingsphere] branch master updated: Fix the failure tests when
building with JDK 11 (#12588)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new e737325 Fix the failure tests when building with JDK 11 (#12588)
e737325 is described below
commit e73732555d11337a38814a02666ebd7d50c06e41
Author: Amos Feng <zh...@gmail.com>
AuthorDate: Thu Sep 23 13:08:13 2021 +0800
Fix the failure tests when building with JDK 11 (#12588)
* Fix the failure tests when building with JDK 11
* Remove redundant blank lines
---
pom.xml | 20 ++++++++++++++++++--
.../adapter/invocation/JdbcMethodInvocationTest.java | 15 ++++++++++++++-
.../core/resultset/ShardingSphereResultSetTest.java | 5 ++---
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 73731baf..3ceeeac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
<junit.version>4.12</junit.version>
<hamcrest.version>1.3</hamcrest.version>
- <mockito.version>2.7.21</mockito.version>
+ <mockito.version>2.28.2</mockito.version>
<logback.version>1.2.0</logback.version>
<hikari-cp.version>3.4.2</hikari-cp.version>
@@ -110,7 +110,8 @@
<jaxb.version>2.3.0</jaxb.version>
<annotation-api.version>1.3.2</annotation-api.version>
-
+ <activation-api.version>1.2.0</activation-api.version>
+
<!-- Plugin versions -->
<apache-rat-plugin.version>0.12</apache-rat-plugin.version>
<takari-maven-plugin.version>0.6.1</takari-maven-plugin.version>
@@ -903,10 +904,25 @@
<version>${jaxb.version}</version>
</dependency>
<dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-core</artifactId>
+ <version>${jaxb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>${jaxb.version}</version>
+ </dependency>
+ <dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${annotation-api.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>javax.activation-api</artifactId>
+ <version>${activation-api.version}</version>
+ </dependency>
</dependencies>
</profile>
</profiles>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/JdbcMethodInvocationTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/JdbcMethodInvocationTest.java
index 6337aa3..34c7f95 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/JdbcMethodInvocationTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/JdbcMethodInvocationTest.java
@@ -29,7 +29,20 @@ public final class JdbcMethodInvocationTest {
@Test(expected = IllegalAccessException.class)
public void assertInvokeFailure() throws NoSuchMethodException {
- JdbcMethodInvocation actual = new JdbcMethodInvocation(String.class.getDeclaredMethod("indexOfSupplementary", int.class, int.class), new Object[] {1, 1});
+ JdbcMethodInvocation actual;
+ if (isJDK8OrEarlier()) {
+ actual = new JdbcMethodInvocation(String.class.getDeclaredMethod("indexOfSupplementary", int.class, int.class), new Object[] {1, 1});
+ } else {
+ actual = new JdbcMethodInvocation(String.class.getDeclaredMethod("value"), new Object[] {});
+ }
actual.invoke("");
}
+
+ private boolean isJDK8OrEarlier() {
+ String version = System.getProperty("java.specification.version");
+ if (version.startsWith("1.")) {
+ version = version.substring(2);
+ }
+ return Integer.parseInt(version) <= 8;
+ }
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
index 4c116d0..6e1c0d0 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
@@ -44,7 +44,6 @@ import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.LocalDateTime;
-import java.time.ZoneId;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
@@ -478,8 +477,8 @@ public final class ShardingSphereResultSetTest {
@Test
public void assertGetObjectWithLocalDateColumnLabel() throws SQLException {
LocalDateTime now = LocalDateTime.now();
- long curMillis = now.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
- when(mergeResultSet.getValue(1, Timestamp.class)).thenReturn(new Timestamp(curMillis));
+ when(mergeResultSet.getValue(1, Timestamp.class)).thenReturn(Timestamp.valueOf(now));
+ LocalDateTime timestamp = shardingSphereResultSet.getObject(1, LocalDateTime.class);
assertThat(shardingSphereResultSet.getObject(1, LocalDateTime.class), is(now));
}
}