This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 77afef34e8e Use DateTimeFormatter to instead of SimpleDateFormat
(#25336)
77afef34e8e is described below
commit 77afef34e8e281ebccb34eaf89f09fb5ceb9ddab
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Apr 27 00:48:45 2023 +0800
Use DateTimeFormatter to instead of SimpleDateFormat (#25336)
* Use DateTimeFormatter to instead of SimpleDateFormat
* Use DateTimeFormatter to instead of SimpleDateFormat
* debug
* reverse debug
* debug
* reverse debug
* Refactor SQLValue
* Refactor ResultSetUtils
* Refactor SQLValue
* Fix test cases
* Fix test cases
---
.../row/column/value/time/MySQLTimeValueUtils.java | 13 ------
.../time/MySQLTimestampBinlogProtocolValue.java | 5 ++-
.../query/text/MySQLTextResultSetRowPacket.java | 4 +-
.../column/value/time/MySQLTimeValueUtilsTest.java | 34 ---------------
.../MySQLTimestampBinlogProtocolValueTest.java | 6 ++-
.../text/MySQLTextResultSetRowPacketTest.java | 4 +-
.../datetime/IntervalShardingAlgorithm.java | 2 +-
.../datetime/IntervalShardingAlgorithmTest.java | 9 ++--
.../impl/driver/jdbc/type/util/ResultSetUtils.java | 48 ++++++++++------------
.../assertion/IntegrationTestCaseAssertion.java | 4 +-
.../test/e2e/cases/value/SQLValue.java | 34 +++++++++------
.../test/e2e/cases/value/SQLValueGroup.java | 5 +--
.../engine/composer/BatchE2EContainerComposer.java | 9 ++--
.../composer/SingleE2EContainerComposer.java | 6 +--
.../test/e2e/engine/type/DALE2EIT.java | 16 ++++----
.../test/e2e/engine/type/DCLE2EIT.java | 9 ++--
.../test/e2e/engine/type/DDLE2EIT.java | 11 +++--
.../test/e2e/engine/type/RALE2EIT.java | 7 ++--
.../test/e2e/engine/type/RDLE2EIT.java | 7 ++--
.../test/e2e/engine/type/RQLE2EIT.java | 5 +--
.../e2e/engine/type/dml/AdditionalDMLE2EIT.java | 43 ++++++++++---------
.../test/e2e/engine/type/dml/BaseDMLE2EIT.java | 10 ++---
.../test/e2e/engine/type/dml/BatchDMLE2EIT.java | 11 +++--
.../test/e2e/engine/type/dml/GeneralDMLE2EIT.java | 13 +++---
.../e2e/engine/type/dql/AdditionalDQLE2EIT.java | 25 ++++++-----
.../test/e2e/engine/type/dql/BaseDQLE2EIT.java | 6 +--
.../test/e2e/engine/type/dql/GeneralDQLE2EIT.java | 21 +++++-----
.../test/e2e/env/DataSetEnvironmentManager.java | 4 +-
.../resources/cases/dml/dml-integration-insert.xml | 12 +++---
.../resources/cases/dml/dml-integration-update.xml | 4 +-
30 files changed, 166 insertions(+), 221 deletions(-)
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
index 860c34ecb3e..ac519b97a9b 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
@@ -20,8 +20,6 @@ package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.val
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import java.text.SimpleDateFormat;
-
/**
* Time value utility class of MySQL.
*/
@@ -35,15 +33,4 @@ public final class MySQLTimeValueUtils {
public static final String YEAR_OF_ZERO = "0000";
public static final String DATETIME_OF_ZERO = "0000-00-00 00:00:00";
-
- private static final ThreadLocal<SimpleDateFormat> TIMESTAMP_FORMAT =
ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
-
- /**
- * Get simple date format for current thread.
- *
- * @return simple date format
- */
- public static SimpleDateFormat getSimpleDateFormat() {
- return TIMESTAMP_FORMAT.get();
- }
}
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
index d2c43b22df3..547e1f3dbaf 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
@@ -23,6 +23,7 @@ import
org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
import java.io.Serializable;
import java.sql.Timestamp;
+import java.time.format.DateTimeFormatter;
/**
* MySQL TIMESTAMP binlog protocol value.
@@ -31,9 +32,11 @@ import java.sql.Timestamp;
*/
public final class MySQLTimestampBinlogProtocolValue implements
MySQLBinlogProtocolValue {
+ private final DateTimeFormatter dateTimeFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final
MySQLPacketPayload payload) {
int seconds = payload.readInt4();
- return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO :
MySQLTimeValueUtils.getSimpleDateFormat().format(new Timestamp(seconds *
1000L));
+ return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO :
dateTimeFormatter.format(new Timestamp(seconds * 1000L).toLocalDateTime());
}
}
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
index 77583bcaff3..6473d4e5afb 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
@@ -40,7 +40,7 @@ public final class MySQLTextResultSetRowPacket implements
MySQLPacket {
private static final int NULL = 0xfb;
- private static final DateTimeFormatter DT_FMT =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ private static final DateTimeFormatter DATE_TIME_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private final Collection<Object> data;
@@ -66,7 +66,7 @@ public final class MySQLTextResultSetRowPacket implements
MySQLPacket {
} else if (each instanceof Boolean) {
payload.writeBytesLenenc((Boolean) each ? new byte[]{1} :
new byte[]{0});
} else if (each instanceof LocalDateTime) {
- payload.writeStringLenenc(DT_FMT.format((LocalDateTime)
each));
+
payload.writeStringLenenc(DATE_TIME_FORMATTER.format((LocalDateTime) each));
} else {
payload.writeStringLenenc(each.toString());
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilsTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilsTest.java
deleted file mode 100644
index ad80d5f6014..00000000000
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilsTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.time;
-
-import org.junit.jupiter.api.Test;
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-class MySQLTimeValueUtilsTest {
-
- @Test
- void assertGetSimpleDateFormat() {
- Timestamp expected = new Timestamp(1584599445000L);
- assertThat(MySQLTimeValueUtils.getSimpleDateFormat().format(expected),
is(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(expected)));
- }
-}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
index 7178d38fd5d..ceba78e9d66 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
@@ -25,6 +25,7 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.sql.Timestamp;
+import java.time.format.DateTimeFormatter;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -41,9 +42,10 @@ class MySQLTimestampBinlogProtocolValueTest {
@Test
void assertRead() {
- int currentSeconds = Long.valueOf(System.currentTimeMillis() /
1000).intValue();
+ int currentSeconds = Long.valueOf(System.currentTimeMillis() /
1000L).intValue();
when(payload.readInt4()).thenReturn(currentSeconds);
- assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef,
payload), is(MySQLTimeValueUtils.getSimpleDateFormat().format(new
Timestamp(currentSeconds * 1000L))));
+ assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef,
payload),
+ is(DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ss").format(new Timestamp(currentSeconds * 1000L).toLocalDateTime())));
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
index 58769af5804..9e9ae9da4bd 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
@@ -78,8 +78,8 @@ class MySQLTextResultSetRowPacketTest {
@Test
void assertLocalDateTime() {
String localDateTimeStr = "2021-08-23T17:30:30";
- LocalDateTime time = LocalDateTime.parse(localDateTimeStr,
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"));
- MySQLTextResultSetRowPacket actual = new
MySQLTextResultSetRowPacket(Collections.singletonList(time));
+ LocalDateTime dateTime = LocalDateTime.parse(localDateTimeStr,
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"));
+ MySQLTextResultSetRowPacket actual = new
MySQLTextResultSetRowPacket(Collections.singletonList(dateTime));
actual.write(payload);
verify(payload).writeStringLenenc(DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ss").format(LocalDateTime.parse(localDateTimeStr,
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))));
}
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
index 044d1dbd89e..0274d5523e4 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
@@ -334,7 +334,7 @@ public final class IntervalShardingAlgorithm implements
StandardShardingAlgorith
return dateTimeFormatter.format((TemporalAccessor) endpoint);
}
if (endpoint instanceof java.sql.Date) {
- return dateTimeFormatter.format(((java.sql.Date)
endpoint).toLocalDate().atStartOfDay(ZoneId.systemDefault()));
+ return ((java.sql.Date)
endpoint).toLocalDate().format(dateTimeFormatter);
}
if (endpoint instanceof Date) {
return dateTimeFormatter.format(((Date)
endpoint).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
index afd2796317d..386cc377e14 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
@@ -30,8 +30,6 @@ import org.junit.jupiter.api.Test;
import java.sql.Date;
import java.sql.Timestamp;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -334,7 +332,7 @@ class IntervalShardingAlgorithmTest {
}
@Test
- void assertTimestampInJDBCTypeWithZeroMillisecond() throws ParseException {
+ void assertTimestampInJDBCTypeWithZeroMillisecond() {
Collection<String> actualAsLocalDateTime =
shardingAlgorithmByDayWithMillisecond.doSharding(availableTablesForDayWithMillisecondDataSources,
new RangeShardingValue<>("t_order", "create_time",
DATA_NODE_INFO,
Range.closed(LocalDateTime.of(2021, 6, 15, 2, 25, 27),
LocalDateTime.of(2021, 7, 31, 2, 25, 27))));
@@ -363,10 +361,11 @@ class IntervalShardingAlgorithmTest {
ZonedDateTime.of(2021, 6, 15, 2, 25, 27, 0,
ZoneId.systemDefault()),
ZonedDateTime.of(2021, 7, 31, 2, 25, 27, 0,
ZoneId.systemDefault()))));
assertThat(actualAsZonedDateTime.size(), is(24));
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss.SSS");
+ DateTimeFormatter dateTimeFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
Collection<String> actualAsDate =
shardingAlgorithmByDayWithMillisecond.doSharding(availableTablesForDayWithMillisecondDataSources,
new RangeShardingValue<>("t_order", "create_time",
DATA_NODE_INFO,
- Range.closed(simpleDateFormat.parse("2021-06-15
02:25:27.000"), simpleDateFormat.parse("2021-07-31 02:25:27.000"))));
+
Range.closed(Date.from(LocalDate.from(dateTimeFormatter.parse("2021-06-15
02:25:27.000")).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()),
+
Date.from(LocalDate.from(dateTimeFormatter.parse("2021-07-31
02:25:27.000")).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()))));
assertThat(actualAsDate.size(), is(24));
}
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
index f6c29f9d3be..fe2cc848fc2 100644
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
+++
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
@@ -62,10 +62,10 @@ public final class ResultSetUtils {
return value;
}
if (value instanceof LocalDateTime) {
- return convertLocalDateTimeValue(value, convertType);
+ return convertLocalDateTimeValue((LocalDateTime) value,
convertType);
}
if (value instanceof Timestamp) {
- return convertTimestampValue(value, convertType);
+ return convertTimestampValue((Timestamp) value, convertType);
}
if (URL.class.equals(convertType)) {
return convertURL(value);
@@ -74,10 +74,10 @@ public final class ResultSetUtils {
return convertNumberValue(value, convertType);
}
if (value instanceof Date) {
- return convertDateValue(value, convertType);
+ return convertDateValue((Date) value, convertType);
}
if (value instanceof byte[]) {
- return convertByteArrayValue(value, convertType);
+ return convertByteArrayValue((byte[]) value, convertType);
}
if (boolean.class.equals(convertType)) {
return convertBooleanValue(value);
@@ -134,10 +134,9 @@ public final class ResultSetUtils {
return value;
}
- private static Object convertLocalDateTimeValue(final Object value, final
Class<?> convertType) {
- LocalDateTime localDateTime = (LocalDateTime) value;
+ private static Object convertLocalDateTimeValue(final LocalDateTime value,
final Class<?> convertType) {
if (Timestamp.class.equals(convertType)) {
- return Timestamp.valueOf(localDateTime);
+ return Timestamp.valueOf(value);
}
if (String.class.equals(convertType)) {
return value.toString();
@@ -145,19 +144,18 @@ public final class ResultSetUtils {
return value;
}
- private static Object convertTimestampValue(final Object value, final
Class<?> convertType) {
- Timestamp timestamp = (Timestamp) value;
+ private static Object convertTimestampValue(final Timestamp value, final
Class<?> convertType) {
if (LocalDateTime.class.equals(convertType)) {
- return
timestamp.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+ return
value.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
if (LocalDate.class.equals(convertType)) {
- return
timestamp.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+ return
value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
if (LocalTime.class.equals(convertType)) {
- return
timestamp.toInstant().atZone(ZoneId.systemDefault()).toLocalTime();
+ return
value.toInstant().atZone(ZoneId.systemDefault()).toLocalTime();
}
if (OffsetDateTime.class.equals(convertType)) {
- return
timestamp.toInstant().atZone(ZoneId.systemDefault()).toOffsetDateTime();
+ return
value.toInstant().atZone(ZoneId.systemDefault()).toOffsetDateTime();
}
if (String.class.equals(convertType)) {
return value.toString();
@@ -220,33 +218,31 @@ public final class ResultSetUtils {
}
}
- private static Object convertDateValue(final Object value, final Class<?>
convertType) {
- Date date = (Date) value;
+ private static Object convertDateValue(final Date value, final Class<?>
convertType) {
switch (convertType.getName()) {
case "java.sql.Date":
- return new java.sql.Date(date.getTime());
+ return new java.sql.Date(value.getTime());
case "java.sql.Time":
- return new Time(date.getTime());
+ return new Time(value.getTime());
case "java.sql.Timestamp":
- return new Timestamp(date.getTime());
+ return new Timestamp(value.getTime());
case "java.lang.String":
- return date.toString();
+ return value.toString();
default:
throw new UnsupportedDataTypeConversionException(convertType,
value);
}
}
- private static Object convertByteArrayValue(final Object value, final
Class<?> convertType) {
- byte[] bytesValue = (byte[]) value;
- switch (bytesValue.length) {
+ private static Object convertByteArrayValue(final byte[] value, final
Class<?> convertType) {
+ switch (value.length) {
case 1:
- return convertNumberValue(bytesValue[0], convertType);
+ return convertNumberValue(value[0], convertType);
case Shorts.BYTES:
- return convertNumberValue(Shorts.fromByteArray(bytesValue),
convertType);
+ return convertNumberValue(Shorts.fromByteArray(value),
convertType);
case Ints.BYTES:
- return convertNumberValue(Ints.fromByteArray(bytesValue),
convertType);
+ return convertNumberValue(Ints.fromByteArray(value),
convertType);
case Longs.BYTES:
- return convertNumberValue(Longs.fromByteArray(bytesValue),
convertType);
+ return convertNumberValue(Longs.fromByteArray(value),
convertType);
default:
return value;
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCaseAssertion.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCaseAssertion.java
index 7c2f63c8c2a..8dec04bba19 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCaseAssertion.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCaseAssertion.java
@@ -26,7 +26,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
-import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -66,9 +65,8 @@ public final class IntegrationTestCaseAssertion {
* Get SQL values.
*
* @return SQL values
- * @throws ParseException parse exception
*/
- public Collection<SQLValue> getSQLValues() throws ParseException {
+ public Collection<SQLValue> getSQLValues() {
if (null == parameters) {
return Collections.emptyList();
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
index c5fa14ddd87..7089c608a6b 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
@@ -18,32 +18,42 @@
package org.apache.shardingsphere.test.e2e.cases.value;
import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Locale;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
/**
* SQL value.
*/
-@Getter
+@Slf4j
public final class SQLValue {
+ @Getter
private final Object value;
+ @Getter
private final int index;
- public SQLValue(final String value, final String type, final int index)
throws ParseException {
+ private final DateTimeFormatter dateFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+ private final DateTimeFormatter timeFormatter =
DateTimeFormatter.ofPattern("HH:mm:ss");
+
+ private final DateTimeFormatter timestampFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
+
+ public SQLValue(final String value, final String type, final int index) {
this.value = null == type ? value : getValue(value, type);
this.index = index;
}
- private Object getValue(final String value, final String type) throws
ParseException {
+ private Object getValue(final String value, final String type) {
if (type.startsWith("enum#") || type.startsWith("cast#")) {
return value;
}
@@ -75,11 +85,11 @@ public final class SQLValue {
return Boolean.parseBoolean(value);
case "Date":
case "datetime":
- return new Date(new SimpleDateFormat("yyyy-MM-dd",
Locale.getDefault()).parse(value).getTime());
+ return Date.valueOf(LocalDate.parse(value, dateFormatter));
case "time":
- return new Time(new SimpleDateFormat("HH:mm:ss",
Locale.getDefault()).parse(value).getTime());
+ return Time.valueOf(LocalTime.parse(value, timeFormatter));
case "timestamp":
- return new Timestamp(new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss", Locale.getDefault()).parse(value).getTime());
+ return Timestamp.valueOf(LocalDateTime.parse(value,
timestampFormatter));
case "bytes":
return value.getBytes(StandardCharsets.UTF_8);
default:
@@ -93,13 +103,13 @@ public final class SQLValue {
return formatString((String) value);
}
if (value instanceof Date) {
- return formatString(new SimpleDateFormat("yyyy-MM-dd",
Locale.getDefault()).format(value));
+ return formatString(dateFormatter.format(((Date)
value).toLocalDate()));
}
if (value instanceof Time) {
- return formatString(new SimpleDateFormat("HH:mm:ss",
Locale.getDefault()).format(value));
+ return formatString(timeFormatter.format(((Time)
value).toLocalTime()));
}
if (value instanceof Timestamp) {
- return formatString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",
Locale.getDefault()).format(value));
+ return formatString(timestampFormatter.format(((Timestamp)
value).toLocalDateTime()));
}
if (value instanceof byte[]) {
return formatString(new String((byte[]) value,
StandardCharsets.UTF_8));
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValueGroup.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValueGroup.java
index 1910c381819..dc800166fe4 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValueGroup.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValueGroup.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.test.e2e.cases.value;
import lombok.Getter;
import
org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData;
-import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -33,11 +32,11 @@ public final class SQLValueGroup {
private final Collection<SQLValue> values;
- public SQLValueGroup(final DataSetMetaData metaData, final List<String>
values) throws ParseException {
+ public SQLValueGroup(final DataSetMetaData metaData, final List<String>
values) {
this.values = createSQLValues(metaData, values);
}
- private Collection<SQLValue> createSQLValues(final DataSetMetaData
metaData, final List<String> values) throws ParseException {
+ private Collection<SQLValue> createSQLValues(final DataSetMetaData
metaData, final List<String> values) {
Collection<SQLValue> result = new LinkedList<>();
int count = 0;
for (String each : values) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
index 7dc10670d10..bec66d487f3 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
@@ -41,8 +41,7 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
@@ -64,7 +63,9 @@ public final class BatchE2EContainerComposer extends
E2EContainerComposer {
private final DataSetEnvironmentManager dataSetEnvironmentManager;
- public BatchE2EContainerComposer(final CaseTestParameter testParam) throws
JAXBException, IOException, SQLException, ParseException {
+ private final DateTimeFormatter dateTimeFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+ public BatchE2EContainerComposer(final CaseTestParameter testParam) throws
JAXBException, IOException, SQLException {
super(testParam);
databaseType = testParam.getDatabaseType();
for (IntegrationTestCaseAssertion each :
testParam.getTestCaseContext().getTestCase().getAssertions()) {
@@ -158,7 +159,7 @@ public final class BatchE2EContainerComposer extends
E2EContainerComposer {
for (String expected :
expectedDatSetRows.get(count).splitValues(", ")) {
if (Types.DATE ==
actual.getMetaData().getColumnType(columnIndex)) {
if
(!E2EContainerComposer.NOT_VERIFY_FLAG.equals(expected)) {
- assertThat(new
SimpleDateFormat("yyyy-MM-dd").format(actual.getDate(columnIndex)),
is(expected));
+
assertThat(dateTimeFormatter.format(actual.getDate(columnIndex).toLocalDate()),
is(expected));
}
} else if (Types.CHAR ==
actual.getMetaData().getColumnType(columnIndex)
&& ("PostgreSQL".equals(databaseType.getType()) ||
"openGauss".equals(databaseType.getType()))) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/SingleE2EContainerComposer.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/SingleE2EContainerComposer.java
index 3f6566bcdd5..67a9f5f6cb5 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/SingleE2EContainerComposer.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/SingleE2EContainerComposer.java
@@ -25,7 +25,6 @@ import
org.apache.shardingsphere.test.e2e.cases.dataset.DataSetLoader;
import org.apache.shardingsphere.test.e2e.cases.value.SQLValue;
import
org.apache.shardingsphere.test.e2e.framework.param.model.AssertionTestParameter;
-import java.text.ParseException;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -64,13 +63,12 @@ public final class SingleE2EContainerComposer extends
E2EContainerComposer {
* Get SQL.
*
* @return SQL
- * @throws ParseException parse exception
*/
- public String getSQL() throws ParseException {
+ public String getSQL() {
return sqlExecuteType == SQLExecuteType.Literal ? getLiteralSQL(sql) :
sql;
}
- private String getLiteralSQL(final String sql) throws ParseException {
+ private String getLiteralSQL(final String sql) {
List<Object> params = null == assertion ? Collections.emptyList() :
assertion.getSQLValues().stream().map(SQLValue::toString).collect(Collectors.toList());
return params.isEmpty() ? sql : String.format(sql.replace("%",
"ÿ").replace("?", "%s"), params.toArray()).replace("ÿ", "%").replace("%%",
"%").replace("'%'", "'%%'");
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DALE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DALE2EIT.java
index 77d1122f680..322ca224e41 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DALE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DALE2EIT.java
@@ -21,9 +21,9 @@ import
org.apache.shardingsphere.test.e2e.cases.SQLCommandType;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetColumn;
import
org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData;
import org.apache.shardingsphere.test.e2e.cases.dataset.row.DataSetRow;
-import org.apache.shardingsphere.test.e2e.engine.composer.E2EContainerComposer;
import
org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseArgumentsProvider;
import org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseSettings;
+import org.apache.shardingsphere.test.e2e.engine.composer.E2EContainerComposer;
import
org.apache.shardingsphere.test.e2e.engine.composer.SingleE2EContainerComposer;
import
org.apache.shardingsphere.test.e2e.framework.param.array.E2ETestParameterFactory;
import
org.apache.shardingsphere.test.e2e.framework.param.model.AssertionTestParameter;
@@ -37,8 +37,7 @@ import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -50,10 +49,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@E2ETestCaseSettings(SQLCommandType.DAL)
class DALE2EIT {
+ private final DateTimeFormatter dateTimeFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -63,7 +64,7 @@ class DALE2EIT {
}
}
- private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException, ParseException {
+ private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException {
try (Connection connection =
containerComposer.getTargetDataSource().getConnection()) {
try (Statement statement = connection.createStatement()) {
statement.execute(containerComposer.getSQL());
@@ -134,9 +135,8 @@ class DALE2EIT {
if (E2EContainerComposer.NOT_VERIFY_FLAG.equals(expected)) {
return;
}
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
- assertThat(dateFormat.format(actual.getDate(columnIndex)),
is(expected));
- assertThat(dateFormat.format(actual.getDate(columnLabel)),
is(expected));
+
assertThat(dateTimeFormatter.format(actual.getDate(columnIndex).toLocalDate()),
is(expected));
+
assertThat(dateTimeFormatter.format(actual.getDate(columnLabel).toLocalDate()),
is(expected));
}
private void assertObjectValue(final ResultSet actual, final int
columnIndex, final String columnLabel, final String expected) throws
SQLException {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
index 6568e05aca9..08b9de52304 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
@@ -36,7 +36,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
@E2ETestCaseSettings(SQLCommandType.DCL)
class DCLE2EIT {
@@ -44,7 +43,7 @@ class DCLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteUpdate(final AssertionTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteUpdate(final AssertionTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -57,7 +56,7 @@ class DCLE2EIT {
}
}
- private void assertExecuteUpdate(final SingleE2EContainerComposer
containerComposer) throws ParseException, SQLException {
+ private void assertExecuteUpdate(final SingleE2EContainerComposer
containerComposer) throws SQLException {
String sql = containerComposer.getSQL();
try (Connection connection =
containerComposer.getTargetDataSource().getConnection()) {
if (SQLExecuteType.Literal ==
containerComposer.getSqlExecuteType()) {
@@ -75,7 +74,7 @@ class DCLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -88,7 +87,7 @@ class DCLE2EIT {
}
}
- private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws ParseException, SQLException {
+ private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException {
String sql = containerComposer.getSQL();
try (Connection connection =
containerComposer.getTargetDataSource().getConnection()) {
if (SQLExecuteType.Literal ==
containerComposer.getSqlExecuteType()) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
index faed90702e5..2bb18454b5b 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
@@ -41,7 +41,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.LinkedList;
@@ -60,7 +59,7 @@ class DDLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteUpdate(final AssertionTestParameter testParam) throws
SQLException, ParseException {
+ void assertExecuteUpdate(final AssertionTestParameter testParam) throws
SQLException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -79,14 +78,14 @@ class DDLE2EIT {
}
}
- private void executeUpdateForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException,
ParseException {
+ private void executeUpdateForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.executeUpdate(containerComposer.getSQL()) >
0, "Not a DDL statement.");
}
waitCompleted();
}
- private void executeUpdateForPreparedStatement(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private void executeUpdateForPreparedStatement(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL())) {
assertFalse(preparedStatement.executeUpdate() > 0, "Not a DDL
statement.");
}
@@ -115,14 +114,14 @@ class DDLE2EIT {
}
}
- private void executeForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException,
ParseException {
+ private void executeForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.execute(containerComposer.getSQL()), "Not a
DDL statement.");
}
waitCompleted();
}
- private void executeForPreparedStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException,
ParseException {
+ private void executeForPreparedStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL())) {
assertFalse(preparedStatement.execute(), "Not a DDL statement.");
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RALE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RALE2EIT.java
index d631d5f2d90..c043f72c673 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RALE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RALE2EIT.java
@@ -38,7 +38,6 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -54,7 +53,7 @@ class RALE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -66,7 +65,7 @@ class RALE2EIT {
}
}
- private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException, ParseException {
+ private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException {
try (Connection connection =
containerComposer.getTargetDataSource().getConnection()) {
try (Statement statement = connection.createStatement()) {
assertResultSet(containerComposer, statement);
@@ -114,7 +113,7 @@ class RALE2EIT {
waitCompleted(1000L);
}
- private void assertResultSet(final SingleE2EContainerComposer
containerComposer, final Statement statement) throws SQLException,
ParseException {
+ private void assertResultSet(final SingleE2EContainerComposer
containerComposer, final Statement statement) throws SQLException {
if (null == containerComposer.getAssertion().getAssertionSQL()) {
assertResultSet(containerComposer, statement,
containerComposer.getSQL());
} else {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RDLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RDLE2EIT.java
index 865d043f11f..9b3e0914c4f 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RDLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RDLE2EIT.java
@@ -38,7 +38,6 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -54,7 +53,7 @@ class RDLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -66,7 +65,7 @@ class RDLE2EIT {
}
}
- private void assertExecute(final AssertionTestParameter testParam, final
SingleE2EContainerComposer containerComposer) throws SQLException,
ParseException {
+ private void assertExecute(final AssertionTestParameter testParam, final
SingleE2EContainerComposer containerComposer) throws SQLException {
assertNotNull(testParam.getAssertion().getAssertionSQL(), "Assertion
SQL is required");
try (Connection connection =
containerComposer.getTargetDataSource().getConnection()) {
try (Statement statement = connection.createStatement()) {
@@ -77,7 +76,7 @@ class RDLE2EIT {
}
}
- private void executeSQLCase(final SingleE2EContainerComposer
containerComposer, final Statement statement) throws SQLException,
ParseException {
+ private void executeSQLCase(final SingleE2EContainerComposer
containerComposer, final Statement statement) throws SQLException {
statement.execute(containerComposer.getSQL());
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RQLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RQLE2EIT.java
index 08c2efe9790..aaf55f7f698 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RQLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/RQLE2EIT.java
@@ -35,7 +35,6 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -50,7 +49,7 @@ class RQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -60,7 +59,7 @@ class RQLE2EIT {
}
}
- private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException, ParseException {
+ private void assertExecute(final SingleE2EContainerComposer
containerComposer) throws SQLException {
try (Connection connection =
containerComposer.getTargetDataSource().getConnection()) {
try (
Statement statement = connection.createStatement();
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
index 019ba119bc8..67f6dd4154d 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
@@ -37,7 +37,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -47,7 +46,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteUpdateWithAutoGeneratedKeys(final AssertionTestParameter
testParam) throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteUpdateWithAutoGeneratedKeys(final AssertionTestParameter
testParam) throws SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -72,7 +71,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
private int executeUpdateForStatementWithAutoGeneratedKeys(final
AssertionTestParameter testParam,
- final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
int result =
statement.executeUpdate(String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()),
Statement.RETURN_GENERATED_KEYS);
assertGeneratedKeys(testParam, containerComposer,
statement.getGeneratedKeys());
@@ -81,7 +80,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
private int executeUpdateForPreparedStatementWithAutoGeneratedKeys(final
AssertionTestParameter testParam,
- final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(),
Statement.RETURN_GENERATED_KEYS)) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -97,7 +96,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteUpdateWithColumnIndexes(final AssertionTestParameter
testParam) throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteUpdateWithColumnIndexes(final AssertionTestParameter
testParam) throws SQLException, JAXBException, IOException {
if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) {
return;
}
@@ -113,13 +112,13 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeUpdateForStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeUpdateForStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
return
statement.executeUpdate(String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()), new int[]{1});
}
}
- private int executeUpdateForPreparedStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeUpdateForPreparedStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(), new int[]{1})) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -133,7 +132,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteUpdateWithColumnNames(final AssertionTestParameter
testParam) throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteUpdateWithColumnNames(final AssertionTestParameter
testParam) throws SQLException, JAXBException, IOException {
if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) {
return;
}
@@ -149,13 +148,13 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeUpdateForStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeUpdateForStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
return
statement.executeUpdate(String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()));
}
}
- private int executeUpdateForPreparedStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeUpdateForPreparedStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(), new String[]{"TODO"})) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -167,7 +166,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteWithoutAutoGeneratedKeys(final AssertionTestParameter
testParam) throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteWithoutAutoGeneratedKeys(final AssertionTestParameter
testParam) throws SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -187,14 +186,14 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeForStatementWithoutAutoGeneratedKeys(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeForStatementWithoutAutoGeneratedKeys(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.execute(String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()),
Statement.NO_GENERATED_KEYS), "Not a DML statement.");
return statement.getUpdateCount();
}
}
- private int executeForPreparedStatementWithoutAutoGeneratedKeys(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeForPreparedStatementWithoutAutoGeneratedKeys(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(),
Statement.NO_GENERATED_KEYS)) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -207,7 +206,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteWithAutoGeneratedKeys(final AssertionTestParameter
testParam) throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteWithAutoGeneratedKeys(final AssertionTestParameter
testParam) throws SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -228,7 +227,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
private int executeForStatementWithAutoGeneratedKeys(final
AssertionTestParameter testParam,
- final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.execute(
String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()),
Statement.RETURN_GENERATED_KEYS), "Not a DML statement.");
@@ -238,7 +237,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
private int executeForPreparedStatementWithAutoGeneratedKeys(final
AssertionTestParameter testParam,
- final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(),
Statement.RETURN_GENERATED_KEYS)) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -254,7 +253,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteWithColumnIndexes(final AssertionTestParameter
testParam) throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteWithColumnIndexes(final AssertionTestParameter
testParam) throws SQLException, JAXBException, IOException {
if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) {
return;
}
@@ -270,14 +269,14 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeForStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeForStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.execute(String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()), new int[]{1}), "Not
a DML statement.");
return statement.getUpdateCount();
}
}
- private int executeForPreparedStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeForPreparedStatementWithColumnIndexes(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(), new int[]{1})) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -292,7 +291,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteWithColumnNames(final AssertionTestParameter testParam)
throws SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteWithColumnNames(final AssertionTestParameter testParam)
throws SQLException, JAXBException, IOException {
if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) {
return;
}
@@ -308,14 +307,14 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeForStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeForStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.execute(String.format(containerComposer.getSQL(),
containerComposer.getAssertion().getSQLValues().toArray()), new
String[]{"TODO"}), "Not a DML statement.");
return statement.getUpdateCount();
}
}
- private int executeForPreparedStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeForPreparedStatementWithColumnNames(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL(), new String[]{"TODO"})) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
index c3067b08e6d..81be0fa95ca 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
@@ -42,8 +42,7 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
@@ -55,6 +54,8 @@ public abstract class BaseDMLE2EIT {
private static final String DATA_COLUMN_DELIMITER = ", ";
+ private final DateTimeFormatter dateTimeFormatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
private DataSetEnvironmentManager dataSetEnvironmentManager;
/**
@@ -63,11 +64,10 @@ public abstract class BaseDMLE2EIT {
* @param testParam test parameter
* @param containerComposer container composer
* @throws SQLException SQL exception
- * @throws ParseException parse exception
* @throws IOException IO exception
* @throws JAXBException JAXB exception
*/
- public final void init(final AssertionTestParameter testParam, final
SingleE2EContainerComposer containerComposer) throws SQLException,
ParseException, IOException, JAXBException {
+ public final void init(final AssertionTestParameter testParam, final
SingleE2EContainerComposer containerComposer) throws SQLException, IOException,
JAXBException {
dataSetEnvironmentManager = new DataSetEnvironmentManager(
new
ScenarioDataPath(testParam.getScenario()).getDataSetFile(Type.ACTUAL),
containerComposer.getActualDataSourceMap());
dataSetEnvironmentManager.fillData();
@@ -138,7 +138,7 @@ public abstract class BaseDMLE2EIT {
private void assertValue(final AssertionTestParameter testParam, final
ResultSet actual, final int columnIndex, final String expected) throws
SQLException {
if (Types.DATE == actual.getMetaData().getColumnType(columnIndex)) {
if (!E2EContainerComposer.NOT_VERIFY_FLAG.equals(expected)) {
- assertThat(new
SimpleDateFormat("yyyy-MM-dd").format(actual.getDate(columnIndex)),
is(expected));
+
assertThat(dateTimeFormatter.format(actual.getDate(columnIndex).toLocalDate()),
is(expected));
}
} else if (Types.CHAR ==
actual.getMetaData().getColumnType(columnIndex)
&& ("PostgreSQL".equals(testParam.getDatabaseType().getType())
|| "openGauss".equals(testParam.getDatabaseType().getType()))) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
index d1645447f10..ad68af7ccb5 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.test.e2e.engine.type.dml;
import org.apache.shardingsphere.test.e2e.cases.SQLCommandType;
import
org.apache.shardingsphere.test.e2e.cases.assertion.IntegrationTestCaseAssertion;
import org.apache.shardingsphere.test.e2e.cases.value.SQLValue;
-import
org.apache.shardingsphere.test.e2e.engine.composer.BatchE2EContainerComposer;
import
org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseArgumentsProvider;
import org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseSettings;
+import
org.apache.shardingsphere.test.e2e.engine.composer.BatchE2EContainerComposer;
import
org.apache.shardingsphere.test.e2e.framework.param.array.E2ETestParameterFactory;
import
org.apache.shardingsphere.test.e2e.framework.param.model.CaseTestParameter;
import org.junit.jupiter.api.condition.EnabledIf;
@@ -34,7 +34,6 @@ import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-import java.text.ParseException;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -45,7 +44,7 @@ class BatchDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteBatch(final CaseTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteBatch(final CaseTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -59,7 +58,7 @@ class BatchDMLE2EIT {
}
}
- private int[] executeBatchForPreparedStatement(final CaseTestParameter
testParam, final Connection connection) throws SQLException, ParseException {
+ private int[] executeBatchForPreparedStatement(final CaseTestParameter
testParam, final Connection connection) throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(testParam.getTestCaseContext().getTestCase().getSql()))
{
for (IntegrationTestCaseAssertion each :
testParam.getTestCaseContext().getTestCase().getAssertions()) {
addBatch(preparedStatement, each);
@@ -68,7 +67,7 @@ class BatchDMLE2EIT {
}
}
- private void addBatch(final PreparedStatement preparedStatement, final
IntegrationTestCaseAssertion assertion) throws ParseException, SQLException {
+ private void addBatch(final PreparedStatement preparedStatement, final
IntegrationTestCaseAssertion assertion) throws SQLException {
for (SQLValue each : assertion.getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
}
@@ -78,7 +77,7 @@ class BatchDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertClearBatch(final CaseTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertClearBatch(final CaseTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
index 3dbf5fef291..b75528978b6 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
@@ -35,7 +35,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -45,7 +44,7 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteUpdate(final AssertionTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertExecuteUpdate(final AssertionTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -62,13 +61,13 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeUpdateForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException,
ParseException {
+ private int executeUpdateForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException {
try (Statement statement = connection.createStatement()) {
return statement.executeUpdate(containerComposer.getSQL());
}
}
- private int executeUpdateForPreparedStatement(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException, ParseException {
+ private int executeUpdateForPreparedStatement(final
SingleE2EContainerComposer containerComposer, final Connection connection)
throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL())) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -80,7 +79,7 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -97,14 +96,14 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT {
}
}
- private int executeForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException,
ParseException {
+ private int executeForStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException {
try (Statement statement = connection.createStatement()) {
assertFalse(statement.execute(containerComposer.getSQL()), "Not a
DML statement.");
return statement.getUpdateCount();
}
}
- private int executeForPreparedStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException,
ParseException {
+ private int executeForPreparedStatement(final SingleE2EContainerComposer
containerComposer, final Connection connection) throws SQLException {
try (PreparedStatement preparedStatement =
connection.prepareStatement(containerComposer.getSQL())) {
for (SQLValue each :
containerComposer.getAssertion().getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
index 074b6493221..8246f0331fa 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
@@ -37,7 +37,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -47,7 +46,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteQueryWithResultSetTypeAndConcurrency(final
AssertionTestParameter testParam) throws SQLException, ParseException,
JAXBException, IOException {
+ void assertExecuteQueryWithResultSetTypeAndConcurrency(final
AssertionTestParameter testParam) throws SQLException, JAXBException,
IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -69,7 +68,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteQueryWithResultSetTypeAndConcurrencyAndHoldability(final
AssertionTestParameter testParam) throws SQLException, ParseException,
JAXBException, IOException {
+ void assertExecuteQueryWithResultSetTypeAndConcurrencyAndHoldability(final
AssertionTestParameter testParam) throws SQLException, JAXBException,
IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -91,7 +90,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteWithResultSetTypeAndConcurrency(final
AssertionTestParameter testParam) throws SQLException, ParseException,
JAXBException, IOException {
+ void assertExecuteWithResultSetTypeAndConcurrency(final
AssertionTestParameter testParam) throws SQLException, JAXBException,
IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -113,7 +112,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteWithResultSetTypeAndConcurrencyAndHoldability(final
AssertionTestParameter testParam) throws SQLException, ParseException,
JAXBException, IOException {
+ void assertExecuteWithResultSetTypeAndConcurrencyAndHoldability(final
AssertionTestParameter testParam) throws SQLException, JAXBException,
IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -137,7 +136,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteQueryWithXMLExpected(final
AssertionTestParameter testParam,
- final
SingleE2EContainerComposer containerComposer, final int... resultSetTypes)
throws SQLException, ParseException {
+ final
SingleE2EContainerComposer containerComposer, final int... resultSetTypes)
throws SQLException {
// TODO Fix jdbc adapter
if ("jdbc".equals(testParam.getAdapter())) {
return;
@@ -151,7 +150,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
}
- private void assertExecuteQueryWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer, final int... resultSetTypes)
throws SQLException, ParseException {
+ private void assertExecuteQueryWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer, final int... resultSetTypes)
throws SQLException {
try (
Connection actualConnection =
containerComposer.getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
@@ -165,7 +164,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
private void assertExecuteQueryForStatementWithResultSetTypes(final
SingleE2EContainerComposer containerComposer,
final
Connection actualConnection, final Connection expectedConnection,
- final int...
resultSetTypes) throws SQLException, ParseException {
+ final int...
resultSetTypes) throws SQLException {
try (
Statement actualStatement = 2 == resultSetTypes.length ?
actualConnection.createStatement(resultSetTypes[0], resultSetTypes[1])
: actualConnection.createStatement(resultSetTypes[0],
resultSetTypes[1], resultSetTypes[2]);
@@ -178,7 +177,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
private void
assertExecuteQueryForPreparedStatementWithResultSetTypes(final
SingleE2EContainerComposer containerComposer, final Connection
actualConnection, final Connection expectedConnection,
-
final int... resultSetTypes) throws SQLException, ParseException {
+
final int... resultSetTypes) throws SQLException {
try (
PreparedStatement actualPreparedStatement = 2 ==
resultSetTypes.length ?
actualConnection.prepareStatement(containerComposer.getSQL(),
resultSetTypes[0], resultSetTypes[1])
:
actualConnection.prepareStatement(containerComposer.getSQL(),
resultSetTypes[0], resultSetTypes[1], resultSetTypes[2]);
@@ -197,7 +196,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteWithXMLExpected(final AssertionTestParameter
testParam,
- final SingleE2EContainerComposer
containerComposer, final int... resultSetTypes) throws SQLException,
ParseException {
+ final SingleE2EContainerComposer
containerComposer, final int... resultSetTypes) throws SQLException {
// TODO Fix jdbc adapter
if ("jdbc".equals(testParam.getAdapter())) {
return;
@@ -212,7 +211,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
}
- private void assertExecuteWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer, final int... resultSetTypes)
throws SQLException, ParseException {
+ private void assertExecuteWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer, final int... resultSetTypes)
throws SQLException {
try (
Connection actualConnection =
containerComposer.getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
@@ -225,7 +224,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteForStatementWithResultSetTypes(final
SingleE2EContainerComposer containerComposer,
- final Connection
actualConnection, final Connection expectedConnection, final int...
resultSetTypes) throws SQLException, ParseException {
+ final Connection
actualConnection, final Connection expectedConnection, final int...
resultSetTypes) throws SQLException {
try (
Statement actualStatement = 2 == resultSetTypes.length ?
actualConnection.createStatement(resultSetTypes[0], resultSetTypes[1])
: actualConnection.createStatement(resultSetTypes[0],
resultSetTypes[1], resultSetTypes[2]);
@@ -241,7 +240,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteForPreparedStatementWithResultSetTypes(final
SingleE2EContainerComposer containerComposer, final Connection
actualConnection, final Connection expectedConnection,
- final
int... resultSetTypes) throws SQLException, ParseException {
+ final
int... resultSetTypes) throws SQLException {
try (
PreparedStatement actualPreparedStatement = 2 ==
resultSetTypes.length ?
actualConnection.prepareStatement(containerComposer.getSQL(),
resultSetTypes[0], resultSetTypes[1])
:
actualConnection.prepareStatement(containerComposer.getSQL(),
resultSetTypes[0], resultSetTypes[1], resultSetTypes[2]);
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/BaseDQLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/BaseDQLE2EIT.java
index 8ebe2535f72..d8d72a2d59d 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/BaseDQLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/BaseDQLE2EIT.java
@@ -35,7 +35,6 @@ import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
-import java.text.ParseException;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
@@ -62,11 +61,10 @@ public abstract class BaseDQLE2EIT {
* @param testParam test parameter
* @param containerComposer container composer
* @throws SQLException SQL exception
- * @throws ParseException parse exception
* @throws IOException IO exception
* @throws JAXBException JAXB exception
*/
- public final void init(final AssertionTestParameter testParam, final
SingleE2EContainerComposer containerComposer) throws SQLException,
ParseException, IOException, JAXBException {
+ public final void init(final AssertionTestParameter testParam, final
SingleE2EContainerComposer containerComposer) throws SQLException, IOException,
JAXBException {
fillDataOnlyOnce(testParam, containerComposer);
expectedDataSource = null ==
containerComposer.getAssertion().getExpectedDataSourceName() || 1 ==
containerComposer.getExpectedDataSourceMap().size()
?
containerComposer.getExpectedDataSourceMap().values().iterator().next()
@@ -74,7 +72,7 @@ public abstract class BaseDQLE2EIT {
useXMLAsExpectedDataset = null !=
containerComposer.getAssertion().getExpectedDataFile();
}
- private void fillDataOnlyOnce(final AssertionTestParameter testParam,
final SingleE2EContainerComposer containerComposer) throws SQLException,
ParseException, IOException, JAXBException {
+ private void fillDataOnlyOnce(final AssertionTestParameter testParam,
final SingleE2EContainerComposer containerComposer) throws SQLException,
IOException, JAXBException {
String cacheKey = testParam.getKey() + "-" +
System.identityHashCode(containerComposer.getActualDataSourceMap());
if (!FILLED_SUITES.contains(cacheKey)) {
synchronized (FILLED_SUITES) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
index e9a327d0eab..73568800aae 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
@@ -36,7 +36,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.text.ParseException;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -46,7 +45,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecuteQuery(final AssertionTestParameter testParam) throws
SQLException, ParseException, IOException, JAXBException {
+ void assertExecuteQuery(final AssertionTestParameter testParam) throws
SQLException, IOException, JAXBException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -62,7 +61,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
- private void assertExecuteQueryWithXmlExpected(final
AssertionTestParameter testParam, final SingleE2EContainerComposer
containerComposer) throws SQLException, ParseException {
+ private void assertExecuteQueryWithXmlExpected(final
AssertionTestParameter testParam, final SingleE2EContainerComposer
containerComposer) throws SQLException {
// TODO Fix jdbc adapter
if ("jdbc".equals(testParam.getAdapter())) {
return;
@@ -75,7 +74,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
}
- private void assertExecuteQueryWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer) throws SQLException,
ParseException {
+ private void assertExecuteQueryWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer) throws SQLException {
try (
Connection actualConnection =
containerComposer.getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
@@ -88,7 +87,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteQueryForStatement(final
SingleE2EContainerComposer containerComposer,
- final Connection
actualConnection, final Connection expectedConnection) throws SQLException,
ParseException {
+ final Connection
actualConnection, final Connection expectedConnection) throws SQLException {
try (
Statement actualStatement = actualConnection.createStatement();
ResultSet actualResultSet =
actualStatement.executeQuery(containerComposer.getSQL());
@@ -99,7 +98,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteQueryForPreparedStatement(final
SingleE2EContainerComposer containerComposer,
- final Connection
actualConnection, final Connection expectedConnection) throws SQLException,
ParseException {
+ final Connection
actualConnection, final Connection expectedConnection) throws SQLException {
try (
PreparedStatement actualPreparedStatement =
actualConnection.prepareStatement(containerComposer.getSQL());
PreparedStatement expectedPreparedStatement =
expectedConnection.prepareStatement(containerComposer.getSQL())) {
@@ -118,7 +117,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
- void assertExecute(final AssertionTestParameter testParam) throws
SQLException, ParseException, JAXBException, IOException {
+ void assertExecute(final AssertionTestParameter testParam) throws
SQLException, JAXBException, IOException {
// TODO make sure test case can not be null
if (null == testParam.getTestCaseContext()) {
return;
@@ -133,7 +132,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
}
- private void assertExecuteWithXmlExpected(final AssertionTestParameter
testParam, final SingleE2EContainerComposer containerComposer) throws
SQLException, ParseException {
+ private void assertExecuteWithXmlExpected(final AssertionTestParameter
testParam, final SingleE2EContainerComposer containerComposer) throws
SQLException {
// TODO Fix jdbc adapter
if ("jdbc".equals(testParam.getAdapter())) {
return;
@@ -147,7 +146,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
}
- private void assertExecuteWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer) throws SQLException,
ParseException {
+ private void assertExecuteWithExpectedDataSource(final
SingleE2EContainerComposer containerComposer) throws SQLException {
try (
Connection actualConnection =
containerComposer.getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
@@ -160,7 +159,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteForStatement(final SingleE2EContainerComposer
containerComposer,
- final Connection actualConnection,
final Connection expectedConnection) throws SQLException, ParseException {
+ final Connection actualConnection,
final Connection expectedConnection) throws SQLException {
try (
Statement actualStatement = actualConnection.createStatement();
Statement expectedStatement =
expectedConnection.createStatement()) {
@@ -174,7 +173,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
}
private void assertExecuteForPreparedStatement(final
SingleE2EContainerComposer containerComposer,
- final Connection
actualConnection, final Connection expectedConnection) throws SQLException,
ParseException {
+ final Connection
actualConnection, final Connection expectedConnection) throws SQLException {
try (
PreparedStatement actualPreparedStatement =
actualConnection.prepareStatement(containerComposer.getSQL());
PreparedStatement expectedPreparedStatement =
expectedConnection.prepareStatement(containerComposer.getSQL())) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
index 5dc6dcd3d4e..b626e7fe4a0 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
@@ -39,7 +39,6 @@ import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-import java.text.ParseException;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -73,9 +72,8 @@ public final class DataSetEnvironmentManager {
* Fill data.
*
* @throws SQLException SQL exception
- * @throws ParseException parse exception
*/
- public void fillData() throws SQLException, ParseException {
+ public void fillData() throws SQLException {
Map<DataNode, List<DataSetRow>> dataNodeListMap = getDataSetRowMap();
List<Callable<Void>> fillDataTasks = new LinkedList<>();
for (Entry<DataNode, List<DataSetRow>> entry :
dataNodeListMap.entrySet()) {
diff --git
a/test/e2e/sql/src/test/resources/cases/dml/dml-integration-insert.xml
b/test/e2e/sql/src/test/resources/cases/dml/dml-integration-insert.xml
index 2fd57445f64..76ce4532ea2 100644
--- a/test/e2e/sql/src/test/resources/cases/dml/dml-integration-insert.xml
+++ b/test/e2e/sql/src/test/resources/cases/dml/dml-integration-insert.xml
@@ -135,38 +135,38 @@
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="MySQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="6:int, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp"
+ <assertion parameters="6:int, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30.0:timestamp"
expected-data-file="pro_insert_order_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="MySQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="6:int, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp"
+ <assertion parameters="6:int, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30.0:timestamp"
expected-data-file="shadow_insert_order_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?);" db-types="MySQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="7:int, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp, 8:int, 1:int, pro_order:String,
S:char, true:boolean, 50:smallint, summer:enum#season, 100.00:decimal,
2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30:timestamp"
+ <assertion parameters="7:int, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30.0:timestamp, 8:int, 1:int, pro_order:String,
S:char, true:boolean, 50:smallint, summer:enum#season, 100.00:decimal,
2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30.0:timestamp"
expected-data-file="pro_insert_order_batch_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date,
type_time, type_timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?);" db-types="MySQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="7:int, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30:timestamp, 8:int, 0:int,
shadow_order:String, S:char, true:boolean, 50:smallint, summer:enum#season,
100.00:decimal, 2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30:timestamp"
+ <assertion parameters="7:int, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date,
12:30:30:time, 2021-01-01 12:30:30.0:timestamp, 8:int, 0:int,
shadow_order:String, S:char, true:boolean, 50:smallint, summer:enum#season,
100.00:decimal, 2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30.0:timestamp"
expected-data-file="shadow_insert_order_batch_value.xml" />
</test-case>
<!-- FIXME Support enum types for PostgreSQL -->
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_decimal, type_date, type_time,
type_timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="PostgreSQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="6:int, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time,
2021-01-01 12:30:30:timestamp"
+ <assertion parameters="6:int, 1:int, pro_order:String, S:char,
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time,
2021-01-01 12:30:30.0:timestamp"
expected-data-file="pro_insert_order_value.xml" />
</test-case>
<test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name,
type_char, type_boolean, type_smallint, type_decimal, type_date, type_time,
type_timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
db-types="PostgreSQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="6:int, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time,
2021-01-01 12:30:30:timestamp"
+ <assertion parameters="6:int, 0:int, shadow_order:String, S:char,
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time,
2021-01-01 12:30:30.0:timestamp"
expected-data-file="shadow_insert_order_value.xml" />
</test-case>
diff --git
a/test/e2e/sql/src/test/resources/cases/dml/dml-integration-update.xml
b/test/e2e/sql/src/test/resources/cases/dml/dml-integration-update.xml
index 55abd56d660..dcef6d5e8e9 100644
--- a/test/e2e/sql/src/test/resources/cases/dml/dml-integration-update.xml
+++ b/test/e2e/sql/src/test/resources/cases/dml/dml-integration-update.xml
@@ -73,13 +73,13 @@
<test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?,
type_boolean = ?, type_smallint = ?, type_enum = ?, type_decimal = ?, type_date
= ?, type_time = ?, type_timestamp = ?
WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="pro_order_update:String, F:char, false:boolean,
60:smallint, spring:enum#season, 120.00:decimal, 2021-01-02:Date,
13:30:30:time, 2021-01-02 13:30:30:timestamp, 1:int, 1:int, 2:int"
+ <assertion parameters="pro_order_update:String, F:char, false:boolean,
60:smallint, spring:enum#season, 120.00:decimal, 2021-01-02:Date,
13:30:30:time, 2021-01-02 13:30:30.0:timestamp, 1:int, 1:int, 2:int"
expected-data-file="pro_update_order_by_user_id.xml" />
</test-case>
<test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?,
type_boolean = ?, type_smallint = ?, type_enum = ?, type_decimal = ?, type_date
= ?, type_time = ?, type_timestamp = ?
WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL"
scenario-types="shadow,sharding_encrypt_shadow,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow">
- <assertion parameters="shadow_order_update:String, F:char,
false:boolean, 60:smallint, spring:enum#season, 120.00:decimal,
2021-01-02:Date, 13:30:30:time, 2021-01-02 13:30:30:timestamp, 0:int, 1:int,
2:int"
+ <assertion parameters="shadow_order_update:String, F:char,
false:boolean, 60:smallint, spring:enum#season, 120.00:decimal,
2021-01-02:Date, 13:30:30:time, 2021-01-02 13:30:30.0:timestamp, 0:int, 1:int,
2:int"
expected-data-file="shadow_update_order_by_user_id.xml" />
</test-case>