Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
+1
-1
@@ -77,7 +77,7 @@ class LoadingListControllerContractTest {
|
||||
.contains("/loading-plans/{planId}/lifecycle")
|
||||
.contains("/loading-plans/{planId}/pallet-labels/prepare")
|
||||
.contains("/loading-plans/{planId}/pallet-labels/print")
|
||||
.contains("柜号-FBA仓编码-三位序号")
|
||||
.contains("柜号-FBA地址内部编号-三位序号")
|
||||
.contains("不得以错误文案或 A0404 猜测阶段")
|
||||
.contains("confirmationStatus")
|
||||
.contains("canConfirm")
|
||||
|
||||
+1
-1
@@ -390,7 +390,7 @@ class OceanBookingServiceTest {
|
||||
when(priceBooks.channels(51L, 701L)).thenReturn(List.of(row));
|
||||
when(warehouses.active(any(), eq(0L), eq(701L))).thenReturn(ApiResponse.success(
|
||||
new WarehouseMasterDataClient.Detail(new WarehouseMasterDataClient.Warehouse(
|
||||
701L, 0L, "SZX", "深圳中转仓", "DOMESTIC", "ACTIVE"))));
|
||||
701L, 0L, "SZX", null, "深圳中转仓", "DOMESTIC", "ACTIVE"))));
|
||||
when(suppliers.booking(81L, null)).thenReturn(
|
||||
new WarehouseSupplierClient.Snapshot(81L, "订舱代理", "BOOKING", "ACTIVE", List.of("MATSON")));
|
||||
when(partners.active(any(), eq(0L), eq(71L))).thenReturn(ApiResponse.success(
|
||||
|
||||
@@ -468,7 +468,7 @@ class ContainerServiceTest {
|
||||
String type,
|
||||
String name) {
|
||||
return ApiResponse.success(new WarehouseMasterDataClient.Detail(
|
||||
new WarehouseMasterDataClient.Warehouse(warehouseId, 0L, "CN-SHA-01", name, type, "ACTIVE")));
|
||||
new WarehouseMasterDataClient.Warehouse(warehouseId, 0L, "CN-SHA-01", null, name, type, "ACTIVE")));
|
||||
}
|
||||
|
||||
private static ContainerBookingEntity booking(String status, int version) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -315,6 +316,16 @@ class LoadingListServiceTest {
|
||||
verify(loadingCompletedOutboxService).publish(10L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void completedEventReadinessMustAllowPalletLabelFreeze() throws Exception {
|
||||
Transactional transaction = LoadingListService.class
|
||||
.getDeclaredMethod("requireCompletedEventReady", long.class)
|
||||
.getAnnotation(Transactional.class);
|
||||
|
||||
assertThat(transaction).isNotNull();
|
||||
assertThat(transaction.readOnly()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectAutomaticCompletionWhenPdaItemsRemain() {
|
||||
when(pickRepository.allPlanItemsPicked(10L)).thenReturn(false);
|
||||
|
||||
+17
-2
@@ -1,6 +1,8 @@
|
||||
package com.baiyue.firstleg.service;
|
||||
|
||||
import com.baiyue.firstleg.mapper.LoadingPalletLabelMapper;
|
||||
import com.baiyue.firstleg.client.WarehouseMasterDataClient;
|
||||
import com.baiyue.common.core.api.ApiResponse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
@@ -18,21 +20,28 @@ class LoadingPalletLabelServiceTest {
|
||||
LoadingPalletLabelMapper mapper = mock(LoadingPalletLabelMapper.class);
|
||||
LoadingPalletLabelService service = new LoadingPalletLabelService();
|
||||
ReflectionTestUtils.setField(service, "mapper", mapper);
|
||||
WarehouseMasterDataClient warehouseClient = mock(WarehouseMasterDataClient.class);
|
||||
ReflectionTestUtils.setField(service, "warehouseClient", warehouseClient);
|
||||
ReflectionTestUtils.setField(service, "internalToken", "test-token");
|
||||
List<LoadingPalletLabelMapper.LabelRow> saved = new ArrayList<>();
|
||||
when(mapper.lockSources(10L)).thenReturn(List.of(source(3, "LAX9", 1, "STANDARD"),
|
||||
source(1, "ONT8", 2, "STANDARD"), source(2, "ONT8", 1, "STANDARD"),
|
||||
source(4, "ONT8", 4, "ONE_CLICK_DROPSHIP")));
|
||||
when(mapper.labels(10L)).thenAnswer(ignored -> List.copyOf(saved));
|
||||
when(mapper.insert(any())).thenAnswer(invocation -> { saved.add(invocation.getArgument(0)); return 1; });
|
||||
when(warehouseClient.active("test-token", 0L, 101L)).thenReturn(warehouse("LAX9", "154"));
|
||||
when(warehouseClient.active("test-token", 0L, 102L)).thenReturn(warehouse("ONT8", "CADF"));
|
||||
|
||||
var manifest = service.prepare(10L, 20L);
|
||||
|
||||
assertThat(manifest.totalCount()).isEqualTo(4);
|
||||
assertThat(manifest.groups()).extracting(group -> group.destinationWarehouseCode() + ":" + group.totalCount())
|
||||
.containsExactly("LAX9:1", "ONT8:3");
|
||||
assertThat(manifest.groups()).extracting(group -> group.destinationWarehouseInternalCode())
|
||||
.containsExactly("154", "CADF");
|
||||
assertThat(saved).extracting(LoadingPalletLabelMapper.LabelRow::getPalletCode)
|
||||
.containsExactly("MSCU6639870-LAX9-001", "MSCU6639870-ONT8-001",
|
||||
"MSCU6639870-ONT8-002", "MSCU6639870-ONT8-003");
|
||||
.containsExactly("MSCU6639870-154-001", "MSCU6639870-CADF-001",
|
||||
"MSCU6639870-CADF-002", "MSCU6639870-CADF-003");
|
||||
}
|
||||
|
||||
private LoadingPalletLabelMapper.SourceRow source(long itemId, String destination, int pallets, String fulfillment) {
|
||||
@@ -40,7 +49,13 @@ class LoadingPalletLabelServiceTest {
|
||||
row.setPlanStatus("LOADING"); row.setContainerNo("MSCU6639870"); row.setWarehouseId(20L);
|
||||
row.setItemId(itemId); row.setAccountId(100L); row.setInboundId(itemId + 1000);
|
||||
row.setInboundCode("RK-" + itemId); row.setDestinationWarehouseCode(destination);
|
||||
row.setDestinationWarehouseId("LAX9".equals(destination) ? 101L : 102L);
|
||||
row.setDestinationWarehouseName(destination); row.setPalletCount(pallets);
|
||||
row.setFulfillmentType(fulfillment); row.setDestinationType("FBA"); return row;
|
||||
}
|
||||
|
||||
private ApiResponse<WarehouseMasterDataClient.Detail> warehouse(String code, String internalCode) {
|
||||
return ApiResponse.success(new WarehouseMasterDataClient.Detail(new WarehouseMasterDataClient.Warehouse(
|
||||
"LAX9".equals(code) ? 101L : 102L, 0L, code, internalCode, code, "FBA", "ACTIVE")));
|
||||
}
|
||||
}
|
||||
|
||||
+7
-2
@@ -23,7 +23,10 @@ class TerminalDrayageSqlContractTest {
|
||||
if (name.equals("pendingMails")) assertThat(sql).contains("earlier.container_booking_id=m.container_booking_id", "earlier.id<m.id", "earlier.status<>'SENT'");
|
||||
}
|
||||
for (Path path : java.util.List.of(Path.of("src/main/resources/db/phase3-terminal-drayage-schema.sql"), Path.of("../deploy/sql/头程数据库统一增量-MySQL8.sql"))) {
|
||||
assertThat(Files.readString(path)).contains("CREATE TABLE IF NOT EXISTS fl_terminal_drayage_mail (", "CHECK(status IN ('PENDING','SENDING','SENT','FAILED'))");
|
||||
assertThat(Files.readString(path)).contains(
|
||||
"CREATE TABLE IF NOT EXISTS fl_terminal_drayage_mail (",
|
||||
"CHECK(status IN ('PENDING','SENDING','SENT','FAILED'))",
|
||||
"('SELECT_FLEET','SEND_PICKUP_EMAIL','SCHEDULE_PICKUP','RECORD_PICKUP','RECORD_EMPTY_RETURN')");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +41,9 @@ class TerminalDrayageSqlContractTest {
|
||||
}
|
||||
String release = Files.readString(Path.of("../deploy/sql/头程数据库统一增量-MySQL8.sql"));
|
||||
assertThat(release).contains("DROP CHECK chk_terminal_drayage_times",
|
||||
"ADD CONSTRAINT chk_terminal_drayage_times CHECK(");
|
||||
"ADD CONSTRAINT chk_terminal_drayage_times CHECK(",
|
||||
"DROP CHECK chk_terminal_drayage_history_action",
|
||||
"ADD CONSTRAINT chk_terminal_drayage_history_action CHECK(action IN");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user