阶段七:完成 React Feature 化与前置重构收口
This commit is contained in:
1 parent
375e84d663
commit
1a228dc35c
305 files changed
+14179
-5431
No files matched your search
@@ -12,7 +12,7 @@ func TestNewServerAssemblesApplicationServices(t *testing.T) {
|
||||
}
|
||||
// services 是统一应用服务集合。
|
||||
services := srv.applicationServiceSet()
|
||||
if services.orders == nil || services.itemSinglePublish == nil || services.itemCatalog == nil || services.itemCatalogMutation == nil || services.accountLogin == nil || services.authentication == nil || services.loginAudit == nil || services.passwordLogin == nil || services.accountDelete == nil || services.accountSettings == nil || services.analytics == nil || services.publishAutomationRules == nil || services.defaultReplies == nil || services.keywords == nil {
|
||||
if services.orders == nil || services.orderRefreshJobs == nil || services.itemBatchCoordinator == nil || services.itemSinglePublish == nil || services.itemCatalog == nil || services.itemCatalogMutation == nil || services.accountLogin == nil || services.authentication == nil || services.loginAudit == nil || services.passwordLogin == nil || services.accountDelete == nil || services.accountSettings == nil || services.uncertainNotifications == nil || services.notificationChannels == nil || services.analytics == nil || services.cards == nil || services.publishAutomationRules == nil || services.defaultReplies == nil || services.keywords == nil {
|
||||
t.Fatal("应用服务集合存在未装配的服务")
|
||||
}
|
||||
if services.orders.services == nil || services.orders.services.List == nil || services.orders.services.Detail == nil || services.orders.services.Refresh == nil || services.orders.services.RefreshJobs == nil {
|
||||
@@ -22,3 +22,35 @@ func TestNewServerAssemblesApplicationServices(t *testing.T) {
|
||||
t.Fatal("应用服务访问器未返回统一装配实例")
|
||||
}
|
||||
}
|
||||
|
||||
// TestApplicationLifecycleComponentsExposeWorkerOwnership 验证 Server 只暴露应用 worker 生命周期端口,不再提供启动入口。
|
||||
func TestApplicationLifecycleComponentsExposeWorkerOwnership(t *testing.T) {
|
||||
// srv、cleanup 保存带完整应用服务装配的测试 Server 及其资源清理函数。
|
||||
srv, _, cleanup := newTestServer(t)
|
||||
defer cleanup()
|
||||
// components 保存交给进程生命周期协调器登记的应用 worker 组件。
|
||||
components := srv.ApplicationLifecycleComponents()
|
||||
if len(components) != 3 {
|
||||
t.Fatalf("应用生命周期组件数量=%d,期望=3", len(components))
|
||||
}
|
||||
// names 保存组件稳定名称,顺序同时表达启动依赖与关闭逆序。
|
||||
names := make([]string, 0, len(components))
|
||||
// component 表示当前应用 worker 生命周期组件。
|
||||
for _, component := range components {
|
||||
names = append(names, component.Name)
|
||||
if component.Component == nil {
|
||||
t.Fatalf("组件 %q 缺少生命周期实现", component.Name)
|
||||
}
|
||||
}
|
||||
// want 是 cmd 应登记的应用 worker 稳定名称与启动顺序。
|
||||
want := []string{"order-refresh-recovery", "publish-batch-workers", "order-reconciliation-recovery"}
|
||||
if len(names) != len(want) {
|
||||
t.Fatalf("组件名称数量=%d,期望=%d", len(names), len(want))
|
||||
}
|
||||
// index 表示当前比较的生命周期组件下标。
|
||||
for index := range want {
|
||||
if names[index] != want[index] {
|
||||
t.Fatalf("组件名称[%d]=%q,期望=%q", index, names[index], want[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user