这是缺少的功能,我们正在处理它,因此您可能只需将 benchmarkConfig.xml 文件放在 src/test/resources 中,而无需任何 entityClass 等信息 - 甚至根本没有配置 xml 文件 - 并且刚刚好。
我相信它会在 8.5 或 8.6 登陆。
解决方法
同时,这可行:
// This needs to be in src/main/java, because src/test/java doesn't work
// TODO move this to src/test/java after https://issues.redhat.com/browse/PLANNER-2341
@QuarkusMain(name = "benchmark")
public class VaccinationScheduleBenchmark implements QuarkusApplication {
public static void main(String[] args) {
Quarkus.run(VaccinationScheduleBenchmark.class, args);
}
@Inject
ObjectMapper objectMapper;
@Override
public int run(String... args) {
generateDemoFile(5, 25, 0.0);
generateDemoFile(10, 50, 0.0);
generateDemoFile(10, 50, 0.3);
generateDemoFile(25, 500, 0.0);
generateDemoFile(50, 2000, 0.0);
generateDemoFile(50, 2000, 0.3);
// The solverBenchmarkConfig.xml explicitly mentions the entityClass, etc :(
PlannerBenchmarkFactory benchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource("solverBenchmarkConfig.xml");
benchmarkFactory.buildPlannerBenchmark()
.benchmarkAndShowReportInBrowser();
return 0;
}
private void generateDemoFile(int vaccinationCenterCount, int totalBoothCount, double pinnedAppointmentRatio) {
File file = new File("local/input/" + vaccinationCenterCount + "vc-" + totalBoothCount + "booths"
+ (pinnedAppointmentRatio > 0.0 ? "-" + pinnedAppointmentRatio + "pinned" : "") + ".json");
if (!file.exists()) {
DemoDataGenerator demoDataGenerator = new DemoDataGenerator(33.40, 34.10, -84.90, -83.90);
VaccinationSchedule schedule = demoDataGenerator.generate(vaccinationCenterCount, totalBoothCount, pinnedAppointmentRatio);
try {
objectMapper.writeValue(file, schedule);
} catch (IOException e) {
throw new IllegalArgumentException("Failed writing file (" + file + ").", e);
}
}
}
}