use of org.opencastproject.job.api.Incident in project opencast by opencast.
the class AbstractIncidentService method getLocalization.
@Override
public IncidentL10n getLocalization(long id, Locale locale) throws IncidentServiceException, NotFoundException {
final Incident incident = getIncident(id);
final List<String> loc = localeToList(locale);
// check if cache map is empty
// fill cache from
final String title = findText(loc, incident.getCode(), FIELD_TITLE).getOrElse(NO_TITLE);
final String description = findText(loc, incident.getCode(), FIELD_DESCRIPTION).map(replaceVarsF(incident.getDescriptionParameters())).getOrElse(NO_DESCRIPTION);
return new IncidentL10n() {
@Override
public String getTitle() {
return title;
}
@Override
public String getDescription() {
return description;
}
};
}
use of org.opencastproject.job.api.Incident in project opencast by opencast.
the class OsgiIncidentServiceTest method testRetrieving.
@Test
public void testRetrieving() throws Exception {
// manually create and store a job bypassing the service registry because the JPA implementation of the registry
// is not very test friendly
// Mock up a job
Job job = createNiceMock(Job.class);
expect(job.getId()).andStubReturn(1L);
expect(job.getProcessingHost()).andStubReturn("localhost");
expect(job.getJobType()).andStubReturn("org.opencastproject.service");
expect(job.getCreator()).andStubReturn("creator");
expect(job.getOrganization()).andStubReturn("organization");
replay(job);
jobs.put(job.getId(), job);
incidents.record(job, Incident.Severity.FAILURE, 1511);
// retrieve the job incident
final List<Incident> incidents = incidentService.getIncidentsOfJob(Immutables.list(job.getId()));
assertEquals(1, incidents.size());
assertEquals(Incident.Severity.FAILURE, incidents.get(0).getSeverity());
assertEquals("localhost", incidents.get(0).getProcessingHost());
assertEquals("org.opencastproject.service", incidents.get(0).getServiceType());
assertEquals("org.opencastproject.service.1511", incidents.get(0).getCode());
// todo more tests
}
Aggregations