perf: 收敛工作流状态与高 IO 节点开销
- 落地 Redis 版本状态、触发租约和定义缓存 - 优化数据批写、插件请求、文件下载与审计日志 - 补齐循环范围校验、轮询兼容和专项测试
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package tech.easyflow.datacenter.schedule;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* 数据集写入回执清理任务测试。
|
||||
*/
|
||||
public class DatacenterWriteReceiptCleanupJobTest {
|
||||
|
||||
/**
|
||||
* 验证清理任务按固定大小分批,并在最后一个非满批次后停止。
|
||||
*/
|
||||
@Test
|
||||
public void shouldDeleteExpiredReceiptsInBoundedBatches() {
|
||||
JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
||||
when(jdbcTemplate.update(anyString(), any(), anyInt()))
|
||||
.thenReturn(1000, 7);
|
||||
DatacenterWriteReceiptCleanupJob job =
|
||||
new DatacenterWriteReceiptCleanupJob(
|
||||
jdbcTemplate, 14L, 1000, 20);
|
||||
|
||||
job.cleanup();
|
||||
|
||||
verify(jdbcTemplate, times(2)).update(
|
||||
anyString(), any(), anyInt());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user