@Test public void testAddLivePublicationChannel() throws Exception { URI mpURI = LiveScheduleServiceImplTest.class.getResource("/assetmanager-mp.xml").toURI(); MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder() .loadFromXml(mpURI.toURL().openStream()); replayServices(); service.addLivePublicationChannel(org, mp, new HashMap<String, Track>()); Publication[] publications = mp.getPublications(); Assert.assertEquals(1, publications.length); Assert.assertEquals(LiveScheduleService.CHANNEL_ID, publications[0].getChannel()); Assert.assertEquals("text/html", publications[0].getMimeType().toString()); Assert.assertEquals(ENGAGE_URL + "/play/" + MP_ID, publications[0].getURI().toString()); }
void addLivePublicationChannel(Organization currentOrg, MediaPackage mp, Map<String, Track> generatedTracks) throws LiveScheduleException { logger.debug("Adding live channel publication element to media package {}", mp); String engageUrlString = null; if (currentOrg != null) { engageUrlString = StringUtils.trimToNull(currentOrg.getProperties().get(ENGAGE_URL_PROPERTY)); } if (engageUrlString == null) { engageUrlString = serverUrl; logger.info( "Using 'server.url' as a fallback for the non-existing organization level key '{}' for the publication url", ENGAGE_URL_PROPERTY); } try { URI engageUri = URIUtils.resolve(new URI(engageUrlString), PLAYER_PATH + mp.getIdentifier().toString()); Publication publicationElement = PublicationImpl.publication(UUID.randomUUID().toString(), CHANNEL_ID, engageUri, MimeTypes.parseMimeType("text/html")); mp.add(publicationElement); createOrUpdatePublicationTracks(publicationElement, generatedTracks); } catch (URISyntaxException e) { throw new LiveScheduleException(e); } }
LiveScheduleServiceImpl implements LiveScheduleService { void addLivePublicationChannel(Organization currentOrg, MediaPackage mp, Map<String, Track> generatedTracks) throws LiveScheduleException { logger.debug("Adding live channel publication element to media package {}", mp); String engageUrlString = null; if (currentOrg != null) { engageUrlString = StringUtils.trimToNull(currentOrg.getProperties().get(ENGAGE_URL_PROPERTY)); } if (engageUrlString == null) { engageUrlString = serverUrl; logger.info( "Using 'server.url' as a fallback for the non-existing organization level key '{}' for the publication url", ENGAGE_URL_PROPERTY); } try { URI engageUri = URIUtils.resolve(new URI(engageUrlString), PLAYER_PATH + mp.getIdentifier().toString()); Publication publicationElement = PublicationImpl.publication(UUID.randomUUID().toString(), CHANNEL_ID, engageUri, MimeTypes.parseMimeType("text/html")); mp.add(publicationElement); createOrUpdatePublicationTracks(publicationElement, generatedTracks); } catch (URISyntaxException e) { throw new LiveScheduleException(e); } } }
LiveScheduleServiceImpl implements LiveScheduleService { void addLivePublicationChannel(Organization currentOrg, MediaPackage mp, Map<String, Track> generatedTracks) throws LiveScheduleException { logger.debug("Adding live channel publication element to media package {}", mp); String engageUrlString = null; if (currentOrg != null) { engageUrlString = StringUtils.trimToNull(currentOrg.getProperties().get(ENGAGE_URL_PROPERTY)); } if (engageUrlString == null) { engageUrlString = serverUrl; logger.info( "Using 'server.url' as a fallback for the non-existing organization level key '{}' for the publication url", ENGAGE_URL_PROPERTY); } try { URI engageUri = URIUtils.resolve(new URI(engageUrlString), PLAYER_PATH + mp.getIdentifier().toString()); Publication publicationElement = PublicationImpl.publication(UUID.randomUUID().toString(), CHANNEL_ID, engageUri, MimeTypes.parseMimeType("text/html")); mp.add(publicationElement); createOrUpdatePublicationTracks(publicationElement, generatedTracks); } catch (URISyntaxException e) { throw new LiveScheduleException(e); } }  }
LiveScheduleServiceImpl implements LiveScheduleService { void addLivePublicationChannel(Organization currentOrg, MediaPackage mp, Map<String, Track> generatedTracks) throws LiveScheduleException { logger.debug("Adding live channel publication element to media package {}", mp); String engageUrlString = null; if (currentOrg != null) { engageUrlString = StringUtils.trimToNull(currentOrg.getProperties().get(ENGAGE_URL_PROPERTY)); } if (engageUrlString == null) { engageUrlString = serverUrl; logger.info( "Using 'server.url' as a fallback for the non-existing organization level key '{}' for the publication url", ENGAGE_URL_PROPERTY); } try { URI engageUri = URIUtils.resolve(new URI(engageUrlString), PLAYER_PATH + mp.getIdentifier().toString()); Publication publicationElement = PublicationImpl.publication(UUID.randomUUID().toString(), CHANNEL_ID, engageUri, MimeTypes.parseMimeType("text/html")); mp.add(publicationElement); createOrUpdatePublicationTracks(publicationElement, generatedTracks); } catch (URISyntaxException 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); }
LiveScheduleServiceImpl implements LiveScheduleService { void addLivePublicationChannel(Organization currentOrg, MediaPackage mp, Map<String, Track> generatedTracks) throws LiveScheduleException { logger.debug("Adding live channel publication element to media package {}", mp); String engageUrlString = null; if (currentOrg != null) { engageUrlString = StringUtils.trimToNull(currentOrg.getProperties().get(ENGAGE_URL_PROPERTY)); } if (engageUrlString == null) { engageUrlString = serverUrl; logger.info( "Using 'server.url' as a fallback for the non-existing organization level key '{}' for the publication url", ENGAGE_URL_PROPERTY); } try { URI engageUri = URIUtils.resolve(new URI(engageUrlString), PLAYER_PATH + mp.getIdentifier().toString()); Publication publicationElement = PublicationImpl.publication(UUID.randomUUID().toString(), CHANNEL_ID, engageUri, MimeTypes.parseMimeType("text/html")); mp.add(publicationElement); createOrUpdatePublicationTracks(publicationElement, generatedTracks); } catch (URISyntaxException 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; }