改进单元测试类配置
This commit is contained in:
@@ -1,16 +1,7 @@
|
|||||||
|
|
||||||
# 产品或项目名称、软件开发公司名称
|
|
||||||
productName: JeeSite Demo
|
|
||||||
companyName: ThinkGem
|
|
||||||
|
|
||||||
# 产品版本、版权年份
|
|
||||||
productVersion: V5.13
|
|
||||||
copyrightYear: 2025
|
|
||||||
|
|
||||||
|
|
||||||
# 数据库连接
|
# 数据库连接
|
||||||
jdbc:
|
jdbc:
|
||||||
|
|
||||||
# Mysql 数据库配置
|
# Mysql 数据库配置
|
||||||
type: mysql
|
type: mysql
|
||||||
driver: com.mysql.cj.jdbc.Driver
|
driver: com.mysql.cj.jdbc.Driver
|
||||||
@@ -18,11 +9,7 @@ jdbc:
|
|||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
testSql: SELECT 1
|
testSql: SELECT 1
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback-test.xml
|
config: classpath:logback-test.xml
|
||||||
|
|
||||||
# 消息推送
|
|
||||||
msg:
|
|
||||||
enabled: true
|
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# 温馨提示:不建议直接修改此文件,为了平台升级方便,建议将需要修改的参数值,复制到application.yml里进行覆盖该参数值。
|
# 温馨提示:不建议直接修改此文件,为了平台升级方便,建议将需要修改的参数值,复制到application.yml里进行覆盖该参数值。
|
||||||
|
|
||||||
|
# 产品或项目名称、软件开发公司名称
|
||||||
|
productName: JeeSite Demo
|
||||||
|
companyName: ThinkGem
|
||||||
|
|
||||||
|
# 产品版本、版权年份
|
||||||
|
productVersion: V5.13
|
||||||
|
copyrightYear: 2025
|
||||||
|
|
||||||
#======================================#
|
#======================================#
|
||||||
#========== Database sttings ==========#
|
#========== Database sttings ==========#
|
||||||
#======================================#
|
#======================================#
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
|
|
||||||
# 产品或项目名称、软件开发公司名称
|
|
||||||
productName: JeeSite Demo
|
|
||||||
companyName: ThinkGem
|
|
||||||
|
|
||||||
# 产品版本、版权年份
|
|
||||||
productVersion: V5.13
|
|
||||||
copyrightYear: 2025
|
|
||||||
|
|
||||||
# 数据库连接
|
# 数据库连接
|
||||||
jdbc:
|
jdbc:
|
||||||
|
|
||||||
# Mysql 数据库配置
|
# Mysql 数据库配置
|
||||||
type: mysql
|
type: mysql
|
||||||
driver: com.mysql.cj.jdbc.Driver
|
driver: com.mysql.cj.jdbc.Driver
|
||||||
@@ -17,12 +9,7 @@ jdbc:
|
|||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
testSql: SELECT 1
|
testSql: SELECT 1
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback-test.xml
|
config: classpath:logback-test.xml
|
||||||
|
|
||||||
# 消息推送
|
|
||||||
msg:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||||
|
* No deletion without permission, or be held responsible to law.
|
||||||
|
*/
|
||||||
|
package com.jeesite.test;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JeeSite Web
|
||||||
|
* @author ThinkGem
|
||||||
|
* @version 2018-1-8
|
||||||
|
*/
|
||||||
|
@ActiveProfiles("test")
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ApplicationTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ApplicationTest.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ package com.jeesite.test;
|
|||||||
|
|
||||||
import com.jeesite.common.collect.ListUtils;
|
import com.jeesite.common.collect.ListUtils;
|
||||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
import com.jeesite.common.tests.BaseSpringContextTests;
|
||||||
import com.jeesite.modules.Application;
|
|
||||||
import com.jeesite.modules.test.dao.TestDataDao;
|
import com.jeesite.modules.test.dao.TestDataDao;
|
||||||
import com.jeesite.modules.test.entity.TestData;
|
import com.jeesite.modules.test.entity.TestData;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -22,7 +21,7 @@ import java.util.List;
|
|||||||
* @version 2019年10月28日
|
* @version 2019年10月28日
|
||||||
*/
|
*/
|
||||||
@ActiveProfiles("test")
|
@ActiveProfiles("test")
|
||||||
@SpringBootTest(classes = Application.class)
|
@SpringBootTest(classes = ApplicationTest.class)
|
||||||
public class InsertBatchTest extends BaseSpringContextTests {
|
public class InsertBatchTest extends BaseSpringContextTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -4,23 +4,21 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeesite.test;
|
package com.jeesite.test;
|
||||||
|
|
||||||
import java.util.List;
|
import com.jeesite.common.collect.ListUtils;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import com.jeesite.common.idgen.IdGen;
|
||||||
import java.util.concurrent.ExecutorService;
|
import com.jeesite.common.tests.BaseSpringContextTests;
|
||||||
import java.util.concurrent.Executors;
|
import com.jeesite.modules.test.entity.TestData;
|
||||||
|
import com.jeesite.modules.test.entity.TestDataChild;
|
||||||
|
import com.jeesite.modules.test.service.TestDataService;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
import com.jeesite.common.collect.ListUtils;
|
import java.util.List;
|
||||||
import com.jeesite.common.idgen.IdGen;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
import java.util.concurrent.ExecutorService;
|
||||||
import com.jeesite.modules.Application;
|
import java.util.concurrent.Executors;
|
||||||
import com.jeesite.modules.test.entity.TestData;
|
|
||||||
import com.jeesite.modules.test.entity.TestDataChild;
|
|
||||||
import com.jeesite.modules.test.service.TestDataService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多数据源并发测试<br>
|
* 多数据源并发测试<br>
|
||||||
@@ -31,7 +29,7 @@ import com.jeesite.modules.test.service.TestDataService;
|
|||||||
* @version 2019-6-26
|
* @version 2019-6-26
|
||||||
*/
|
*/
|
||||||
@ActiveProfiles("test")
|
@ActiveProfiles("test")
|
||||||
@SpringBootTest(classes = Application.class)
|
@SpringBootTest(classes = ApplicationTest.class)
|
||||||
public class MultiDataSourceTest extends BaseSpringContextTests {
|
public class MultiDataSourceTest extends BaseSpringContextTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
15
modules/test/src/test/resources/application.yml
Normal file
15
modules/test/src/test/resources/application.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
# 数据库连接
|
||||||
|
jdbc:
|
||||||
|
|
||||||
|
# Mysql 数据库配置
|
||||||
|
type: mysql
|
||||||
|
driver: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/jeesite_v5?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
testSql: SELECT 1
|
||||||
|
|
||||||
|
# 日志配置
|
||||||
|
logging:
|
||||||
|
config: classpath:logback-test.xml
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
|
|
||||||
<!-- Logger level setting -->
|
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
|
||||||
<include resource="config/logger-core.xml"/>
|
|
||||||
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{HH:mm:ss.SSS} %clr(%-5p) %clr([%-39logger{39}]){cyan} - %m%n%wEx</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="WARN">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
|
|
||||||
<!-- Logger level setting -->
|
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
|
||||||
<include resource="config/logger-core.xml"/>
|
|
||||||
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{HH:mm:ss.SSS} %clr(%-5p) %clr([%-39logger{39}]){cyan} - %m%n%wEx</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="WARN">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
|
|
||||||
<!-- Logger level setting -->
|
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
|
||||||
<include resource="config/logger-core.xml"/>
|
|
||||||
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{HH:mm:ss.SSS} %clr(%-5p) %clr([%-39logger{39}]){cyan} - %m%n%wEx</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="WARN">
|
|
||||||
<appender-ref ref="console" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
Reference in New Issue
Block a user