use of org.opencastproject.mediapackage.MediaPackageElementBuilderImpl in project opencast by opencast.
the class AbstractAssetManagerBasicTest method testGetFileNameFromUrn.
@Test
public void testGetFileNameFromUrn() throws Exception {
MediaPackageElement element = new MediaPackageElementBuilderImpl().newElement(Type.Track, MediaPackageElements.PRESENTER_SOURCE);
Opt<String> fileNameFromUrn = AbstractAssetManager.getFileNameFromUrn(element);
assertTrue(fileNameFromUrn.isNone());
element.setURI(URI.create("file://test.txt"));
fileNameFromUrn = AbstractAssetManager.getFileNameFromUrn(element);
assertTrue(fileNameFromUrn.isNone());
element.setURI(URI.create("urn:matterhorn:uuid:22:uuid2:caption-ger.vtt"));
fileNameFromUrn = AbstractAssetManager.getFileNameFromUrn(element);
assertTrue(fileNameFromUrn.isSome());
assertEquals("caption-ger.vtt", fileNameFromUrn.get());
}
use of org.opencastproject.mediapackage.MediaPackageElementBuilderImpl in project opencast by opencast.
the class JobUtilTest method testPayloadAsMediaPackageElement.
@Test
public void testPayloadAsMediaPackageElement() throws Exception {
MediaPackageElement element = new MediaPackageElementBuilderImpl().newElement(Type.Track, MediaPackageElements.PRESENTATION_SOURCE);
JobImpl job = new JobImpl(20);
job.setStatus(Status.FINISHED);
job.setPayload(MediaPackageElementParser.getAsXml(element));
Function<Job, MediaPackageElement> payloadAsMediaPackageElement = payloadAsMediaPackageElement(job, serviceRegistry);
assertEquals(element, payloadAsMediaPackageElement.apply(job));
}
Aggregations