示例#1
0
        public virtual void testUpdateXMLMultipart()
        {
            AttachmentCollection multipart = null;
            JDFDoc jDoc = new JDFDoc("JMF");

            MimeUtil.updateXMLMultipart(multipart, jDoc, null);
            string mimeFile = sm_dirTestDataTemp + "testUpdateXML";

            MimeUtil.writeToFile(multipart, mimeFile + "0.mjm", null);
            AttachmentCollection multiparsed = MimeUtil.GetMultiPart(mimeFile + "0.mjm");
            Attachment           bp          = multiparsed[0];

            Assert.IsTrue(bp.ContentId.Length > 5, "cid >cid_");

            JDFDoc jDoc1 = new JDFDoc("JDF");

            jDoc1.setOriginalFileName("jdf1.jdf");

            MimeUtil.updateXMLMultipart(multipart, jDoc1, null);

            MimeUtil.writeToFile(multipart, mimeFile + "1.mjm", null);
            multiparsed = MimeUtil.GetMultiPart(mimeFile + "1.mjm");
            bp          = multiparsed[0];
            Assert.IsTrue(bp.ContentId.Length > 5, "cid >cid_");

            JDFDoc jDoc2 = new JDFDoc("JDF");

            jDoc2.setOriginalFileName("jdf1.jdf");
            jDoc2.getJDFRoot().setDescriptiveName("updated jdf");
            MimeUtil.updateXMLMultipart(multipart, jDoc2, "jdf1.jdf");
            MimeUtil.writeToFile(multipart, mimeFile + "2.mjm", null);

            AttachmentCollection multipart3 = MimeUtil.GetMultiPart(mimeFile + "2.mjm");

            jDoc2.getJDFRoot().setDescriptiveName("3rd jdf");
            MimeUtil.updateXMLMultipart(multipart3, jDoc2, "jdf2.jdf");
            MimeUtil.writeToFile(multipart3, mimeFile + "3.mjm", null);
        }