From 8c5b103752e65774efe653b6b33f52a7731a8c52 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Tue, 18 Jul 2023 22:40:29 +0800 Subject: [PATCH] =?UTF-8?q?enhancement=20#I7KZCZ=20=E5=9C=A8=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E4=BD=BF=E7=94=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E5=B7=B2=E7=BB=8F=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../def/SQLWithXmlELMultiLanguageSpringbootTest.java | 2 +- .../test/def/SQLWithXmlELSpringbootTest.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELMultiLanguageSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELMultiLanguageSpringbootTest.java index c573fd243..ee72f5f9a 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELMultiLanguageSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELMultiLanguageSpringbootTest.java @@ -15,7 +15,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; import javax.annotation.Resource; @ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/application-xml.properties") +@TestPropertySource(value = "classpath:/application-data-source-xml.properties") @SpringBootTest(classes = SQLWithXmlELMultiLanguageSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({"com.yomahub.liteflow.test.sql.cmp"}) diff --git a/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELSpringbootTest.java index 87edf48cd..8e86d5129 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-sql-springboot/src/test/java/com/yomahub/liteflow/test/def/SQLWithXmlELSpringbootTest.java @@ -18,8 +18,8 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; import javax.annotation.Resource; +import javax.sql.DataSource; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; @@ -28,7 +28,7 @@ import java.sql.Statement; * @since 2.9.0 */ @ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/application-xml.properties") +@TestPropertySource(value = "classpath:/application-data-source-xml.properties") @SpringBootTest(classes = SQLWithXmlELSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({"com.yomahub.liteflow.test.sql.cmp"}) @@ -36,6 +36,8 @@ public class SQLWithXmlELSpringbootTest extends BaseTest { @Resource private FlowExecutor flowExecutor; + @Resource + private DataSource dataSource; @Test public void testSQLWithXml() { @@ -71,8 +73,7 @@ public class SQLWithXmlELSpringbootTest extends BaseTest { SQLParserVO sqlParserVO = JsonUtil.parseObject(liteflowConfig.getRuleSourceExtData(), SQLParserVO.class); Connection connection; try { - connection = DriverManager.getConnection(sqlParserVO.getUrl(), sqlParserVO.getUsername(), - sqlParserVO.getPassword()); + connection = dataSource.getConnection(); Statement statement = connection.createStatement(); statement.executeUpdate("UPDATE EL_TABLE SET EL_DATA='THEN(a, c, b);' WHERE chain_name='chain1'"); } catch (SQLException e) { @@ -88,8 +89,7 @@ public class SQLWithXmlELSpringbootTest extends BaseTest { SQLParserVO sqlParserVO = JsonUtil.parseObject(liteflowConfig.getRuleSourceExtData(), SQLParserVO.class); Connection connection; try { - connection = DriverManager.getConnection(sqlParserVO.getUrl(), sqlParserVO.getUsername(), - sqlParserVO.getPassword()); + connection = dataSource.getConnection(); Statement statement = connection.createStatement(); statement.executeUpdate( "UPDATE SCRIPT_NODE_TABLE SET SCRIPT_NODE_DATA='return false;' WHERE SCRIPT_NODE_ID='x0'");