package com.gzzn.omms.msgexchange.processing import com.gzzn.omms.msgexchange.infra.persistence.MsgEventRepository import com.gzzn.omms.msgexchange.infra.persistence.PipelineLockRepository import com.gzzn.omms.msgexchange.infra.persistence.PipelineTransactionManager import com.gzzn.omms.msgexchange.infra.persistence.ProcStateRepository import com.gzzn.omms.msgexchange.infra.stub.StubFlightProjectionPort import com.gzzn.omms.msgexchange.infra.stub.StubMsgEvents import com.gzzn.omms.msgexchange.infra.stub.StubPipelineLock import com.gzzn.omms.msgexchange.infra.stub.StubPipelineTx import com.gzzn.omms.msgexchange.infra.stub.StubProcState import java.time.Clock /** * 处理器用例共用的三步提交装配:默认全内存、投影不失败。 * 事件仓储要和处理器用同一个实例,否则放行(`HELD` → `PENDING`)落不到处理器写的那些行上。 */ internal fun testCommit( procState: ProcStateRepository = StubProcState(), msgEvents: MsgEventRepository = StubMsgEvents(), projection: FlightProjectionPort = StubFlightProjectionPort(), lock: PipelineLockRepository = StubPipelineLock(), txManager: PipelineTransactionManager = StubPipelineTx(), clock: Clock = Clock.systemUTC(), ) = FlightCommit(txManager, lock, procState, msgEvents, projection, clock)