From 6d2812429940690bedf159b48b0a2b537a00e3e6 Mon Sep 17 00:00:00 2001 From: "1906439128@qq.com" <1906439128@qq.com> Date: Tue, 7 Mar 2023 19:02:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E5=9F=BA=E4=BA=8ESpring=20Cloud=20Bus?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=9A=84Producer=E6=8A=BD=E8=B1=A1=E7=B1=BB?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=87=AA=E5=B7=B1=E6=9C=8D=E5=8A=A1=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E6=97=B6=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/mq/core/bus/AbstractBusProducer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/core/bus/AbstractBusProducer.java b/yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/core/bus/AbstractBusProducer.java index 7a4686405..9c85299fa 100644 --- a/yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/core/bus/AbstractBusProducer.java +++ b/yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/core/bus/AbstractBusProducer.java @@ -20,7 +20,7 @@ public abstract class AbstractBusProducer { @Resource protected ServiceMatcher serviceMatcher; - @Value("{spring.application.name}") + @Value("${spring.application.name}") protected String applicationName; protected void publishEvent(RemoteApplicationEvent event) { From 853fb4b21041f6e80ab114348fc503343efc22df Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Thu, 9 Mar 2023 22:03:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test:=20=E5=AD=97=E5=85=B8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=A8=A1=E5=9D=97=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pom.xml | 7 +++ .../core/util/DictFrameworkUtilsTest.java | 50 +++++++++++++++++++ .../core/annotations/OperateLog.java | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-dict/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DictFrameworkUtilsTest.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml index f99d727ba..9da365e3e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml @@ -46,5 +46,12 @@ com.google.guava guava + + + + cn.iocoder.cloud + yudao-spring-boot-starter-test + test + diff --git a/yudao-framework/yudao-spring-boot-starter-biz-dict/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DictFrameworkUtilsTest.java b/yudao-framework/yudao-spring-boot-starter-biz-dict/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DictFrameworkUtilsTest.java new file mode 100644 index 000000000..f0a6eb1a6 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-dict/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DictFrameworkUtilsTest.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.framework.datapermission.core.util; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; +import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mock; + +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +/** + * {@link DictFrameworkUtils} 的单元测试 + */ +public class DictFrameworkUtilsTest extends BaseMockitoUnitTest { + + @Mock + private DictDataApi dictDataApi; + + @BeforeEach + public void setUp() { + DictFrameworkUtils.init(dictDataApi); + } + + @Test + public void testGetDictDataLabel() { + // mock 数据 + DictDataRespDTO dataRespDTO = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus())); + // mock 方法 + when(dictDataApi.getDictData(dataRespDTO.getDictType(), dataRespDTO.getValue())).thenReturn(CommonResult.success(dataRespDTO)); + // 断言返回值 + assertEquals(dataRespDTO.getLabel(), DictFrameworkUtils.getDictDataLabel(dataRespDTO.getDictType(), dataRespDTO.getValue())); + } + + @Test + public void testParseDictDataValue() { + // mock 数据 + DictDataRespDTO resp = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus())); + // mock 方法 + when(dictDataApi.parseDictData(resp.getDictType(), resp.getLabel())).thenReturn(CommonResult.success(resp)); + // 断言返回值 + assertEquals(resp.getValue(), DictFrameworkUtils.parseDictDataValue(resp.getDictType(), resp.getLabel())); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/annotations/OperateLog.java b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/annotations/OperateLog.java index c9a117cb4..89627555e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/annotations/OperateLog.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/annotations/OperateLog.java @@ -29,7 +29,7 @@ public @interface OperateLog { /** * 操作名 * - * 为空时,会尝试读取 {@link ApiOperation#value()} 属性 + * 为空时,会尝试读取 {@link Operation#summary()} 属性 */ String name() default ""; /**