Exemplo n.º 1
0
        public virtual void testGetJMFSubmission()
        {
            JDFDoc d1 = new JDFDoc("JMF");

            d1.setOriginalFileName("JMF.jmf");
            JDFJMF jmf = d1.getJMFRoot();

            jmf.setDeviceID("gr?n?");
            JDFCommand com = (JDFCommand)jmf.appendMessageElement(JDFMessage.EnumFamily.Command, JDFMessage.EnumType.SubmitQueueEntry);

            com.appendQueueSubmissionParams().setURL("TheJDF");

            JDFDoc doc = new JDFDoc("JDF");

            doc.setOriginalFileName("JDF.jdf");
            JDFNode n = doc.getJDFRoot();

            n.setType(EnumType.ColorSpaceConversion);
            JDFColorSpaceConversionParams cscp = (JDFColorSpaceConversionParams)n.addResource(ElementName.COLORSPACECONVERSIONPARAMS, null, EnumUsage.Input, null, null, null, null);
            JDFFileSpec fs0 = cscp.appendFinalTargetDevice();

            fs0.setURL(StringUtil.uncToUrl(sm_dirTestData + "test.icc", true));
            JDFRunList rl = (JDFRunList)n.addResource(ElementName.RUNLIST, null, EnumUsage.Input, null, null, null, null);

            rl.addPDF(StringUtil.uncToUrl(sm_dirTestData + "url1.pdf", false), 0, -1);
            for (int i = 0; i < 100; i++)
            {
                rl.addPDF("gr?n?" + i + ".pdf", 0, -1);
            }
            AttachmentCollection m = MimeUtil.buildMimePackage(d1, doc, true);

            JDFDoc[] d2 = MimeUtil.GetJMFSubmission(m);
            Assert.IsNotNull(d2);
            Assert.AreEqual("cid:JDF.jdf", d2[0].getJMFRoot().getCommand(0).getQueueSubmissionParams(0).getURL());
            Assert.AreEqual(EnumType.ColorSpaceConversion, d2[1].getJDFRoot().getEnumType());

            // now serialize to file and reread - should still work
            MimeUtil.writeToFile(m, sm_dirTestDataTemp + "test2.mjm", null);
            AttachmentCollection m2 = MimeUtil.GetMultiPart(sm_dirTestDataTemp + "test2.mjm");

            Assert.IsNotNull(m2);
            d2 = MimeUtil.GetJMFSubmission(m);
            Assert.IsNotNull(d2);
            Assert.AreEqual("cid:JDF.jdf", d2[0].getJMFRoot().getCommand(0).getQueueSubmissionParams(0).getURL());
            Assert.AreEqual(EnumType.ColorSpaceConversion, d2[1].getJDFRoot().getEnumType());
        }