#!/usr/bin/env python3 """Explicit synthetic fixture/Mock ACK driver; no QA HTTP endpoints or real device transport.""" import argparse import os from pathlib import Path import subprocess import xml.etree.ElementTree as ET import qa def main(): parser=argparse.ArgumentParser(description=__doc__) parser.add_argument('action',choices=['seed','ack','state','verify']) parser.add_argument('--approve-synthetic-qa-writes',action='store_true',required=True) parser.add_argument('--config',type=Path,default=Path.home()/'.railwaysystem-qa.env') args=parser.parse_args() env=qa.environment(qa.load_config(args.config));qa.private_directory() directory=qa.RUNTIME/'round5v4';directory.mkdir(mode=0o700,exist_ok=True) env.update(ROUND5V4_KINGBASE_TESTS='1',ROUND5V4_LOG_DIR=str(directory)) report=qa.ROOT/'RuoYi-Vue/ruoyi-train/target/surefire-reports/TEST-com.ruoyi.train.integration.lock.Round5v4KingbaseIntegrationTest.xml' tree=ET.parse(report);cp=tree.find("./properties/property[@name='surefire.test.class.path']").attrib['value'] command=['java','-cp',cp,'com.ruoyi.train.integration.lock.Round5v4BrowserFixture',args.action] result=subprocess.run(command,cwd=qa.ROOT,env=env,text=True,capture_output=True,timeout=90) with open(directory/('browser-fixture-'+args.action+'.log'),'w',opener=lambda p,f:os.open(p,f,0o600)) as log: log.write(result.stdout+result.stderr) for line in result.stdout.splitlines(): if line.startswith(('BROWSER_FIXTURE_CREATED','FIXTURE_AUTH','FIXTURE_COMMAND','FIXTURE_BROWSER_DATABASE')):print(line) print('FIXTURE_DRIVER_EXIT='+str(result.returncode)) return result.returncode if __name__=='__main__': raise SystemExit(main())