diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 5a81fb02a908b..4158093a06987 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -258,7 +258,7 @@ 1. Kernel: Fix use Consul in cluster mode start up failure 1. DB Discovery: Close heartbeat job when drop discovery rule 1. Kernel: Fix wrong decide result when execute same sharding condition subquery with SQL federation -1. Kernel: Fix priority problem of UNION, INTERSECT, EXCEPT set operation in SQL Federation for PostgreSQL and openGuass dialect +1. Kernel: Fix priority problem of UNION, INTERSECT, EXCEPT set operation in SQL Federation for PostgreSQL and openGauss dialect 1. Kernel: Fix create view index out of range exception when view contains set operator 1. Kernel: Add XA resource exceeds length check 1. Kernel: Fix transaction support for spring requires_new diff --git a/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md b/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md index 5d2a35884ed23..5d07f2f5efac6 100644 --- a/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md +++ b/docs/blog/content/material/2022_04_06_A_Holistic_Pluggable_Platform_for_Data_Sharding_ICDE_2022_Understanding_Apache_ShardingSphere.en.md @@ -55,7 +55,7 @@ Currently, more than 170 companies are using ShardingSphere. This article is bas ## System Architecture and Data Flow As shown in Figure 2, ShardingSphere can be divided into five modules: -1. **dData source:** It enables storage by integrating various databases and currently supports data sources such as MySQL, PostgreSQL, SQL Server, Oracle, MariaDB and openGuass. +1. **dData source:** It enables storage by integrating various databases and currently supports data sources such as MySQL, PostgreSQL, SQL Server, Oracle, MariaDB and openGauss. 2. **Function:** It provides many out-of-the-box features that can be freely added, combined, or deleted as needed. 3. **Governor** is mainly used for configuration management and health monitoring. 4. **SQL engine.** With the complete data sharding SQL engine, all functions are pluggable, and any function can be implemented through a SQL statement. diff --git "a/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" "b/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" index 93bef78784deb..8e89b63dd6014 100644 --- "a/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" +++ "b/docs/blog/content/material/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy\342\200\231s_Authentication.en.md" @@ -175,7 +175,7 @@ Connection failed. We see that it’s actually due to the authentication protocol. -The psql client requires md5 protocol authentication by default, but because Proxy requires the scram-sha-256 under the openGuass protocol, the negotiation fails and an exception is thrown. +The psql client requires md5 protocol authentication by default, but because Proxy requires the scram-sha-256 under the openGauss protocol, the negotiation fails and an exception is thrown. ## Following Steps @@ -229,7 +229,7 @@ Connection succeeded. ![img](https://shardingsphere.apache.org/blog/img/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy’s_Authentication.en.md8.jpeg) -Now we see that `psql` has successfully connected to ShardingSphere-Proxy under the openGuass protocol. +Now we see that `psql` has successfully connected to ShardingSphere-Proxy under the openGauss protocol. ![img](https://shardingsphere.apache.org/blog/img/2023_05_18_Enhancing_Database_Security_ShardingSphere-Proxy’s_Authentication.en.md9.jpeg) diff --git a/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md b/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md index 25bb75933062b..065db93d5a363 100644 --- a/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md +++ b/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md @@ -14,7 +14,7 @@ Currently, NATIVE and DOCKER are available. 1. NATIVE : Run on developer local machine. Need to start ShardingSphere-Proxy instance and database instance by developer. It could be used for local debugging. 2. DOCKER : Run on docker started by Maven plugin. It could be used for GitHub Actions, and it could be used for local debugging too. -Supported databases: MySQL, PostgreSQL and openGuass. +Supported databases: MySQL, PostgreSQL and openGauss. ## User guide diff --git a/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/DataRecordResultConvertUtilsTest.java b/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/DataRecordResultConvertUtilsTest.java index 0f3c39146d509..dcf869ea7812a 100644 --- a/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/DataRecordResultConvertUtilsTest.java +++ b/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/DataRecordResultConvertUtilsTest.java @@ -57,7 +57,7 @@ class DataRecordResultConvertUtilsTest { void assertConvertDataRecordToRecord() throws InvalidProtocolBufferException, SQLException { DataRecord dataRecord = new DataRecord(PipelineSQLOperationType.INSERT, "t_order", new IntegerPrimaryKeyIngestPosition(0L, 1L), 2); dataRecord.addColumn(new Column("order_id", BigInteger.ONE, false, true)); - dataRecord.addColumn(new Column("price", BigDecimal.valueOf(123), false, false)); + dataRecord.addColumn(new Column("price", BigDecimal.valueOf(123L), false, false)); dataRecord.addColumn(new Column("user_id", Long.MAX_VALUE, false, false)); dataRecord.addColumn(new Column("item_id", Integer.MAX_VALUE, false, false)); dataRecord.addColumn(new Column("create_date", LocalDate.now(), false, false)); diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/JdbcProjectApplication.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/JdbcProjectApplication.java index 50f0624a7671e..ee49bd6397da3 100644 --- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/JdbcProjectApplication.java +++ b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/JdbcProjectApplication.java @@ -55,7 +55,7 @@ private static void run() throws ClassNotFoundException, SQLException, Interrupt Connection connection = getConnection(); OrderService orderService = new OrderServiceImpl(connection); OrderController orderController = new OrderController(orderService); - long endTime = System.currentTimeMillis() + (5 * 60 * 1000); + long endTime = System.currentTimeMillis() + (5L * 60L * 1000L); while (System.currentTimeMillis() < endTime) { orderController.dropTable(); orderController.createTable(); diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/OrderController.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/OrderController.java index 4003fc068ef63..b3c53519a9d04 100644 --- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/OrderController.java +++ b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/OrderController.java @@ -50,10 +50,10 @@ public void dropTable() { * Insert order. */ public void insert() { - long index = 0; - while (index++ <= 100) { + long index = 0L; + while (index++ <= 100L) { OrderEntity order = new OrderEntity(index, index, "OK"); - orderService.insert(order, 0 == (index & 1) ? StatementType.STATEMENT : StatementType.PREPARED, 0 == index % 5); + orderService.insert(order, 0L == (index & 1L) ? StatementType.STATEMENT : StatementType.PREPARED, 0L == index % 5L); } } @@ -61,10 +61,10 @@ public void insert() { * Create error request. */ public void createErrorRequest() { - long index = 0; - while (index++ <= 10) { + long index = 0L; + while (index++ <= 10L) { OrderEntity order = new OrderEntity(index, index, "Fail"); - orderService.insert(order, 0 == (index & 1) ? StatementType.STATEMENT : StatementType.PREPARED, false); + orderService.insert(order, 0L == (index & 1L) ? StatementType.STATEMENT : StatementType.PREPARED, false); } } diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereJdbcContainer.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereJdbcContainer.java index 062ade73c49f7..6f383c8ae9bc5 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereJdbcContainer.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereJdbcContainer.java @@ -57,7 +57,7 @@ protected void configure() { } private Map createResourceMappingForProxy() { - Map result = new HashMap<>(); + Map result = new HashMap<>(2, 1F); result.put("/env/jdbc/conf/config.yaml", CONFIG_PATH_IN_CONTAINER + "conf/config.yaml"); if (!Strings.isNullOrEmpty(plugin)) { result.put(String.format("/env/agent/conf/%s/agent.yaml", plugin), CONFIG_PATH_IN_CONTAINER + "agent/conf/agent.yaml"); diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereProxyContainer.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereProxyContainer.java index 5730f6f775724..aaecb04354ac9 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereProxyContainer.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/container/ShardingSphereProxyContainer.java @@ -71,7 +71,7 @@ protected void configure() { } private Map createResourceMappingForProxy() { - Map result = new HashMap<>(); + Map result = new HashMap<>(3, 1F); result.put("/env/proxy/conf/global.yaml", ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml"); result.put("/env/proxy/conf/database-db.yaml", ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "database-db.yaml"); if (!Strings.isNullOrEmpty(plugin)) { diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java index 1192ff4ecfe68..6c1840bf06405 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java @@ -136,8 +136,8 @@ public void init() { createJDBCEnvironment(); } log.info("Waiting to collect data ..."); - if (0 < collectDataWaitSeconds) { - Awaitility.await().ignoreExceptions().atMost(Duration.ofSeconds(collectDataWaitSeconds + 1)).pollDelay(collectDataWaitSeconds, TimeUnit.SECONDS).until(() -> true); + if (0L < collectDataWaitSeconds) { + Awaitility.await().ignoreExceptions().atMost(Duration.ofSeconds(collectDataWaitSeconds + 1L)).pollDelay(collectDataWaitSeconds, TimeUnit.SECONDS).until(() -> true); } initialized = true; } diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/request/ProxyRequestExecutor.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/request/ProxyRequestExecutor.java index 93656cd6febed..47141a81f9581 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/request/ProxyRequestExecutor.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/request/ProxyRequestExecutor.java @@ -72,7 +72,7 @@ private void request() { JDBCAgentTestUtils.insertOrder(orderEntity, connection); results.add(orderEntity.getOrderId()); } - OrderEntity orderEntity = new OrderEntity(1000, 1000, "ROLL_BACK"); + OrderEntity orderEntity = new OrderEntity(1000L, 1000, "ROLL_BACK"); JDBCAgentTestUtils.insertOrderRollback(orderEntity, connection); JDBCAgentTestUtils.updateOrderStatus(orderEntity, connection); JDBCAgentTestUtils.selectAllOrders(connection); diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/OkHttpUtils.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/OkHttpUtils.java index 54ee478d4b61c..293110fb5c604 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/OkHttpUtils.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/OkHttpUtils.java @@ -39,9 +39,9 @@ public final class OkHttpUtils { private OkHttpUtils() { OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.connectTimeout(10, TimeUnit.SECONDS); - builder.readTimeout(10, TimeUnit.SECONDS); - builder.writeTimeout(10, TimeUnit.SECONDS); + builder.connectTimeout(10L, TimeUnit.SECONDS); + builder.readTimeout(10L, TimeUnit.SECONDS); + builder.writeTimeout(10L, TimeUnit.SECONDS); client = builder.build(); } diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/DockerStorageContainer.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/DockerStorageContainer.java index beb6b516f2632..a2adcf1673501 100644 --- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/DockerStorageContainer.java +++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/DockerStorageContainer.java @@ -48,15 +48,13 @@ public abstract class DockerStorageContainer extends DockerITContainer implement private final DatabaseType databaseType; - private final Map actualDataSourceMap; + private final Map actualDataSourceMap = new LinkedHashMap<>(); - private final Map expectedDataSourceMap; + private final Map expectedDataSourceMap = new LinkedHashMap<>(); protected DockerStorageContainer(final DatabaseType databaseType, final String containerImage) { super(databaseType.getType().toLowerCase(), containerImage); this.databaseType = databaseType; - actualDataSourceMap = new LinkedHashMap<>(); - expectedDataSourceMap = new LinkedHashMap<>(); } @Override diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/StorageContainerConfiguration.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/StorageContainerConfiguration.java index 607dc887c0357..436476ef9ace1 100644 --- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/StorageContainerConfiguration.java +++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/StorageContainerConfiguration.java @@ -46,7 +46,7 @@ public StorageContainerConfiguration(final String containerCommand, final Map databaseTypes, final Map expectedDatabaseTypes) { this.databaseTypes = databaseTypes; this.expectedDatabaseTypes = expectedDatabaseTypes; - this.scenario = null; + scenario = null; this.containerCommand = containerCommand; this.containerEnvironments = containerEnvironments; this.mountedResources = mountedResources; diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/OpenGaussContainer.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/OpenGaussContainer.java index 9f5b37af17273..3f732fc684808 100644 --- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/OpenGaussContainer.java +++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/OpenGaussContainer.java @@ -58,7 +58,7 @@ protected void configure() { mapResources(storageContainerConfig.getMountedResources()); withPrivilegedMode(true); super.configure(); - withStartupTimeout(Duration.of(120, ChronoUnit.SECONDS)); + withStartupTimeout(Duration.of(120L, ChronoUnit.SECONDS)); } @Override diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/util/StorageContainerUtils.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/util/StorageContainerUtils.java index 647b2fa8f3f67..b5b8be6d07b1f 100644 --- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/util/StorageContainerUtils.java +++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/util/StorageContainerUtils.java @@ -62,7 +62,7 @@ public static DataSource generateDataSource(final String jdbcUrl, final String u result.setPassword(password); result.setMaximumPoolSize(maximumPoolSize); result.setTransactionIsolation("TRANSACTION_READ_COMMITTED"); - result.setLeakDetectionThreshold(10000); + result.setLeakDetectionThreshold(10000L); return result; } } diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/authority/AuthorityEnvironment.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/authority/AuthorityEnvironment.java index 4a84c127eb745..75b6c1f502bb7 100644 --- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/authority/AuthorityEnvironment.java +++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/authority/AuthorityEnvironment.java @@ -37,7 +37,7 @@ public final class AuthorityEnvironment { * Get init SQLs of this database type. * * @param databaseType database type - * @return init SQLs of this data base type + * @return init SQLs of this database type */ public Collection getInitSQLs(final DatabaseType databaseType) { Collection result = new LinkedList<>(); diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/database/DatabaseEnvironmentManager.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/database/DatabaseEnvironmentManager.java index a9f344ca6906d..01ad7f8d8b56f 100644 --- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/database/DatabaseEnvironmentManager.java +++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/scenario/database/DatabaseEnvironmentManager.java @@ -54,7 +54,7 @@ public static Map getDatabaseTypes(final String scenario, } private static Map crateDatabaseTypes(final Collection datasourceNames, final DatabaseType defaultDatabaseType) { - Map result = new LinkedHashMap<>(); + Map result = new LinkedHashMap<>(datasourceNames.size(), 1F); for (String each : datasourceNames) { List items = Splitter.on(":").splitToList(each); DatabaseType databaseType = items.size() > 1 ? TypedSPILoader.getService(DatabaseType.class, items.get(1)) : defaultDatabaseType; diff --git a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITStandardShardingAlgorithmFixture.java b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITStandardShardingAlgorithmFixture.java index 88892b9a046bd..2c802ce353e0e 100644 --- a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITStandardShardingAlgorithmFixture.java +++ b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITStandardShardingAlgorithmFixture.java @@ -44,7 +44,7 @@ public Collection doSharding(final Collection availableTargetNam int maxValue = shardingValue.getValueRange().hasUpperBound() ? shardingValue.getValueRange().upperEndpoint() : Integer.MAX_VALUE; long range = BigInteger.valueOf(maxValue).subtract(BigInteger.valueOf(minValue)).longValue(); int begin = Math.abs(minValue) % 10; - if (range > 9) { + if (range > 9L) { return availableTargetNames; } for (int i = begin; i <= range; i += 1) { diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java index defd2d5bfef20..5d5ca34916fcf 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java @@ -245,7 +245,7 @@ public void registerStorageUnit(final String storageUnitName) throws SQLExceptio .replace("${url}", getActualJdbcUrlTemplate(storageUnitName, true)); proxyExecuteWithLog(registerStorageUnitTemplate, 0); int timeout = databaseType instanceof OpenGaussDatabaseType ? 60 : 10; - Awaitility.await().ignoreExceptions().atMost(timeout, TimeUnit.SECONDS).pollInterval(3, TimeUnit.SECONDS).until(() -> showStorageUnitsName().contains(storageUnitName)); + Awaitility.await().ignoreExceptions().atMost(timeout, TimeUnit.SECONDS).pollInterval(3L, TimeUnit.SECONDS).until(() -> showStorageUnitsName().contains(storageUnitName)); } /** @@ -473,11 +473,11 @@ public List> queryForListWithLog(final DataSource dataSource */ public List> transformResultSetToList(final ResultSet resultSet) throws SQLException { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); - int columns = resultSetMetaData.getColumnCount(); + int columnCount = resultSetMetaData.getColumnCount(); List> result = new ArrayList<>(); while (resultSet.next()) { - Map row = new HashMap<>(); - for (int i = 1; i <= columns; i++) { + Map row = new HashMap<>(columnCount, 1F); + for (int i = 1; i <= columnCount; i++) { row.put(resultSetMetaData.getColumnLabel(i).toLowerCase(), resultSet.getObject(i)); } result.add(row); @@ -506,7 +506,7 @@ public List> waitIncrementTaskFinished(final String distSQL) for (int i = 0; i < 10; i++) { List> listJobStatus = queryForListWithLog(distSQL); log.info("show status result: {}", listJobStatus); - Set actualStatus = new HashSet<>(); + Set actualStatus = new HashSet<>(listJobStatus.size(), 1F); Collection incrementalIdleSecondsList = new LinkedList<>(); for (Map each : listJobStatus) { assertTrue(Strings.isNullOrEmpty((String) each.get("error_message")), "error_message: `" + each.get("error_message") + "`"); diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/DataSourceRecordConsumer.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/DataSourceRecordConsumer.java index eab65bb2ce8ef..f7a43258d831c 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/DataSourceRecordConsumer.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/DataSourceRecordConsumer.java @@ -53,13 +53,12 @@ public final class DataSourceRecordConsumer implements Consumer> { private final DataSource dataSource; - private final Map tableMetaDataMap; - private final StandardPipelineTableMetaDataLoader loader; + private final Map tableMetaDataMap = new ConcurrentHashMap<>(); + public DataSourceRecordConsumer(final DataSource dataSource, final DatabaseType databaseType) { this.dataSource = dataSource; - tableMetaDataMap = new ConcurrentHashMap<>(); loader = new StandardPipelineTableMetaDataLoader(new PipelineDataSourceWrapper(dataSource, databaseType)); } @@ -79,7 +78,7 @@ public void accept(final List records) { private void processRecords(final List records, final Connection connection) throws SQLException { long insertCount = records.stream().filter(each -> DataChangeType.INSERT == each.getDataChangeType()).count(); if (insertCount == records.size()) { - Map> recordsMap = new HashMap<>(); + Map> recordsMap = new HashMap<>(records.size(), 1F); for (Record each : records) { String key = buildTableNameWithSchema(each.getMetaData().getTable(), each.getMetaData().getSchema()); recordsMap.computeIfAbsent(key, ignored -> new LinkedList<>()).add(each); @@ -182,7 +181,7 @@ private String buildSQL(final Record ingestedRecord) { case DELETE: return SQLBuilderUtils.buildDeleteSQL(tableName, "order_id"); default: - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(""); } } diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java index c0b5f39743430..99c2acc6ede91 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java @@ -82,7 +82,7 @@ void assertMigrationSuccess(final PipelineTestParameter testParam) throws SQLExc containerComposer.waitJobPrepareSuccess(String.format("SHOW MIGRATION STATUS '%s'", orderJobId)); containerComposer.startIncrementTask( new E2EIncrementalTask(containerComposer.getSourceDataSource(), SOURCE_TABLE_NAME, new SnowflakeKeyGenerateAlgorithm(), containerComposer.getDatabaseType(), 30)); - TimeUnit.SECONDS.timedJoin(containerComposer.getIncreaseTaskThread(), 30); + TimeUnit.SECONDS.timedJoin(containerComposer.getIncreaseTaskThread(), 30L); containerComposer.sourceExecuteWithLog(String.format("INSERT INTO %s (order_id, user_id, status) VALUES (10000, 1, 'OK')", SOURCE_TABLE_NAME)); containerComposer.sourceExecuteWithLog("INSERT INTO t_order_item (item_id, order_id, user_id, status) VALUES (10000, 10000, 1, 'OK')"); stopMigrationByJobId(containerComposer, orderJobId); diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java index 0b9cf90772a31..1dd4a33fc4c03 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java @@ -90,7 +90,7 @@ void assertMigrationSuccess(final PipelineTestParameter testParam) throws SQLExc String schemaTableName = String.join(".", PipelineContainerComposer.SCHEMA_NAME, SOURCE_TABLE_NAME); containerComposer.startIncrementTask(new E2EIncrementalTask(containerComposer.getSourceDataSource(), schemaTableName, new SnowflakeKeyGenerateAlgorithm(), containerComposer.getDatabaseType(), 20)); - TimeUnit.SECONDS.timedJoin(containerComposer.getIncreaseTaskThread(), 30); + TimeUnit.SECONDS.timedJoin(containerComposer.getIncreaseTaskThread(), 30L); containerComposer.sourceExecuteWithLog(String.format("INSERT INTO %s (order_id, user_id, status) VALUES (10000, 1, 'OK')", schemaTableName)); DataSource jdbcDataSource = containerComposer.generateShardingSphereDataSourceFromProxy(); containerComposer.assertOrderRecordExist(jdbcDataSource, schemaTableName, 10000); diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java index 6b124a232b8eb..a187e1de41def 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java @@ -75,7 +75,7 @@ void assertMySQLToPostgreSQLMigrationSuccess(final PipelineTestParameter testPar + "KEY_GENERATE_STRATEGY(COLUMN=order_id, TYPE(NAME='snowflake')))", 2); initTargetTable(containerComposer); containerComposer.proxyExecuteWithLog("MIGRATE TABLE source_ds.t_order INTO t_order", 2); - Awaitility.await().ignoreExceptions().atMost(10, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(() -> !listJobId(containerComposer).isEmpty()); + Awaitility.await().ignoreExceptions().atMost(10L, TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS).until(() -> !listJobId(containerComposer).isEmpty()); String jobId = listJobId(containerComposer).get(0); containerComposer.waitJobStatusReached(String.format("SHOW MIGRATION STATUS %s", jobId), JobStatus.EXECUTE_INCREMENTAL_TASK, 15); try (Connection connection = DriverManager.getConnection(jdbcUrl, "postgres", "postgres")) { diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java index a5d332530367b..340f276e36949 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java @@ -106,7 +106,7 @@ private void insertOrder(final Object[] orderInsertData) { } else if (databaseType instanceof OpenGaussDatabaseType) { sql = SQLBuilderUtils.buildInsertSQL(OPENGAUSS_COLUMN_NAMES, orderTableName); } else { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(""); } DataSourceExecuteUtils.execute(dataSource, sql, orderInsertData); } @@ -124,7 +124,7 @@ private void doIncrementalChanges(final Object orderId, final List testP private void setTestParameters(final Map testParams, final TransactionTestCaseRegistry registry, final String databaseVersion, final TransactionType transactionType, final String scenario, final Class caseClass) { - if (TransactionType.LOCAL.equals(transactionType)) { + if (TransactionType.LOCAL == transactionType) { setTestParameters(testParams, registry, databaseVersion, Collections.singletonList(transactionType), Collections.singletonList(""), scenario, caseClass); return; } - if (TransactionType.XA.equals(transactionType)) { + if (TransactionType.XA == transactionType) { for (String each : ENV.getAllowXAProviders().isEmpty() ? ALL_XA_PROVIDERS : ENV.getAllowXAProviders()) { setTestParameters(testParams, registry, databaseVersion, Collections.singletonList(transactionType), Collections.singletonList(each), scenario, caseClass); } diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionTestCase.java index b213564f7ed91..65ed8e0ae8e61 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionTestCase.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionTestCase.java @@ -28,7 +28,7 @@ * It represents a class to be tested for transaction integration. */ @Target(ElementType.TYPE) -@Retention(value = RetentionPolicy.RUNTIME) +@Retention(RetentionPolicy.RUNTIME) public @interface TransactionTestCase { /** diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java index 6df21b9757e36..483c1bdd4e0de 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java @@ -76,7 +76,7 @@ private TransactionE2EEnvironment() { } private Map initTransactionTestCaseRegistryMap() { - Map result = new HashMap<>(TransactionTestCaseRegistry.values().length, 1); + Map result = new HashMap<>(TransactionTestCaseRegistry.values().length, 1F); for (TransactionTestCaseRegistry each : TransactionTestCaseRegistry.values()) { result.put(each.getTestCaseClass().getName(), each); } diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/BaseContainerComposer.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/BaseContainerComposer.java index b98eac6adfc84..7cc3b4c130a2b 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/BaseContainerComposer.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/BaseContainerComposer.java @@ -27,7 +27,7 @@ public abstract class BaseContainerComposer implements Startable { private final ITContainers containers; protected BaseContainerComposer(final String scenario) { - this.containers = new ITContainers(scenario); + containers = new ITContainers(scenario); } @Override diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java index 683e9759acf45..bbf1a841d661b 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/compose/DockerContainerComposer.java @@ -56,7 +56,7 @@ public final class DockerContainerComposer extends BaseContainerComposer { public DockerContainerComposer(final TransactionTestParameter testParam) { super(testParam.getScenario()); - this.databaseType = testParam.getDatabaseType(); + databaseType = testParam.getDatabaseType(); governanceContainer = getContainers().registerContainer(new ZookeeperContainer()); storageContainer = getContainers().registerContainer((DockerStorageContainer) StorageContainerFactory.newInstance(databaseType, testParam.getStorageContainerImage(), StorageContainerConfigurationFactory.newInstance(databaseType, testParam.getScenario()))); diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java index adfc0f56eed41..aca46ec0f7c63 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/mysql/MySQLContainerConfigurationFactory.java @@ -61,7 +61,7 @@ private static Map getContainerEnvironments() { } private static Map getMountedResources(final String scenario) { - Map result = new HashMap<>(); + Map result = new HashMap<>(3, 1F); result.put(new ScenarioDataPath(scenario).getInitSQLResourcePath(Type.ACTUAL, TypedSPILoader.getService(DatabaseType.class, "MySQL")) + "/01-actual-init.sql", "/docker-entrypoint-initdb.d/01-actual-init.sql"); result.put(new ScenarioDataPath(scenario).getInitSQLResourcePath(Type.EXPECTED, TypedSPILoader.getService(DatabaseType.class, "MySQL")) + "/01-expected-init.sql", diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java index 060256c773af2..6c05dd8a24cf2 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/util/TestCaseClassScanner.java @@ -108,8 +108,8 @@ private static void addTestCaseClassesInJars(final URL url, final List true); + Awaitility.await().atMost(Duration.ofMinutes(5L)).pollDelay(testParam.getTestCaseContext().getTestCase().getDelayAssertionSeconds(), TimeUnit.SECONDS).until(() -> true); } if (isUseXMLAsExpectedDataset()) { assertExecuteQueryWithXmlExpected(testParam, containerComposer); @@ -130,7 +130,7 @@ void assertExecute(final AssertionTestParameter testParam) throws SQLException, SingleE2EContainerComposer containerComposer = new SingleE2EContainerComposer(testParam); init(testParam, containerComposer); if (null != testParam.getTestCaseContext().getTestCase().getDelayAssertionSeconds()) { - Awaitility.await().atMost(Duration.ofMinutes(5)).pollDelay(testParam.getTestCaseContext().getTestCase().getDelayAssertionSeconds(), TimeUnit.SECONDS).until(() -> true); + Awaitility.await().atMost(Duration.ofMinutes(5L)).pollDelay(testParam.getTestCaseContext().getTestCase().getDelayAssertionSeconds(), TimeUnit.SECONDS).until(() -> true); } if (isUseXMLAsExpectedDataset()) { assertExecuteWithXmlExpected(testParam, containerComposer); diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java index a14446633e6b6..df1385e293103 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java @@ -342,7 +342,7 @@ public static void assertFunction(final SQLCaseAssertContext assertContext, fina Iterator expectedIterator = expected.getParameters().iterator(); Iterator actualIterator = actual.getParameters().iterator(); while (expectedIterator.hasNext()) { - ExpressionAssert.assertExpression(assertContext, actualIterator.next(), expectedIterator.next()); + assertExpression(assertContext, actualIterator.next(), expectedIterator.next()); } if (null != expected.getOwner()) { OwnerAssert.assertIs(assertContext, actual.getOwner(), expected.getOwner()); @@ -583,7 +583,7 @@ private static void assertXmlQueryAndExistsFunctionSegment(final SQLCaseAssertCo Iterator expectedIterator = expected.getParameters().iterator(); Iterator actualIterator = actual.getParameters().iterator(); while (expectedIterator.hasNext()) { - ExpressionAssert.assertExpression(assertContext, actualIterator.next(), expectedIterator.next()); + assertExpression(assertContext, actualIterator.next(), expectedIterator.next()); } } diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/hint/WithTableHintClauseAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/hint/WithTableHintClauseAssert.java index 997b8473fe1ee..54d9201b6ecb1 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/hint/WithTableHintClauseAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/hint/WithTableHintClauseAssert.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.hint.ExpectedTableHint; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.hint.ExpectedWithTableHintClause; -import org.hamcrest.CoreMatchers; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -46,7 +46,7 @@ public final class WithTableHintClauseAssert { */ public static void assertIs(final SQLCaseAssertContext assertContext, final WithTableHintSegment actual, final ExpectedWithTableHintClause expected) { if (null == expected.getTableHint()) { - assertThat(assertContext.getText("with table hint clause assertion error: "), actual.getTableHintLimitedSegments().size(), CoreMatchers.is(expected.getTableHint().size())); + assertThat(assertContext.getText("with table hint clause assertion error: "), actual.getTableHintLimitedSegments().size(), is(expected.getTableHint().size())); } else { int count = 0; for (TableHintLimitedSegment each : actual.getTableHintLimitedSegments()) { diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/insert/InsertExecClauseAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/insert/InsertExecClauseAssert.java index 940bacbe85fb2..9b22330616ebc 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/insert/InsertExecClauseAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/insert/InsertExecClauseAssert.java @@ -36,7 +36,7 @@ * Insert execute clause assert. **/ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public class InsertExecClauseAssert { +public final class InsertExecClauseAssert { /** * Assert actual execute segment is correct with expected execute clause. diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/owner/OwnerAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/owner/OwnerAssert.java index 4b3ff9baf27c2..a9491f46de2e4 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/owner/OwnerAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/owner/OwnerAssert.java @@ -48,7 +48,7 @@ public static void assertIs(final SQLCaseAssertContext assertContext, final Owne assertFalse(actual.getOwner().isPresent(), assertContext.getText("Actual owner should not exist.")); } else { assertTrue(actual.getOwner().isPresent(), assertContext.getText("Actual owner should exist.")); - OwnerAssert.assertIs(assertContext, actual.getOwner().get(), expected.getOwner()); + assertIs(assertContext, actual.getOwner().get(), expected.getOwner()); } } } diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/AlterTransmissionRuleStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/AlterTransmissionRuleStatementAssert.java index 4de7e97bee7ee..0e37c6635343a 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/AlterTransmissionRuleStatementAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/AlterTransmissionRuleStatementAssert.java @@ -37,7 +37,7 @@ * Alter transmission rule statement assert. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public class AlterTransmissionRuleStatementAssert { +public final class AlterTransmissionRuleStatementAssert { /** * Assert statement is correct with expected parser result. diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/common/metadata/loader/StandardPipelineTableMetaDataLoaderTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/common/metadata/loader/StandardPipelineTableMetaDataLoaderTest.java index 876019a8d9111..cae26d5244dcf 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/common/metadata/loader/StandardPipelineTableMetaDataLoaderTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/common/metadata/loader/StandardPipelineTableMetaDataLoaderTest.java @@ -56,8 +56,8 @@ private HikariDataSource createHikariDataSource() { result.setPassword("root"); result.setMaximumPoolSize(10); result.setMinimumIdle(2); - result.setConnectionTimeout(15 * 1000L); - result.setIdleTimeout(40 * 1000L); + result.setConnectionTimeout(15L * 1000L); + result.setIdleTimeout(40L * 1000L); return result; } diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculatorTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculatorTest.java index 027fad9e991ff..b57af6a326b9c 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculatorTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculatorTest.java @@ -65,8 +65,8 @@ private static HikariDataSource createHikariDataSource(final String databaseName result.setPassword("root"); result.setMaximumPoolSize(10); result.setMinimumIdle(2); - result.setConnectionTimeout(15 * 1000); - result.setIdleTimeout(40 * 1000); + result.setConnectionTimeout(15L * 1000L); + result.setIdleTimeout(40L * 1000L); return result; } diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/EmbedTestingServer.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/EmbedTestingServer.java index f8149eeb54479..7349f235dec63 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/EmbedTestingServer.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/EmbedTestingServer.java @@ -69,10 +69,10 @@ private static void start0() { // CHECKSTYLE:OFF } catch (final Exception ex) { // CHECKSTYLE:ON - if (!isIgnoredException(ex)) { - throw new RuntimeException(ex); - } else { + if (isIgnoredException(ex)) { log.warn("Start embed zookeeper server got exception: {}", ex.getMessage()); + } else { + throw new RuntimeException(ex); } } finally { Runtime.getRuntime().addShutdownHook(new Thread(() -> { diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/algorithm/FixtureTransmissionJobItemContext.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/algorithm/FixtureTransmissionJobItemContext.java index 23ed37f9ec158..bea381310b39c 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/algorithm/FixtureTransmissionJobItemContext.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/algorithm/FixtureTransmissionJobItemContext.java @@ -67,7 +67,7 @@ public PipelineSink getSink() { @Override public long getProcessedRecordsCount() { - return 0; + return 0L; } @Override @@ -76,7 +76,7 @@ public void updateInventoryRecordsCount(final long recordsCount) { @Override public long getInventoryRecordsCount() { - return 0; + return 0L; } @Override diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/registrycenter/repository/PipelineGovernanceFacadeTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/registrycenter/repository/PipelineGovernanceFacadeTest.java index b7c263eef3163..c53465661d144 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/registrycenter/repository/PipelineGovernanceFacadeTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/registrycenter/repository/PipelineGovernanceFacadeTest.java @@ -89,7 +89,7 @@ private static void watch() { void assertWatch() throws InterruptedException { String key = PipelineNodePath.DATA_PIPELINE_ROOT + "/1"; getClusterPersistRepository().persist(key, ""); - boolean awaitResult = COUNT_DOWN_LATCH.await(10, TimeUnit.SECONDS); + boolean awaitResult = COUNT_DOWN_LATCH.await(10L, TimeUnit.SECONDS); assertTrue(awaitResult); DataChangedEvent event = EVENT_ATOMIC_REFERENCE.get(); assertNotNull(event); diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java index 97199882f405d..dff879eb38de7 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/IncrementalTaskTest.java @@ -67,7 +67,7 @@ void tearDown() { @Test @Disabled("H2 doesn't support incremental") void assertStart() throws ExecutionException, InterruptedException, TimeoutException { - CompletableFuture.allOf(incrementalTask.start().toArray(new CompletableFuture[0])).get(10, TimeUnit.SECONDS); + CompletableFuture.allOf(incrementalTask.start().toArray(new CompletableFuture[0])).get(10L, TimeUnit.SECONDS); assertThat(incrementalTask.getTaskId(), is("ds_0")); assertThat(incrementalTask.getTaskProgress().getPosition(), instanceOf(IngestPlaceholderPosition.class)); } diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/InventoryTaskTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/InventoryTaskTest.java index 582e39ae3de79..a2c28dc913462 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/InventoryTaskTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/task/InventoryTaskTest.java @@ -101,8 +101,9 @@ private InventoryDumperContext createInventoryDumperContext(final String logicTa result.setLogicTableName(logicTableName); result.setActualTableName(actualTableName); result.setUniqueKeyColumns(Collections.singletonList(PipelineContextUtils.mockOrderIdColumnMetaData())); - result.getCommonContext().setPosition( - null == taskConfig.getDumperContext().getCommonContext().getPosition() ? new IntegerPrimaryKeyIngestPosition(0, 1000) : taskConfig.getDumperContext().getCommonContext().getPosition()); + result.getCommonContext().setPosition(null == taskConfig.getDumperContext().getCommonContext().getPosition() + ? new IntegerPrimaryKeyIngestPosition(0L, 1000L) + : taskConfig.getDumperContext().getCommonContext().getPosition()); return result; } } diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineDistributedBarrierTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineDistributedBarrierTest.java index b4e15b29791cf..385bfca89c88f 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineDistributedBarrierTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/util/PipelineDistributedBarrierTest.java @@ -66,10 +66,10 @@ void assertAwait() { String barrierEnablePath = PipelineMetaDataNode.getJobBarrierEnablePath(jobId); instance.register(barrierEnablePath, 1); instance.persistEphemeralChildrenNode(barrierEnablePath, 1); - boolean actual = instance.await(barrierEnablePath, 1, TimeUnit.SECONDS); + boolean actual = instance.await(barrierEnablePath, 1L, TimeUnit.SECONDS); assertFalse(actual); instance.notifyChildrenNodeCountCheck(barrierEnablePath + "/0"); - actual = instance.await(barrierEnablePath, 1, TimeUnit.SECONDS); + actual = instance.await(barrierEnablePath, 1L, TimeUnit.SECONDS); assertTrue(actual); } } diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java index 362556cac2b5d..5c807362a7f76 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java @@ -331,8 +331,8 @@ void assertGetJobItemInfosAtIncrementTask() { YamlTransmissionJobItemProgress yamlJobItemProgress = new YamlTransmissionJobItemProgress(); yamlJobItemProgress.setSourceDatabaseType("MySQL"); yamlJobItemProgress.setStatus(JobStatus.EXECUTE_INCREMENTAL_TASK.name()); - yamlJobItemProgress.setProcessedRecordsCount(100); - yamlJobItemProgress.setInventoryRecordsCount(50); + yamlJobItemProgress.setProcessedRecordsCount(100L); + yamlJobItemProgress.setInventoryRecordsCount(50L); PipelineAPIFactory.getPipelineGovernanceFacade(PipelineContextUtils.getContextKey()).getJobItemFacade().getProcess().persist(jobConfig.getJobId(), 0, YamlEngine.marshal(yamlJobItemProgress)); Collection jobItemInfos = transmissionJobManager.getJobItemInfos(jobConfig.getJobId()); TransmissionJobItemInfo jobItemInfo = jobItemInfos.stream().iterator().next(); diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/yaml/YamlMigrationJobConfigurationSwapperTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/yaml/YamlMigrationJobConfigurationSwapperTest.java index fa77e18dde8d8..290f64de39c9a 100644 --- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/yaml/YamlMigrationJobConfigurationSwapperTest.java +++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/yaml/YamlMigrationJobConfigurationSwapperTest.java @@ -30,7 +30,7 @@ class YamlMigrationJobConfigurationSwapperTest { @Test - void assertMarsharlUnmarshal() { + void assertMarshalUnmarshal() { YamlMigrationJobConfiguration yamlJobConfig = JobConfigurationBuilder.createYamlMigrationJobConfiguration(); YamlMigrationJobConfigurationSwapper swapper = new YamlMigrationJobConfigurationSwapper(); MigrationJobConfiguration jobConfig = swapper.swapToObject(yamlJobConfig); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java index 420d449a5b44d..c9ca62e18d7cd 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/TestShardingService.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; @@ -76,11 +77,11 @@ public void processSuccess() throws SQLException { assertThat(orderItems.stream().map(OrderItem::getStatus).collect(Collectors.toList()), equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); assertThat(addressRepository.selectAll(), - equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + equalTo(LongStream.range(1L, 11L).mapToObj(each -> new Address(each, "address_test_" + each)).collect(Collectors.toList()))); deleteData(orderIds); - assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(orderRepository.selectAll(), equalTo(Collections.emptyList())); + assertThat(orderItemRepository.selectAll(), equalTo(Collections.emptyList())); + assertThat(addressRepository.selectAll(), equalTo(Collections.emptyList())); orderItemRepository.assertRollbackWithTransactions(); } @@ -119,7 +120,7 @@ public Collection insertData() throws SQLException { * @throws SQLException An exception that provides information on a database access error or other errors. */ public void deleteData(final Collection orderIds) throws SQLException { - long count = 1; + long count = 1L; for (Long each : orderIds) { orderRepository.delete(each); orderItemRepository.delete(each); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java index 289ebfe00971a..491169fa155d0 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java @@ -69,7 +69,7 @@ void assertShardingInLocalTransactions() throws SQLException { jdbcUrlPrefix = "jdbc:mysql://localhost:" + container.getMappedPort(3306) + "/"; DataSource dataSource = createDataSource(); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } @@ -93,7 +93,7 @@ private Connection openConnection() throws SQLException { @SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"}) private DataSource createDataSource() { - Awaitility.await().atMost(Duration.ofMinutes(1)).ignoreExceptionsMatching(e -> e instanceof CommunicationsException) + Awaitility.await().atMost(Duration.ofMinutes(1L)).ignoreExceptionsMatching(e -> e instanceof CommunicationsException) .until(() -> { openConnection().close(); return true; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java index ac0609fba464c..edff542ce3e58 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java @@ -63,7 +63,7 @@ void assertShardingInLocalTransactions() throws SQLException { jdbcUrlPrefix = "jdbc:opengauss://localhost:" + openGaussContainer.getMappedPort(5432) + "/"; DataSource dataSource = createDataSource(); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } @@ -87,7 +87,7 @@ private Connection openConnection() throws SQLException { @SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"}) private DataSource createDataSource() { - Awaitility.await().atMost(Duration.ofMinutes(1)).ignoreExceptions().until(() -> { + Awaitility.await().atMost(Duration.ofMinutes(1L)).ignoreExceptions().until(() -> { openConnection().close(); return true; }); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java index 4860c4aea3398..a9852c3ca31da 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java @@ -38,7 +38,7 @@ void assertShardingInLocalTransactions() throws SQLException { config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/databases/postgresql.yaml"); DataSource dataSource = new HikariDataSource(config); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java index a86bb139833ac..85cda9696060d 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java @@ -38,7 +38,7 @@ void assertShardingInLocalTransactions() throws SQLException { config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/databases/sqlserver.yaml"); DataSource dataSource = new HikariDataSource(config); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java index d8e6c9bb6189d..bd6a2874ce42f 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java @@ -55,9 +55,9 @@ void assertEncryptInLocalTransactions() throws SQLException { orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); - this.initEnvironment(); - this.processSuccess(); - this.cleanEnvironment(); + initEnvironment(); + processSuccess(); + cleanEnvironment(); } private void initEnvironment() throws SQLException { @@ -72,11 +72,11 @@ private void initEnvironment() throws SQLException { private void processSuccess() throws SQLException { final Collection orderIds = insertData(); assertThat(orderRepository.selectAll(), - equalTo(IntStream.range(1, 11).mapToObj(i -> new Order(i, i % 2, i, i, "INSERT_TEST")).collect(Collectors.toList()))); + equalTo(IntStream.range(1, 11).mapToObj(each -> new Order(each, each % 2, each, each, "INSERT_TEST")).collect(Collectors.toList()))); assertThat(orderItemRepository.selectAll(), - equalTo(IntStream.range(1, 11).mapToObj(i -> new OrderItem(i, i, i, "13800000001", "INSERT_TEST")).collect(Collectors.toList()))); + equalTo(IntStream.range(1, 11).mapToObj(each -> new OrderItem(each, each, each, "13800000001", "INSERT_TEST")).collect(Collectors.toList()))); assertThat(addressRepository.selectAll(), - equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + equalTo(LongStream.range(1L, 11L).mapToObj(each -> new Address(each, "address_test_" + each)).collect(Collectors.toList()))); deleteData(orderIds); assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); @@ -106,7 +106,7 @@ private Collection insertData() throws SQLException { } private void deleteData(final Collection orderIds) throws SQLException { - long count = 1; + long count = 1L; for (Long each : orderIds) { orderRepository.delete(each); orderItemRepository.delete(each); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java index 5f9a6742c363b..f6fbd6320c48c 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java @@ -31,6 +31,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; @@ -55,9 +56,9 @@ void assertMaskInLocalTransactions() throws SQLException { orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); - this.initEnvironment(); - this.processSuccess(); - this.cleanEnvironment(); + initEnvironment(); + processSuccess(); + cleanEnvironment(); } private void initEnvironment() throws SQLException { @@ -72,15 +73,15 @@ private void initEnvironment() throws SQLException { private void processSuccess() throws SQLException { final Collection orderIds = insertData(); assertThat(orderRepository.selectAll(), - equalTo(IntStream.range(1, 11).mapToObj(i -> new Order(i, i % 2, i, i, "INSERT_TEST")).collect(Collectors.toList()))); + equalTo(IntStream.range(1, 11).mapToObj(each -> new Order(each, each % 2, each, each, "INSERT_TEST")).collect(Collectors.toList()))); assertThat(orderItemRepository.selectAll(), - equalTo(IntStream.range(1, 11).mapToObj(i -> new OrderItem(i, i, i, "138****0001", "INSERT_TEST")).collect(Collectors.toList()))); + equalTo(IntStream.range(1, 11).mapToObj(each -> new OrderItem(each, each, each, "138****0001", "INSERT_TEST")).collect(Collectors.toList()))); assertThat(addressRepository.selectAll(), - equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + equalTo(LongStream.range(1L, 11L).mapToObj(each -> new Address(each, "address_test_" + each)).collect(Collectors.toList()))); deleteData(orderIds); - assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(orderRepository.selectAll(), equalTo(Collections.emptyList())); + assertThat(orderItemRepository.selectAll(), equalTo(Collections.emptyList())); + assertThat(addressRepository.selectAll(), equalTo(Collections.emptyList())); } private Collection insertData() throws SQLException { diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java index e83e9e0a5a4f7..d2c52b66a6556 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java @@ -52,9 +52,9 @@ void assertReadWriteSplittingInLocalTransactions() throws SQLException { orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); - this.initEnvironment(); - this.processSuccess(); - this.cleanEnvironment(); + initEnvironment(); + processSuccess(); + cleanEnvironment(); } private void initEnvironment() throws SQLException { diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java index fea3bb471da79..f195e623f0f00 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java @@ -56,9 +56,9 @@ void assertShadowInLocalTransactions() throws SQLException { orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); - this.initEnvironment(); - this.processSuccess(); - this.cleanEnvironment(); + initEnvironment(); + processSuccess(); + cleanEnvironment(); } private void initEnvironment() throws SQLException { @@ -74,34 +74,34 @@ private void initEnvironment() throws SQLException { private void processSuccess() throws SQLException { final Collection orderIds = insertData(); - assertThat(this.selectAll(), equalTo(Arrays.asList( - new Order(1, 0, 2, 2, "INSERT_TEST"), - new Order(2, 0, 4, 4, "INSERT_TEST"), - new Order(3, 0, 6, 6, "INSERT_TEST"), - new Order(4, 0, 8, 8, "INSERT_TEST"), - new Order(5, 0, 10, 10, "INSERT_TEST"), - new Order(1, 1, 1, 1, "INSERT_TEST"), - new Order(2, 1, 3, 3, "INSERT_TEST"), - new Order(3, 1, 5, 5, "INSERT_TEST"), - new Order(4, 1, 7, 7, "INSERT_TEST"), - new Order(5, 1, 9, 9, "INSERT_TEST")))); + assertThat(selectAll(), equalTo(Arrays.asList( + new Order(1L, 0, 2, 2L, "INSERT_TEST"), + new Order(2L, 0, 4, 4L, "INSERT_TEST"), + new Order(3L, 0, 6, 6L, "INSERT_TEST"), + new Order(4L, 0, 8, 8L, "INSERT_TEST"), + new Order(5L, 0, 10, 10L, "INSERT_TEST"), + new Order(1L, 1, 1, 1L, "INSERT_TEST"), + new Order(2L, 1, 3, 3L, "INSERT_TEST"), + new Order(3L, 1, 5, 5L, "INSERT_TEST"), + new Order(4L, 1, 7, 7L, "INSERT_TEST"), + new Order(5L, 1, 9, 9L, "INSERT_TEST")))); assertThat(orderItemRepository.selectAll(), equalTo(Arrays.asList( - new OrderItem(1, 1, 1, "13800000001", "INSERT_TEST"), - new OrderItem(2, 1, 2, "13800000001", "INSERT_TEST"), - new OrderItem(3, 2, 3, "13800000001", "INSERT_TEST"), - new OrderItem(4, 2, 4, "13800000001", "INSERT_TEST"), - new OrderItem(5, 3, 5, "13800000001", "INSERT_TEST"), - new OrderItem(6, 3, 6, "13800000001", "INSERT_TEST"), - new OrderItem(7, 4, 7, "13800000001", "INSERT_TEST"), - new OrderItem(8, 4, 8, "13800000001", "INSERT_TEST"), - new OrderItem(9, 5, 9, "13800000001", "INSERT_TEST"), - new OrderItem(10, 5, 10, "13800000001", "INSERT_TEST")))); + new OrderItem(1L, 1L, 1, "13800000001", "INSERT_TEST"), + new OrderItem(2L, 1L, 2, "13800000001", "INSERT_TEST"), + new OrderItem(3L, 2L, 3, "13800000001", "INSERT_TEST"), + new OrderItem(4L, 2L, 4, "13800000001", "INSERT_TEST"), + new OrderItem(5L, 3L, 5, "13800000001", "INSERT_TEST"), + new OrderItem(6L, 3L, 6, "13800000001", "INSERT_TEST"), + new OrderItem(7L, 4L, 7, "13800000001", "INSERT_TEST"), + new OrderItem(8L, 4L, 8, "13800000001", "INSERT_TEST"), + new OrderItem(9L, 5L, 9, "13800000001", "INSERT_TEST"), + new OrderItem(10L, 5L, 10, "13800000001", "INSERT_TEST")))); assertThat(addressRepository.selectAll(), - equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + equalTo(LongStream.range(1L, 11L).mapToObj(each -> new Address(each, "address_test_" + each)).collect(Collectors.toList()))); deleteData(orderIds); - assertThat(this.selectAll(), equalTo(Collections.singletonList(new Order(1, 0, 2, 2, "INSERT_TEST")))); - assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(selectAll(), equalTo(Collections.singletonList(new Order(1L, 0, 2, 2L, "INSERT_TEST")))); + assertThat(orderItemRepository.selectAll(), equalTo(Collections.emptyList())); + assertThat(addressRepository.selectAll(), equalTo(Collections.emptyList())); } private Collection insertData() throws SQLException { @@ -127,7 +127,7 @@ private Collection insertData() throws SQLException { } private void deleteData(final Collection orderIds) throws SQLException { - long count = 1; + long count = 1L; for (Long each : orderIds) { orderRepository.deleteShadow(each); orderRepository.delete(each); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java index 79e34f4347044..99d18af28438b 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java @@ -36,7 +36,7 @@ void assertShardingInLocalTransactions() throws SQLException { config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/features/sharding.yaml"); DataSource dataSource = new HikariDataSource(config); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java index a84a82dcabb49..b3f0b73301ade 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java @@ -51,7 +51,7 @@ void assertShardingInSeataTransactions() throws SQLException { container.start(); DataSource dataSource = createDataSource(); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/AtomikosTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/AtomikosTest.java index 9c07794f55ca7..9df766bec81e6 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/AtomikosTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/AtomikosTest.java @@ -36,7 +36,7 @@ void assertShardingInAtomikosTransactions() throws SQLException { config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/transactions/xa/atomikos.yaml"); DataSource dataSource = new HikariDataSource(config); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); } diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/NarayanaTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/NarayanaTest.java index 48073f62fcc3e..87993a5215099 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/NarayanaTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/xa/NarayanaTest.java @@ -39,7 +39,7 @@ void assertShardingInNarayanaTransactions() throws SQLException, CoreEnvironment config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/transactions/xa/narayana.yaml"); DataSource dataSource = new HikariDataSource(config); testShardingService = new TestShardingService(dataSource); - this.initEnvironment(); + initEnvironment(); testShardingService.processSuccess(); testShardingService.cleanEnvironment(); }