Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
0
        public virtual void testGetBadJDFInfo()
        {
            JDFDoc       d  = JDFDoc.parseFile(sm_dirTestData + "Device_Elk_ConventionalPrinting2.xml");
            JDFDeviceCap dc = (JDFDeviceCap)d.getRoot().getXPathElement("/JMF/Response/DeviceList/DeviceInfo/Device/DeviceCap");

            Assert.IsNotNull(dc);
            JDFDoc  d2     = JDFDoc.parseFile(sm_dirTestData + "Elk_ConventionalPrinting.jdf");
            JDFNode cpNode = d2.getJDFRoot();

            Assert.IsNotNull(cpNode);
            XMLDoc outDoc = dc.getBadJDFInfo(cpNode, EnumFitsValue.Allowed, EnumValidationLevel.Complete);

            Assert.IsNull(outDoc, "devcaps are consistently evaluated");
        }
Exemplo n.º 3
0
        ///
        ///	 <summary> * Composes a BugReport in XML form for the given JDFNode 'jdfRoot'. Gives a list of error messages for 'jdfRoot'
        ///	 * and every child rejected Node.<br>
        ///	 * Returns <code>null</code> if there are no errors.
        ///	 *  </summary>
        ///	 * <param name="jdfRoot"> the node to test </param>
        ///	 * <param name="testlists"> testlists that are specified for the State elements (FitsValue_Allowed or FitsValue_Present)<br>
        ///	 *            Will be used in fitsValue method of the State class. </param>
        ///	 * <param name="level"> validation level </param>
        ///	 * <returns> XMLDoc - XMLDoc output of the error messages. If XMLDoc is null there are no errors. </returns>
        ///
        public XMLDoc getBadJDFInfo(JDFNode jdfRoot, EnumFitsValue testlists, EnumValidationLevel level)
        {
            VElement vDC = getChildElementVector(ElementName.DEVICECAP, null, null, true, -1, false);

            if (vDC == null || vDC.IsEmpty())
            {
                return(null);
            }

            VElement vn = new VElement();

            for (int i = 0; i < vDC.Count; i++)
            {
                JDFDeviceCap dc        = (JDFDeviceCap)vDC[i];
                XMLDoc       bugReport = dc.getBadJDFInfo(jdfRoot, testlists, level);
                if (bugReport == null)
                {
                    return(null);
                }
                vn.addAll(bugReport.getRoot().getChildElementVector(null, null, null, true, -1, false));
            }

            int vnSize = vn.Count;

            if (vnSize == 0)
            {
                return(null);
            }

            XMLDoc   bugReport2 = new XMLDoc("BugReport", null);
            KElement root       = bugReport2.getRoot();
            bool     bFit       = false;

            for (int i = 0; i < vnSize; i++)
            {
                KElement e = vn[i];
                if (JDFConstants.TRUE.Equals(e.getAttribute(JDFDeviceCap.FITS_TYPE)))
                {
                    bFit = true;
                }
            }
            if (bFit)
            {
                for (int i = 0; i < vnSize; i++)
                {
                    KElement e = vn[i];
                    if (JDFConstants.FALSE.Equals(e.getAttribute(JDFDeviceCap.FITS_TYPE)))
                    {
                        vn[i] = null;
                    }
                }
            }
            for (int i = 0; i < vnSize; i++)
            {
                if (vn[i] != null)
                {
                    root.moveElement(vn.item(i), null);
                }
            }
            return(bugReport2);
        }