use of org.opencastproject.serviceregistry.api.Incidents in project opencast by opencast.
the class OsgiIncidentServiceTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
final EntityManagerFactory emf = PersistenceUtil.newTestEntityManagerFactory(AbstractIncidentService.PERSISTENCE_UNIT_NAME);
penv = PersistenceEnvs.persistenceEnvironment(emf);
// Mock up a job
Job job = createNiceMock(Job.class);
expect(job.getProcessingHost()).andStubReturn(PROCESSING_HOST);
expect(job.getJobType()).andStubReturn(JOB_TYPE);
expect(job.getCreator()).andStubReturn("creator");
expect(job.getOrganization()).andStubReturn("organization");
replay(job);
// Mock up a service registry
final ServiceRegistry serviceRegistry = createNiceMock(ServiceRegistry.class);
expect(serviceRegistry.getJob(EasyMock.anyLong())).andAnswer(new IAnswer<Job>() {
@Override
public Job answer() throws Throwable {
final Long jobId = (Long) EasyMock.getCurrentArguments()[0];
return jobs.get(jobId);
}
}).anyTimes();
replay(serviceRegistry);
// Mock up a workflow service
final WorkflowService workflowService = createNiceMock(WorkflowService.class);
replay(workflowService);
incidentService = new AbstractIncidentService() {
@Override
protected ServiceRegistry getServiceRegistry() {
return serviceRegistry;
}
@Override
protected WorkflowService getWorkflowService() {
return workflowService;
}
@Override
protected PersistenceEnv getPenv() {
return PersistenceEnvs.persistenceEnvironment(emf);
}
};
incidents = new Incidents(serviceRegistry, incidentService);
}
use of org.opencastproject.serviceregistry.api.Incidents in project opencast by opencast.
the class ServiceRegistryJpaImpl method setIncidentService.
/**
* OSGi DI.
*/
public void setIncidentService(IncidentService incidentService) {
// Manually resolve the cyclic dependency between the incident service and the service registry
((OsgiIncidentService) incidentService).setServiceRegistry(this);
this.incidents = new Incidents(this, incidentService);
}
Aggregations