use of org.opencastproject.search.api.SearchService in project opencast by opencast.
the class LiveScheduleServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
mimeType = MimeTypes.parseMimeType(MIME_TYPE);
// Osgi Services
serviceRegistry = EasyMock.createNiceMock(ServiceRegistry.class);
searchService = EasyMock.createNiceMock(SearchService.class);
seriesService = EasyMock.createNiceMock(SeriesService.class);
captureAgentService = EasyMock.createNiceMock(CaptureAgentStateService.class);
EasyMock.expect(captureAgentService.getAgentCapabilities("demo-capture-agent")).andReturn(new Properties());
downloadDistributionService = EasyMock.createNiceMock(DownloadDistributionService.class);
EasyMock.expect(downloadDistributionService.getDistributionType()).andReturn(LiveScheduleServiceImpl.DEFAULT_LIVE_DISTRIBUTION_SERVICE).anyTimes();
workspace = EasyMock.createNiceMock(Workspace.class);
EasyMock.expect(workspace.put(EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyObject(InputStream.class))).andReturn(new URI("http://someUrl"));
dublinCoreService = EasyMock.createNiceMock(DublinCoreCatalogService.class);
assetManager = EasyMock.createNiceMock(AssetManager.class);
authService = new AuthorizationServiceMock();
organizationService = EasyMock.createNiceMock(OrganizationDirectoryService.class);
Organization defOrg = new DefaultOrganization();
Map<String, String> orgProps = new HashMap<String, String>();
orgProps.put(LiveScheduleServiceImpl.PLAYER_PROPERTY, PATH_TO_PLAYER);
orgProps.put(LiveScheduleServiceImpl.ENGAGE_URL_PROPERTY, ENGAGE_URL);
org = new JaxbOrganization(ORG_ID, "Test Organization", defOrg.getServers(), defOrg.getAdminRole(), defOrg.getAnonymousRole(), orgProps);
EasyMock.expect(organizationService.getOrganization(ORG_ID)).andReturn(org).anyTimes();
// Live service configuration
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(LiveScheduleServiceImpl.LIVE_STREAMING_URL, STREAMING_SERVER_URL);
props.put(LiveScheduleServiceImpl.LIVE_STREAM_MIME_TYPE, "video/x-flv");
props.put(LiveScheduleServiceImpl.LIVE_STREAM_NAME, STREAM_NAME);
props.put(LiveScheduleServiceImpl.LIVE_STREAM_RESOLUTION, "1920x540,960x270");
props.put(LiveScheduleServiceImpl.LIVE_TARGET_FLAVORS, "presenter/delivery");
cc = EasyMock.createNiceMock(ComponentContext.class);
EasyMock.expect(cc.getBundleContext()).andReturn(bc);
EasyMock.expect(cc.getProperties()).andReturn(props);
EasyMock.replay(bc, cc);
service = new LiveScheduleServiceImpl();
service.setJobPollingInterval(1L);
service.setSearchService(searchService);
service.setSeriesService(seriesService);
service.setCaptureAgentService(captureAgentService);
service.setServiceRegistry(serviceRegistry);
service.setWorkspace(workspace);
service.setDublinCoreService(dublinCoreService);
service.setAssetManager(assetManager);
service.setAuthorizationService(authService);
service.setOrganizationService(organizationService);
service.activate(cc);
}
Aggregations