You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/03/24 11:07:30 UTC
[shardingsphere] branch master updated: Add javadoc for IT test
engine (#9804)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 81e0d7a Add javadoc for IT test engine (#9804)
81e0d7a is described below
commit 81e0d7a04ada5a9638fc554f3bde5fe8ddcf784e
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Mar 24 19:06:51 2021 +0800
Add javadoc for IT test engine (#9804)
---
.../test/integration/common/ExecutionMode.java | 3 +++
.../junit/annotation/BeforeAllCases.java | 1 -
.../junit/annotation/ContainerInitializer.java | 4 ++-
.../junit/annotation/ContainerType.java | 9 +++----
.../integration/junit/annotation/OnContainer.java | 1 -
.../junit/annotation/ParameterFilter.java | 4 ++-
.../junit/annotation/ShardingSphereITInject.java | 1 -
.../annotation/ShardingSphereITStorageType.java | 3 +++
.../integration/junit/annotation/TestCaseSpec.java | 4 ++-
.../integration/junit/annotation/XmlResource.java | 6 +++--
.../junit/compose/ContainerCompose.java | 28 ++++++++++----------
.../junit/compose/NotSupportedException.java | 21 ---------------
.../integration/junit/container/H2Container.java | 5 +++-
.../junit/container/MySQLContainer.java | 4 +--
.../junit/container/NativeStorageContainer.java | 5 +++-
.../junit/container/PostgreSQLContainer.java | 6 +++--
.../container/ShardingSphereAdapterContainer.java | 4 ++-
.../junit/container/ShardingSphereContainer.java | 12 +++++----
.../container/ShardingSphereJDBCContainer.java | 14 +++++-----
.../container/ShardingSphereProxyContainer.java | 8 +++---
.../container/ShardingSphereStorageContainer.java | 2 +-
.../integration/junit/logging/ContainerLogs.java | 15 +++++------
.../junit/param/ParameterizedArrayFactory.java | 1 -
.../junit/param/TestCaseParameters.java | 8 +++---
.../junit/processor/AuthenticationProcessor.java | 8 +++---
.../junit/processor/DatabaseProcessor.java | 6 +++--
.../integration/junit/processor/Processor.java | 6 ++++-
.../junit/runner/ShardingSphereCISubRunner.java | 12 +++++----
.../junit/runner/ShardingSphereITSubRunner.java | 12 +++++----
.../junit/runner/ShardingSphereRunner.java | 30 ++++++++++------------
.../junit/runner/TestCaseBeanContext.java | 5 +++-
.../junit/runner/TestCaseDescription.java | 12 +++++----
.../test/integration/engine/it/SingleITCase.java | 1 -
.../test/integration/engine/junit/ITWatcher.java | 15 +++++------
34 files changed, 147 insertions(+), 129 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/common/ExecutionMode.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/common/ExecutionMode.java
index 5c79ecf..fa8bf24 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/common/ExecutionMode.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/common/ExecutionMode.java
@@ -17,6 +17,9 @@
package org.apache.shardingsphere.test.integration.common;
+/**
+ * Execution mode.
+ */
public enum ExecutionMode {
SINGLE, BATCH, ADDITIONAL
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/BeforeAllCases.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/BeforeAllCases.java
index d090c0a..14f2fa3 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/BeforeAllCases.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/BeforeAllCases.java
@@ -29,5 +29,4 @@ import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface BeforeAllCases {
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerInitializer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerInitializer.java
index c232e21..e7cc6cf 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerInitializer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerInitializer.java
@@ -22,8 +22,10 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Container initializer.
+ */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ContainerInitializer {
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerType.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerType.java
index 8c2eb12..cc9d8bf 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerType.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ContainerType.java
@@ -17,11 +17,10 @@
package org.apache.shardingsphere.test.integration.junit.annotation;
+/**
+ * Container type.
+ */
public enum ContainerType {
- ADAPTER,
-
- STORAGE,
-
- COORDINATOR
+ ADAPTER, STORAGE, COORDINATOR
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/OnContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/OnContainer.java
index 916e293..e764ecf 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/OnContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/OnContainer.java
@@ -46,5 +46,4 @@ public @interface OnContainer {
* @return container type.
*/
ContainerType type() default ContainerType.ADAPTER;
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ParameterFilter.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ParameterFilter.java
index c77f677..237464a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ParameterFilter.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ParameterFilter.java
@@ -24,6 +24,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Parameter filter.
+ */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ParameterFilter {
@@ -44,6 +47,5 @@ public @interface ParameterFilter {
* @return false if ignore
*/
boolean filter(TestCaseBeanContext context);
-
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITInject.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITInject.java
index 74dedbd..42ae2e1 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITInject.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITInject.java
@@ -32,5 +32,4 @@ import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ShardingSphereITInject {
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITStorageType.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITStorageType.java
index 28b9ce8..4aefd2e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITStorageType.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/ShardingSphereITStorageType.java
@@ -22,6 +22,9 @@ import org.apache.shardingsphere.test.integration.junit.container.H2Container;
import org.apache.shardingsphere.test.integration.junit.container.MySQLContainer;
import org.apache.shardingsphere.test.integration.junit.container.ShardingSphereStorageContainer;
+/**
+ * ShardingSphere IT storage type.
+ */
public enum ShardingSphereITStorageType {
MySQL(MySQLContainer.class),
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/TestCaseSpec.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/TestCaseSpec.java
index 03b4095..857247a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/TestCaseSpec.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/TestCaseSpec.java
@@ -25,6 +25,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Test case specification.
+ */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TestCaseSpec {
@@ -49,5 +52,4 @@ public @interface TestCaseSpec {
* @return execution mode
*/
ExecutionMode executionMode() default ExecutionMode.SINGLE;
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/XmlResource.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/XmlResource.java
index d90a98e..dbf3c61 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/XmlResource.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/annotation/XmlResource.java
@@ -24,6 +24,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * XML resource.
+ */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface XmlResource {
@@ -38,8 +41,7 @@ public @interface XmlResource {
/**
* Specify the processor of resource.
*
- * @return prceossor
+ * @return processor
*/
Class<? extends Processor> processor();
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java
index 5b5baea..da3201a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java
@@ -50,9 +50,12 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
-@Slf4j
+/**
+ * Container compose.
+ */
@RequiredArgsConstructor
-public class ContainerCompose implements Closeable {
+@Slf4j
+public final class ContainerCompose implements Closeable {
private final Network network = Network.newNetwork();
@@ -84,9 +87,9 @@ public class ContainerCompose implements Closeable {
@SneakyThrows
private ShardingSphereContainer createContainer(final FrameworkField field) {
- final OnContainer metadata = field.getAnnotation(OnContainer.class);
+ OnContainer metadata = field.getAnnotation(OnContainer.class);
try {
- final ShardingSphereContainer container = createContainer(metadata);
+ ShardingSphereContainer container = createContainer(metadata);
if (Objects.isNull(container)) {
log.warn("container {} is not activated.", metadata.name());
return null;
@@ -105,9 +108,9 @@ public class ContainerCompose implements Closeable {
log.info("container {} is activated.", metadata.name());
return container;
// CHECKSTYLE:OFF
- } catch (Exception e) {
+ } catch (final Exception ex) {
// CHECKSTYLE:ON
- log.error("Failed to instantiate container {}.", metadata.name(), e);
+ log.error("Failed to instantiate container {}.", metadata.name(), ex);
}
return null;
}
@@ -120,7 +123,7 @@ public class ContainerCompose implements Closeable {
case STORAGE:
return createStorageContainer();
case COORDINATOR:
- throw new NotSupportedException();
+ throw new UnsupportedOperationException("");
default:
return null;
}
@@ -149,7 +152,7 @@ public class ContainerCompose implements Closeable {
}
private void inject(final ShardingSphereContainer container) {
- final List<Field> fields = Lists.newArrayList();
+ List<Field> fields = Lists.newArrayList();
for (Class<?> klass = container.getClass(); Objects.nonNull(klass); klass = klass.getSuperclass()) {
fields.addAll(Arrays.asList(klass.getDeclaredFields()));
}
@@ -164,7 +167,7 @@ public class ContainerCompose implements Closeable {
} else {
e.set(container, beanContext.getBean(type));
}
- } catch (IllegalAccessException illegalAccessException) {
+ } catch (final IllegalAccessException illegalAccessException) {
log.error("Failed to auto inject {}.{}.", container.getContainerName(), e.getName());
}
});
@@ -185,7 +188,7 @@ public class ContainerCompose implements Closeable {
method.invokeExplosively(instance);
}
// CHECKSTYLE:OFF
- } catch (Throwable throwable) {
+ } catch (final Throwable throwable) {
// CHECKSTYLE:ON
throwable.printStackTrace();
}
@@ -208,7 +211,7 @@ public class ContainerCompose implements Closeable {
try {
return !c.isHealthy();
// CHECKSTYLE:OFF
- } catch (Exception e) {
+ } catch (final Exception ex) {
// CHECKSTYLE:ON
return false;
}
@@ -217,7 +220,7 @@ public class ContainerCompose implements Closeable {
while (!(c.isRunning() && c.isHealthy())) {
try {
TimeUnit.MILLISECONDS.sleep(200L);
- } catch (InterruptedException ignore) {
+ } catch (final InterruptedException ignored) {
}
}
@@ -229,5 +232,4 @@ public class ContainerCompose implements Closeable {
public void close() {
containers.forEach(Startable::close);
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/NotSupportedException.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/NotSupportedException.java
deleted file mode 100644
index 9acab94..0000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/NotSupportedException.java
+++ /dev/null
@@ -1,21 +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.test.integration.junit.compose;
-
-public class NotSupportedException extends Exception {
-}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/H2Container.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/H2Container.java
index 9bda4fe..5335b93 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/H2Container.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/H2Container.java
@@ -24,7 +24,10 @@ import org.apache.shardingsphere.test.integration.env.datasource.builder.ActualD
import javax.sql.DataSource;
import java.util.Map;
-public class H2Container extends ShardingSphereStorageContainer {
+/**
+ * H2 container.
+ */
+public final class H2Container extends ShardingSphereStorageContainer {
private volatile Map<String, DataSource> actualDataSources;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/MySQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/MySQLContainer.java
index cff9f62..a86799a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/MySQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/MySQLContainer.java
@@ -24,9 +24,9 @@ import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import java.util.Optional;
/**
- * MySQL Server Container.
+ * MySQL Container.
*/
-public class MySQLContainer extends ShardingSphereStorageContainer {
+public final class MySQLContainer extends ShardingSphereStorageContainer {
public MySQLContainer() {
super("mysql/mysql-server:5.7", new MySQLDatabaseType());
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/NativeStorageContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/NativeStorageContainer.java
index c932f79..d9490c2 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/NativeStorageContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/NativeStorageContainer.java
@@ -17,7 +17,10 @@
package org.apache.shardingsphere.test.integration.junit.container;
-public class NativeStorageContainer extends ShardingSphereStorageContainer {
+/**
+ * Native storage container.
+ */
+public final class NativeStorageContainer extends ShardingSphereStorageContainer {
public NativeStorageContainer() {
super("native-storage", null);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/PostgreSQLContainer.java
index f7513a6..cf39a37 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/PostgreSQLContainer.java
@@ -19,7 +19,10 @@ package org.apache.shardingsphere.test.integration.junit.container;
import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
-public class PostgreSQLContainer extends ShardingSphereStorageContainer {
+/**
+ * PostgreSQL container.
+ */
+public final class PostgreSQLContainer extends ShardingSphereStorageContainer {
public PostgreSQLContainer() {
super("postgres:12.6", new PostgreSQLDatabaseType());
@@ -52,5 +55,4 @@ public class PostgreSQLContainer extends ShardingSphereStorageContainer {
protected String getPassword() {
return "postgres";
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereAdapterContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereAdapterContainer.java
index 9c7563d..bf041e4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereAdapterContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereAdapterContainer.java
@@ -26,6 +26,9 @@ import org.apache.shardingsphere.test.integration.junit.processor.Authentication
import javax.sql.DataSource;
+/**
+ * ShardingSphere adapter container.
+ */
@Slf4j
public abstract class ShardingSphereAdapterContainer extends ShardingSphereContainer {
@@ -51,5 +54,4 @@ public abstract class ShardingSphereAdapterContainer extends ShardingSphereConta
* @return DataSource
*/
public abstract DataSource getDataSource();
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java
index 163d8fd..06142ee 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java
@@ -50,6 +50,9 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+/**
+ * ShardingSphere container.
+ */
@Slf4j
public abstract class ShardingSphereContainer extends GenericContainer<ShardingSphereContainer> {
@@ -80,7 +83,7 @@ public abstract class ShardingSphereContainer extends GenericContainer<ShardingS
@Override
public void start() {
- resolveXmlResource(this.getClass());
+ resolveXmlResource(getClass());
configure();
startDependencies();
if (!isFakeContainer) {
@@ -90,7 +93,7 @@ public abstract class ShardingSphereContainer extends GenericContainer<ShardingS
}
private void startDependencies() {
- final List<ShardingSphereContainer> dependencies = getDependencies().stream()
+ List<ShardingSphereContainer> dependencies = getDependencies().stream()
.map(e -> (ShardingSphereContainer) e)
.collect(Collectors.toList());
dependencies.stream()
@@ -101,9 +104,9 @@ public abstract class ShardingSphereContainer extends GenericContainer<ShardingS
try {
return !c.isHealthy();
// CHECKSTYLE:OFF
- } catch (Exception e) {
+ } catch (final Exception ex) {
// CHECKSTYLE:ON
- log.warn("Failed to check container {} healthy.", c.getDockerName(), e);
+ log.warn("Failed to check container {} healthy.", c.getDockerName(), ex);
return false;
}
})
@@ -161,6 +164,5 @@ public abstract class ShardingSphereContainer extends GenericContainer<ShardingS
}
protected void execute() {
-
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereJDBCContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereJDBCContainer.java
index 9dc3f0c..ee6ec59 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereJDBCContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereJDBCContainer.java
@@ -33,8 +33,11 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
+/**
+ * ShardingSphere JDBC container.
+ */
@Slf4j
-public class ShardingSphereJDBCContainer extends ShardingSphereAdapterContainer {
+public final class ShardingSphereJDBCContainer extends ShardingSphereAdapterContainer {
private final AtomicBoolean isHealthy = new AtomicBoolean();
@@ -56,16 +59,13 @@ public class ShardingSphereJDBCContainer extends ShardingSphereAdapterContainer
}
/**
- * Get DataSource.
+ * Get data source.
*
- * @return DataSource
+ * @return data source
*/
public DataSource getDataSource() {
try {
- return YamlShardingSphereDataSourceFactory.createDataSource(
- dataSourceMap,
- new File(EnvironmentPath.getRulesConfigurationFile(getDescription().getScenario()))
- );
+ return YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap, new File(EnvironmentPath.getRulesConfigurationFile(getDescription().getScenario())));
} catch (SQLException | IOException ex) {
throw new RuntimeException(ex);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereProxyContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereProxyContainer.java
index 41a5e29..1674a70 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereProxyContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereProxyContainer.java
@@ -28,8 +28,11 @@ import javax.sql.DataSource;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
+/**
+ * ShardingSphere proxy container.
+ */
@Slf4j
-public class ShardingSphereProxyContainer extends ShardingSphereAdapterContainer {
+public final class ShardingSphereProxyContainer extends ShardingSphereAdapterContainer {
private static final String AGENT_HOME_IN_CONTAINER = "/usr/local/shardingsphere-agent";
@@ -78,7 +81,7 @@ public class ShardingSphereProxyContainer extends ShardingSphereAdapterContainer
@Override
protected void configure() {
withConfMapping("/docker/" + getDescription().getScenario() + "/proxy/conf");
- super.setWaitStrategy(new LogMessageWaitStrategy().withRegEx(".*ShardingSphere-Proxy start success.*"));
+ setWaitStrategy(new LogMessageWaitStrategy().withRegEx(".*ShardingSphere-Proxy start success.*"));
super.configure();
}
@@ -117,5 +120,4 @@ public class ShardingSphereProxyContainer extends ShardingSphereAdapterContainer
return String.format("jdbc:mysql://%s:%s/%s?useServerPrepStmts=true&serverTimezone=UTC&useSSL=false&useLocalSessionState=true&characterEncoding=utf-8",
getHost(), getMappedPort(3307), getDescription().getScenario());
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereStorageContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereStorageContainer.java
index 9702cec..bbcb639 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereStorageContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereStorageContainer.java
@@ -38,8 +38,8 @@ import java.util.Optional;
*/
public abstract class ShardingSphereStorageContainer extends ShardingSphereContainer {
- @Getter
@XmlResource(file = "/env/{scenario}/databases.xml", processor = DatabaseProcessor.class)
+ @Getter
private Collection<String> databases;
private ImmutableMap<String, DataSource> dataSourceMap;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/logging/ContainerLogs.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/logging/ContainerLogs.java
index d173d20..62e30e4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/logging/ContainerLogs.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/logging/ContainerLogs.java
@@ -28,8 +28,11 @@ import org.slf4j.LoggerFactory;
import org.testcontainers.containers.output.BaseConsumer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
+/**
+ * Container logs.
+ */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public class ContainerLogs {
+public final class ContainerLogs {
/**
* Create new log consumer.
@@ -38,22 +41,18 @@ public class ContainerLogs {
* @return log consumer
*/
public static BaseConsumer<?> newConsumer(final String serviceName) {
- final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-
+ LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(context);
encoder.setPattern("%d{yyyy-MM-dd HH:mm:ss.SSS} %msg%n");
encoder.start();
-
- final ConsoleAppender<ILoggingEvent> fileAppender = new ConsoleAppender<>();
+ ConsoleAppender<ILoggingEvent> fileAppender = new ConsoleAppender<>();
fileAppender.setEncoder(encoder);
fileAppender.start();
-
- final ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(serviceName);
+ ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(serviceName);
logger.addAppender(fileAppender);
logger.setLevel(Level.DEBUG);
logger.setAdditive(false);
-
Slf4jLogConsumer consumer = new Slf4jLogConsumer(logger, true);
consumer.withPrefix(serviceName);
return consumer;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/ParameterizedArrayFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/ParameterizedArrayFactory.java
index 3cca6f3..7ef386d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/ParameterizedArrayFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/ParameterizedArrayFactory.java
@@ -52,7 +52,6 @@ public final class ParameterizedArrayFactory {
private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
-
/**
* Get assertion parameterized array.
*
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/TestCaseParameters.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/TestCaseParameters.java
index 2c5be6c..5f1ee83 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/TestCaseParameters.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/param/TestCaseParameters.java
@@ -24,10 +24,13 @@ import org.apache.shardingsphere.test.integration.cases.assertion.IntegrationTes
import org.apache.shardingsphere.test.integration.cases.assertion.IntegrationTestCaseAssertion;
import org.apache.shardingsphere.test.integration.common.SQLExecuteType;
+/**
+ * Test case parameters.
+ */
+@RequiredArgsConstructor
@Getter
@ToString
-@RequiredArgsConstructor
-public class TestCaseParameters {
+public final class TestCaseParameters {
private final String name;
@@ -42,5 +45,4 @@ public class TestCaseParameters {
private final IntegrationTestCase testCase;
private final IntegrationTestCaseAssertion assertion;
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/AuthenticationProcessor.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/AuthenticationProcessor.java
index 530408c..83ac30f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/AuthenticationProcessor.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/AuthenticationProcessor.java
@@ -27,7 +27,10 @@ import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
import java.io.InputStream;
-public class AuthenticationProcessor implements Processor<AuthenticationProcessor.Authentication> {
+/**
+ * Authentication processor.
+ */
+public final class AuthenticationProcessor implements Processor<AuthenticationProcessor.Authentication> {
@Override
@SneakyThrows
@@ -37,13 +40,12 @@ public class AuthenticationProcessor implements Processor<AuthenticationProcesso
return new Authentication("root", user.getPassword());
}
- @Getter
@RequiredArgsConstructor
+ @Getter
public static class Authentication {
private final String user;
private final String password;
-
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/DatabaseProcessor.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/DatabaseProcessor.java
index c79bc8b..3f22564 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/DatabaseProcessor.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/DatabaseProcessor.java
@@ -26,8 +26,11 @@ import java.io.InputStream;
import java.util.Collection;
import java.util.LinkedList;
+/**
+ * Database processor.
+ */
@XmlRootElement(name = "databases")
-public class DatabaseProcessor implements Processor<Collection<String>> {
+public final class DatabaseProcessor implements Processor<Collection<String>> {
@XmlElement(name = "database")
private final Collection<String> databases = new LinkedList<>();
@@ -37,5 +40,4 @@ public class DatabaseProcessor implements Processor<Collection<String>> {
public Collection<String> process(final InputStream stream) {
return ((DatabaseProcessor) JAXBContext.newInstance(DatabaseProcessor.class).createUnmarshaller().unmarshal(stream)).databases;
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/Processor.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/Processor.java
index 6d86301..a297094 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/Processor.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/processor/Processor.java
@@ -19,6 +19,11 @@ package org.apache.shardingsphere.test.integration.junit.processor;
import java.io.InputStream;
+/**
+ * Processor.
+ *
+ * @param <T> type of configuration bean
+ */
public interface Processor<T> {
/**
@@ -28,5 +33,4 @@ public interface Processor<T> {
* @return configuration bean
*/
T process(InputStream stream);
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereCISubRunner.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereCISubRunner.java
index f0a9233..88a72e1 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereCISubRunner.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereCISubRunner.java
@@ -30,8 +30,11 @@ import org.junit.runners.model.Statement;
import java.lang.reflect.Field;
+/**
+ * ShardingSphere CI sub runner.
+ */
@Slf4j
-public class ShardingSphereCISubRunner extends BlockJUnit4ClassRunner {
+public final class ShardingSphereCISubRunner extends BlockJUnit4ClassRunner {
private final TestCaseBeanContext context;
@@ -45,8 +48,8 @@ public class ShardingSphereCISubRunner extends BlockJUnit4ClassRunner {
public ShardingSphereCISubRunner(final Class<?> testClass, final TestCaseBeanContext context) throws InitializationError {
super(testClass);
this.context = context;
- this.parameterized = context.getBean(ParameterizedArray.class);
- this.compose = new ContainerCompose(getTestClass().getName(), getTestClass(), context.getBean(TestCaseDescription.class), context);
+ parameterized = context.getBean(ParameterizedArray.class);
+ compose = new ContainerCompose(getTestClass().getName(), getTestClass(), context.getBean(TestCaseDescription.class), context);
}
@Override
@@ -64,7 +67,7 @@ public class ShardingSphereCISubRunner extends BlockJUnit4ClassRunner {
} else {
field.set(testInstance, context.getBean(e.getType()));
}
- } catch (IllegalAccessException ex) {
+ } catch (final IllegalAccessException ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
});
@@ -114,5 +117,4 @@ public class ShardingSphereCISubRunner extends BlockJUnit4ClassRunner {
context.getBeanByName("statement")
);
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereITSubRunner.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereITSubRunner.java
index 3faeae6..9b225bc 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereITSubRunner.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereITSubRunner.java
@@ -28,8 +28,11 @@ import org.junit.runners.model.Statement;
import java.lang.reflect.Field;
+/**
+ * ShardingSphere IT sub runner.
+ */
@Slf4j
-public class ShardingSphereITSubRunner extends BlockJUnit4ClassRunner {
+public final class ShardingSphereITSubRunner extends BlockJUnit4ClassRunner {
@Getter
private final TestCaseBeanContext context;
@@ -41,7 +44,7 @@ public class ShardingSphereITSubRunner extends BlockJUnit4ClassRunner {
@Override
protected Object createTest() throws Exception {
- final Object testInstance = super.createTest();
+ Object testInstance = super.createTest();
autowired(testInstance);
return testInstance;
}
@@ -71,7 +74,7 @@ public class ShardingSphereITSubRunner extends BlockJUnit4ClassRunner {
} else {
field.set(testInstance, context.getBean(e.getType()));
}
- } catch (IllegalAccessException ex) {
+ } catch (final IllegalAccessException ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
});
@@ -81,7 +84,7 @@ public class ShardingSphereITSubRunner extends BlockJUnit4ClassRunner {
try {
e.getField().setAccessible(true);
e.getField().set(testInstance, c);
- } catch (IllegalAccessException ex) {
+ } catch (final IllegalAccessException ex) {
throw new RuntimeException(ex);
}
});
@@ -111,5 +114,4 @@ public class ShardingSphereITSubRunner extends BlockJUnit4ClassRunner {
context.getBeanByName("statement")
);
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereRunner.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereRunner.java
index 5504617..5c39ce9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereRunner.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/ShardingSphereRunner.java
@@ -31,7 +31,6 @@ import org.apache.shardingsphere.test.integration.junit.annotation.BeforeAllCase
import org.apache.shardingsphere.test.integration.junit.annotation.ParameterFilter;
import org.apache.shardingsphere.test.integration.junit.annotation.TestCaseSpec;
import org.apache.shardingsphere.test.integration.junit.compose.ContainerCompose;
-import org.apache.shardingsphere.test.integration.junit.compose.NotSupportedException;
import org.apache.shardingsphere.test.integration.junit.param.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.junit.param.TestCaseParameters;
import org.apache.shardingsphere.test.integration.junit.param.model.AssertionParameterizedArray;
@@ -54,7 +53,7 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
@Slf4j
-public class ShardingSphereRunner extends Suite {
+public final class ShardingSphereRunner extends Suite {
private final List<Runner> runners;
@@ -81,7 +80,7 @@ public class ShardingSphereRunner extends Suite {
}
private List<Runner> createITRunners(final TestCaseSpec testCaseSpec) {
- final Predicate<TestCaseBeanContext> predicate = createTestCaseParametersPredicate();
+ Predicate<TestCaseBeanContext> predicate = createTestCaseParametersPredicate();
TestCaseDescription description = TestCaseDescription.fromSystemProps(testCaseSpec).build();
beanContext.registerBean(TestCaseDescription.class, description);
compose = new ContainerCompose(caseName, getTestClass(), description, beanContext);
@@ -95,7 +94,7 @@ public class ShardingSphereRunner extends Suite {
.map(e -> {
try {
return new ShardingSphereITSubRunner(getTestClass().getJavaClass(), e);
- } catch (InitializationError ex) {
+ } catch (final InitializationError ex) {
throw new RuntimeException("Initialization Error", ex);
}
})
@@ -103,10 +102,10 @@ public class ShardingSphereRunner extends Suite {
}
private List<Runner> createCIRunners(final TestCaseSpec testCaseSpec) {
- final Predicate<TestCaseBeanContext> predicate = createTestCaseParametersPredicate();
+ Predicate<TestCaseBeanContext> predicate = createTestCaseParametersPredicate();
return allCIParameters(testCaseSpec).stream()
.map(e -> {
- final TestCaseDescription description = TestCaseDescription.builder()
+ TestCaseDescription description = TestCaseDescription.builder()
.sqlCommandType(testCaseSpec.sqlCommandType())
.executionMode(testCaseSpec.executionMode())
.adapter(e.getAdapter())
@@ -114,7 +113,7 @@ public class ShardingSphereRunner extends Suite {
.scenario(e.getScenario())
.build();
IntegrationTestCase testCase = e.getTestCaseContext().getTestCase();
- final TestCaseBeanContext context = beanContext.subContext();
+ TestCaseBeanContext context = beanContext.subContext();
context.registerBean(ParameterizedArray.class, e);
context.registerBean(TestCaseDescription.class, description);
TestCaseParameters testCaseParameters;
@@ -136,7 +135,7 @@ public class ShardingSphereRunner extends Suite {
.map(e -> {
try {
return new ShardingSphereCISubRunner(getTestClass().getJavaClass(), e);
- } catch (InitializationError initializationError) {
+ } catch (final InitializationError initializationError) {
throw new RuntimeException(initializationError);
}
})
@@ -154,11 +153,11 @@ public class ShardingSphereRunner extends Suite {
private Predicate<TestCaseBeanContext> createTestCaseParametersPredicate() {
ParameterFilter filter = getTestClass().getAnnotation(ParameterFilter.class);
- final Predicate<TestCaseBeanContext> predicate;
+ Predicate<TestCaseBeanContext> predicate;
if (Objects.nonNull(filter)) {
Class<? extends ParameterFilter.Filter> filtered = filter.filter();
try {
- final ParameterFilter.Filter instance = filtered.newInstance();
+ ParameterFilter.Filter instance = filtered.newInstance();
predicate = instance::filter;
} catch (InstantiationException | IllegalAccessException ex) {
throw new RuntimeException(ex);
@@ -194,12 +193,12 @@ public class ShardingSphereRunner extends Suite {
case SINGLE:
return getAssertionParameters(getTestClass().getJavaClass(), description);
default:
- throw new NotSupportedException();
+ throw new UnsupportedOperationException("");
}
}
private Collection<TestCaseParameters> getAssertionParameters(final Class<?> klass, final TestCaseDescription description) {
- final IntegrationTestCasesLoader testCasesLoader = IntegrationTestCasesLoader.getInstance();
+ IntegrationTestCasesLoader testCasesLoader = IntegrationTestCasesLoader.getInstance();
return testCasesLoader.getTestCaseContexts(description.getSqlCommandType()).stream()
.filter(e -> assertThan(e.getTestCase().getDbTypes(), description.getDatabase()))
.filter(e -> assertThan(e.getTestCase().getScenarioTypes(), description.getScenario()))
@@ -256,8 +255,8 @@ public class ShardingSphereRunner extends Suite {
List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(BeforeAllCases.class);
List<Runner> children = getChildren();
if (!children.isEmpty()) {
- final Runner runner = children.get(0);
- final Object testInstance;
+ Runner runner = children.get(0);
+ Object testInstance;
if (runner instanceof ShardingSphereITSubRunner) {
ShardingSphereITSubRunner itRunner = ((ShardingSphereITSubRunner) runner).copySelf();
testInstance = itRunner.createTestInstance();
@@ -275,7 +274,7 @@ public class ShardingSphereRunner extends Suite {
try {
e.invokeExplosively(testInstance);
// CHECKSTYLE:OFF
- } catch (Throwable throwable) {
+ } catch (final Throwable throwable) {
// CHECKSTYLE:ON
throw new RuntimeException(throwable);
}
@@ -297,5 +296,4 @@ public class ShardingSphereRunner extends Suite {
}
});
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseBeanContext.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseBeanContext.java
index 450e33e..9750f62 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseBeanContext.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseBeanContext.java
@@ -22,7 +22,10 @@ import org.apache.curator.shaded.com.google.common.collect.Maps;
import java.util.Map;
import java.util.Objects;
-public class TestCaseBeanContext {
+/**
+ * Test case bean context.
+ */
+public final class TestCaseBeanContext {
private final Map<Object, Object> classObjectMap = Maps.newConcurrentMap();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseDescription.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseDescription.java
index f19ba2e..86435f8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseDescription.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/runner/TestCaseDescription.java
@@ -28,10 +28,13 @@ import org.apache.shardingsphere.test.integration.common.ExecutionMode;
import org.apache.shardingsphere.test.integration.junit.annotation.ShardingSphereITStorageType;
import org.apache.shardingsphere.test.integration.junit.annotation.TestCaseSpec;
-@Getter
-@Builder
+/**
+ * Test case description.
+ */
@RequiredArgsConstructor
-public class TestCaseDescription {
+@Builder
+@Getter
+public final class TestCaseDescription {
@NonNull
private final String database;
@@ -73,12 +76,11 @@ public class TestCaseDescription {
* @return test instance
*/
public static TestCaseDescriptionBuilder fromSystemProps(final TestCaseSpec testCaseSpec) {
- return TestCaseDescription.builder()
+ return builder()
.adapter(System.getProperty("it.adapter"))
.database(System.getProperty("it.database"))
.scenario(System.getProperty("it.scenario"))
.executionMode(testCaseSpec.executionMode())
.sqlCommandType(testCaseSpec.sqlCommandType());
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleITCase.java
index 3b99834..a7dea0c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleITCase.java
@@ -39,5 +39,4 @@ public abstract class SingleITCase extends BaseITCase {
public void setup() {
dataSet = null == getAssertion() ? null : DataSetLoader.load(getParentPath(), getDescription().getScenario(), getDescription().getDatabaseType(), getAssertion().getExpectedDataFile());
}
-
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/junit/ITWatcher.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/junit/ITWatcher.java
index fef5041..3f048d2 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/junit/ITWatcher.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/junit/ITWatcher.java
@@ -36,18 +36,17 @@ public final class ITWatcher extends TestWatcher {
super.failed(ex, description);
}
- private String stackTrace(final Throwable t) {
- if (t == null) {
+ private String stackTrace(final Throwable cause) {
+ if (null == cause) {
return "";
}
- //CHECKSTYLE:OFF
try (ByteArrayOutputStream out = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(out)) {
- t.printStackTrace(ps);
- ps.flush();
+ PrintStream printStream = new PrintStream(out)) {
+ cause.printStackTrace(printStream);
+ printStream.flush();
return new String(out.toByteArray());
- } catch (Exception ignored) {
- // ignored
+ //CHECKSTYLE:OFF
+ } catch (final Exception ignored) {
//CHECKSTYLE:ON
}
return "";