@Test public void testCreateOuUpdateLiveEventAlreadyPast() throws Exception { URI searchResultURI = LiveScheduleServiceImplTest.class.getResource("/search-result-empty.xml").toURI(); SearchResult searchResult = SearchResultImpl.valueOf(searchResultURI.toURL().openStream()); EasyMock.expect(searchService.getByQuery((SearchQuery) EasyMock.anyObject())).andReturn(searchResult); replayServices(); URI catalogURI = LiveScheduleServiceImplTest.class.getResource("/episode.xml").toURI(); DublinCoreCatalog episodeDC = DublinCores.read(catalogURI.toURL().openStream()); Assert.assertFalse(service.createOrUpdateLiveEvent(MP_ID, episodeDC)); }
@Override public boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC) throws LiveScheduleException { MediaPackage mp = getMediaPackageFromSearch(mpId); if (mp == null) { DCMIPeriod period = EncodingSchemeUtils.decodeMandatoryPeriod(episodeDC.getFirst(DublinCore.PROPERTY_TEMPORAL)); if (period.getEnd().getTime() <= System.currentTimeMillis()) { logger.info("Live media package {} not created in search index because event is already past (end date: {})", mpId, period.getEnd()); return false; } return createLiveEvent(mpId, episodeDC); } else { if (!isLive(mp)) { logger.info("Media package {} is in search index but not live so not updating it.", mpId); return false; } return updateLiveEvent(mp, episodeDC); } }
LiveScheduleServiceImpl implements LiveScheduleService { @Override public boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC) throws LiveScheduleException { MediaPackage mp = getMediaPackageFromSearch(mpId); if (mp == null) { DCMIPeriod period = EncodingSchemeUtils.decodeMandatoryPeriod(episodeDC.getFirst(DublinCore.PROPERTY_TEMPORAL)); if (period.getEnd().getTime() <= System.currentTimeMillis()) { logger.info("Live media package {} not created in search index because event is already past (end date: {})", mpId, period.getEnd()); return false; } return createLiveEvent(mpId, episodeDC); } else { if (!isLive(mp)) { logger.info("Media package {} is in search index but not live so not updating it.", mpId); return false; } return updateLiveEvent(mp, episodeDC); } } }
LiveScheduleServiceImpl implements LiveScheduleService { @Override public boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC) throws LiveScheduleException { MediaPackage mp = getMediaPackageFromSearch(mpId); if (mp == null) { DCMIPeriod period = EncodingSchemeUtils.decodeMandatoryPeriod(episodeDC.getFirst(DublinCore.PROPERTY_TEMPORAL)); if (period.getEnd().getTime() <= System.currentTimeMillis()) { logger.info("Live media package {} not created in search index because event is already past (end date: {})", mpId, period.getEnd()); return false; } return createLiveEvent(mpId, episodeDC); } else { if (!isLive(mp)) { logger.info("Media package {} is in search index but not live so not updating it.", mpId); return false; } return updateLiveEvent(mp, episodeDC); } }  }
LiveScheduleServiceImpl implements LiveScheduleService { @Override public boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC) throws LiveScheduleException { MediaPackage mp = getMediaPackageFromSearch(mpId); if (mp == null) { DCMIPeriod period = EncodingSchemeUtils.decodeMandatoryPeriod(episodeDC.getFirst(DublinCore.PROPERTY_TEMPORAL)); if (period.getEnd().getTime() <= System.currentTimeMillis()) { logger.info("Live media package {} not created in search index because event is already past (end date: {})", mpId, period.getEnd()); return false; } return createLiveEvent(mpId, episodeDC); } else { if (!isLive(mp)) { logger.info("Media package {} is in search index but not live so not updating it.", mpId); return false; } return updateLiveEvent(mp, episodeDC); } }  @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); }
LiveScheduleServiceImpl implements LiveScheduleService { @Override public boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC) throws LiveScheduleException { MediaPackage mp = getMediaPackageFromSearch(mpId); if (mp == null) { DCMIPeriod period = EncodingSchemeUtils.decodeMandatoryPeriod(episodeDC.getFirst(DublinCore.PROPERTY_TEMPORAL)); if (period.getEnd().getTime() <= System.currentTimeMillis()) { logger.info("Live media package {} not created in search index because event is already past (end date: {})", mpId, period.getEnd()); return false; } return createLiveEvent(mpId, episodeDC); } else { if (!isLive(mp)) { logger.info("Media package {} is in search index but not live so not updating it.", mpId); return false; } return updateLiveEvent(mp, episodeDC); } }  @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; }