示例#1
0
        public virtual void testValidateCombined()
        {
            JDFDoc       doc      = new JDFDoc("JDF");
            JDFValidator checkJDF = new JDFValidator();

            checkJDF.setPrint(false);
            checkJDF.bQuiet = true;
            JDFNode n = doc.getJDFRoot();

            n.setType(EnumType.Combined);
            int v = 0;

            while (true)
            {
                checkJDF.level = EnumValidationLevel.getEnum(v);
                if (checkJDF.level == null)
                {
                    break;
                }
                for (int i = 0; i < 3; i++)
                {
                    if (i >= 1)
                    {
                        doc = null;
                    }
                    XMLDoc   schemaValidationResult = checkJDF.processSingleDocument(doc);
                    KElement root = schemaValidationResult.getRoot();
                    Assert.IsNotNull(root.getXPathElement("TestFile/SchemaValidationOutput"));
                    Assert.IsNotNull(root.getXPathElement("TestFile/CheckJDFOutput"));
                    Assert.AreEqual(root.getXPathAttribute("TestFile/CheckJDFOutput/@IsValid", "booboo"), "true");
                }
                v++;
            }
        }
示例#2
0
        public virtual void testIsValid()
        {
            JDFDoc  doc = new JDFDoc("JDF");
            JDFNode n   = doc.getJDFRoot();

            n.setType(EnumType.ProcessGroup);
            JDFValidator checkJDF = new JDFValidator();

            checkJDF.setPrint(false);
            checkJDF.bQuiet = true;
            int v = 0;

            while (true)
            {
                checkJDF.level = EnumValidationLevel.getEnum(v);
                if (checkJDF.level == null)
                {
                    break;
                }
                for (int i = 0; i < 3; i++)
                {
                    if (i >= 1)
                    {
                        doc = null;
                    }
                    bool bValid = checkJDF.isValid(doc);
                    Assert.IsTrue(bValid);
                }
                v++;
            }
        }
示例#3
0
        public virtual void testProcessUsage()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType("fnarf", false);

            EnumFitsValue       testlists  = EnumFitsValue.Allowed;
            EnumValidationLevel level      = KElement.EnumValidationLevel.Complete;
            VElement            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);

            Assert.IsNull(vExecNodes, "missing resources");

            JDFLayout lo = (JDFLayout)n.addResource(ElementName.LAYOUT, null, EnumUsage.Input, null, null, null, null);

            lo.appendContentObject().setCTM(new JDFMatrix("1 0 0 1 0 0"));
            lo.appendContentObject().setCTM(new JDFMatrix("1 0 0 1 10 20"));

            JDFRunList rlDoc = (JDFRunList)n.addResource(ElementName.RUNLIST, null, EnumUsage.Input, EnumProcessUsage.Document, null, null, null);

            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "no missing resources");

            n.addResource(ElementName.RUNLIST, null, EnumUsage.Input, EnumProcessUsage.Marks, null, null, null);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "no missing resources");

            JDFResourceLink rl = n.getLink(rlDoc, null);

            rl.setUsage(EnumUsage.Output);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNull(vExecNodes, "no required runlist doc");

            rl.setUsage(EnumUsage.Input);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "no required runlist doc");

            JDFDevCaps   dcsRLDoc = devicecap.getDevCapsByName("RunList", null, null, EnumProcessUsage.Document, 0);
            JDFNameState ns       = dcsRLDoc.getDevCap().appendNameState("RunTag");

            ns.setRequired(true);

            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNull(vExecNodes, "incomplete required runlist doc");

            ns.setRequired(false);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "incomplete required runlist doc");

            JDFDevCaps   dcsRLMarks = devicecap.getDevCapsByName("RunList", null, null, EnumProcessUsage.Marks, 0);
            JDFNameState nsMarks    = dcsRLMarks.getDevCap().appendNameState("PageNames");

            nsMarks.setRequired(true);

            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNull(vExecNodes, "incomplete required runlist marks");
        }
