Commit 3a24d05bdcea2ca846a54324121e85e4be02b2da
1 parent
6aea461e
mall + pay:
1. 修复单元测试的报错
Showing
14 changed files
with
51 additions
and
29 deletions
pom.xml
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | <!-- <module>yudao-module-bpm</module>--> |
| 21 | 21 | <!-- <module>yudao-module-report</module>--> |
| 22 | 22 | <!-- <module>yudao-module-mp</module>--> |
| 23 | - <module>yudao-module-mall</module> | |
| 23 | +<!-- <module>yudao-module-mall</module>--> | |
| 24 | 24 | <!-- 示例项目 --> |
| 25 | 25 | <module>yudao-example</module> |
| 26 | 26 | </modules> | ... | ... |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbAndRedisUnitTest.java
| ... | ... | @@ -8,7 +8,6 @@ import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration |
| 8 | 8 | import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; |
| 9 | 9 | import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; |
| 10 | 10 | import org.redisson.spring.starter.RedissonAutoConfiguration; |
| 11 | -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; | |
| 12 | 11 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| 13 | 12 | import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; |
| 14 | 13 | import org.springframework.boot.test.context.SpringBootTest; |
| ... | ... | @@ -41,7 +40,6 @@ public class BaseDbAndRedisUnitTest { |
| 41 | 40 | |
| 42 | 41 | // Redis 配置类 |
| 43 | 42 | RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer |
| 44 | - RedisAutoConfiguration.class, // Spring Redis 自动配置类 | |
| 45 | 43 | YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 |
| 46 | 44 | RedissonAutoConfiguration.class, // Redisson 自动高配置类 |
| 47 | 45 | }) | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/address/MemberAddressDO.java
yudao-module-member/yudao-module-member-biz/src/test/resources/sql/create_tables.sql
| ... | ... | @@ -23,9 +23,8 @@ CREATE TABLE IF NOT EXISTS "member_address" ( |
| 23 | 23 | "name" varchar(10) NOT NULL, |
| 24 | 24 | "mobile" varchar(20) NOT NULL, |
| 25 | 25 | "area_id" bigint(20) NOT NULL, |
| 26 | - "post_code" varchar(16) NOT NULL, | |
| 27 | 26 | "detail_address" varchar(250) NOT NULL, |
| 28 | - "defaulted" bit NOT NULL, | |
| 27 | + "default_status" bit NOT NULL, | |
| 29 | 28 | "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 30 | 29 | "creator" varchar(64) DEFAULT '', |
| 31 | 30 | "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java
| ... | ... | @@ -20,9 +20,11 @@ import org.springframework.context.annotation.Import; |
| 20 | 20 | import javax.annotation.Resource; |
| 21 | 21 | import javax.validation.Validator; |
| 22 | 22 | |
| 23 | +import java.time.Duration; | |
| 23 | 24 | import java.util.Collections; |
| 24 | 25 | import java.util.List; |
| 25 | 26 | |
| 27 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime; | |
| 26 | 28 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 27 | 29 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 28 | 30 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| ... | ... | @@ -68,7 +70,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest { |
| 68 | 70 | public void testRefreshLocalCache() { |
| 69 | 71 | // mock 数据 01 |
| 70 | 72 | PayChannelDO dbChannel = randomPojo(PayChannelDO.class, |
| 71 | - o -> o.setConfig(randomWxPayClientConfig())); | |
| 73 | + o -> o.setConfig(randomWxPayClientConfig()).setUpdateTime(addTime(Duration.ofMinutes(-2)))); | |
| 72 | 74 | channelMapper.insert(dbChannel);// @Sql: 先插入出一条存在的数据 |
| 73 | 75 | channelService.initLocalCache(); |
| 74 | 76 | // mock 数据 02 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql
| ... | ... | @@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS "pay_app" ( |
| 3 | 3 | "name" varchar(64) NOT NULL, |
| 4 | 4 | "status" tinyint NOT NULL, |
| 5 | 5 | "remark" varchar(255) DEFAULT NULL, |
| 6 | - `pay_notify_url` varchar(1024) NOT NULL, | |
| 6 | + `order_notify_url` varchar(1024) NOT NULL, | |
| 7 | 7 | `refund_notify_url` varchar(1024) NOT NULL, |
| 8 | 8 | "creator" varchar(64) DEFAULT '', |
| 9 | 9 | "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImplTest.java
| ... | ... | @@ -84,6 +84,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 84 | 84 | o.setParams(Lists.newArrayList("code", "op")); |
| 85 | 85 | }); |
| 86 | 86 | when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); |
| 87 | + String title = RandomUtils.randomString(); | |
| 88 | + when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams))) | |
| 89 | + .thenReturn(title); | |
| 87 | 90 | String content = RandomUtils.randomString(); |
| 88 | 91 | when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams))) |
| 89 | 92 | .thenReturn(content); |
| ... | ... | @@ -101,7 +104,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 101 | 104 | assertEquals(mailLogId, resultMailLogId); |
| 102 | 105 | // 断言调用 |
| 103 | 106 | verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(user.getEmail()), |
| 104 | - eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content)); | |
| 107 | + eq(account.getId()), eq(template.getNickname()), eq(title), eq(content)); | |
| 105 | 108 | } |
| 106 | 109 | |
| 107 | 110 | @Test |
| ... | ... | @@ -122,6 +125,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 122 | 125 | o.setParams(Lists.newArrayList("code", "op")); |
| 123 | 126 | }); |
| 124 | 127 | when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); |
| 128 | + String title = RandomUtils.randomString(); | |
| 129 | + when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams))) | |
| 130 | + .thenReturn(title); | |
| 125 | 131 | String content = RandomUtils.randomString(); |
| 126 | 132 | when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams))) |
| 127 | 133 | .thenReturn(content); |
| ... | ... | @@ -139,7 +145,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 139 | 145 | assertEquals(mailLogId, resultMailLogId); |
| 140 | 146 | // 断言调用 |
| 141 | 147 | verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail), |
| 142 | - eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content)); | |
| 148 | + eq(account.getId()), eq(template.getNickname()), eq(title), eq(content)); | |
| 143 | 149 | } |
| 144 | 150 | |
| 145 | 151 | /** |
| ... | ... | @@ -161,6 +167,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 161 | 167 | o.setParams(Lists.newArrayList("code", "op")); |
| 162 | 168 | }); |
| 163 | 169 | when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); |
| 170 | + String title = RandomUtils.randomString(); | |
| 171 | + when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams))) | |
| 172 | + .thenReturn(title); | |
| 164 | 173 | String content = RandomUtils.randomString(); |
| 165 | 174 | when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams))) |
| 166 | 175 | .thenReturn(content); |
| ... | ... | @@ -178,7 +187,7 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 178 | 187 | assertEquals(mailLogId, resultMailLogId); |
| 179 | 188 | // 断言调用 |
| 180 | 189 | verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail), |
| 181 | - eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content)); | |
| 190 | + eq(account.getId()), eq(template.getNickname()), eq(title), eq(content)); | |
| 182 | 191 | } |
| 183 | 192 | |
| 184 | 193 | /** |
| ... | ... | @@ -200,6 +209,9 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 200 | 209 | o.setParams(Lists.newArrayList("code", "op")); |
| 201 | 210 | }); |
| 202 | 211 | when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); |
| 212 | + String title = RandomUtils.randomString(); | |
| 213 | + when(mailTemplateService.formatMailTemplateContent(eq(template.getTitle()), eq(templateParams))) | |
| 214 | + .thenReturn(title); | |
| 203 | 215 | String content = RandomUtils.randomString(); |
| 204 | 216 | when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams))) |
| 205 | 217 | .thenReturn(content); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.service.social; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory; |
| 5 | -import cn.iocoder.yudao.framework.test.core.ut.BaseDbAndRedisUnitTest; | |
| 5 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 6 | 6 | import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; |
| 7 | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserBindDO; |
| 8 | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; |
| ... | ... | @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; |
| 35 | 35 | import static org.mockito.Mockito.*; |
| 36 | 36 | |
| 37 | 37 | @Import(SocialUserServiceImpl.class) |
| 38 | -public class SocialUserServiceImplTest extends BaseDbAndRedisUnitTest { | |
| 38 | +public class SocialUserServiceImplTest extends BaseDbUnitTest { | |
| 39 | 39 | |
| 40 | 40 | @Resource |
| 41 | 41 | private SocialUserServiceImpl socialUserService; | ... | ... |
yudao-server/pom.xml
| ... | ... | @@ -68,21 +68,21 @@ |
| 68 | 68 | <!-- </dependency>--> |
| 69 | 69 | |
| 70 | 70 | <!-- 商城相关模块。默认注释,保证编译速度 --> |
| 71 | - <dependency> | |
| 72 | - <groupId>cn.iocoder.boot</groupId> | |
| 73 | - <artifactId>yudao-module-promotion-biz</artifactId> | |
| 74 | - <version>${revision}</version> | |
| 75 | - </dependency> | |
| 76 | - <dependency> | |
| 77 | - <groupId>cn.iocoder.boot</groupId> | |
| 78 | - <artifactId>yudao-module-product-biz</artifactId> | |
| 79 | - <version>${revision}</version> | |
| 80 | - </dependency> | |
| 81 | - <dependency> | |
| 82 | - <groupId>cn.iocoder.boot</groupId> | |
| 83 | - <artifactId>yudao-module-trade-biz</artifactId> | |
| 84 | - <version>${revision}</version> | |
| 85 | - </dependency> | |
| 71 | +<!-- <dependency>--> | |
| 72 | +<!-- <groupId>cn.iocoder.boot</groupId>--> | |
| 73 | +<!-- <artifactId>yudao-module-promotion-biz</artifactId>--> | |
| 74 | +<!-- <version>${revision}</version>--> | |
| 75 | +<!-- </dependency>--> | |
| 76 | +<!-- <dependency>--> | |
| 77 | +<!-- <groupId>cn.iocoder.boot</groupId>--> | |
| 78 | +<!-- <artifactId>yudao-module-product-biz</artifactId>--> | |
| 79 | +<!-- <version>${revision}</version>--> | |
| 80 | +<!-- </dependency>--> | |
| 81 | +<!-- <dependency>--> | |
| 82 | +<!-- <groupId>cn.iocoder.boot</groupId>--> | |
| 83 | +<!-- <artifactId>yudao-module-trade-biz</artifactId>--> | |
| 84 | +<!-- <version>${revision}</version>--> | |
| 85 | +<!-- </dependency>--> | |
| 86 | 86 | |
| 87 | 87 | <!-- spring boot 配置所需依赖 --> |
| 88 | 88 | <dependency> | ... | ... |
yudao-ui-admin/src/views/pay/app/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | - | |
| 3 | + <doc-alert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" /> | |
| 4 | 4 | <!-- 搜索工作栏 --> |
| 5 | 5 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| 6 | 6 | <el-form-item label="应用名" prop="name"> | ... | ... |
yudao-ui-admin/src/views/pay/demo/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | + <doc-alert title="支付宝支付接入" url="https://doc.iocoder.cn/pay/alipay-pay-demo/" /> | |
| 4 | + <doc-alert title="支付宝、微信退款接入" url="https://doc.iocoder.cn/pay/refund-demo/" /> | |
| 5 | + <doc-alert title="微信公众号支付接入" url="https://doc.iocoder.cn/pay/wx-pub-pay-demo/" /> | |
| 6 | + <doc-alert title="微信小程序支付接入" url="https://doc.iocoder.cn/pay/wx-lite-pay-demo/" /> | |
| 7 | + | |
| 3 | 8 | <!-- 操作工具栏 --> |
| 4 | 9 | <el-row :gutter="10" class="mb8"> |
| 5 | 10 | <el-col :span="1.5"> | ... | ... |
yudao-ui-admin/src/views/pay/notify/index.vue
yudao-ui-admin/src/views/pay/order/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | + <doc-alert title="支付宝支付接入" url="https://doc.iocoder.cn/pay/alipay-pay-demo/" /> | |
| 4 | + <doc-alert title="微信公众号支付接入" url="https://doc.iocoder.cn/pay/wx-pub-pay-demo/" /> | |
| 5 | + <doc-alert title="微信小程序支付接入" url="https://doc.iocoder.cn/pay/wx-lite-pay-demo/" /> | |
| 3 | 6 | |
| 4 | 7 | <!-- 搜索工作栏 --> |
| 5 | 8 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px"> | ... | ... |
yudao-ui-admin/src/views/pay/refund/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | + <doc-alert title="支付宝、微信退款接入" url="https://doc.iocoder.cn/pay/refund-demo/" /> | |
| 4 | + | |
| 3 | 5 | <!-- 搜索工作栏 --> |
| 4 | 6 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px"> |
| 5 | 7 | <el-form-item label="应用编号" prop="appId"> | ... | ... |