优化
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
package com.baiyue.warehouse.repository;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class InitialWarehouseResourceSeedSqlContractTest {
|
||||
@Test
|
||||
void initializesAvailablePalletAndLocationsForBothDomesticWarehouses() throws Exception {
|
||||
assertModuleSeed(Files.readString(Path.of("src", "main", "resources", "db", "phase2-pallet-seed.sql"),
|
||||
StandardCharsets.UTF_8));
|
||||
assertUnifiedSeed(Files.readString(Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql"),
|
||||
StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private static void assertModuleSeed(String sql) {
|
||||
assertSeed(sql, "190000000000000001", "190000000000000002", "190000000000000");
|
||||
}
|
||||
|
||||
private static void assertUnifiedSeed(String sql) {
|
||||
assertSeed(sql, "193000000000200001", "193000000000200002", "193000000000200");
|
||||
}
|
||||
|
||||
private static void assertSeed(String sql, String yiwuId, String dongguanId, String idPrefix) {
|
||||
assertThat(sql)
|
||||
.contains("0," + yiwuId + ",'TP-001'")
|
||||
.contains("0," + dongguanId + ",'TP-002'")
|
||||
.contains("(" + idPrefix + "201,0," + yiwuId + ",'A','A区','A1'")
|
||||
.contains("(" + idPrefix + "202,0," + yiwuId + ",'A','A区','A0'")
|
||||
.contains("(" + idPrefix + "203,0," + dongguanId + ",'A','A区','A1'")
|
||||
.contains("(" + idPrefix + "204,0," + dongguanId + ",'A','A区','A0'")
|
||||
.contains("shared_overflow")
|
||||
.contains("'AVAILABLE'")
|
||||
.doesNotContain("INSERT INTO wh_location_reservation")
|
||||
.doesNotContain("INSERT INTO wh_location_occupancy");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user