- 门控:用户提供 existing_system 路径 → 进入影响调查;未提供 → 原流程不变
- CodeParser 解析 Java(@RestController/@Service/@Entity/@TableName)+ ExistingSystemExplorer 组装
- ImpactAgent 变更点定位(变更区分×既存対応 确定性比对,无 LLM)→ ImpactReport(JSON 可下载)
- 影响调查结果作为 Writer 生成概要设计书的主上下文({{impact}},无专用影响章)
- source_aggregator 解除 existing_system=None 硬编码
- 既有系统样本 sunOnly/stock-trade-system(无 LICENSE,仅测试输入,保留来源标注)
- 新造股票交易域追加改修样本 要件定義_追加改修_股票.xlsx(对齐 sunOnly 真实类名)
- 全量 351 passed / 99.27% 覆盖;门禁 PASS(16 要素:新规5/変更8/削除3/未受影响50)
46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
"""ExistingSystemExplorer 测试:CodeStructure → ExistingSystemInfo 分层组装。"""
|
|
import pytest
|
|
|
|
from genesis.data_models import CodeStructure, ControllerInfo, EntityInfo, ServiceInfo
|
|
from genesis.impact.existing_system_explorer import ExistingSystemExplorer
|
|
|
|
|
|
def _code() -> CodeStructure:
|
|
return CodeStructure(
|
|
root_path="/fake/root",
|
|
language="java",
|
|
modules=["trade-order"],
|
|
classes=[],
|
|
controllers=[
|
|
ControllerInfo(name="OrderController", class_name="OrderController", path="OrderController.java",
|
|
base_path="/api/order", endpoints=["/api/order/{id}"], source_uri="OrderController.java"),
|
|
],
|
|
services=[ServiceInfo(name="OrderService", class_name="OrderService", path="OrderService.java",
|
|
methods=["query"], source_uri="OrderService.java")],
|
|
entities=[EntityInfo(name="OrderEntity", class_name="OrderEntity", path="OrderEntity.java",
|
|
table_name="t_order", fields=["id"], source_uri="OrderEntity.java")],
|
|
endpoints=[],
|
|
raw_imports=[],
|
|
)
|
|
|
|
|
|
def test_explore_assembles_layers():
|
|
info = ExistingSystemExplorer().explore(_code())
|
|
assert len(info.controller_layer) == 1
|
|
assert info.controller_layer[0].class_name == "OrderController"
|
|
assert len(info.service_layer) == 1
|
|
assert info.service_layer[0].class_name == "OrderService"
|
|
assert len(info.entity_layer) == 1
|
|
assert info.entity_layer[0].table_name == "t_order"
|
|
assert info.source_path == "/fake/root"
|
|
|
|
|
|
def test_explore_empty_code():
|
|
code = CodeStructure(root_path="/x", language="java", modules=[], classes=[], controllers=[],
|
|
services=[], entities=[], endpoints=[], raw_imports=[])
|
|
info = ExistingSystemExplorer().explore(code)
|
|
assert info.controller_layer == []
|
|
assert info.service_layer == []
|
|
assert info.entity_layer == []
|
|
assert info.api_endpoints == []
|