This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 41ab7cfc178 Merge AgentE2EEnvironmentProperties and
EnvironmentPropertiesLoader (#36731)
41ab7cfc178 is described below
commit 41ab7cfc1786f1a5914a37687040752287909df2
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Sep 27 23:53:53 2025 +0800
Merge AgentE2EEnvironmentProperties and EnvironmentPropertiesLoader (#36731)
---
.../env/props/AgentE2EEnvironmentProperties.java | 51 ----------------------
.../env/props/AgentE2ETestConfiguration.java | 3 +-
.../env/props/AgentE2ETestImageConfiguration.java | 3 +-
.../env/runtime/EnvironmentPropertiesLoader.java | 14 +++++-
4 files changed, 16 insertions(+), 55 deletions(-)
diff --git
a/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2EEnvironmentProperties.java
b/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2EEnvironmentProperties.java
deleted file mode 100644
index 7ce0b535801..00000000000
---
a/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2EEnvironmentProperties.java
+++ /dev/null
@@ -1,51 +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.e2e.agent.engine.env.props;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import lombok.SneakyThrows;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * Agent E2E environment properties.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class AgentE2EEnvironmentProperties {
-
- /**
- * Load properties.
- *
- * @param propsFileName properties file name
- * @return properties
- */
- @SneakyThrows(IOException.class)
- public static Properties loadProperties(final String propsFileName) {
- Properties result = new Properties();
- try (InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(propsFileName))
{
- result.load(inputStream);
- }
- for (String each : System.getProperties().stringPropertyNames()) {
- result.setProperty(each, System.getProperty(each));
- }
- return result;
- }
-}
diff --git
a/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestConfiguration.java
b/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestConfiguration.java
index fd30e16e66f..4b3df6cece8 100644
---
a/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestConfiguration.java
+++
b/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestConfiguration.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.test.e2e.agent.engine.env.props;
import com.google.common.base.Strings;
import lombok.Getter;
+import
org.apache.shardingsphere.test.e2e.env.runtime.EnvironmentPropertiesLoader;
import java.util.Properties;
@@ -43,7 +44,7 @@ public final class AgentE2ETestConfiguration {
private final long collectDataWaitSeconds;
private AgentE2ETestConfiguration() {
- Properties envProps =
AgentE2EEnvironmentProperties.loadProperties("env/engine-env.properties");
+ Properties envProps =
EnvironmentPropertiesLoader.loadProperties("env/engine-env.properties");
adapter = envProps.getProperty("e2e.env.adapter");
pluginType = envProps.getProperty("e2e.env.plugin.type");
pluginImageName = envProps.getProperty("e2e.env.plugin.image");
diff --git
a/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestImageConfiguration.java
b/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestImageConfiguration.java
index 2737921ddda..8dafb46a685 100644
---
a/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestImageConfiguration.java
+++
b/test/e2e/agent/engine/src/test/java/org/apache/shardingsphere/test/e2e/agent/engine/env/props/AgentE2ETestImageConfiguration.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.test.e2e.agent.engine.env.props;
import lombok.Getter;
+import
org.apache.shardingsphere.test.e2e.env.runtime.EnvironmentPropertiesLoader;
import java.util.Properties;
@@ -36,7 +37,7 @@ public final class AgentE2ETestImageConfiguration {
private final String jdbcProjectImage;
private AgentE2ETestImageConfiguration() {
- Properties imageProps =
AgentE2EEnvironmentProperties.loadProperties("env/image.properties");
+ Properties imageProps =
EnvironmentPropertiesLoader.loadProperties("env/image.properties");
mysqlImage = imageProps.getProperty("mysql.image", "mysql:8.0");
proxyImage = imageProps.getProperty("proxy.image",
"apache/shardingsphere-proxy-agent-test:latest");
jdbcProjectImage = imageProps.getProperty("jdbc.project.image",
"apache/shardingsphere-jdbc-agent-test:latest");
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/EnvironmentPropertiesLoader.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/EnvironmentPropertiesLoader.java
index bd4c366b6f1..8613ce61ffc 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/EnvironmentPropertiesLoader.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/EnvironmentPropertiesLoader.java
@@ -39,10 +39,20 @@ public final class EnvironmentPropertiesLoader {
*
* @return loaded properties
*/
- @SneakyThrows(IOException.class)
public static Properties loadProperties() {
+ return loadProperties("env/e2e-env.properties");
+ }
+
+ /**
+ * Load environment properties.
+ *
+ * @param fileName file name
+ * @return loaded properties
+ */
+ @SneakyThrows(IOException.class)
+ public static Properties loadProperties(final String fileName) {
Properties result = new Properties();
- try (InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("env/e2e-env.properties"))
{
+ try (InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)) {
result.load(inputStream);
}
for (String each : System.getProperties().stringPropertyNames()) {