feat(dispatch): unify whole vehicle scheduling, source ownership and staged execution
This commit is contained in:
@@ -73,6 +73,40 @@ function analyze(sourceSet = 'main') {
|
||||
}));
|
||||
}
|
||||
|
||||
test('original appointment adapters use only the reviewed dispatch port types', () => {
|
||||
const report = analyze();
|
||||
const baseline = JSON.parse(readFileSync(contract, 'utf8'));
|
||||
const prefix = 'com.baiyue.lastleg.inboundplan.work.';
|
||||
const port = 'com.baiyue.lastleg.dispatch.port.';
|
||||
const expected = [
|
||||
['FbaAppointmentExecutionAdapter', 'DispatchAppointmentAmendmentPort'],
|
||||
['FbaAppointmentExecutionAdapter', 'DispatchContracts'],
|
||||
['FbaAppointmentExecutionAdapter', 'DispatchTypes'],
|
||||
['FbaAppointmentTransportAdapter', 'DispatchAppointmentAmendmentPort'],
|
||||
['FbaAppointmentTransportAdapter', 'DispatchCommands'],
|
||||
['FbaAppointmentTransportAdapter', 'DispatchContracts'],
|
||||
['FbaAppointmentTransportAdapter', 'DispatchTypes'],
|
||||
].map(([source, target]) => `${prefix}${source}->${port}${target}`).sort();
|
||||
const reviewed = baseline.reviewedClassDependencies.filter(edge => edge.source.startsWith(prefix)
|
||||
&& edge.target.startsWith('com.baiyue.lastleg.dispatch.'));
|
||||
assert.deepEqual(reviewed.map(edge => `${edge.source}->${edge.target}`).sort(), expected);
|
||||
assert.equal(baseline.allowedSliceEdges.includes('inbound-pda->dispatch-delivery'), false);
|
||||
const violations = contractViolations(report, baseline);
|
||||
for (const edge of expected) assert.equal(violations.some(message => message.includes(edge)), false);
|
||||
|
||||
// 精确端口边不允许原适配器直连整车实现,也不授权其他预约消费者借用此许可。
|
||||
const forbidden = [
|
||||
{ source: prefix + 'FbaAppointmentExecutionAdapter', target: 'com.baiyue.lastleg.dispatch.service.DispatchAggregateService' },
|
||||
{ source: prefix + 'AppointmentWorkDispatchBinding', target: port + 'DispatchAppointmentAmendmentPort' },
|
||||
];
|
||||
for (const edge of forbidden) {
|
||||
assert.ok(report.classes.some(entry => entry.fqcn === edge.source));
|
||||
assert.ok(report.classes.some(entry => entry.fqcn === edge.target));
|
||||
report.classDependencies.push(edge);
|
||||
assert.ok(contractViolations(report, baseline).some(message => message.includes(`${edge.source}->${edge.target}`)));
|
||||
}
|
||||
});
|
||||
|
||||
test('current source does not add slice dependencies beyond the Lastleg baseline', () => {
|
||||
execFileSync(process.execPath, [analyzer, '--source-set', 'main', '--format', 'dot', '--check', contract], {
|
||||
cwd: moduleRoot,
|
||||
|
||||
Reference in New Issue
Block a user