示例#4
0
        public virtual void testGetExecutableJDF()
        {
            string docTest   = "MISPrepress_ICS_Minimal.jdf";
            string docDevCap = "DevCaps_Product_MISPrepress_ICS_Minimal.jdf";

            // parse input file
            JDFParser p         = new JDFParser();
            JDFDoc    jmfDevCap = p.parseFile(sm_dirTestData + docDevCap);
            JDFJMF    jmfRoot   = null;

            Assert.IsNotNull(jmfDevCap, "Parse of file " + docDevCap + " failed");
            jmfRoot = jmfDevCap.getJMFRoot();
            Assert.IsNotNull(jmfRoot, "jmfRoot == null Can't start Test");
            XMLDoc docOutDevCap = jmfRoot.getOwnerDocument_KElement();

            docOutDevCap.write2File(sm_dirTestDataTemp + "_" + docDevCap, 0, true);

            JDFDoc  jdfTest = p.parseFile(sm_dirTestData + docTest);
            JDFNode jdfRoot = jdfTest.getJDFRoot();

            Assert.IsTrue(jdfRoot != null, "jdfRoot is null");

            if (jdfRoot != null)
            {
                jdfRoot.getOwnerDocument_KElement();
                JDFDeviceCap deviceCap = (JDFDeviceCap)jmfRoot.getChildByTagName("DeviceCap", null, 0, null, false, true);

                EnumFitsValue       testlists  = EnumFitsValue.Allowed;
                EnumValidationLevel level      = KElement.EnumValidationLevel.Complete;
                VElement            vExecNodes = deviceCap.getExecutableJDF(jdfRoot, testlists, level);
                if (vExecNodes == null)
                {
                    Console.WriteLine(docDevCap + ": found No matching JDFNode");
                }
                else
                {
                    for (int n = 0; n < vExecNodes.Count; n++)
                    {
                        // XMLDoc docExecNodes = ((JDFNode)
                        // vExecNodes.elementAt(n)).getOwnerDocument_KElement();
                        // docExecNodes.write2File ("temp\\" + "_" + docTest
                        // +"_ExecNode" + (n+1) +
                        // ".jdf", 0);
                        Console.WriteLine(vExecNodes[n]);
                    }
                }

                XMLDoc testResult = deviceCap.getBadJDFInfo(jdfRoot, testlists, level);
                if (testResult != null)
                {
                    testResult.write2File(sm_dirTestDataTemp + "_BugReport.xml", 0, true);
                }
            }
        }
示例#5
0
        private void processSingleFile(string fileName, bool bShouldValidate, EnumValidationLevel level)
        {
            JDFValidator checkJDF = new JDFValidator();

            checkJDF.setPrint(false);
            checkJDF.bQuiet = true;
            checkJDF.level  = level != null ? level : EnumValidationLevel.Complete;
            XMLDoc   schemaValidationResult = checkJDF.processSingleFile(fileName);
            KElement root = schemaValidationResult.getRoot();

            Assert.IsNotNull(root.getXPathElement("TestFile/SchemaValidationOutput"));
            Assert.IsNotNull(root.getXPathElement("TestFile/CheckJDFOutput"));

            checkJDF = new JDFValidator();
            checkJDF.setPrint(false);
            checkJDF.bQuiet = true;
            checkJDF.level  = EnumValidationLevel.Complete;
            checkJDF.processSingleFile(fileName);
            Assert.IsNotNull(root);

            if (bShouldValidate)
            {
                Assert.AreEqual(root.getXPathAttribute("TestFile/CheckJDFOutput/@IsValid", ""), "true", fileName + " should validate");
            }
            else
            {
                Assert.AreEqual(root.getXPathAttribute("TestFile/CheckJDFOutput/@IsValid", ""), "false", fileName + " should not validate");
            }

            // now repeat including schema
            checkJDF.setJDFSchemaLocation(new FileInfo(sm_dirTestSchema + "JDF.xsd"));
            checkJDF.processSingleDocument(null);
            Assert.IsNotNull(root);

            if (bShouldValidate)
            {
                Assert.AreEqual(root.getXPathAttribute("TestFile/CheckJDFOutput/@IsValid", ""), "true");
            }
            else
            {
                Assert.AreEqual(root.getXPathAttribute("TestFile/CheckJDFOutput/@IsValid", ""), "false");
            }
        }