Search in sources :

Example 1 with MediaPackageElementBuilderImpl

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());
}
Also used : MediaPackageElement(org.opencastproject.mediapackage.MediaPackageElement) MediaPackageElementBuilderImpl(org.opencastproject.mediapackage.MediaPackageElementBuilderImpl) Test(org.junit.Test)

Example 2 with MediaPackageElementBuilderImpl

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));
}
Also used : JobUtil.payloadAsMediaPackageElement(org.opencastproject.util.JobUtil.payloadAsMediaPackageElement) MediaPackageElement(org.opencastproject.mediapackage.MediaPackageElement) MediaPackageElementBuilderImpl(org.opencastproject.mediapackage.MediaPackageElementBuilderImpl) JobUtil.waitForJob(org.opencastproject.util.JobUtil.waitForJob) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 MediaPackageElement (org.opencastproject.mediapackage.MediaPackageElement)2 MediaPackageElementBuilderImpl (org.opencastproject.mediapackage.MediaPackageElementBuilderImpl)2 JobUtil.payloadAsMediaPackageElement (org.opencastproject.util.JobUtil.payloadAsMediaPackageElement)1 JobUtil.waitForJob (org.opencastproject.util.JobUtil.waitForJob)1