ReplayJob extends AbstractJob<ReplayRequest, ReplayJobStatus> implements GroupedJob { private void replay(ExtensionJobHistoryRecord record) throws ComponentLookupException { if (record.getRequest() instanceof AbstractRequest) { ((AbstractRequest) record.getRequest()).setStatusLogIsolated(false); } Job job = this.componentManager.getInstance(Job.class, record.getJobType()); job.initialize(record.getRequest()); job.run(); } ReplayJob(); @Override String getType(); @Override JobGroupPath getGroupPath(); @Override void initialize(Request request); static final String JOB_TYPE; }
@Test void replay() { InstallRequest installRequest = new InstallRequest(); ExtensionJobHistoryRecord installRecord = new ExtensionJobHistoryRecord("install", installRequest, null, null, null); UninstallRequest uninstallRequest = new UninstallRequest(); ExtensionJobHistoryRecord uninstallRecord = new ExtensionJobHistoryRecord("uninstall", uninstallRequest, null, null, null); ReplayRequest request = new ReplayRequest(); request.setRecords(Arrays.asList(installRecord, uninstallRecord)); assertNull(installRequest.isStatusLogIsolated()); assertNull(uninstallRequest.isStatusLogIsolated()); this.replayJob.initialize(request); this.replayJob.run(); verify(this.installJob).initialize(installRequest); verify(this.installJob).run(); verify(this.uninstallJob).initialize(uninstallRequest); verify(this.uninstallJob).run(); assertEquals(1, this.replayJob.getStatus().getCurrentRecordNumber()); verifyNoInteractions(this.execution); assertFalse(installRequest.isStatusLogIsolated()); assertFalse(uninstallRequest.isStatusLogIsolated()); }