LiveScheduleServiceImpl implements LiveScheduleService { void publish(MediaPackage mp) throws LiveScheduleException { try { logger.info("Publishing LIVE media package {} to search index", mp); Job publishJob = searchService.add(mp); if (!waitForStatus(publishJob).isSuccess()) throw new LiveScheduleException("Live media package " + mp.getIdentifier() + " could not be published"); } catch (LiveScheduleException e) { throw e; } catch (Exception e) { throw new LiveScheduleException(e); } }  @Override boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC); @Override boolean deleteLiveEvent(String mpId); @Override boolean updateLiveEventAcl(String mpId, AccessControlList acl); void setDublinCoreService(DublinCoreCatalogService service); void setSearchService(SearchService service); void setSeriesService(SeriesService service); void setServiceRegistry(ServiceRegistry service); void setCaptureAgentService(CaptureAgentStateService service); void setDownloadDistributionService(DownloadDistributionService service); void setWorkspace(Workspace ws); void setAssetManager(AssetManager assetManager); void setAuthorizationService(AuthorizationService service); void setOrganizationService(OrganizationDirectoryService service); static final String CA_PROPERTY_RESOLUTION_URL_PREFIX; static final String REPLACE_ID; static final String REPLACE_FLAVOR; static final String REPLACE_CA_NAME; static final String REPLACE_RESOLUTION; static final String LIVE_STREAMING_URL; static final String LIVE_STREAM_NAME; static final String LIVE_STREAM_MIME_TYPE; static final String LIVE_STREAM_RESOLUTION; static final String LIVE_TARGET_FLAVORS; static final String LIVE_DISTRIBUTION_SERVICE; static final String LIVE_PUBLISH_STREAMING; }
@Test public void testPublish() throws Exception { Job job = createJob(1L, "anything", "anything"); Capture<MediaPackage> capturedMp = Capture.newInstance(); EasyMock.expect(searchService.add(EasyMock.capture(capturedMp))).andReturn(job); EasyMock.expect(serviceRegistry.getJob(1L)).andReturn(job).anyTimes(); replayServices(); MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().createNew(); mp.setIdentifier(new IdImpl(MP_ID)); service.publish(mp); Assert.assertEquals(MP_ID, capturedMp.getValue().getIdentifier().toString()); }