Search in sources :

Example 21 with JobImpl

use of org.opencastproject.job.api.JobImpl in project opencast by opencast.

the class JobTest method testMarshallingWithXmlPayload.

@Test
public void testMarshallingWithXmlPayload() throws Exception {
    final String payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<random xmlns:ns2=\"http://mediapackage.opencastproject.org\" xmlns:ns3=\"http://job.opencastproject.org/\">something</random>";
    Job job = new JobImpl();
    job.setPayload(payload);
    String marshalledJob = JobParser.toXml(new JaxbJob(job));
    Job unmarshalledJob = JobParser.parseJob(marshalledJob);
    assertEquals("xml from unmarshalled job should remain unchanged", StringUtils.trim(payload), StringUtils.trim(unmarshalledJob.getPayload()));
}
Also used : JobImpl(org.opencastproject.job.api.JobImpl) JaxbJob(org.opencastproject.job.api.JaxbJob) Arrays.mkString(org.opencastproject.util.data.Arrays.mkString) JaxbJob(org.opencastproject.job.api.JaxbJob) Job(org.opencastproject.job.api.Job) Test(org.junit.Test)

Aggregations

JobImpl (org.opencastproject.job.api.JobImpl)21 Job (org.opencastproject.job.api.Job)17 Before (org.junit.Before)9 Test (org.junit.Test)9 File (java.io.File)7 ServiceRegistry (org.opencastproject.serviceregistry.api.ServiceRegistry)7 Workspace (org.opencastproject.workspace.api.Workspace)7 ArrayList (java.util.ArrayList)6 MediaPackage (org.opencastproject.mediapackage.MediaPackage)6 URI (java.net.URI)5 DefaultOrganization (org.opencastproject.security.api.DefaultOrganization)5 OrganizationDirectoryService (org.opencastproject.security.api.OrganizationDirectoryService)5 InputStream (java.io.InputStream)4 List (java.util.List)4 SecurityService (org.opencastproject.security.api.SecurityService)4 WorkflowInstanceImpl (org.opencastproject.workflow.api.WorkflowInstanceImpl)4 Date (java.util.Date)3 TrackImpl (org.opencastproject.mediapackage.track.TrackImpl)3 JaxbRole (org.opencastproject.security.api.JaxbRole)3 JaxbUser (org.opencastproject.security.api.JaxbUser)3