use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class DefaultDistributionManager method getPreviousFarmJobStatus.
@Override
public DistributionJobStatus getPreviousFarmJobStatus() {
JobStatus jobStatus = this.jobStore.getJobStatus(getFarmJobId());
DistributionJobStatus farmJobStatus;
if (jobStatus != null) {
if (jobStatus instanceof DistributionJobStatus) {
farmJobStatus = (DistributionJobStatus) jobStatus;
} else {
// RETRO-COMPATIBILITY: the status used to be a DistributionJobStatus
farmJobStatus = new DistributionJobStatus(jobStatus, this.observationManagerProvider.get(), this.loggerManagerProvider.get());
}
} else {
farmJobStatus = null;
}
return farmJobStatus;
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class WikiTemplateManagerScriptTest method getWikiProvisioningJobStatusWithBadId.
@Test
public void getWikiProvisioningJobStatusWithBadId() throws Exception {
List<String> jobId = new ArrayList<String>();
JobStatus result = mocker.getComponentUnderTest().getWikiProvisioningJobStatus(jobId);
assertEquals(null, result);
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class WikiTemplateManagerScriptTest method getWikiProvisioningJobStatus.
@Test
public void getWikiProvisioningJobStatus() throws Exception {
WikiProvisioningJob job = mock(WikiProvisioningJob.class);
when(wikiTemplateManager.getWikiProvisioningJob(anyList())).thenReturn(job);
JobStatus status = mock(JobStatus.class);
when(job.getStatus()).thenReturn(status);
List<String> jobId = new ArrayList<String>();
JobStatus result = mocker.getComponentUnderTest().getWikiProvisioningJobStatus(jobId);
assertEquals(status, result);
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class WikiTemplateManagerScriptTest method getWikiProvisioningJobStatusWithException.
@Test
public void getWikiProvisioningJobStatusWithException() throws Exception {
Exception exception = new WikiTemplateManagerException("test");
when(wikiTemplateManager.getWikiProvisioningJob(anyList())).thenThrow(exception);
List<String> jobId = new ArrayList<String>();
JobStatus result = mocker.getComponentUnderTest().getWikiProvisioningJobStatus(jobId);
assertEquals(null, result);
assertEquals(exception, mocker.getComponentUnderTest().getLastError());
verify(mocker.getMockedLogger()).error("Failed to get tge wiki provisioning job.", exception);
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class ExtensionManagerScriptService method getCurrentJobStatus.
/**
* Get the status of the currently executing job, if any.
*
* @return status of the currently executing job, or {@code null} if no job is being executed
*/
public JobStatus getCurrentJobStatus() {
Job job = getCurrentJobInternal();
JobStatus jobStatus;
if (job != null) {
jobStatus = job.getStatus();
if (!this.authorization.hasAccess(Right.PROGRAM)) {
jobStatus = safe(jobStatus);
}
} else {
jobStatus = null;
}
return jobStatus;
}
Aggregations