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 2023/06/27 02:16:56 UTC
[shardingsphere] branch master updated: Remove SpringBoot from e2e test of agent (#26588)
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 dd28b105999 Remove SpringBoot from e2e test of agent (#26588)
dd28b105999 is described below
commit dd28b105999ceda453ec32fcd034abd0a11bb80e
Author: jiangML <10...@qq.com>
AuthorDate: Tue Jun 27 10:16:49 2023 +0800
Remove SpringBoot from e2e test of agent (#26588)
---
test/e2e/agent/jdbc-project/pom.xml | 97 +++++++++++++---------
.../agent/jdbc/project/JdbcProjectApplication.java | 47 +++++++++--
.../project/controller/AbstractRestController.java | 35 --------
.../jdbc/project/controller/OrderController.java | 63 +++++---------
.../project/service/impl/OrderServiceImpl.java | 61 ++++++++------
.../agent/jdbc/project/vo/response/HttpResult.java | 37 ---------
.../agent/jdbc/project/vo/response/ResponseVo.java | 37 ---------
.../agent/jdbc/project/vo/response/ResultCode.java | 37 ---------
.../src/main/resources/application.yml | 27 ------
.../src/main/resources/bin}/start.sh | 6 +-
.../jdbc-project/src/main/resources/logback.xml | 31 -------
.../e2e/agent/common/AgentTestActionExtension.java | 23 -----
.../e2e/agent/common/env/E2ETestEnvironment.java | 22 ++---
test/e2e/agent/plugins/logging/file/pom.xml | 29 ++++---
.../test/e2e/agent/file/FilePluginE2EIT.java | 3 +-
.../test/e2e/agent/file/asserts/ContentAssert.java | 14 ++--
.../test/e2e/agent/file/loader/LogLoader.java | 7 +-
.../file/src/test/resources/docker/jdbc/Dockerfile | 5 +-
.../resources/docker/jdbc/conf/application.yml | 24 ------
.../src/test/resources/docker/jdbc/conf/start.sh | 54 ------------
.../test/resources/docker/jdbc/docker-compose.yml | 2 -
.../src/test/resources/env/engine-env.properties | 10 +--
test/e2e/agent/plugins/metrics/prometheus/pom.xml | 29 ++++---
.../src/test/resources/docker/jdbc/Dockerfile | 5 +-
.../resources/docker/jdbc/conf/application.yml | 24 ------
.../src/test/resources/docker/jdbc/conf/start.sh | 54 ------------
.../test/resources/docker/jdbc/docker-compose.yml | 1 -
.../src/test/resources/env/engine-env.properties | 9 +-
test/e2e/agent/plugins/tracing/jaeger/pom.xml | 29 ++++---
.../src/test/resources/cases/jdbc/parse_sql.xml | 4 +-
.../src/test/resources/docker/jdbc/Dockerfile | 5 +-
.../resources/docker/jdbc/conf/application.yml | 24 ------
.../test/resources/docker/jdbc/docker-compose.yml | 2 -
.../src/test/resources/env/engine-env.properties | 11 +--
test/e2e/agent/plugins/tracing/zipkin/pom.xml | 29 ++++---
.../src/test/resources/cases/jdbc/parse_sql.xml | 4 +-
.../src/test/resources/docker/jdbc/Dockerfile | 5 +-
.../resources/docker/jdbc/conf/application.yml | 24 ------
.../src/test/resources/docker/jdbc/conf/start.sh | 54 ------------
.../test/resources/docker/jdbc/docker-compose.yml | 2 -
.../src/test/resources/env/engine-env.properties | 11 +--
test/e2e/agent/pom.xml | 1 -
42 files changed, 272 insertions(+), 726 deletions(-)
diff --git a/test/e2e/agent/jdbc-project/pom.xml b/test/e2e/agent/jdbc-project/pom.xml
index 70144a3e47a..11202cf557e 100644
--- a/test/e2e/agent/jdbc-project/pom.xml
+++ b/test/e2e/agent/jdbc-project/pom.xml
@@ -27,35 +27,13 @@
<artifactId>shardingsphere-test-e2e-agent-jdbc-project</artifactId>
<name>${project.artifactId}</name>
- <properties>
- <spring-boot.version>2.7.9</spring-boot.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${spring-boot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jdbc</artifactId>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-jdbc-core</artifactId>
+ <version>${project.parent.version}</version>
</dependency>
+
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
@@ -72,15 +50,10 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc-core</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2.version}</version>
+ <scope>compile</scope>
</dependency>
</dependencies>
@@ -88,18 +61,60 @@
<profile>
<id>release</id>
<build>
- <finalName>${docker.jdbc.distribution.name}</finalName>
+ <finalName>agent-test-app-${project.version}</finalName>
<plugins>
<plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <version>${spring-boot.version}</version>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${project.build.directory}/app</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/resources/bin</directory>
+ <includes>
+ <include>start.sh</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <outputDirectory>${project.build.directory}/app/lib</outputDirectory>
+ <excludes>
+ <exclude>*.yaml</exclude>
+ <exclude>*.yml</exclude>
+ <exclude>*.xml</exclude>
+ <exclude>bin/start.sh</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <id>repackage</id>
+ <id>copy-lib</id>
<goals>
- <goal>repackage</goal>
+ <goal>copy-dependencies</goal>
</goals>
+ <phase>package</phase>
+ <configuration>
+ <outputDirectory>${project.build.directory}/app/lib</outputDirectory>
+ <excludeTransitive>false</excludeTransitive>
+ <stripVersion>false</stripVersion>
+ <includeScope>runtime</includeScope>
+ </configuration>
</execution>
</executions>
</plugin>
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 57da8af9358..22b4f3cd804 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
@@ -17,18 +17,55 @@
package org.apache.shardingsphere.test.e2e.agent.jdbc.project;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.test.e2e.agent.jdbc.project.controller.OrderController;
+import org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.OrderService;
+import org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.impl.OrderServiceImpl;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.concurrent.TimeUnit;
/**
* Jdbc project application.
*/
-@SpringBootApplication
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class JdbcProjectApplication {
+ /**
+ * Main.
+ *
+ * @param args args
+ * @throws Exception Exception
+ */
// CHECKSTYLE:OFF
- public static void main(final String[] args) {
- SpringApplication.run(JdbcProjectApplication.class, args);
+ public static void main(final String[] args) throws Exception {
+ run();
}
// CHECKSTYLE:ON
+
+ private static void run() throws Exception {
+ Connection connection = getConnection();
+ OrderService orderService = new OrderServiceImpl(connection);
+ OrderController orderController = new OrderController(orderService);
+ long endTime = System.currentTimeMillis() + (5 * 60 * 1000);
+ while (System.currentTimeMillis() < endTime) {
+ orderController.dropTable();
+ orderController.createTable();
+ orderController.insert();
+ orderController.selectAll();
+ orderController.update();
+ orderController.createErrorRequest();
+ orderController.delete();
+ orderController.dropTable();
+ TimeUnit.MILLISECONDS.sleep(1000L);
+ }
+ }
+
+ private static Connection getConnection() throws Exception {
+ Class.forName("org.apache.shardingsphere.driver.ShardingSphereDriver");
+ String url = "jdbc:shardingsphere:classpath:config.yaml";
+ return DriverManager.getConnection(url, "root", "root");
+ }
}
diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/AbstractRestController.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/AbstractRestController.java
deleted file mode 100644
index 5a2751265e7..00000000000
--- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/controller/AbstractRestController.java
+++ /dev/null
@@ -1,35 +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.jdbc.project.controller;
-
-import org.apache.shardingsphere.test.e2e.agent.jdbc.project.vo.response.HttpResult;
-import org.apache.shardingsphere.test.e2e.agent.jdbc.project.vo.response.ResultCode;
-
-/**
- * Abstract rest controller.
- */
-public abstract class AbstractRestController {
-
- protected HttpResult<Void> success() {
- return new HttpResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), null);
- }
-
- protected <T> HttpResult<T> success(final T data) {
- return new HttpResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
- }
-}
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 99031d63238..4003fc068ef 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
@@ -17,107 +17,84 @@
package org.apache.shardingsphere.test.e2e.agent.jdbc.project.controller;
+import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.test.e2e.agent.jdbc.project.entity.OrderEntity;
import org.apache.shardingsphere.test.e2e.agent.jdbc.project.enums.StatementType;
import org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.OrderService;
-import org.apache.shardingsphere.test.e2e.agent.jdbc.project.vo.response.HttpResult;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import javax.annotation.Resource;
import java.util.Collection;
/**
* Order controller.
*/
-@RestController
-@RequestMapping("/order")
-public class OrderController extends AbstractRestController {
+@RequiredArgsConstructor
+public final class OrderController {
- @Resource
- private OrderService orderService;
+ private final OrderService orderService;
/**
* Create table.
- *
- * @return http result
*/
- @GetMapping("/createTable")
- public HttpResult<Void> createTable() {
+ public void createTable() {
orderService.createTable();
- return success();
}
/**
* Drop table.
- *
- * @return http result
*/
- @GetMapping("/dropTable")
- public HttpResult<Void> dropTable() {
+ public void dropTable() {
orderService.dropTable();
- return success();
}
/**
* Insert order.
- *
- * @return http result
*/
- @GetMapping("/insert")
- public HttpResult<Void> insert() {
+ public void insert() {
long index = 0;
- while (index++ < 100) {
+ while (index++ <= 100) {
OrderEntity order = new OrderEntity(index, index, "OK");
orderService.insert(order, 0 == (index & 1) ? StatementType.STATEMENT : StatementType.PREPARED, 0 == index % 5);
}
- index = 0;
- while (index++ < 10) {
+ }
+
+ /**
+ * Create error request.
+ */
+ public void createErrorRequest() {
+ long index = 0;
+ while (index++ <= 10) {
OrderEntity order = new OrderEntity(index, index, "Fail");
orderService.insert(order, 0 == (index & 1) ? StatementType.STATEMENT : StatementType.PREPARED, false);
}
- return success();
}
/**
* Update.
- *
- * @return http result
*/
- @GetMapping("/update")
- public HttpResult<Void> update() {
+ public void update() {
Collection<OrderEntity> orders = orderService.selectAll(StatementType.STATEMENT);
int index = 0;
for (OrderEntity each : orders) {
each.setStatus("Fail");
orderService.update(each, 0 == (index++ & 1) ? StatementType.STATEMENT : StatementType.PREPARED);
}
- return success();
}
/**
* Delete order.
- *
- * @return http result
*/
- @GetMapping("/delete")
- public HttpResult<Void> delete() {
+ public void delete() {
Collection<OrderEntity> orders = orderService.selectAll(StatementType.STATEMENT);
int index = 0;
for (OrderEntity each : orders) {
orderService.delete(each.getOrderId(), 0 == (index++ & 1) ? StatementType.STATEMENT : StatementType.PREPARED);
}
- return success();
}
/**
* Select all order.
- *
- * @return http result
*/
- @GetMapping("selectAll")
- public HttpResult<Collection<OrderEntity>> selectAll() {
- return success(orderService.selectAll(StatementType.PREPARED));
+ public void selectAll() {
+ orderService.selectAll(StatementType.PREPARED);
}
}
diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
index 8e0fbd23d9a..3b3795ce7a2 100644
--- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
+++ b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
@@ -17,14 +17,12 @@
package org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.impl;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.test.e2e.agent.jdbc.project.entity.OrderEntity;
import org.apache.shardingsphere.test.e2e.agent.jdbc.project.enums.StatementType;
import org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.OrderService;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -38,11 +36,10 @@ import java.util.LinkedList;
* Order service impl.
*/
@Slf4j
-@Service
-public class OrderServiceImpl implements OrderService {
+@RequiredArgsConstructor
+public final class OrderServiceImpl implements OrderService {
- @Resource
- private DataSource dataSource;
+ private final Connection connection;
@Override
public void createTable() {
@@ -58,9 +55,10 @@ public class OrderServiceImpl implements OrderService {
@Override
public void insert(final OrderEntity order, final StatementType statementType, final boolean isRollback) {
- if (StatementType.STATEMENT == statementType) {
+ if (StatementType.PREPARED == statementType) {
String sql = "INSERT INTO t_order (order_id, user_id, status) VALUES (?, ?, ?)";
- try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
+ log.info("execute sql:{}", sql);
+ try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
connection.setAutoCommit(false);
preparedStatement.setLong(1, order.getOrderId());
preparedStatement.setLong(2, order.getUserId());
@@ -71,9 +69,10 @@ public class OrderServiceImpl implements OrderService {
} else {
connection.commit();
}
- } catch (final SQLException ignored) {
+ } catch (final SQLException ex) {
+ log.error(String.format("execute `%s` error", sql), ex);
}
- } else if (StatementType.PREPARED == statementType) {
+ } else if (StatementType.STATEMENT == statementType) {
String sql = String.format("INSERT INTO t_order (order_id, user_id, status) VALUES (%d, %d, '%s')", order.getOrderId(), order.getUserId(), order.getStatus());
execute(sql, false, isRollback);
}
@@ -81,14 +80,16 @@ public class OrderServiceImpl implements OrderService {
@Override
public void delete(final Long orderId, final StatementType statementType) {
- if (StatementType.STATEMENT == statementType) {
+ if (StatementType.PREPARED == statementType) {
String sql = "DELETE FROM t_order WHERE order_id=?";
- try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
+ log.info("execute sql:{}", sql);
+ try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
preparedStatement.setLong(1, orderId);
preparedStatement.executeUpdate();
- } catch (final SQLException ignored) {
+ } catch (final SQLException ex) {
+ log.error(String.format("execute `%s` error", sql), ex);
}
- } else if (StatementType.PREPARED == statementType) {
+ } else if (StatementType.STATEMENT == statementType) {
String sql = String.format("DELETE FROM t_order WHERE order_id = %d", orderId);
execute(sql, true, false);
}
@@ -96,17 +97,19 @@ public class OrderServiceImpl implements OrderService {
@Override
public void update(final OrderEntity order, final StatementType statementType) {
- if (StatementType.STATEMENT == statementType) {
+ if (StatementType.PREPARED == statementType) {
String sql = "UPDATE t_order SET status = ? WHERE order_id = ?";
- try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
+ log.info("execute sql:{}", sql);
+ try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
connection.setAutoCommit(false);
preparedStatement.setString(1, order.getStatus());
preparedStatement.setLong(2, order.getOrderId());
preparedStatement.executeUpdate();
connection.commit();
- } catch (final SQLException ignored) {
+ } catch (final SQLException ex) {
+ log.error(String.format("execute `%s` error", sql), ex);
}
- } else if (StatementType.PREPARED == statementType) {
+ } else if (StatementType.STATEMENT == statementType) {
String sql = String.format("UPDATE t_order SET status = '%s' WHERE order_id = %d", order.getStatus(), order.getOrderId());
execute(sql, false, false);
}
@@ -115,15 +118,18 @@ public class OrderServiceImpl implements OrderService {
@Override
public Collection<OrderEntity> selectAll(final StatementType statementType) {
String sql = "SELECT * FROM t_order";
- if (StatementType.STATEMENT == statementType) {
- try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
+ log.info("execute sql:{}", sql);
+ if (StatementType.PREPARED == statementType) {
+ try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
return getOrders(preparedStatement.executeQuery());
- } catch (final SQLException ignored) {
+ } catch (final SQLException ex) {
+ log.error(String.format("execute `%s` error", sql), ex);
}
- } else if (StatementType.PREPARED == statementType) {
- try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement()) {
+ } else if (StatementType.STATEMENT == statementType) {
+ try (Statement statement = connection.createStatement()) {
return getOrders(statement.executeQuery(sql));
- } catch (final SQLException ignored) {
+ } catch (final SQLException ex) {
+ log.error(String.format("execute `%s` error", sql), ex);
}
}
return Collections.emptyList();
@@ -140,7 +146,7 @@ public class OrderServiceImpl implements OrderService {
private void execute(final String sql, final boolean autoCommit, final boolean isRollback) {
log.info("execute sql:{}", sql);
- try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement()) {
+ try (Statement statement = connection.createStatement()) {
if (autoCommit) {
statement.execute(sql);
} else {
@@ -152,7 +158,8 @@ public class OrderServiceImpl implements OrderService {
connection.commit();
}
}
- } catch (final SQLException ignored) {
+ } catch (final SQLException ex) {
+ log.error(String.format("execute `%s` error", sql), ex);
}
}
}
diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/HttpResult.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/HttpResult.java
deleted file mode 100644
index 84a7c8ac952..00000000000
--- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/HttpResult.java
+++ /dev/null
@@ -1,37 +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.jdbc.project.vo.response;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Http result.
- *
- * @param <T> type of data
- */
-@RequiredArgsConstructor
-@Getter
-public class HttpResult<T> {
-
- private final int code;
-
- private final String message;
-
- private final T data;
-}
diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/ResponseVo.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/ResponseVo.java
deleted file mode 100644
index 2ffa482d612..00000000000
--- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/ResponseVo.java
+++ /dev/null
@@ -1,37 +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.jdbc.project.vo.response;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Response VO.
- *
- * @param <T> type of data
- */
-@Getter
-@Setter
-public class ResponseVo<T> {
-
- private String code;
-
- private String message;
-
- private T data;
-}
diff --git a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/ResultCode.java b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/ResultCode.java
deleted file mode 100644
index e1ea191b2ae..00000000000
--- a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/vo/response/ResultCode.java
+++ /dev/null
@@ -1,37 +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.jdbc.project.vo.response;
-
-import lombok.Getter;
-
-/**
- * Result code.
- */
-@Getter
-public enum ResultCode {
-
- SUCCESS(200, "SUCCESS"), FAIL(400, "FAIL");
- private final int code;
-
- private final String message;
-
- ResultCode(final int code, final String message) {
- this.code = code;
- this.message = message;
- }
-}
diff --git a/test/e2e/agent/jdbc-project/src/main/resources/application.yml b/test/e2e/agent/jdbc-project/src/main/resources/application.yml
deleted file mode 100644
index c4721e30e93..00000000000
--- a/test/e2e/agent/jdbc-project/src/main/resources/application.yml
+++ /dev/null
@@ -1,27 +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.
-#
-
-server:
- port: 80
-
-logging:
- config: classpath:logback.xml
-
-spring:
- datasource:
- driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
- url: jdbc:shardingsphere:classpath:config.yaml
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/start.sh b/test/e2e/agent/jdbc-project/src/main/resources/bin/start.sh
similarity index 86%
rename from test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/start.sh
rename to test/e2e/agent/jdbc-project/src/main/resources/bin/start.sh
index 46bdf181936..9ea604e3984 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/start.sh
+++ b/test/e2e/agent/jdbc-project/src/main/resources/bin/start.sh
@@ -22,7 +22,9 @@ if [ ! -d "${LOGS_DIR}" ]; then
mkdir "${LOGS_DIR}"
fi
STDOUT_FILE=${LOGS_DIR}/stdout.log
-JAR_FILE=$1
+
+CLASS_PATH=".:${DEPLOY_DIR}/lib/*:${DEPLOY_DIR}/conf"
+MAIN_CLASS=org.apache.shardingsphere.test.e2e.agent.jdbc.project.JdbcProjectApplication
AGENT_FILE=${DEPLOY_DIR}/agent/shardingsphere-agent.jar
function set_agent_name() {
@@ -51,4 +53,4 @@ do
let PARAMETER_INDEX+=1
done
-nohup java ${AGENT_PARAM} -jar ${DEPLOY_DIR}/${JAR_FILE} >> ${STDOUT_FILE} 2>&1 &
+nohup java -classpath ${CLASS_PATH} ${AGENT_PARAM} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
diff --git a/test/e2e/agent/jdbc-project/src/main/resources/logback.xml b/test/e2e/agent/jdbc-project/src/main/resources/logback.xml
deleted file mode 100644
index a5b428b38dc..00000000000
--- a/test/e2e/agent/jdbc-project/src/main/resources/logback.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<configuration>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder charset="UTF-8">
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="info" />
- <appender-ref ref="STDOUT" />
- </root>
-</configuration>
diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java
index ee661ef48f8..b8f916c2599 100644
--- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java
+++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java
@@ -17,18 +17,15 @@
package org.apache.shardingsphere.test.e2e.agent.common;
-import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.test.e2e.agent.common.entity.OrderEntity;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import org.apache.shardingsphere.test.e2e.agent.common.util.JDBCAgentTestUtils;
-import org.apache.shardingsphere.test.e2e.agent.common.util.OkHttpUtils;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import javax.sql.DataSource;
-import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
@@ -49,8 +46,6 @@ public final class AgentTestActionExtension implements BeforeEachCallback {
checkEnvironment();
if (E2ETestEnvironment.getInstance().isAdaptedProxy()) {
requestProxy();
- } else {
- requestJdbcProject();
}
sleep();
}
@@ -79,24 +74,6 @@ public final class AgentTestActionExtension implements BeforeEachCallback {
JDBCAgentTestUtils.createExecuteError(dataSource);
}
- @SneakyThrows(IOException.class)
- private void requestJdbcProject() {
- String baseUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.base.url");
- String createTableUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.path.create.table");
- String dropTableUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.path.drop.table");
- String insertUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.path.insert");
- String updateUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.path.update");
- String selectAllUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.path.select.all");
- String deleteUrl = E2ETestEnvironment.getInstance().getProps().getProperty("jdbc.path.delete");
- OkHttpUtils.getInstance().get(String.join("", baseUrl, dropTableUrl));
- OkHttpUtils.getInstance().get(String.join("", baseUrl, createTableUrl));
- OkHttpUtils.getInstance().get(String.join("", baseUrl, insertUrl));
- OkHttpUtils.getInstance().get(String.join("", baseUrl, updateUrl));
- OkHttpUtils.getInstance().get(String.join("", baseUrl, selectAllUrl));
- OkHttpUtils.getInstance().get(String.join("", baseUrl, deleteUrl));
- OkHttpUtils.getInstance().get(String.join("", baseUrl, dropTableUrl));
- }
-
private void sleep() {
if (!hasSleep) {
log.info("Waiting to collect data ...");
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 77af5057cb9..c34414d9057 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
@@ -21,13 +21,12 @@ import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
-import okhttp3.Response;
-import org.apache.shardingsphere.test.e2e.agent.common.util.OkHttpUtils;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import javax.sql.DataSource;
-import java.io.IOException;
+import java.io.File;
+import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -136,7 +135,7 @@ public final class E2ETestEnvironment {
private boolean waitForJdbcEnvironmentReady() {
log.info("Jdbc project with agent environment initializing ...");
try {
- Awaitility.await().atMost(2L, TimeUnit.MINUTES).pollInterval(5L, TimeUnit.SECONDS).until(() -> isJdbcReady(props));
+ Awaitility.await().atMost(2L, TimeUnit.MINUTES).pollInterval(5L, TimeUnit.SECONDS).until(() -> isJdbcReady());
} catch (final ConditionTimeoutException ignored) {
log.info("Jdbc project with agent environment initialization failed ...");
return false;
@@ -145,16 +144,9 @@ public final class E2ETestEnvironment {
return true;
}
- private boolean isJdbcReady(final Properties props) {
- log.info("Try to connect jdbc project ...");
- String baseUrl = props.getProperty("jdbc.base.url");
- String selectAllUrl = props.getProperty("jdbc.path.select.all");
- try {
- Response response = OkHttpUtils.getInstance().getResponse(String.join("", baseUrl, selectAllUrl));
- response.close();
- return response.isSuccessful();
- } catch (final IOException ignored) {
- }
- return false;
+ private boolean isJdbcReady() {
+ log.info("Wait for the jdbc project environment to be ready ...");
+ String logPath = String.join(File.separator, Paths.get("").toAbsolutePath().toString(), String.join(File.separator, "target", "jdbc", "logs", "stdout.log"));
+ return new File(logPath).exists();
}
}
diff --git a/test/e2e/agent/plugins/logging/file/pom.xml b/test/e2e/agent/plugins/logging/file/pom.xml
index fe57898b3eb..cc96a9dccd6 100644
--- a/test/e2e/agent/plugins/logging/file/pom.xml
+++ b/test/e2e/agent/plugins/logging/file/pom.xml
@@ -194,7 +194,7 @@
</configuration>
</execution>
<execution>
- <id>copy-resources</id>
+ <id>copy-app</id>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -203,16 +203,28 @@
<outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app</outputDirectory>
<resources>
<resource>
- <directory>${project.basedir}/../../../jdbc-project/target/</directory>
- <includes>
- <include>${docker.jdbc.distribution.name}.jar</include>
- </includes>
+ <directory>${project.basedir}/../../../jdbc-project/target/app</directory>
</resource>
<resource>
- <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
</resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-config</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app/conf</outputDirectory>
+ <resources>
<resource>
- <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
+ <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <includes>
+ <include>config.yaml</include>
+ </includes>
</resource>
</resources>
</configuration>
@@ -225,9 +237,6 @@
<configuration>
<repository>apache/shardingsphere-jdbc-agent-logging-file-test</repository>
<tag>latest</tag>
- <buildArgs>
- <APP_NAME>${docker.jdbc.distribution.name}</APP_NAME>
- </buildArgs>
<contextDirectory>${docker.jdbc.context.directory}</contextDirectory>
<dockerfile>${docker.jdbc.context.directory}/Dockerfile</dockerfile>
</configuration>
diff --git a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
index 5f30c437060..8fe1395f381 100644
--- a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
+++ b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
@@ -37,7 +37,8 @@ class FilePluginE2EIT {
void assertWithAgent() {
assertTrue(new File(LogLoader.getLogFilePath(E2ETestEnvironment.getInstance().isAdaptedProxy())).exists(),
String.format("The file `%s` does not exist", LogLoader.getLogFilePath(E2ETestEnvironment.getInstance().isAdaptedProxy())));
- Collection<String> actualLogLines = LogLoader.getLogLines(E2ETestEnvironment.getInstance().isAdaptedProxy());
+ Collection<String> actualLogLines = LogLoader.getLogLines(LogLoader.getLogFilePath(E2ETestEnvironment.getInstance().isAdaptedProxy()),
+ E2ETestEnvironment.getInstance().isAdaptedProxy());
assertFalse(actualLogLines.isEmpty(), "Actual log is empty");
if (E2ETestEnvironment.getInstance().isAdaptedProxy()) {
assertProxyWithAgent(actualLogLines);
diff --git a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java
index 10a02bffbc7..4698c98920c 100644
--- a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java
+++ b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/asserts/ContentAssert.java
@@ -19,10 +19,8 @@ package org.apache.shardingsphere.test.e2e.agent.file.asserts;
import java.util.Collection;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Content assert.
@@ -37,7 +35,13 @@ public final class ContentAssert {
*/
public static void assertIs(final Collection<String> actualLogLines, final String expectedLogRegex) {
Pattern pattern = Pattern.compile(expectedLogRegex);
- Collection<String> expectedLogs = actualLogLines.stream().filter(each -> pattern.matcher(each).find()).collect(Collectors.toList());
- assertThat(String.format("The log for the specified regular `%s` does not exist", expectedLogRegex), expectedLogs.size(), greaterThan(0));
+ String actualLog = null;
+ for (String each : actualLogLines) {
+ if (pattern.matcher(each).find()) {
+ actualLog = each;
+ break;
+ }
+ }
+ assertNotNull(String.format("The log for the specified regular `%s` does not exist", expectedLogRegex), actualLog);
}
}
diff --git a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java
index fa8082cf05a..0e56ff47493 100644
--- a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java
+++ b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/loader/LogLoader.java
@@ -36,14 +36,15 @@ public final class LogLoader {
/**
* Get log lines.
*
+ * @param logFilePath log file path
* @param isAdaptedProxy is adapted proxy
* @return log lines
*/
@SneakyThrows(IOException.class)
- public static Collection<String> getLogLines(final boolean isAdaptedProxy) {
+ public static Collection<String> getLogLines(final String logFilePath, final boolean isAdaptedProxy) {
Collection<String> result = new LinkedList<>();
- Collection<String> lines = Files.readAllLines(Paths.get(getLogFilePath(isAdaptedProxy)));
- Pattern pattern = Pattern.compile("^\\[");
+ Collection<String> lines = Files.readAllLines(Paths.get(logFilePath));
+ Pattern pattern = isAdaptedProxy ? Pattern.compile("^\\[") : Pattern.compile("^\\d{2}:");
StringBuilder builder = new StringBuilder();
boolean hasFind = false;
for (String each : lines) {
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/Dockerfile b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/Dockerfile
index e734fd67a0d..138fd8483ba 100644
--- a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/Dockerfile
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/Dockerfile
@@ -17,11 +17,10 @@
FROM eclipse-temurin:11-jdk
-ARG APP_NAME
-ENV WAIT_VERSION=2.7.2 JAR_FILE_NAME=${APP_NAME}.jar
+ENV WAIT_VERSION=2.7.2
COPY shardingsphere-jdbc-app /opt/shardingsphere-jdbc-app
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
RUN chmod +x /wait && chmod +x /opt/shardingsphere-jdbc-app/start.sh
WORKDIR /opt/shardingsphere-jdbc-app
-ENTRYPOINT /wait && ./start.sh $JAR_FILE_NAME --agent && tail -f ./logs/stdout.log
+ENTRYPOINT /wait && ./start.sh --agent && tail -f ./logs/stdout.log
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/conf/application.yml b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/conf/application.yml
deleted file mode 100644
index 389a37be2ac..00000000000
--- a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/conf/application.yml
+++ /dev/null
@@ -1,24 +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.
-#
-
-server:
- port: 80
-
-spring:
- datasource:
- driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
- url: jdbc:shardingsphere:absolutepath:/opt/shardingsphere-jdbc-app/config.yaml
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/conf/start.sh b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/conf/start.sh
deleted file mode 100644
index 46bdf181936..00000000000
--- a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/conf/start.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-DEPLOY_DIR="$(pwd)"
-LOGS_DIR=${DEPLOY_DIR}/logs
-if [ ! -d "${LOGS_DIR}" ]; then
- mkdir "${LOGS_DIR}"
-fi
-STDOUT_FILE=${LOGS_DIR}/stdout.log
-JAR_FILE=$1
-
-AGENT_FILE=${DEPLOY_DIR}/agent/shardingsphere-agent.jar
-function set_agent_name() {
- if [ -d "${DEPLOY_DIR}/agent" ]; then
- AGENT_NAME=$(ls "${DEPLOY_DIR}/agent/shardingsphere-agent"*)
- if [ -n "${AGENT_NAME}" ]; then
- AGENT_FILE=${AGENT_NAME}
- fi
- fi
-}
-
-AGENT_PARAM="";
-function set_agent_parameter() {
- if [ -f "$AGENT_FILE" ]; then
- AGENT_PARAM=" -javaagent:${AGENT_FILE} "
- fi
-}
-
-for arg in $*
-do
- if [ "$arg" == "--agent" ] ; then
- set_agent_name
- set_agent_parameter
- break
- fi
- let PARAMETER_INDEX+=1
-done
-
-nohup java ${AGENT_PARAM} -jar ${DEPLOY_DIR}/${JAR_FILE} >> ${STDOUT_FILE} 2>&1 &
diff --git a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/docker-compose.yml b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/docker-compose.yml
index 0bf59f4c537..c7fe2ffb2ae 100644
--- a/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/docker-compose.yml
+++ b/test/e2e/agent/plugins/logging/file/src/test/resources/docker/jdbc/docker-compose.yml
@@ -32,8 +32,6 @@ services:
shardingsphere-jdbc-agent-logging:
image: apache/shardingsphere-jdbc-agent-logging-file-test
container_name: shardingsphere-jdbc-agent-logging-file
- ports:
- - "18080:80"
links:
- "mysql:mysql.agent.jdbc.logging.host"
volumes:
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 486fe927238..4431edb760b 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
@@ -22,12 +22,4 @@ proxy.url=jdbc:mysql://127.0.0.1:43072/agent-file-db?serverTimezone=UTC&useSSL=f
proxy.username=root
proxy.password=root
-jdbc.base.url=http://127.0.0.1:18080
-jdbc.path.create.table=/order/createTable
-jdbc.path.drop.table=/order/dropTable
-jdbc.path.insert=/order/insert
-jdbc.path.update=/order/update
-jdbc.path.select.all=/order/selectAll
-jdbc.path.delete=/order/delete
-
-collect.data.wait.milliseconds=2000
+collect.data.wait.milliseconds=8000
diff --git a/test/e2e/agent/plugins/metrics/prometheus/pom.xml b/test/e2e/agent/plugins/metrics/prometheus/pom.xml
index 67791298339..75d96796ec7 100644
--- a/test/e2e/agent/plugins/metrics/prometheus/pom.xml
+++ b/test/e2e/agent/plugins/metrics/prometheus/pom.xml
@@ -195,7 +195,7 @@
</configuration>
</execution>
<execution>
- <id>copy-resources</id>
+ <id>copy-app</id>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -204,16 +204,28 @@
<outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app</outputDirectory>
<resources>
<resource>
- <directory>${project.basedir}/../../../jdbc-project/target/</directory>
- <includes>
- <include>${docker.jdbc.distribution.name}.jar</include>
- </includes>
+ <directory>${project.basedir}/../../../jdbc-project/target/app</directory>
</resource>
<resource>
- <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
</resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-config</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app/conf</outputDirectory>
+ <resources>
<resource>
- <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
+ <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <includes>
+ <include>config.yaml</include>
+ </includes>
</resource>
</resources>
</configuration>
@@ -227,9 +239,6 @@
<repository>apache/shardingsphere-jdbc-agent-metrics-test</repository>
<tag>${project.version}</tag>
<tag>latest</tag>
- <buildArgs>
- <APP_NAME>${docker.jdbc.distribution.name}</APP_NAME>
- </buildArgs>
<contextDirectory>${docker.jdbc.context.directory}</contextDirectory>
<dockerfile>${docker.jdbc.context.directory}/Dockerfile</dockerfile>
</configuration>
diff --git a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/Dockerfile b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/Dockerfile
index e734fd67a0d..138fd8483ba 100644
--- a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/Dockerfile
+++ b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/Dockerfile
@@ -17,11 +17,10 @@
FROM eclipse-temurin:11-jdk
-ARG APP_NAME
-ENV WAIT_VERSION=2.7.2 JAR_FILE_NAME=${APP_NAME}.jar
+ENV WAIT_VERSION=2.7.2
COPY shardingsphere-jdbc-app /opt/shardingsphere-jdbc-app
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
RUN chmod +x /wait && chmod +x /opt/shardingsphere-jdbc-app/start.sh
WORKDIR /opt/shardingsphere-jdbc-app
-ENTRYPOINT /wait && ./start.sh $JAR_FILE_NAME --agent && tail -f ./logs/stdout.log
+ENTRYPOINT /wait && ./start.sh --agent && tail -f ./logs/stdout.log
diff --git a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/conf/application.yml b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/conf/application.yml
deleted file mode 100644
index 389a37be2ac..00000000000
--- a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/conf/application.yml
+++ /dev/null
@@ -1,24 +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.
-#
-
-server:
- port: 80
-
-spring:
- datasource:
- driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
- url: jdbc:shardingsphere:absolutepath:/opt/shardingsphere-jdbc-app/config.yaml
diff --git a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/conf/start.sh b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/conf/start.sh
deleted file mode 100644
index 46bdf181936..00000000000
--- a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/conf/start.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-DEPLOY_DIR="$(pwd)"
-LOGS_DIR=${DEPLOY_DIR}/logs
-if [ ! -d "${LOGS_DIR}" ]; then
- mkdir "${LOGS_DIR}"
-fi
-STDOUT_FILE=${LOGS_DIR}/stdout.log
-JAR_FILE=$1
-
-AGENT_FILE=${DEPLOY_DIR}/agent/shardingsphere-agent.jar
-function set_agent_name() {
- if [ -d "${DEPLOY_DIR}/agent" ]; then
- AGENT_NAME=$(ls "${DEPLOY_DIR}/agent/shardingsphere-agent"*)
- if [ -n "${AGENT_NAME}" ]; then
- AGENT_FILE=${AGENT_NAME}
- fi
- fi
-}
-
-AGENT_PARAM="";
-function set_agent_parameter() {
- if [ -f "$AGENT_FILE" ]; then
- AGENT_PARAM=" -javaagent:${AGENT_FILE} "
- fi
-}
-
-for arg in $*
-do
- if [ "$arg" == "--agent" ] ; then
- set_agent_name
- set_agent_parameter
- break
- fi
- let PARAMETER_INDEX+=1
-done
-
-nohup java ${AGENT_PARAM} -jar ${DEPLOY_DIR}/${JAR_FILE} >> ${STDOUT_FILE} 2>&1 &
diff --git a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/docker-compose.yml b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/docker-compose.yml
index ea005fbd808..92ab648c01e 100644
--- a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/docker-compose.yml
+++ b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/docker/jdbc/docker-compose.yml
@@ -47,7 +47,6 @@ services:
image: apache/shardingsphere-jdbc-agent-metrics-test
container_name: shardingsphere-jdbc-agent-metrics
ports:
- - "18080:80"
- "19099:19099"
links:
- "mysql:mysql.agent.jdbc.metrics.host"
diff --git a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/env/engine-env.properties b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/env/engine-env.properties
index 19659e0b165..e779fcc6e23 100644
--- a/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/env/engine-env.properties
+++ b/test/e2e/agent/plugins/metrics/prometheus/src/test/resources/env/engine-env.properties
@@ -22,14 +22,7 @@ proxy.url=jdbc:mysql://127.0.0.1:43070/agent-metrics-db?serverTimezone=UTC&useSS
proxy.username=root
proxy.password=root
-jdbc.base.url=http://127.0.0.1:18080
-jdbc.path.create.table=/order/createTable
-jdbc.path.drop.table=/order/dropTable
-jdbc.path.insert=/order/insert
-jdbc.path.update=/order/update
-jdbc.path.select.all=/order/selectAll
-jdbc.path.delete=/order/delete
-
prometheus.metadata.url=http://127.0.0.1:19090/api/v1/metadata
prometheus.query.url=http://127.0.0.1:19090/api/v1/query
+
collect.data.wait.milliseconds=35000
diff --git a/test/e2e/agent/plugins/tracing/jaeger/pom.xml b/test/e2e/agent/plugins/tracing/jaeger/pom.xml
index a55b25df1c6..ea206f82d97 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/pom.xml
+++ b/test/e2e/agent/plugins/tracing/jaeger/pom.xml
@@ -194,7 +194,7 @@
</configuration>
</execution>
<execution>
- <id>copy-resources</id>
+ <id>copy-app</id>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -203,16 +203,28 @@
<outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app</outputDirectory>
<resources>
<resource>
- <directory>${project.basedir}/../../../jdbc-project/target/</directory>
- <includes>
- <include>${docker.jdbc.distribution.name}.jar</include>
- </includes>
+ <directory>${project.basedir}/../../../jdbc-project/target/app</directory>
</resource>
<resource>
- <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
</resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-config</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app/conf</outputDirectory>
+ <resources>
<resource>
- <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
+ <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <includes>
+ <include>config.yaml</include>
+ </includes>
</resource>
</resources>
</configuration>
@@ -226,9 +238,6 @@
<repository>apache/shardingsphere-jdbc-agent-tracing-jaeger-test</repository>
<tag>${project.version}</tag>
<tag>latest</tag>
- <buildArgs>
- <APP_NAME>${docker.jdbc.distribution.name}</APP_NAME>
- </buildArgs>
<contextDirectory>${docker.jdbc.context.directory}</contextDirectory>
<dockerfile>${docker.jdbc.context.directory}/Dockerfile</dockerfile>
</configuration>
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
index 230f9da19f4..a77ac28cc60 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
+++ b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
@@ -22,8 +22,8 @@
<tag-assertion key="span.kind" value="internal" need-assert-value="true" />
<tag-assertion key="db.statement" />
<tag-assertion key="db.statement" value="SELECT * FROM t_order" need-assert-value="true" />
- <tag-assertion key="db.statement" value="INSERT INTO t_order (order_id, user_id, status) VALUES (1, 1, 'OK')" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="INSERT INTO t_order (order_id, user_id, status) VALUES (2, 2, 'OK')" need-assert-value="true" />
<tag-assertion key="db.statement" value="UPDATE t_order SET status = 'Fail' WHERE order_id = 1" need-assert-value="true" />
- <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE order_id = 1" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE order_id = 2" need-assert-value="true" />
</test-case>
</integration-test-cases>
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile
index e734fd67a0d..138fd8483ba 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile
+++ b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile
@@ -17,11 +17,10 @@
FROM eclipse-temurin:11-jdk
-ARG APP_NAME
-ENV WAIT_VERSION=2.7.2 JAR_FILE_NAME=${APP_NAME}.jar
+ENV WAIT_VERSION=2.7.2
COPY shardingsphere-jdbc-app /opt/shardingsphere-jdbc-app
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
RUN chmod +x /wait && chmod +x /opt/shardingsphere-jdbc-app/start.sh
WORKDIR /opt/shardingsphere-jdbc-app
-ENTRYPOINT /wait && ./start.sh $JAR_FILE_NAME --agent && tail -f ./logs/stdout.log
+ENTRYPOINT /wait && ./start.sh --agent && tail -f ./logs/stdout.log
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/application.yml b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/application.yml
deleted file mode 100644
index 389a37be2ac..00000000000
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/application.yml
+++ /dev/null
@@ -1,24 +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.
-#
-
-server:
- port: 80
-
-spring:
- datasource:
- driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
- url: jdbc:shardingsphere:absolutepath:/opt/shardingsphere-jdbc-app/config.yaml
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml
index 6f0158f8a75..659c8d40d38 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml
+++ b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml
@@ -41,8 +41,6 @@ services:
shardingsphere-jdbc-agent-tracing:
image: apache/shardingsphere-jdbc-agent-tracing-jaeger-test
container_name: shardingsphere-jdbc-agent-tracing-jaeger-test
- ports:
- - "18080:80"
links:
- "mysql:mysql.agent.jdbc.jaeger.host"
- "jaeger:jaeger.agent.host"
diff --git a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
index 22d01fc3aaa..c732c0c08b5 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
+++ b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
@@ -22,13 +22,6 @@ proxy.url=jdbc:mysql://127.0.0.1:43071/agent-tracing-jaeger-db?serverTimezone=UT
proxy.username=root
proxy.password=root
-jdbc.base.url=http://127.0.0.1:18080
-jdbc.path.create.table=/order/createTable
-jdbc.path.drop.table=/order/dropTable
-jdbc.path.insert=/order/insert
-jdbc.path.update=/order/update
-jdbc.path.select.all=/order/selectAll
-jdbc.path.delete=/order/delete
-
jaeger.url=http://127.0.0.1:26686
-collect.data.wait.milliseconds=5000
+
+collect.data.wait.milliseconds=15000
diff --git a/test/e2e/agent/plugins/tracing/zipkin/pom.xml b/test/e2e/agent/plugins/tracing/zipkin/pom.xml
index 5ce066d3790..d109865d666 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/pom.xml
+++ b/test/e2e/agent/plugins/tracing/zipkin/pom.xml
@@ -194,7 +194,7 @@
</configuration>
</execution>
<execution>
- <id>copy-resources</id>
+ <id>copy-app</id>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -203,16 +203,28 @@
<outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app</outputDirectory>
<resources>
<resource>
- <directory>${project.basedir}/../../../jdbc-project/target/</directory>
- <includes>
- <include>${docker.jdbc.distribution.name}.jar</include>
- </includes>
+ <directory>${project.basedir}/../../../jdbc-project/target/app</directory>
</resource>
<resource>
- <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
</resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-config</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app/conf</outputDirectory>
+ <resources>
<resource>
- <directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
+ <directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ <includes>
+ <include>config.yaml</include>
+ </includes>
</resource>
</resources>
</configuration>
@@ -226,9 +238,6 @@
<repository>apache/shardingsphere-jdbc-agent-tracing-zipkin-test</repository>
<tag>${project.version}</tag>
<tag>latest</tag>
- <buildArgs>
- <APP_NAME>${docker.jdbc.distribution.name}</APP_NAME>
- </buildArgs>
<contextDirectory>${docker.jdbc.context.directory}</contextDirectory>
<dockerfile>${docker.jdbc.context.directory}/Dockerfile</dockerfile>
</configuration>
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml
index 230f9da19f4..a77ac28cc60 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml
@@ -22,8 +22,8 @@
<tag-assertion key="span.kind" value="internal" need-assert-value="true" />
<tag-assertion key="db.statement" />
<tag-assertion key="db.statement" value="SELECT * FROM t_order" need-assert-value="true" />
- <tag-assertion key="db.statement" value="INSERT INTO t_order (order_id, user_id, status) VALUES (1, 1, 'OK')" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="INSERT INTO t_order (order_id, user_id, status) VALUES (2, 2, 'OK')" need-assert-value="true" />
<tag-assertion key="db.statement" value="UPDATE t_order SET status = 'Fail' WHERE order_id = 1" need-assert-value="true" />
- <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE order_id = 1" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE order_id = 2" need-assert-value="true" />
</test-case>
</integration-test-cases>
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile
index e734fd67a0d..138fd8483ba 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile
@@ -17,11 +17,10 @@
FROM eclipse-temurin:11-jdk
-ARG APP_NAME
-ENV WAIT_VERSION=2.7.2 JAR_FILE_NAME=${APP_NAME}.jar
+ENV WAIT_VERSION=2.7.2
COPY shardingsphere-jdbc-app /opt/shardingsphere-jdbc-app
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
RUN chmod +x /wait && chmod +x /opt/shardingsphere-jdbc-app/start.sh
WORKDIR /opt/shardingsphere-jdbc-app
-ENTRYPOINT /wait && ./start.sh $JAR_FILE_NAME --agent && tail -f ./logs/stdout.log
+ENTRYPOINT /wait && ./start.sh --agent && tail -f ./logs/stdout.log
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/application.yml b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/application.yml
deleted file mode 100644
index 389a37be2ac..00000000000
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/application.yml
+++ /dev/null
@@ -1,24 +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.
-#
-
-server:
- port: 80
-
-spring:
- datasource:
- driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
- url: jdbc:shardingsphere:absolutepath:/opt/shardingsphere-jdbc-app/config.yaml
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/start.sh b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/start.sh
deleted file mode 100644
index 46bdf181936..00000000000
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/start.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-DEPLOY_DIR="$(pwd)"
-LOGS_DIR=${DEPLOY_DIR}/logs
-if [ ! -d "${LOGS_DIR}" ]; then
- mkdir "${LOGS_DIR}"
-fi
-STDOUT_FILE=${LOGS_DIR}/stdout.log
-JAR_FILE=$1
-
-AGENT_FILE=${DEPLOY_DIR}/agent/shardingsphere-agent.jar
-function set_agent_name() {
- if [ -d "${DEPLOY_DIR}/agent" ]; then
- AGENT_NAME=$(ls "${DEPLOY_DIR}/agent/shardingsphere-agent"*)
- if [ -n "${AGENT_NAME}" ]; then
- AGENT_FILE=${AGENT_NAME}
- fi
- fi
-}
-
-AGENT_PARAM="";
-function set_agent_parameter() {
- if [ -f "$AGENT_FILE" ]; then
- AGENT_PARAM=" -javaagent:${AGENT_FILE} "
- fi
-}
-
-for arg in $*
-do
- if [ "$arg" == "--agent" ] ; then
- set_agent_name
- set_agent_parameter
- break
- fi
- let PARAMETER_INDEX+=1
-done
-
-nohup java ${AGENT_PARAM} -jar ${DEPLOY_DIR}/${JAR_FILE} >> ${STDOUT_FILE} 2>&1 &
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml
index 560c633617a..5ffa27b60d9 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml
@@ -39,8 +39,6 @@ services:
shardingsphere-jdbc-agent-tracing:
image: apache/shardingsphere-jdbc-agent-tracing-zipkin-test
container_name: shardingsphere-jdbc-agent-tracing-zipkin-test
- ports:
- - "18080:80"
links:
- "mysql:mysql.agent.jdbc.zipkin.host"
- "zipkin:zipkin.host"
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
index a6ef22e1a7a..3658c0b87a1 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
@@ -22,13 +22,6 @@ proxy.url=jdbc:mysql://127.0.0.1:43071/agent-tracing-zipkin-db?serverTimezone=UT
proxy.username=root
proxy.password=root
-jdbc.base.url=http://127.0.0.1:18080
-jdbc.path.create.table=/order/createTable
-jdbc.path.drop.table=/order/dropTable
-jdbc.path.insert=/order/insert
-jdbc.path.update=/order/update
-jdbc.path.select.all=/order/selectAll
-jdbc.path.delete=/order/delete
-
zipkin.url=http://127.0.0.1:19411
-collect.data.wait.milliseconds=5000
+
+collect.data.wait.milliseconds=15000
diff --git a/test/e2e/agent/pom.xml b/test/e2e/agent/pom.xml
index aaea613f8d3..1ea38887e9e 100644
--- a/test/e2e/agent/pom.xml
+++ b/test/e2e/agent/pom.xml
@@ -36,7 +36,6 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<docker.proxy.distribution.name>apache-shardingsphere-${project.version}-shardingsphere-proxy-bin</docker.proxy.distribution.name>
- <docker.jdbc.distribution.name>shardingsphere-jdbc-agent-test-${project.version}</docker.jdbc.distribution.name>
</properties>
<dependencies>