This is an automated email from the ASF dual-hosted git repository. menghaoran 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 2e9e8480d6c Remove useless PluginType (#32216) 2e9e8480d6c is described below commit 2e9e8480d6c2f4ea5353cebd4f865f5dcf305a06 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sun Jul 21 17:38:31 2024 +0800 Remove useless PluginType (#32216) --- .../container/ShardingSphereJdbcContainer.java | 4 --- .../test/e2e/agent/common/enums/PluginType.java | 39 ---------------------- .../common/env/AgentE2ETestConfiguration.java | 3 ++ .../agent/common/env/AgentE2ETestEnvironment.java | 9 ++--- .../src/test/resources/env/engine-env.properties | 1 + 5 files changed, 6 insertions(+), 50 deletions(-) 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 07a128b7bd6..77c454ac02e 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 @@ -40,10 +40,6 @@ public final class ShardingSphereJdbcContainer extends DockerITContainer { private final Consumer<OutputFrame> consumer; - public ShardingSphereJdbcContainer(final String image, final String plugin) { - this(image, plugin, null); - } - public ShardingSphereJdbcContainer(final String image, final String plugin, final Consumer<OutputFrame> consumer) { super("jdbc", image); this.consumer = consumer; diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/enums/PluginType.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/enums/PluginType.java deleted file mode 100644 index 6737533eff5..00000000000 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/enums/PluginType.java +++ /dev/null @@ -1,39 +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.common.enums; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Plugin type. - */ -@RequiredArgsConstructor -@Getter -public enum PluginType { - - FILE("file"), - - PROMETHEUS("prometheus"), - - ZIPKIN("zipkin"), - - JAEGER("jaeger"); - - private final String value; -} diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestConfiguration.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestConfiguration.java index 5291373cacb..6c57e6b5f3a 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestConfiguration.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestConfiguration.java @@ -36,6 +36,8 @@ public final class AgentE2ETestConfiguration { private final String pluginImageName; + private final boolean logEnabled; + private final int defaultExposePort; private final long collectDataWaitSeconds; @@ -45,6 +47,7 @@ public final class AgentE2ETestConfiguration { adapter = envProps.getProperty("it.env.adapter"); pluginType = envProps.getProperty("it.env.plugin.type"); pluginImageName = envProps.getProperty("it.env.plugin.image"); + logEnabled = Boolean.parseBoolean(envProps.getProperty("it.env.log.enabled", Boolean.FALSE.toString())); defaultExposePort = Integer.parseInt(envProps.getProperty("it.env.plugin.default.expose.port", "0")); collectDataWaitSeconds = Long.parseLong(envProps.getProperty("it.env.collect.data.wait.seconds", "0")); } diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestEnvironment.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestEnvironment.java index fbb498157e4..1b63f84c063 100644 --- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestEnvironment.java +++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/AgentE2ETestEnvironment.java @@ -26,7 +26,6 @@ import org.apache.shardingsphere.test.e2e.agent.common.container.ShardingSphereJ import org.apache.shardingsphere.test.e2e.agent.common.container.ShardingSphereProxyContainer; import org.apache.shardingsphere.test.e2e.agent.common.container.plugin.AgentPluginContainerFactory; import org.apache.shardingsphere.test.e2e.agent.common.container.plugin.AgentPluginHTTPEndpointProvider; -import org.apache.shardingsphere.test.e2e.agent.common.enums.PluginType; import org.apache.shardingsphere.test.e2e.agent.common.fixture.executor.ProxyRequestExecutor; import org.apache.shardingsphere.test.e2e.env.container.atomic.DockerITContainer; import org.apache.shardingsphere.test.e2e.env.container.atomic.enums.AdapterType; @@ -119,9 +118,7 @@ public final class AgentE2ETestEnvironment { containers = new ITContainers(); MySQLContainer storageContainer = new MySQLContainer(mysqlImage); GovernanceContainer governanceContainer = GovernanceContainerFactory.newInstance("ZooKeeper"); - ShardingSphereProxyContainer proxyContainer = PluginType.FILE.getValue().equalsIgnoreCase(testConfig.getPluginType()) - ? new ShardingSphereProxyContainer(proxyImage, testConfig.getPluginType(), this::collectLogs) - : new ShardingSphereProxyContainer(proxyImage, testConfig.getPluginType()); + ShardingSphereProxyContainer proxyContainer = new ShardingSphereProxyContainer(proxyImage, testConfig.getPluginType(), testConfig.isLogEnabled() ? this::collectLogs : null); proxyContainer.dependsOn(storageContainer); proxyContainer.dependsOn(governanceContainer); Optional<DockerITContainer> pluginContainer = getAgentPluginContainer(); @@ -142,9 +139,7 @@ public final class AgentE2ETestEnvironment { containers = new ITContainers(); Optional<DockerITContainer> pluginContainer = getAgentPluginContainer(); MySQLContainer storageContainer = new MySQLContainer(mysqlImage); - ShardingSphereJdbcContainer jdbcContainer = PluginType.FILE.getValue().equalsIgnoreCase(testConfig.getPluginType()) - ? new ShardingSphereJdbcContainer(jdbcProjectImage, testConfig.getPluginType(), this::collectLogs) - : new ShardingSphereJdbcContainer(jdbcProjectImage, testConfig.getPluginType()); + ShardingSphereJdbcContainer jdbcContainer = new ShardingSphereJdbcContainer(jdbcProjectImage, testConfig.getPluginType(), testConfig.isLogEnabled() ? this::collectLogs : null); jdbcContainer.dependsOn(storageContainer); pluginContainer.ifPresent(jdbcContainer::dependsOn); pluginContainer.ifPresent(optional -> containers.registerContainer(optional)); diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties b/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties index 735ca698560..39a1bdbea6c 100644 --- a/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties +++ b/test/e2e/agent/plugins/logging/file/src/test/resources/env/engine-env.properties @@ -17,5 +17,6 @@ # The value of it.env.adapter is proxy or jdbc it.env.adapter= +it.env.log.enabled=true it.env.plugin.type=file it.env.collect.data.wait.seconds=15