mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-30 09:48:43 +08:00 
			
		
		
		
	1. 禁用 member 模块
2. 减少 mybatis 日志打印 3. 降低 local 环境的初始连接 目的:提升项目的启动速度
This commit is contained in:
		| @@ -1,42 +0,0 @@ | ||||
| package cn.iocoder.yudao.framework.tenant.core.job; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService; | ||||
| import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; | ||||
| import com.google.common.collect.Lists; | ||||
| import org.junit.jupiter.api.Test; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||||
|  | ||||
| /** | ||||
|  * 验证 job 租户逻辑 | ||||
|  * {@link TenantJobHandlerDecorator} | ||||
|  * | ||||
|  * @author gaibu | ||||
|  */ | ||||
| public class TenantJobTest extends BaseMockitoUnitTest { | ||||
|  | ||||
|     @Mock | ||||
|     TenantFrameworkService tenantFrameworkService; | ||||
|  | ||||
|     @Test | ||||
|     public void test() throws Exception { | ||||
|         // 准备测试租户 id | ||||
|         List<Long> tenantIds = Lists.newArrayList(1L, 2L, 3L); | ||||
|         // mock 数据 | ||||
|         Mockito.doReturn(tenantIds).when(tenantFrameworkService).getTenantIds(); | ||||
|         // 准备测试任务 | ||||
|         TestJob testJob = new TestJob(); | ||||
|         // 创建任务装饰器 | ||||
|         TenantJobHandlerDecorator tenantJobHandlerDecorator = new TenantJobHandlerDecorator(tenantFrameworkService, testJob); | ||||
|  | ||||
|         // 执行任务 | ||||
|         tenantJobHandlerDecorator.execute(null); | ||||
|  | ||||
|         // 断言返回值 | ||||
|         assertEquals(testJob.getTenantIds(), tenantIds); | ||||
|     } | ||||
| } | ||||
| @@ -9,12 +9,12 @@ import java.util.List; | ||||
| import java.util.concurrent.CopyOnWriteArrayList; | ||||
|  | ||||
| @Component | ||||
| @TenantJob // 标记多租户 | ||||
| public class TestJob implements JobHandler { | ||||
|  | ||||
|     private final List<Long> tenantIds = new CopyOnWriteArrayList<>(); | ||||
|  | ||||
|     @Override | ||||
|     @TenantJob // 标记多租户 | ||||
|     public String execute(String param) throws Exception { | ||||
|         tenantIds.add(TenantContextHolder.getTenantId()); | ||||
|         return "success"; | ||||
| @@ -24,4 +24,5 @@ public class TestJob implements JobHandler { | ||||
|         CollUtil.sort(tenantIds, Long::compareTo); | ||||
|         return tenantIds; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV