Exemple #1
0
        public virtual void testResolveRelativeUrls()
        {
            // Build MIME package
            string path   = sm_dirTestData + "MISPrepress-ICS-Complex.jdf";
            JDFDoc jdfDoc = new JDFParser().parseFile(path);

            Assert.IsNotNull(jdfDoc, "Could not parse JDF: " + path);
            AttachmentCollection multipart = MimeUtil.buildMimePackage(null, jdfDoc, true);

            Assert.IsNotNull(multipart, "Could not build multipart");
            // Verify contents
            Assert.AreEqual(3, multipart.Count);
            JDFDoc jdfDoc2 = MimeUtil.getJDFDoc(multipart[0]);

            Assert.IsNotNull(jdfDoc2);
            JDFNode jdf = jdfDoc2.getJDFRoot();

            Assert.IsNotNull(jdf);
            VElement fileSpecs = jdf.getChildrenByTagName(ElementName.FILESPEC, null, new JDFAttributeMap(AttributeName.URL, "*"), false, false, 0);

            Assert.AreEqual(3, fileSpecs.Count);
            for (IEnumerator i = fileSpecs.GetEnumerator(); i.MoveNext();)
            {
                JDFFileSpec fileSpec = (JDFFileSpec)i.Current;
                string      cid      = fileSpec.getURL();
                Assert.IsTrue(cid.StartsWith("cid:"));
                Assert.IsNotNull(MimeUtil.GetPartByCID(multipart, cid));
            }
        }