示例#1
0
        public static void submitMimeToHDM(JDFNode n)
        {
            // build SubmitQueueEntry
            JDFDoc     docJMF = new JDFDoc("JMF");
            JDFJMF     jmf    = docJMF.getJMFRoot();
            JDFCommand com    = (JDFCommand)jmf.appendMessageElement(JDFMessage.EnumFamily.Command, JDFMessage.EnumType.SubmitQueueEntry);

            com.appendQueueSubmissionParams().setURL("dummy");
            System.Net.Mail.AttachmentCollection mp = MimeUtil.buildMimePackage(docJMF, n.getOwnerDocument_JDFElement(), true);

            try
            {
                MIMEDetails md = new MIMEDetails();
                md.transferEncoding      = UrlUtil.BASE64;
                md.httpDetails.chunkSize = -1;
                HttpWebRequest response = MimeUtil.writeToURL(mp, "http://192.168.40.71:8889/jmfportal", md);
                // Java to C# Converstion - What is the ResponseCode for HttpWebRequest?
                //Assert.AreEqual(200, response.GetResponse().getResponseCode());
                MimeUtil.writeToURL(mp, UrlUtil.fileToUrl(new FileInfo("C:\\data\\test.mim"), false), md);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message); // fail on exception
            }
        }
        public virtual void testGetMimeURL()
        {
            JDFDoc d1 = new JDFDoc("JMF");

            d1.setOriginalFileName("JMF.jmf");
            JDFJMF     jmf = d1.getJMFRoot();
            JDFCommand com = (JDFCommand)jmf.appendMessageElement(JDFMessage.EnumFamily.Command, JDFMessage.EnumType.SubmitQueueEntry);

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

            JDFDoc doc = new JDFDoc("JDF");

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

            n.setType(JDFNode.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);
            System.Net.Mail.AttachmentCollection m = MimeUtil.buildMimePackage(d1, doc, true);

            JDFDoc[] d2 = MimeUtil.GetJMFSubmission(m);
            Assert.IsNotNull(d2);
            JDFQueueSubmissionParams queueSubmissionParams = d2[0].getJMFRoot().getCommand(0).getQueueSubmissionParams(0);

            Assert.AreEqual("cid:JDF.jdf", queueSubmissionParams.getURL());
            Assert.AreEqual(JDFNode.EnumType.ColorSpaceConversion, d2[1].getJDFRoot().getEnumType());
            JDFDoc d3 = queueSubmissionParams.getURLDoc();

            Assert.IsNotNull(d3);
            Assert.AreEqual(JDFNode.EnumType.ColorSpaceConversion, d3.getJDFRoot().getEnumType());
        }