✨ 降低 podam 到 7.2.11,解决 Spring Boot 2.X 单测报错问题
This commit is contained in:
parent
04a242acfc
commit
478d57f2a1
@ -47,7 +47,7 @@
|
|||||||
<spring-boot-admin.version>2.7.15</spring-boot-admin.version>
|
<spring-boot-admin.version>2.7.15</spring-boot-admin.version>
|
||||||
<opentracing.version>0.33.0</opentracing.version>
|
<opentracing.version>0.33.0</opentracing.version>
|
||||||
<!-- Test 测试相关 -->
|
<!-- Test 测试相关 -->
|
||||||
<podam.version>8.0.1.RELEASE</podam.version>
|
<podam.version>7.2.11.RELEASE</podam.version> <!-- Spring Boot 2.X 最多使用 7.2.11 版本 -->
|
||||||
<jedis-mock.version>1.0.13</jedis-mock.version>
|
<jedis-mock.version>1.0.13</jedis-mock.version>
|
||||||
<mockito-inline.version>4.11.0</mockito-inline.version>
|
<mockito-inline.version>4.11.0</mockito-inline.version>
|
||||||
<!-- Bpm 工作流相关 -->
|
<!-- Bpm 工作流相关 -->
|
||||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration
|
|||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||||
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@ -40,8 +41,8 @@ public class BaseDbAndRedisUnitTest {
|
|||||||
|
|
||||||
// Redis 配置类
|
// Redis 配置类
|
||||||
RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
|
RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
|
||||||
// RedisAutoConfiguration.class, // Spring Redis 自动配置类
|
|
||||||
YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
||||||
|
RedisAutoConfiguration.class, // Spring Redis 自动配置类
|
||||||
RedissonAutoConfiguration.class, // Redisson 自动高配置类
|
RedissonAutoConfiguration.class, // Redisson 自动高配置类
|
||||||
})
|
})
|
||||||
public static class Application {
|
public static class Application {
|
||||||
|
@ -9,7 +9,7 @@ import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
|||||||
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -61,8 +61,11 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
|
|||||||
|
|
||||||
// mock DynamicDataSourceProperties
|
// mock DynamicDataSourceProperties
|
||||||
when(dynamicDataSourceProperties.getPrimary()).thenReturn("primary");
|
when(dynamicDataSourceProperties.getPrimary()).thenReturn("primary");
|
||||||
when(dynamicDataSourceProperties.getDatasource()).thenReturn(MapUtil.of("primary",
|
DataSourceProperty dataSourceProperty = new DataSourceProperty();
|
||||||
new DataSourceProperty().setUrl("http://localhost:3306").setUsername("yunai").setPassword("tudou")));
|
dataSourceProperty.setUrl("http://localhost:3306");
|
||||||
|
dataSourceProperty.setUsername("yunai");
|
||||||
|
dataSourceProperty.setPassword("tudou");
|
||||||
|
when(dynamicDataSourceProperties.getDatasource()).thenReturn(MapUtil.of("primary", dataSourceProperty));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user