fix lastleg order detail customer schema
This commit is contained in:
+3
-1
@@ -84,7 +84,9 @@ class InboundStockReceiptServiceTest {
|
||||
assertEquals(10L, receipt.getValue().getInventoryPositionId());
|
||||
assertEquals("INBOUND_COMPLETED", fixture.order.getCurrentStatus());
|
||||
assertEquals("INBOUND_PLAN:COMPLETED", fixture.order.getSubOrderStatus());
|
||||
verify(orderHistories).insert(any(LastlegOrderStatusHistory.class));
|
||||
ArgumentCaptor<LastlegOrderStatusHistory> history = ArgumentCaptor.forClass(LastlegOrderStatusHistory.class);
|
||||
verify(orderHistories).insert(history.capture());
|
||||
assertEquals("100", history.getValue().getCustomerId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.baiyue.lastleg.schema;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class LastlegOrderDetailSchemaContractTest {
|
||||
@Test
|
||||
void orderDetailHasCustomerIsolationInBaselineAndRepeatableUpgrade() throws Exception {
|
||||
String baseline = new ClassPathResource("db/lastleg.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
String unified = Files.readString(Path.of("..", "deploy", "sql", "海外区域统一增量-MySQL8.sql"),
|
||||
StandardCharsets.UTF_8);
|
||||
String service = Files.readString(Path.of("src", "main", "java", "com", "baiyue", "lastleg",
|
||||
"service", "LastlegOrderService.java"), StandardCharsets.UTF_8);
|
||||
|
||||
assertThat(baseline)
|
||||
.contains("CREATE TABLE IF NOT EXISTS ll_order_detail")
|
||||
.contains("customer_id VARCHAR(128) NOT NULL COMMENT '客户数据隔离键'")
|
||||
.contains("KEY idx_ll_detail_customer_order(customer_id,order_id,id)");
|
||||
assertThat(unified)
|
||||
.contains("table_name='ll_order_detail' AND column_name='customer_id'")
|
||||
.contains("UPDATE ll_order_detail detail")
|
||||
.contains("SET detail.customer_id=orders.customer_id")
|
||||
.contains("MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT '客户数据隔离键'")
|
||||
.contains("ADD KEY idx_ll_detail_customer_order(customer_id,order_id,id)");
|
||||
assertThat(service)
|
||||
.contains(".eq(LastlegOrderDetail::getCustomerId, order.getCustomerId())")
|
||||
.contains(".eq(LastlegOrderStatusHistory::getCustomerId, order.getCustomerId())");
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ class LastlegOrderServiceTest {
|
||||
assertEquals("LAX-02", cargo.getValue().getDestinationWarehouseCode());
|
||||
ArgumentCaptor<LastlegOrderStatusHistory> history = ArgumentCaptor.forClass(LastlegOrderStatusHistory.class);
|
||||
verify(histories).insert(history.capture());
|
||||
assertEquals("100", history.getValue().getCustomerId());
|
||||
assertEquals("PENDING_ASSIGNMENT", history.getValue().getFromStatus());
|
||||
assertEquals("DESTINATION_ASSIGNED", history.getValue().getToStatus());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user