Search in sources :

Example 1 with MediaPackageElementBuilderFactory

use of org.opencastproject.mediapackage.MediaPackageElementBuilderFactory in project opencast by opencast.

the class AttachmentTest method testFromURL.

/**
 * Test method for {@link org.opencastproject.mediapackage.attachment.AttachmentImpl#fromURI(java.net.URI)}.
 */
@Test
public void testFromURL() {
    MediaPackageElementBuilderFactory factory = MediaPackageElementBuilderFactory.newInstance();
    MediaPackageElementBuilder builder = factory.newElementBuilder();
    MediaPackageElement packageElement = null;
    // Create the element
    try {
        packageElement = builder.elementFromURI(coverFile.toURI());
    } catch (UnsupportedElementException e) {
        fail("Attachment is unsupported: " + e.getMessage());
    }
    // Type test
    assertTrue("Type mismatch", packageElement instanceof Attachment);
}
Also used : MediaPackageElementBuilder(org.opencastproject.mediapackage.MediaPackageElementBuilder) UnsupportedElementException(org.opencastproject.mediapackage.UnsupportedElementException) MediaPackageElementBuilderFactory(org.opencastproject.mediapackage.MediaPackageElementBuilderFactory) MediaPackageElement(org.opencastproject.mediapackage.MediaPackageElement) Attachment(org.opencastproject.mediapackage.Attachment) MediaPackageBuilderTest(org.opencastproject.mediapackage.MediaPackageBuilderTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Attachment (org.opencastproject.mediapackage.Attachment)1 MediaPackageBuilderTest (org.opencastproject.mediapackage.MediaPackageBuilderTest)1 MediaPackageElement (org.opencastproject.mediapackage.MediaPackageElement)1 MediaPackageElementBuilder (org.opencastproject.mediapackage.MediaPackageElementBuilder)1 MediaPackageElementBuilderFactory (org.opencastproject.mediapackage.MediaPackageElementBuilderFactory)1 UnsupportedElementException (org.opencastproject.mediapackage.UnsupportedElementException)1