test(phase-3): 3E 前置——补 deletebrand 回传段 golden,先立是非源再动代码
蓝图 §5 的「先补再动」对这支仍然生效:1B 那枚 run-snapshot 只锁到建单+解析+载荷, submitResult 出结果段一直空着。本笔落 DeleteBrandSubmitResultSnapshotTest(真入口 service.submitResult,不在测试里照抄管线)+ golden 256 行 25 例: - 事件流水而非分组清单:取锁→加载→模块校验→终态拒→复位 RUNNING→逐片存→恢复重排→ 早挂组装 job→收尾尝试,顺序换了就红(这支的准入步序与底座默认序相反,正是最怕改的一格) - 补传恢复那格单独一例钉住:terminalFailed=true 且分片齐 ⇒ resetForRecovery+再 enqueue - 十二格准入/校验拒绝逐格点名,写库计数全零;非法 taskId 连锁都不碰 - 实测抓到第九处读数坑:收尾 progress 走 Map.of(...),JDK 不可变 Map 的迭代顺序每次起 JVM 重排——同一棵树两次生成 keys 顺序不同。渲染改为按 key 排序,锁内容不锁桶序 (Redis hash 本就不保序,这条不损耗契约) - 现网一条事实顺手打进流水:loadTaskForExecution 命中 DB 后会回写缓存,故「一次库都不碰」 的准确读法是 taskUpdate=0,而 taskCacheSave 可以为 1 门禁:定向 114 例全绿(四支 deletebrand 测试+六套棘轮/边界/接线),golden 跨 JVM 逐字节复现, 非写模式复跑一字未动。
This commit is contained in:
+553
@@ -0,0 +1,553 @@
|
||||
package com.nanri.aiimage.modules.deletebrand.service.support;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.nanri.aiimage.common.exception.BusinessException;
|
||||
import com.nanri.aiimage.config.DeleteBrandProgressProperties;
|
||||
import com.nanri.aiimage.config.TaskPressureProperties;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.cache.DeleteBrandParsedFileCacheDto;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.dto.DeleteBrandCountryResultItemDto;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.dto.DeleteBrandProcessedCountryDto;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.dto.DeleteBrandResultFileDto;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.dto.DeleteBrandSubmitResultRequest;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.vo.DeleteBrandCountryAsinVo;
|
||||
import com.nanri.aiimage.modules.deletebrand.model.vo.DeleteBrandCountryGroupVo;
|
||||
import com.nanri.aiimage.modules.deletebrand.service.DeleteBrandRunService;
|
||||
import com.nanri.aiimage.modules.deletebrand.service.DeleteBrandTaskCacheService;
|
||||
import com.nanri.aiimage.modules.deletebrand.service.DeleteBrandTaskStorageService;
|
||||
import com.nanri.aiimage.modules.file.service.LocalFileStorageService;
|
||||
import com.nanri.aiimage.modules.file.service.oss.OssStorageService;
|
||||
import com.nanri.aiimage.modules.task.mapper.FileResultMapper;
|
||||
import com.nanri.aiimage.modules.task.mapper.FileTaskMapper;
|
||||
import com.nanri.aiimage.modules.task.model.entity.FileResultEntity;
|
||||
import com.nanri.aiimage.modules.task.model.entity.FileTaskEntity;
|
||||
import com.nanri.aiimage.modules.task.service.TaskDistributedLockService;
|
||||
import com.nanri.aiimage.modules.task.service.TaskFileJobService;
|
||||
import com.nanri.aiimage.modules.task.service.TaskProgressLightAssembler;
|
||||
import com.nanri.aiimage.modules.ziniao.service.ZiniaoShopSwitchService;
|
||||
import org.apache.ibatis.builder.MapperBuilderAssistant;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* 删除品牌回传落库(段 3)的现网行为快照——3E 迁移的护身符。
|
||||
*
|
||||
* <p><b>为什么先补这一支再动代码。</b>Phase 0 的 {@link DeleteBrandSnapshotTest} 只锁到
|
||||
* 「建单+解析+载荷」三段,蓝图 §5 明文写着「{@code submitResult} 出结果段没打快照,
|
||||
* Phase 3 要动那一段须先补再动」。3E 要改的正是那段里的准入两行(加载+模块校验)与
|
||||
* 组装 job 挂接({@code enqueueAssembleResult}),所以 golden 必须落在改动**之前**。
|
||||
*
|
||||
* <p><b>快照吃的是事件流水,不是分组清单。</b>回传段的风险全在副作用先后:
|
||||
* 取锁在拒「taskId 不合法」之后、复位 RUNNING 在逐片处理之前、恢复重排在
|
||||
* {@code storeResultChunkIfChanged} 之后而在 {@code isFileCompleted} 之前、
|
||||
* 重复分片一律 {@code continue} 且一个库都不碰。顺序换了就红。
|
||||
*
|
||||
* <p><b>本支与另三族最不同的一格是准入步序</b>:现网是 校验→<b>取锁</b>→空表拒→加载→模块校验→终态拒,
|
||||
* 底座 {@code admitSubmission} 是 校验→加载→终态→归属→心跳。所以这里把
|
||||
* 「非法 taskId 一次锁都不碰」「终态拒发生在锁内」两格显式打进流水,
|
||||
* 迁移后必须逐字不变——它同时是「底座那格对本支接不上」的证据。
|
||||
*
|
||||
* <p><b>替身只实现这条链真吃到的部分</b>:任务行与结果行各是一份内存活实体(重读看得见上一次
|
||||
* update 的写入),分片表是一份 LinkedHashMap,于是 {@code loadMergedChunks} 的完整性判定是真的。
|
||||
* 时钟({@code updated_at}/{@code last_heartbeat_at})、OSS 直链、临时目录一律不进快照。
|
||||
*
|
||||
* golden:src/test/resources/deletebrand/golden/submit-result-snapshot.txt
|
||||
* 重新生成:{@code SHUFU_SNAPSHOT_WRITE=true mvn -o test -Dtest=DeleteBrandSubmitResultSnapshotTest}
|
||||
* (用环境变量而不是 -D:pom 里 {@code <argLine>} 是显式配置,命令行 -DargLine 覆盖不动它)
|
||||
*/
|
||||
class DeleteBrandSubmitResultSnapshotTest {
|
||||
|
||||
private static final File GOLDEN_SUBMIT =
|
||||
new File("src/test/resources/deletebrand/golden/submit-result-snapshot.txt");
|
||||
private static final long TASK_ID = 1001L;
|
||||
private static final long RESULT_ID = 2001L;
|
||||
private static final String FILE_KEY = "uploads/魏振峰.xlsx";
|
||||
|
||||
/** LambdaQueryWrapper 取列名要走 TableInfo 缓存,纯 mock mapper 的测试里必须先初始化。 */
|
||||
@BeforeAll
|
||||
static void initLambdaCache() {
|
||||
MapperBuilderAssistant assistant = new MapperBuilderAssistant(new MybatisConfiguration(), "");
|
||||
TableInfoHelper.initTableInfo(assistant, FileTaskEntity.class);
|
||||
TableInfoHelper.initTableInfo(assistant, FileResultEntity.class);
|
||||
}
|
||||
|
||||
// ---- 现网副作用替身 ----
|
||||
|
||||
private static final class Fixture {
|
||||
private final List<String> events = new ArrayList<>();
|
||||
private final Map<String, DeleteBrandParsedFileCacheDto> payload = new LinkedHashMap<>();
|
||||
private final Map<String, List<DeleteBrandResultFileDto>> mergedChunks = new LinkedHashMap<>();
|
||||
private FileTaskEntity task;
|
||||
private FileResultEntity resultRow;
|
||||
private boolean lockAvailable = true;
|
||||
private boolean storeChanged = true;
|
||||
private boolean hasSuccessfulJob;
|
||||
private boolean terminalFailedJob;
|
||||
private long unfinishedJobs = 1L;
|
||||
private int payloadScopes = 1;
|
||||
private int completedScopes;
|
||||
private DeleteBrandRunService service;
|
||||
}
|
||||
|
||||
private static Fixture running() {
|
||||
Fixture fixture = new Fixture();
|
||||
fixture.task = task("RUNNING");
|
||||
fixture.resultRow = resultRow();
|
||||
fixture.payload.put(FILE_KEY, parsedFile("B011", "B012"));
|
||||
return fixture;
|
||||
}
|
||||
|
||||
private static FileTaskEntity task(String status) {
|
||||
FileTaskEntity task = new FileTaskEntity();
|
||||
task.setId(TASK_ID);
|
||||
task.setModuleType("DELETE_BRAND");
|
||||
task.setStatus(status);
|
||||
task.setTaskMode("IMMEDIATE");
|
||||
task.setUserId(7L);
|
||||
task.setSourceFileCount(1);
|
||||
task.setSuccessFileCount(0);
|
||||
task.setFailedFileCount(0);
|
||||
return task;
|
||||
}
|
||||
|
||||
private static FileResultEntity resultRow() {
|
||||
FileResultEntity row = new FileResultEntity();
|
||||
row.setId(RESULT_ID);
|
||||
row.setTaskId(TASK_ID);
|
||||
row.setModuleType("DELETE_BRAND");
|
||||
row.setSourceFilename("魏振峰.xlsx");
|
||||
row.setSourceFileUrl(FILE_KEY);
|
||||
row.setRowCount(2);
|
||||
row.setSuccess(0);
|
||||
row.setUserId(7L);
|
||||
return row;
|
||||
}
|
||||
|
||||
private static DeleteBrandParsedFileCacheDto parsedFile(String... asins) {
|
||||
DeleteBrandParsedFileCacheDto parsed = new DeleteBrandParsedFileCacheDto();
|
||||
parsed.setFileKey(FILE_KEY);
|
||||
parsed.setSourceFilename("魏振峰.xlsx");
|
||||
parsed.setShopName("魏振峰");
|
||||
parsed.setTotalRows(asins.length);
|
||||
DeleteBrandCountryGroupVo country = new DeleteBrandCountryGroupVo();
|
||||
country.setCountry("US");
|
||||
for (String asin : asins) {
|
||||
DeleteBrandCountryAsinVo asinVo = new DeleteBrandCountryAsinVo();
|
||||
asinVo.setRowIndex(3);
|
||||
asinVo.setAsin(asin);
|
||||
country.getItems().add(asinVo);
|
||||
}
|
||||
country.setAsinCount(country.getItems().size());
|
||||
parsed.setCountries(List.of(country));
|
||||
return parsed;
|
||||
}
|
||||
|
||||
private static DeleteBrandResultFileDto chunk(int index, int total, String asin) {
|
||||
DeleteBrandResultFileDto dto = new DeleteBrandResultFileDto();
|
||||
dto.setFileKey(FILE_KEY);
|
||||
dto.setSourceFilename("魏振峰.xlsx");
|
||||
dto.setFileIndex(1);
|
||||
dto.setFileTotal(1);
|
||||
dto.setChunkIndex(index);
|
||||
dto.setChunkTotal(total);
|
||||
dto.setProcessedRows(index);
|
||||
dto.setTotalRows(2);
|
||||
dto.setCurrentCountry("US");
|
||||
dto.setCurrentAsin(asin);
|
||||
dto.setCountries(List.of(processedCountry("US", asin, "在售")));
|
||||
return dto;
|
||||
}
|
||||
|
||||
private static DeleteBrandProcessedCountryDto processedCountry(String country, String asin, String status) {
|
||||
DeleteBrandProcessedCountryDto dto = new DeleteBrandProcessedCountryDto();
|
||||
dto.setCountry(country);
|
||||
DeleteBrandCountryResultItemDto item = new DeleteBrandCountryResultItemDto();
|
||||
item.setAsin(asin);
|
||||
item.setStatus(status);
|
||||
dto.setItems(List.of(item));
|
||||
return dto;
|
||||
}
|
||||
|
||||
private static DeleteBrandSubmitResultRequest request(DeleteBrandResultFileDto... files) {
|
||||
DeleteBrandSubmitResultRequest request = new DeleteBrandSubmitResultRequest();
|
||||
request.setSubmissionId("sub-1");
|
||||
request.setFiles(new ArrayList<>(List.of(files)));
|
||||
return request;
|
||||
}
|
||||
|
||||
private static DeleteBrandRunService newService(Fixture f) {
|
||||
FileTaskMapper fileTaskMapper = mock(FileTaskMapper.class);
|
||||
FileResultMapper fileResultMapper = mock(FileResultMapper.class);
|
||||
DeleteBrandTaskCacheService cacheService = mock(DeleteBrandTaskCacheService.class);
|
||||
DeleteBrandTaskStorageService taskStorage = mock(DeleteBrandTaskStorageService.class);
|
||||
TaskDistributedLockService lockService = mock(TaskDistributedLockService.class);
|
||||
TaskFileJobService taskFileJobService = mock(TaskFileJobService.class);
|
||||
|
||||
when(fileTaskMapper.selectById(any())).thenAnswer(invocation -> {
|
||||
f.events.add("task.load id=" + invocation.getArgument(0) + " cached=false status="
|
||||
+ dash(f.task == null ? null : f.task.getStatus())
|
||||
+ " module=" + dash(f.task == null ? null : f.task.getModuleType()));
|
||||
return f.task;
|
||||
});
|
||||
doAnswer(invocation -> {
|
||||
FileTaskEntity task = invocation.getArgument(0);
|
||||
f.events.add("task.update id=" + task.getId()
|
||||
+ " status=" + dash(task.getStatus())
|
||||
+ " errorMessage=" + dash(task.getErrorMessage())
|
||||
+ " sourceFileCount=" + dash(task.getSourceFileCount())
|
||||
+ " successFileCount=" + dash(task.getSuccessFileCount())
|
||||
+ " failedFileCount=" + dash(task.getFailedFileCount())
|
||||
+ " finishedAt=" + (task.getFinishedAt() == null ? "-" : "set"));
|
||||
return 1;
|
||||
}).when(fileTaskMapper).updateById(any(FileTaskEntity.class));
|
||||
|
||||
when(fileResultMapper.selectOne(any())).thenAnswer(invocation -> {
|
||||
f.events.add("result.selectOne taskId=" + TASK_ID + " -> id=" + dash(f.resultRow == null
|
||||
? null : f.resultRow.getId()));
|
||||
return f.resultRow;
|
||||
});
|
||||
when(fileResultMapper.selectList(any())).thenAnswer(invocation -> {
|
||||
f.events.add("result.selectList taskId=" + TASK_ID + " -> rows=" + (f.resultRow == null ? 0 : 1));
|
||||
return f.resultRow == null ? List.of() : List.of(f.resultRow);
|
||||
});
|
||||
doAnswer(invocation -> {
|
||||
FileResultEntity row = invocation.getArgument(0);
|
||||
f.events.add("result.update id=" + row.getId()
|
||||
+ " success=" + dash(row.getSuccess())
|
||||
+ " rowCount=" + dash(row.getRowCount())
|
||||
+ " resultFilename=" + dash(row.getResultFilename())
|
||||
+ " resultFileUrl=" + dash(row.getResultFileUrl())
|
||||
+ " fileSize=" + dash(row.getResultFileSize())
|
||||
+ " contentType=" + dash(row.getResultContentType())
|
||||
+ " errorMessage=" + dash(row.getErrorMessage()));
|
||||
return 1;
|
||||
}).when(fileResultMapper).updateById(any(FileResultEntity.class));
|
||||
|
||||
when(cacheService.getTaskCacheBatch(any())).thenReturn(new LinkedHashMap<>());
|
||||
doAnswer(invocation -> {
|
||||
FileTaskEntity task = invocation.getArgument(0);
|
||||
f.events.add("task.cache.save id=" + task.getId() + " status=" + dash(task.getStatus())
|
||||
+ " successFileCount=" + dash(task.getSuccessFileCount()));
|
||||
return null;
|
||||
}).when(cacheService).saveTaskCache(any(FileTaskEntity.class));
|
||||
doAnswer(invocation -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> values = invocation.getArgument(1);
|
||||
f.events.add("progress.save taskId=" + invocation.getArgument(0) + " forceWrite="
|
||||
+ invocation.getArgument(2) + renderProgress(values));
|
||||
return null;
|
||||
}).when(cacheService).saveProgress(anyLong(), anyMap(), anyBoolean());
|
||||
doAnswer(invocation -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> values = invocation.getArgument(1);
|
||||
f.events.add("progress.save taskId=" + invocation.getArgument(0) + " forceWrite=-"
|
||||
+ renderProgress(values));
|
||||
return null;
|
||||
}).when(cacheService).saveProgress(anyLong(), anyMap());
|
||||
|
||||
when(taskStorage.loadParsedPayload(anyLong())).thenAnswer(invocation -> {
|
||||
f.events.add("payload.load -> scopes=" + f.payload.size());
|
||||
return f.payload;
|
||||
});
|
||||
when(taskStorage.storeResultChunkIfChanged(anyLong(), anyString(), any(), any())).thenAnswer(invocation -> {
|
||||
DeleteBrandResultFileDto piece = invocation.getArgument(3);
|
||||
f.events.add("chunk.store file=" + dash(piece.getFileKey()) + " idx=" + piece.getChunkIndex()
|
||||
+ "/" + piece.getChunkTotal() + " -> stored=" + f.storeChanged);
|
||||
return f.storeChanged;
|
||||
});
|
||||
when(taskStorage.loadMergedChunks(anyLong())).thenAnswer(invocation -> {
|
||||
StringBuilder sizes = new StringBuilder();
|
||||
for (Map.Entry<String, List<DeleteBrandResultFileDto>> entry : f.mergedChunks.entrySet()) {
|
||||
if (sizes.length() > 0) {
|
||||
sizes.append(',');
|
||||
}
|
||||
sizes.append(entry.getKey()).append('=').append(entry.getValue().size());
|
||||
}
|
||||
f.events.add("chunks.load -> " + (sizes.length() == 0 ? "-" : sizes));
|
||||
return f.mergedChunks;
|
||||
});
|
||||
when(taskStorage.countParsedPayloadScopes(anyLong())).thenAnswer(invocation -> {
|
||||
f.events.add("payload.countScopes -> " + f.payloadScopes);
|
||||
return f.payloadScopes;
|
||||
});
|
||||
when(taskStorage.countCompletedScopes(anyLong())).thenAnswer(invocation -> {
|
||||
f.events.add("payload.countCompleted -> " + f.completedScopes);
|
||||
return f.completedScopes;
|
||||
});
|
||||
|
||||
when(lockService.acquire(anyString(), anyLong(), any(Duration.class), anyLong())).thenAnswer(invocation -> {
|
||||
long waitMillis = invocation.getArgument(3);
|
||||
if (!f.lockAvailable) {
|
||||
f.events.add("lock.acquire taskId=" + invocation.getArgument(1)
|
||||
+ " waitMillis=" + waitMillis + " -> busy");
|
||||
return null;
|
||||
}
|
||||
f.events.add("lock.acquire taskId=" + invocation.getArgument(1) + " waitMillis=" + waitMillis);
|
||||
return mock(TaskDistributedLockService.LockHandle.class);
|
||||
});
|
||||
|
||||
when(taskFileJobService.hasSuccessfulAssembleJob(anyLong(), anyString(), any())).thenAnswer(invocation -> {
|
||||
f.events.add("job.hasSuccessful resultId=" + invocation.getArgument(2) + " -> " + f.hasSuccessfulJob);
|
||||
return f.hasSuccessfulJob;
|
||||
});
|
||||
when(taskFileJobService.isTerminalFailedAssembleJob(anyLong(), anyString(), any())).thenAnswer(invocation -> {
|
||||
f.events.add("job.terminalFailed resultId=" + invocation.getArgument(2) + " -> " + f.terminalFailedJob);
|
||||
return f.terminalFailedJob;
|
||||
});
|
||||
when(taskFileJobService.resetTerminalFailedForRecovery(anyLong(), anyString(), any())).thenAnswer(invocation -> {
|
||||
f.events.add("job.resetForRecovery resultId=" + invocation.getArgument(2));
|
||||
return null;
|
||||
});
|
||||
when(taskFileJobService.enqueueAssembleResult(anyLong(), anyString(), any(), any())).thenAnswer(invocation -> {
|
||||
f.events.add("job.enqueue taskId=" + invocation.getArgument(0) + " resultId="
|
||||
+ invocation.getArgument(2) + " scope=" + dash(invocation.getArgument(3)));
|
||||
return null;
|
||||
});
|
||||
when(taskFileJobService.countUnfinishedAssembleJobs(anyLong(), anyString())).thenAnswer(invocation -> {
|
||||
f.events.add("job.countUnfinished -> " + f.unfinishedJobs);
|
||||
return f.unfinishedJobs;
|
||||
});
|
||||
|
||||
f.service = new DeleteBrandRunService(fileTaskMapper, fileResultMapper,
|
||||
mock(LocalFileStorageService.class), cacheService, taskStorage,
|
||||
mock(ZiniaoShopSwitchService.class), mock(OssStorageService.class),
|
||||
mock(ObjectMapper.class), mock(DeleteBrandProgressProperties.class),
|
||||
mock(TaskPressureProperties.class), lockService, taskFileJobService,
|
||||
mock(PlatformTransactionManager.class), mock(TaskProgressLightAssembler.class));
|
||||
return f.service;
|
||||
}
|
||||
|
||||
// ---- 渲染 ----
|
||||
|
||||
private static String dash(Object value) {
|
||||
String text = value == null ? "" : String.valueOf(value);
|
||||
return text.isBlank() ? "-" : text.replace('\n', ' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* 只进形状、不进时钟,也<b>不进顺序</b>:{@code updated_at}/{@code last_heartbeat_at} 的值是毫秒数,
|
||||
* 而收尾那格的 progress 是 {@code Map.of(...)}——JDK 的不可变 Map 迭代顺序每次起 JVM 重排一遍
|
||||
* (实测同一棵树两次生成,keys 顺序 与 values 顺序 双双漂移)。这条流水锁的是「写了哪些字段、
|
||||
* 字段值是什么」,不是 HashMap 桶序;顺序对现网也不可见(Redis hash)。
|
||||
*/
|
||||
private static String renderProgress(Map<String, String> values) {
|
||||
List<String> keys = new ArrayList<>(values.keySet());
|
||||
keys.sort(null);
|
||||
StringBuilder sb = new StringBuilder(" keys=").append(keys);
|
||||
for (String key : keys) {
|
||||
if ("updated_at".equals(key) || "last_heartbeat_at".equals(key)) {
|
||||
continue;
|
||||
}
|
||||
sb.append(' ').append(key).append('=').append(dash(values.get(key)));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String counters(Fixture f) {
|
||||
return "counters lockAcquire=" + count(f, "lock.acquire")
|
||||
+ " taskUpdate=" + count(f, "task.update")
|
||||
+ " taskCacheSave=" + count(f, "task.cache.save")
|
||||
+ " resultUpdate=" + count(f, "result.update")
|
||||
+ " jobEnqueue=" + count(f, "job.enqueue")
|
||||
+ " progressSave=" + count(f, "progress.save")
|
||||
+ '\n';
|
||||
}
|
||||
|
||||
private static long count(Fixture f, String prefix) {
|
||||
return f.events.stream().filter(event -> event.startsWith(prefix)).count();
|
||||
}
|
||||
|
||||
private static String submit(Fixture f, Long taskId, DeleteBrandSubmitResultRequest request) {
|
||||
String outcome;
|
||||
try {
|
||||
f.service.submitResult(taskId, request);
|
||||
outcome = "thrown: none\n";
|
||||
} catch (BusinessException ex) {
|
||||
outcome = "thrown: BusinessException code=" + dash(ex.getCode())
|
||||
+ " message=" + dash(ex.getMessage()) + '\n';
|
||||
} catch (Exception ex) {
|
||||
outcome = "thrown: " + ex.getClass().getSimpleName()
|
||||
+ " message=" + dash(ex.getMessage()) + '\n';
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String event : f.events) {
|
||||
sb.append(event).append('\n');
|
||||
}
|
||||
return sb.append(outcome).append(counters(f)).toString();
|
||||
}
|
||||
|
||||
private static void appendCase(StringBuilder sb, String name, Fixture fixture,
|
||||
Long taskId, DeleteBrandSubmitResultRequest request) {
|
||||
sb.append("== case=").append(name).append('\n');
|
||||
newService(fixture);
|
||||
sb.append(submit(fixture, taskId, request));
|
||||
sb.append('\n');
|
||||
}
|
||||
|
||||
static String runAll() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// 1. 常态:非末片回传,只落分片与进度,组装与收尾一次都不碰
|
||||
Fixture partial = running();
|
||||
appendCase(sb, "partialChunk", partial, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
|
||||
// 2. 末片:早挂组装 job,随后按「已完件 < 应交件」只刷进度(不入库结果文件)
|
||||
Fixture last = running();
|
||||
appendCase(sb, "lastChunkEnqueuesEarlyAssemble", last, TASK_ID, request(chunk(2, 2, "B012")));
|
||||
|
||||
// 3. 重复分片:changed 闸门判假即 continue,一条写都不许有
|
||||
Fixture duplicate = running();
|
||||
duplicate.storeChanged = false;
|
||||
appendCase(sb, "duplicateChunkIgnored", duplicate, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
|
||||
// 4. 已组装成功过:恢复分支与早挂 job 双双短路
|
||||
Fixture already = running();
|
||||
already.hasSuccessfulJob = true;
|
||||
appendCase(sb, "successfulJobShortCircuitsBoth", already, TASK_ID, request(chunk(2, 2, "B012")));
|
||||
|
||||
// 5. 补传恢复:分片齐而 job 终态失败 ⇒ 重排+再挂一次组装
|
||||
Fixture recover = running();
|
||||
recover.terminalFailedJob = true;
|
||||
recover.mergedChunks.put(FILE_KEY, List.of(chunk(1, 2, "B011"), chunk(2, 2, "B012")));
|
||||
appendCase(sb, "recoverTerminalFailedAssemble", recover, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
|
||||
// 6. 终态任务重复回传:不带 code 的拒绝形状,发生在锁内
|
||||
Fixture terminal = running();
|
||||
terminal.task = task("SUCCESS");
|
||||
appendCase(sb, "terminalTaskRejected", terminal, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
|
||||
// 7. 非 RUNNING 未终态任务:先把任务复位再逐片处理
|
||||
Fixture reset = running();
|
||||
reset.task = task("PENDING");
|
||||
appendCase(sb, "nonRunningResetBeforeChunk", reset, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
|
||||
// 8. 末片但没有结果行:跳过挂 job,仍走收尾尝试
|
||||
Fixture noRow = running();
|
||||
noRow.resultRow = null;
|
||||
appendCase(sb, "completedFileWithoutResultRow", noRow, TASK_ID, request(chunk(2, 2, "B012")));
|
||||
|
||||
// 9. 应交件为零 ⇒ 按结果行终态自动收尾(成功行把任务判成 SUCCESS 并清缓存进度)
|
||||
Fixture orphan = running();
|
||||
orphan.payloadScopes = 0;
|
||||
orphan.unfinishedJobs = 0L;
|
||||
orphan.resultRow.setSuccess(1);
|
||||
orphan.resultRow.setResultFileUrl("objects/delete-brand/魏振峰.xlsx");
|
||||
appendCase(sb, "finalizeFromTerminalResults", orphan, TASK_ID, request(chunk(2, 2, "B012")));
|
||||
|
||||
// 10. 锁竞争:一句「任务正被占用」,写库计数全零
|
||||
Fixture busy = running();
|
||||
busy.lockAvailable = false;
|
||||
appendCase(sb, "lockBusyRejected", busy, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
|
||||
// 11. 准入与校验的十二格:一次库都不碰(非法 taskId 连锁都不碰)
|
||||
rejection(sb, "taskIdNull", running(), null, request(chunk(1, 2, "B011")));
|
||||
rejection(sb, "taskIdZero", running(), 0L, request(chunk(1, 2, "B011")));
|
||||
rejection(sb, "requestNull", running(), TASK_ID, null);
|
||||
rejection(sb, "filesEmpty", running(), TASK_ID, request());
|
||||
Fixture missingTask = running();
|
||||
missingTask.task = null;
|
||||
rejection(sb, "taskNotFound", missingTask, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
Fixture wrongModule = running();
|
||||
wrongModule.task = task("RUNNING");
|
||||
wrongModule.task.setModuleType("APPEARANCE_PATENT");
|
||||
rejection(sb, "wrongModuleTask", wrongModule, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
Fixture emptyPayload = running();
|
||||
emptyPayload.payload.clear();
|
||||
rejection(sb, "parsedPayloadMissing", emptyPayload, TASK_ID, request(chunk(1, 2, "B011")));
|
||||
Fixture blankIdentity = running();
|
||||
DeleteBrandResultFileDto blankFile = chunk(1, 2, "B011");
|
||||
blankFile.setFileKey("");
|
||||
blankFile.setSourceFilename("");
|
||||
rejection(sb, "blankFileIdentity", blankIdentity, TASK_ID, request(blankFile));
|
||||
Fixture unknownFile = running();
|
||||
DeleteBrandResultFileDto unknown = chunk(1, 2, "B011");
|
||||
unknown.setFileKey("uploads/别的.xlsx");
|
||||
rejection(sb, "unknownFileIdentity", unknownFile, TASK_ID, request(unknown));
|
||||
rejection(sb, "chunkIndexZero", running(), TASK_ID, request(chunk(0, 2, "B011")));
|
||||
rejection(sb, "chunkIndexOverTotal", running(), TASK_ID, request(chunk(3, 2, "B011")));
|
||||
Fixture tooManyRows = running();
|
||||
DeleteBrandResultFileDto overRows = chunk(1, 2, "B011");
|
||||
overRows.setTotalRows(99);
|
||||
rejection(sb, "totalRowsExceedsParsed", tooManyRows, TASK_ID, request(overRows));
|
||||
Fixture wrongCountry = running();
|
||||
DeleteBrandResultFileDto jp = chunk(1, 2, "B011");
|
||||
jp.setCountries(List.of(processedCountry("JP", "B011", "在售")));
|
||||
rejection(sb, "countryMismatch", wrongCountry, TASK_ID, request(jp));
|
||||
Fixture wrongAsin = running();
|
||||
DeleteBrandResultFileDto ghost = chunk(1, 2, "B999");
|
||||
rejection(sb, "asinMismatch", wrongAsin, TASK_ID, request(ghost));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void rejection(StringBuilder sb, String name, Fixture fixture,
|
||||
Long taskId, DeleteBrandSubmitResultRequest request) {
|
||||
appendCase(sb, "reject:" + name, fixture, taskId, request);
|
||||
}
|
||||
|
||||
// ---- 用例 ----
|
||||
|
||||
@Test
|
||||
void submit_result_snapshot_matches_golden() throws Exception {
|
||||
assertEquals(read(GOLDEN_SUBMIT), runAll(), "回传段落库流水与 golden 一致");
|
||||
}
|
||||
|
||||
@Test
|
||||
void submit_result_snapshot_is_reproducible() {
|
||||
assertEquals(runAll(), runAll(), "同一夹具跑两次流水一致(时钟与雪花 id 不得进快照)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void submit_result_snapshot_golden_is_committed() {
|
||||
assertTrue(GOLDEN_SUBMIT.isFile(), "golden 文件必须存在并入库: " + GOLDEN_SUBMIT.getAbsolutePath());
|
||||
assertTrue(GOLDEN_SUBMIT.length() > 0, "golden 文件非空");
|
||||
}
|
||||
|
||||
@Test
|
||||
void submit_result_snapshot_tamper_is_detected() throws Exception {
|
||||
String original = read(GOLDEN_SUBMIT);
|
||||
assertTrue(original.contains("== case=partialChunk"), "golden 内容合法");
|
||||
try {
|
||||
Files.writeString(GOLDEN_SUBMIT.toPath(), original + "\n# tampered", StandardCharsets.UTF_8);
|
||||
assertTrue(!read(GOLDEN_SUBMIT).equals(runAll()), "篡改 golden 后断言应失败");
|
||||
} finally {
|
||||
Files.writeString(GOLDEN_SUBMIT.toPath(), original, StandardCharsets.UTF_8);
|
||||
}
|
||||
assertEquals(original, read(GOLDEN_SUBMIT), "恢复原始 golden");
|
||||
}
|
||||
|
||||
/** 只在显式点名时写 golden:默认跑测试永远不许改是非源。 */
|
||||
@Test
|
||||
@EnabledIfEnvironmentVariable(named = "SHUFU_SNAPSHOT_WRITE", matches = "true")
|
||||
void write_golden_on_demand() throws Exception {
|
||||
Files.createDirectories(GOLDEN_SUBMIT.getParentFile().toPath());
|
||||
Files.writeString(GOLDEN_SUBMIT.toPath(), runAll(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static String read(File file) throws Exception {
|
||||
return Files.readString(file.toPath(), StandardCharsets.UTF_8).replace("\r\n", "\n");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
== case=partialChunk
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=1/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B011 current_country=US current_line=1 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
job.terminalFailed resultId=2001 -> false
|
||||
thrown: none
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=1
|
||||
|
||||
== case=lastChunkEnqueuesEarlyAssemble
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=2/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B012 current_country=US current_line=2 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
job.terminalFailed resultId=2001 -> false
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
result.update id=2001 success=1 rowCount=2 resultFilename=魏振峰.xlsx resultFileUrl=- fileSize=0 contentType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet errorMessage=-
|
||||
job.enqueue taskId=1001 resultId=2001 scope=uploads/魏振峰.xlsx
|
||||
lock.acquire taskId=1001 waitMillis=0
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.countScopes -> 1
|
||||
payload.countCompleted -> 0
|
||||
progress.save taskId=1001 forceWrite=- keys=[finished_files, updated_at] finished_files=0
|
||||
task.update id=1001 status=RUNNING errorMessage=- sourceFileCount=1 successFileCount=0 failedFileCount=0 finishedAt=-
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
thrown: none
|
||||
counters lockAcquire=2 taskUpdate=1 taskCacheSave=3 resultUpdate=1 jobEnqueue=1 progressSave=2
|
||||
|
||||
== case=duplicateChunkIgnored
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=1/2 -> stored=false
|
||||
thrown: none
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=successfulJobShortCircuitsBoth
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=2/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B012 current_country=US current_line=2 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> true
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> true
|
||||
lock.acquire taskId=1001 waitMillis=0
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.countScopes -> 1
|
||||
payload.countCompleted -> 0
|
||||
progress.save taskId=1001 forceWrite=- keys=[finished_files, updated_at] finished_files=0
|
||||
task.update id=1001 status=RUNNING errorMessage=- sourceFileCount=1 successFileCount=0 failedFileCount=0 finishedAt=-
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
thrown: none
|
||||
counters lockAcquire=2 taskUpdate=1 taskCacheSave=3 resultUpdate=0 jobEnqueue=0 progressSave=2
|
||||
|
||||
== case=recoverTerminalFailedAssemble
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=1/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B011 current_country=US current_line=1 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
job.terminalFailed resultId=2001 -> true
|
||||
chunks.load -> uploads/魏振峰.xlsx=2
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
job.resetForRecovery resultId=2001
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
result.update id=2001 success=1 rowCount=2 resultFilename=魏振峰.xlsx resultFileUrl=- fileSize=0 contentType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet errorMessage=-
|
||||
job.enqueue taskId=1001 resultId=2001 scope=uploads/魏振峰.xlsx
|
||||
thrown: none
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=1 jobEnqueue=1 progressSave=1
|
||||
|
||||
== case=terminalTaskRejected
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=SUCCESS module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=SUCCESS successFileCount=0
|
||||
thrown: BusinessException code=- message=任务已结束
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=nonRunningResetBeforeChunk
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=PENDING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=PENDING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
task.update id=1001 status=RUNNING errorMessage=- sourceFileCount=1 successFileCount=0 failedFileCount=0 finishedAt=-
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=1/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B011 current_country=US current_line=1 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
job.terminalFailed resultId=2001 -> false
|
||||
thrown: none
|
||||
counters lockAcquire=1 taskUpdate=1 taskCacheSave=2 resultUpdate=0 jobEnqueue=0 progressSave=1
|
||||
|
||||
== case=completedFileWithoutResultRow
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=2/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B012 current_country=US current_line=2 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=-
|
||||
result.selectOne taskId=1001 -> id=-
|
||||
lock.acquire taskId=1001 waitMillis=0
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.countScopes -> 1
|
||||
payload.countCompleted -> 0
|
||||
progress.save taskId=1001 forceWrite=- keys=[finished_files, updated_at] finished_files=0
|
||||
task.update id=1001 status=RUNNING errorMessage=- sourceFileCount=1 successFileCount=0 failedFileCount=0 finishedAt=-
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
thrown: none
|
||||
counters lockAcquire=2 taskUpdate=1 taskCacheSave=3 resultUpdate=0 jobEnqueue=0 progressSave=2
|
||||
|
||||
== case=finalizeFromTerminalResults
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
chunk.store file=uploads/魏振峰.xlsx idx=2/2 -> stored=true
|
||||
progress.save taskId=1001 forceWrite=true keys=[current_asin, current_country, current_line, file_index, file_name, file_total, last_heartbeat_at, phase, total_lines, updated_at] current_asin=B012 current_country=US current_line=2 file_index=1 file_name=魏振峰.xlsx file_total=1 phase=crawling total_lines=2
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
job.terminalFailed resultId=2001 -> false
|
||||
result.selectOne taskId=1001 -> id=2001
|
||||
job.hasSuccessful resultId=2001 -> false
|
||||
result.update id=2001 success=1 rowCount=2 resultFilename=魏振峰.xlsx resultFileUrl=objects/delete-brand/魏振峰.xlsx fileSize=- contentType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet errorMessage=-
|
||||
job.enqueue taskId=1001 resultId=2001 scope=uploads/魏振峰.xlsx
|
||||
lock.acquire taskId=1001 waitMillis=0
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.countScopes -> 0
|
||||
result.selectList taskId=1001 -> rows=1
|
||||
job.countUnfinished -> 0
|
||||
task.update id=1001 status=SUCCESS errorMessage=- sourceFileCount=1 successFileCount=1 failedFileCount=0 finishedAt=set
|
||||
task.cache.save id=1001 status=SUCCESS successFileCount=1
|
||||
progress.save taskId=1001 forceWrite=true keys=[finished_files, phase, updated_at] finished_files=1 phase=success
|
||||
thrown: none
|
||||
counters lockAcquire=2 taskUpdate=1 taskCacheSave=3 resultUpdate=1 jobEnqueue=1 progressSave=2
|
||||
|
||||
== case=lockBusyRejected
|
||||
lock.acquire taskId=1001 waitMillis=10000 -> busy
|
||||
thrown: BusinessException code=- message=任务正被占用,请稍后重试
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:taskIdNull
|
||||
thrown: BusinessException code=- message=任务 id 不合法
|
||||
counters lockAcquire=0 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:taskIdZero
|
||||
thrown: BusinessException code=- message=任务 id 不合法
|
||||
counters lockAcquire=0 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:requestNull
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
thrown: BusinessException code=- message=文件列表为空
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:filesEmpty
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
thrown: BusinessException code=- message=文件列表为空
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:taskNotFound
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=- module=-
|
||||
thrown: BusinessException code=- message=任务不存在
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:wrongModuleTask
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=APPEARANCE_PATENT
|
||||
thrown: BusinessException code=- message=任务不存在
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=0 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:parsedPayloadMissing
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=0
|
||||
thrown: BusinessException code=- message=任务解析结果不存在
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:blankFileIdentity
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=文件标识为空
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:unknownFileIdentity
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=找不到已解析文件: uploads/别的.xlsx
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:chunkIndexZero
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=分片参数不合法
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:chunkIndexOverTotal
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=分片参数不合法
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:totalRowsExceedsParsed
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=totalRows 不合法
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:countryMismatch
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=country 不匹配: 魏振峰.xlsx / JP
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
== case=reject:asinMismatch
|
||||
lock.acquire taskId=1001 waitMillis=10000
|
||||
task.load id=1001 cached=false status=RUNNING module=DELETE_BRAND
|
||||
task.cache.save id=1001 status=RUNNING successFileCount=0
|
||||
payload.load -> scopes=1
|
||||
thrown: BusinessException code=- message=asin 不匹配: 魏振峰.xlsx / US / B999
|
||||
counters lockAcquire=1 taskUpdate=0 taskCacheSave=1 resultUpdate=0 jobEnqueue=0 progressSave=0
|
||||
|
||||
Reference in New Issue
Block a user