优化
This commit is contained in:
+14
@@ -278,6 +278,20 @@ class LoadingModelBridgeServiceTest {
|
||||
verify(repository).confirmIncrementalPreload(30L, 10L, 20L, 4, 7L, "admin");
|
||||
}
|
||||
|
||||
@Test
|
||||
void bindsConfirmingPreloadToEditingPlanWithoutFinalizingIt() {
|
||||
when(repository.byPair(10, 20, 40)).thenReturn(null);
|
||||
when(repository.loadingPlan(40)).thenReturn(new LoadingPlanSnapshot(40L, 50L, "C1", "EDITING", 3));
|
||||
when(repository.allocatedPackages(10, 20, 40)).thenReturn(2);
|
||||
when(repository.preload(10, 20)).thenReturn(new PreloadSnapshot(30L, 10L, 20L, "CONFIRMING", 4));
|
||||
|
||||
service.bindIncrementalAllocation(40L, 10L, 20L, 7L, "admin", "assign-confirming-editing");
|
||||
|
||||
verify(repository).insert(any());
|
||||
verify(repository, never()).confirmIncrementalPreload(anyLong(), anyLong(), anyLong(),
|
||||
anyInt(), anyLong(), anyString());
|
||||
}
|
||||
|
||||
private static Link link(String preloadStatus, int preloadVersion, String loadingStatus,
|
||||
int loadingVersion, int packages) {
|
||||
return new Link(1L, 10L, 20L, 30L, preloadStatus, preloadVersion, 40L, 50L, "C1",
|
||||
|
||||
+8
-6
@@ -84,14 +84,16 @@ class SplitPreloadServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadingAllocationDoesNotOverwriteConfirmedPreload() {
|
||||
void loadingAllocationMayReuseConfirmingAndConfirmedPreloads() {
|
||||
when(repository.findInbound(10, 20)).thenReturn(new InboundSnapshot(20L, 10L, "WAIT_SPLIT", 3));
|
||||
PreloadPlanEntity plan = new PreloadPlanEntity();
|
||||
plan.setStatus("CONFIRMING");
|
||||
when(repository.findPlan(10, 20)).thenReturn(plan);
|
||||
PreloadPlanEntity confirming = new PreloadPlanEntity();
|
||||
confirming.setStatus("CONFIRMING");
|
||||
PreloadPlanEntity confirmed = new PreloadPlanEntity();
|
||||
confirmed.setStatus("CONFIRMED");
|
||||
when(repository.findPlan(10, 20)).thenReturn(confirming, confirmed);
|
||||
|
||||
assertThatThrownBy(() -> service.ensurePendingForLoadingAllocation(10, 20, 7, "admin"))
|
||||
.hasMessageContaining("已进入确认流程");
|
||||
service.ensurePendingForLoadingAllocation(10, 20, 7, "admin");
|
||||
service.ensurePendingForLoadingAllocation(10, 20, 7, "admin");
|
||||
|
||||
verify(repository, never()).createPlan(any());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user