use of org.opencastproject.mediapackage.identifier.IdImpl in project opencast by opencast.
the class MediaPackagePostOperationHandlerTest method testHTTPPostXML.
@Test
public void testHTTPPostXML() throws Exception {
// create a dummy mediapackage
MediaPackageBuilderFactory factory = MediaPackageBuilderFactory.newInstance();
MediaPackageBuilder builder = factory.newMediaPackageBuilder();
MediaPackage mp = builder.createNew(new IdImpl("xyz"));
mp.setTitle("test");
mp.addContributor("lkiesow");
mp.addContributor("lkiesow");
/* Sending stuff to port 9 shound never return anything as the Discard
* Protocol uses port 9 */
InstanceAndHandler tuple = createWorkflow("http://127.0.0.1:9", "xml");
MediaPackagePostOperationHandler handler = (MediaPackagePostOperationHandler) tuple.workflowHandler;
tuple.workflowInstance.setMediaPackage(mp);
try {
tuple.workflowHandler.start(tuple.workflowInstance, null);
/* This should raise an exception. Something is wrong if not. */
Assert.fail();
} catch (WorkflowOperationException e) {
logger.info(e.toString());
}
}
use of org.opencastproject.mediapackage.identifier.IdImpl in project opencast by opencast.
the class MediaPackagePostOperationHandlerTest method testHTTPPostJSON.
@Test
public void testHTTPPostJSON() throws Exception {
// create a dummy mediapackage
MediaPackageBuilderFactory factory = MediaPackageBuilderFactory.newInstance();
MediaPackageBuilder builder = factory.newMediaPackageBuilder();
MediaPackage mp = builder.createNew(new IdImpl("xyz"));
mp.setTitle("test");
mp.addContributor("lkiesow");
mp.addContributor("lkiesow");
/* Sending stuff to port 9 shound never return anything as the Discard
* Protocol uses port 9 */
InstanceAndHandler tuple = createWorkflow("http://127.0.0.1:9", "json");
MediaPackagePostOperationHandler handler = (MediaPackagePostOperationHandler) tuple.workflowHandler;
tuple.workflowInstance.setMediaPackage(mp);
try {
tuple.workflowHandler.start(tuple.workflowInstance, null);
/* This should raise an exception. Something is wrong if not. */
Assert.fail();
} catch (WorkflowOperationException e) {
logger.info(e.toString());
}
}
use of org.opencastproject.mediapackage.identifier.IdImpl in project opencast by opencast.
the class ToolsEndpointTest method testAddSmilToArchive.
/**
* Test method for {@link ToolsEndpoint#addSmilToArchive(org.opencastproject.mediapackage.MediaPackage, Smil)}
*/
@Test
public void testAddSmilToArchive() throws Exception {
final String mpId = UUID.randomUUID().toString();
final URI archiveElementURI = new URI("http://host.tld/archive/cut.smil");
final String smilId = "s-afe311c6-9161-41f4-98d0-e951fe66d89e";
Workspace workspace = createNiceMock(Workspace.class);
expect(workspace.put(same(mpId), same(smilId), same("cut.smil"), anyObject(InputStream.class))).andReturn(archiveElementURI);
replay(workspace);
endpoint.setWorkspace(workspace);
AssetManager assetManager = createNiceMock(AssetManager.class);
replay(assetManager);
endpoint.setAssetManager(assetManager);
MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().createNew(new IdImpl(mpId));
endpoint.addSmilToArchive(mp, smil);
assertEquals(1, mp.getCatalogs().length);
assertEquals(smil.getId(), mp.getCatalogs()[0].getIdentifier());
assertEquals("smil/cutting", mp.getCatalogs()[0].getFlavor().toString());
}
use of org.opencastproject.mediapackage.identifier.IdImpl in project opencast by opencast.
the class PublishEngageWorkflowOperationHandlerTest method testDefaultPlayerPath.
@Test
public void testDefaultPlayerPath() throws URISyntaxException {
URI engageURI = new URI("http://engage.org");
String mpId = "mp-id";
MediaPackage mp = EasyMock.createNiceMock(MediaPackage.class);
Id id = new IdImpl(mpId);
EasyMock.expect(mp.getIdentifier()).andStubReturn(id);
MediaPackageElement element = EasyMock.createNiceMock(MediaPackageElement.class);
SecurityService securityService = EasyMock.createNiceMock(SecurityService.class);
EasyMock.expect(securityService.getOrganization()).andReturn(getOrgWithoutPlayerPath()).once();
EasyMock.replay(element, mp, securityService);
// Test default player path
PublishEngageWorkflowOperationHandler publishEngagePublish = new PublishEngageWorkflowOperationHandler();
publishEngagePublish.setSecurityService(securityService);
URI result = publishEngagePublish.createEngageUri(engageURI, mp);
assertEquals(engageURI.toString() + PublishEngageWorkflowOperationHandler.DEFAULT_PLAYER_PATH + "?id=" + mpId, result.toString());
}
use of org.opencastproject.mediapackage.identifier.IdImpl in project opencast by opencast.
the class PublishEngageWorkflowOperationHandlerTest method testPlayerUrl.
@Test
public void testPlayerUrl() throws WorkflowOperationException, URISyntaxException {
URI engageURI = new URI("http://engage.org");
String mpId = "mp-id";
MediaPackage mp = EasyMock.createNiceMock(MediaPackage.class);
Id id = new IdImpl(mpId);
EasyMock.expect(mp.getIdentifier()).andStubReturn(id);
MediaPackageElement element = EasyMock.createNiceMock(MediaPackageElement.class);
SecurityService securityService = EasyMock.createNiceMock(SecurityService.class);
EasyMock.expect(securityService.getOrganization()).andReturn(getOrgWithPlayerPath()).once();
EasyMock.replay(element, mp, securityService);
// Test configured organization player path
PublishEngageWorkflowOperationHandler publishEngagePublish = new PublishEngageWorkflowOperationHandler();
publishEngagePublish.setSecurityService(securityService);
URI result = publishEngagePublish.createEngageUri(engageURI, mp);
assertEquals(engageURI.toString() + examplePlayer + "?id=" + mpId, result.toString());
}
Aggregations