Esempio n. 1
0
        public virtual void testRemoveExtensions()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.appendElement("a:b", "a.com");
            n.getAuditPool().appendElement("a:b", "a.com");
            n.getAuditPool().setAttribute("a:b", "c", "a.com");
            Assert.IsTrue(n.ToString().IndexOf("a:") > 0);
            n.removeExtensions();
            Assert.AreEqual(-1, n.ToString().IndexOf("a:"));
        }
Esempio n. 2
0
        private void iterateFirst()
        {
            iterateRead(0);
            JDFPhaseTime pt = iterNode.getAuditPool().setPhase(EnumNodeStatus.InProgress, "First Iteration Ongoing", null, null);

            pt.setStart(new JDFDate(JDFDate.ToMillisecs(DateTime.Now) - 100000));
            pt.setEnd(new JDFDate(JDFDate.ToMillisecs(DateTime.Now)));
            pt.appendEmployee().setPersonalID("Employee 1");
            pt.appendDevice().setDeviceID("Device 1");
            iterRuli.setResStatus(EnumResStatus.Draft, false);
            iterNode.setStatus(EnumNodeStatus.Suspended);
            iterNode.setAttribute("StatusDetails", ITERATION_PAUSED);
            iterDoc.write2File(getIteration(1), 2, false);
        }
Esempio n. 3
0
        public virtual void testAudit()
        {
            JDFAuditPool ap = n.getAuditPool();

            Assert.IsNotNull(ap);
            JDFCreated crea  = (JDFCreated)ap.getAudit(0, EnumAuditType.Created, null, null);
            string     agent = crea.getAgentName();

            Assert.IsNotNull(agent);
            string author = crea.getAuthor();

            Assert.IsNotNull(author);

            n.fixVersion(EnumVersion.Version_1_1);
            author = crea.getAuthor();
            Assert.AreEqual(agent, StringUtil.token(author, 1, "_|_"));
            Assert.IsTrue(author.StartsWith(agent));
            string agent2 = crea.getAgentName();

            Assert.AreEqual("", agent2);

            n.fixVersion(EnumVersion.Version_1_3);
            author = crea.getAuthor();
            Assert.AreEqual(-1, author.IndexOf("_|_"));
            agent2 = crea.getAgentName();
            Assert.AreEqual(agent, agent2);

            n.fixVersion(EnumVersion.Version_1_2);
            author = crea.getAuthor();
            Assert.AreEqual(-1, author.IndexOf("_|_"));
            agent2 = crea.getAgentName();
            Assert.AreEqual(agent, agent2);
        }
Esempio n. 4
0
        public virtual void testGetSettingsPolicy()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            Assert.IsNull(n.getSettingsPolicy(false));
            JDFAuditPool ap = n.getAuditPool();

            Assert.IsNull(ap.getSettingsPolicy(true));
            n.setSettingsPolicy(EnumSettingsPolicy.MustHonor);
            Assert.AreEqual(EnumSettingsPolicy.MustHonor, ap.getSettingsPolicy(true));
        }
Esempio n. 5
0
        public virtual void testDirectProof()
        {
            n.setXMLComment("Example workflow with initioal warmup phase, one direct proof and 100 copies of 10 sheets each.\n" + "The direct proof is acceptable and included in the good output");
            digiParams.setDirectProofAmount(1);
            digiParams.setXMLComment("1 initial proof is requested");
            rlComp.setAmount(100, null);
            JDFAuditPool ap = n.getAuditPool();

            VElement vRL = new VElement();

            vRL.Add(rlComp);
            vRL.Add(rlMedia);

            StatusCounter stCounter = new StatusCounter(n, null, vRL);

            stCounter.setDeviceID("MyDevice");
            string mediaRef = rlMedia.getrRef();

            stCounter.setTrackWaste(mediaRef, true);
            string compRef = rlComp.getrRef();

            stCounter.setTrackWaste(compRef, false);

            doc.write2File(sm_dirTestDataTemp + "DigiPrintAmount_initial.jdf", 2, false);

            stCounter.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null);
            ap.getLastPhase(null, null).setXMLComment("Phase where warm up waste is produced");
            stCounter.addPhase(mediaRef, 0, 2, true);
            stCounter.addPhase(compRef, 0, 20, true);

            stCounter.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null);

            stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
            stCounter.addPhase(mediaRef, 1, 0, true);
            stCounter.addPhase(compRef, 10, 0, true);
            stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
            ap.getLastPhase(null, null).setXMLComment("Phase where 1 proof is produced");

            stCounter.setPhase(EnumNodeStatus.Stopped, "WaitForApproval", EnumDeviceStatus.Stopped, null);
            ap.getLastPhase(null, null).setXMLComment("Phase where the proof is evaluated while the device is stopped");
            stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

            stCounter.addPhase(mediaRef, 99, 0, true);
            stCounter.addPhase(compRef, 990, 0, true);
            stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
            ap.getLastPhase(null, null).setXMLComment("Phase where the 100 copies are produced");

            stCounter.setPhase(EnumNodeStatus.Completed, "Idle", EnumDeviceStatus.Idle, null);
            stCounter.setResourceAudit(mediaRef, EnumReason.ProcessResult);
            doc.write2File(sm_dirTestDataTemp + "DigiPrintProof_final.jdf", 2, false);
        }
Esempio n. 6
0
        public virtual void testFixVersion()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType(EnumType.Bundling);
            JDFProcessRun pr = n.getAuditPool().addProcessRun(EnumNodeStatus.Completed, null, null);

            pr.setAttribute("Duration", "PT90S", null);
            Assert.AreEqual("PT90S", pr.getAttribute("Duration"));
            n.setAttribute("foo3", "a~.doc");
            n.fixVersion(null);
            Assert.AreEqual("PT1M30S", pr.getAttribute("Duration"));
            Assert.AreEqual("a~.doc", n.getAttribute("foo3"));
        }
Esempio n. 7
0
        public virtual void testAudits()
        {
            testPlannedWasteICS();
            VString vs = new VString("Cover Sheet1 Sheet2", " ");

            VElement vRL = new VElement();

            vRL.Add(rlOut);
            vRL.Add(rlMediaIn);

            for (int j = 0; j < 2; j++)
            {
                bool bMinimal = j == 0;

                for (int i = 0; i < vs.Count; i++)
                {
                    string           sheet = vs.stringAt(i);
                    VJDFAttributeMap vmP   = new VJDFAttributeMap();
                    vmP.Add(new JDFAttributeMap(EnumPartIDKey.SheetName, sheet));
                    StatusCounter stUtil = new StatusCounter(n, vmP, vRL);

                    string refComp  = rlOut.getrRef();
                    string refMedia = rlMediaIn.getrRef();

                    stUtil.setTrackWaste(refComp, true);
                    stUtil.setTrackWaste(refMedia, true);

                    if (i == 0)
                    {
                        stUtil.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn");
                    }
                    stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange");
                    stUtil.addPhase(refMedia, 0, 200, true);
                    stUtil.addPhase(refComp, 0, 200, true);
                    stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange");

                    if (i >= 1 && !bMinimal)
                    {
                        JDFResourceAudit ra = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult);

                        stUtil.setResourceAudit(refComp, EnumReason.ProcessResult);

                        stUtil.clearAmounts(refMedia);
                        stUtil.addPhase(refMedia, 50, 0, true);
                        JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput);
                        ra2.setRef(ra);
                        ra2.setDescriptiveName("manual reset to using only 50 sheets because 100 initially were wastes");
                    }
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
                    stUtil.addPhase(refMedia, 4000, 0, true);
                    stUtil.addPhase(refComp, 4000, 0, true);
                    stUtil.setPhase(EnumNodeStatus.Cleanup, "Washup during processing", EnumDeviceStatus.Cleanup, "Washup");
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null);

                    stUtil.addPhase(refMedia, 0, i == 0 ? 40 : 30, true);
                    stUtil.addPhase(refComp, 0, i == 0 ? 40 : 30, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

                    stUtil.addPhase(refMedia, 1000, 0, true);
                    stUtil.addPhase(refComp, 1000, 0, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
                    stUtil.addPhase(refMedia, i == 0 ? 5200 : 5400, 0, true);
                    stUtil.addPhase(refComp, i == 0 ? 5200 : 5400, 0, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

                    JDFResourceAudit ra_1 = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult);

                    if (!bMinimal)
                    {
                        stUtil.setResourceAudit(refComp, EnumReason.ProcessResult);

                        stUtil.clearAmounts(refMedia);
                        // Java to C# Conversion - Don't know the purpose of this unreachable code.  Default to the false value since 1 != 0
                        //stUtil.addPhase(refMedia, 1 == 0 ? 10100 : 10200, 0, true);
                        stUtil.addPhase(refMedia, 10200, 0, true);
                        JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput);
                        ra2.setRef(ra_1);
                        ra2.setDescriptiveName("manual reset to using only 10200 sheets because 100 initially were  wates");
                    }
                    JDFProcessRun pr = stUtil.setProcessResult(EnumNodeStatus.Completed);
                    pr.setDescriptiveName("we even have the utterly useless ProcessRun");
                }
                if (bMinimal)
                {
                    JDFAuditPool ap     = n.getAuditPool();
                    VElement     audits = ap.getAudits(EnumAuditType.PhaseTime, null, null);
                    for (int i = 0; i < audits.Count; i++)
                    {
                        audits.item(i).deleteNode();
                    }
                }
                d.write2File(sm_dirTestDataTemp + "ConvPrintAmount_" + (bMinimal ? "min" : "full") + ".jdf", 2, false);
            }
        }
Esempio n. 8
0
        public virtual void testAutomateLayout_PlateSet()
        {
            for (int loop = 0; loop < 3; loop++)
            {
                n.getAuditPool().appendXMLComment("This is a simple example of an automated layout used for conventional prepress\n" + "The structure is aligned as closely as possible with a static Layout", null);

                JDFRunList run = rl.addRun("file://host/data/test.pdf", 0, -1);
                run.setNPage(128);
                rl.setResStatus(EnumResStatus.Available, true);
                rl.setDescriptiveName("This is a RunList specifiying 128 pages each in a pdf file.");

                lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
                lo.setResStatus(EnumResStatus.Available, true);

                lo.setMaxOrd(4);
                lo.setAutomated(true);
                const string format = "Sheet%02i";
                lo.setAttribute("NameFormat", format);
                lo.setAttribute("NameTemplate", "SheetNum");
                lo.appendXMLComment("Simple automated Layout with exactly one sheet\n", null);
                JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Sheet");
                sheet.setDescriptiveName("two sided 2 up sheet");
                JDFLayout        sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front);
                JDFContentObject co         = sheetFront.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(0);
                co.setDescriptiveName("Front 1st, 5th, 9th... Page");

                co = sheetFront.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(1);
                co.setDescriptiveName("Front 2nd, 6th, 10th... page");

                JDFLayout sheetBack = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Back);
                co = sheetBack.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(2);
                co.setDescriptiveName("Back 3rd, 7th, 11th... Page");

                co = sheetBack.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(3);
                co.setDescriptiveName("Back 4th, 8th, 12th... page");

                JDFRunList rlSheet = (JDFRunList)n.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyOutput, null);
                rlSheet.setDirectory("file://host/out/");
                if (loop == 0) // instantiate individually
                {
                    PrintfFormat fmt = new PrintfFormat(format);
                    for (int i = 0; i < 128; i += 4)
                    {
                        string     sheetName = fmt.tostr(1 + i / 4);
                        JDFRunList rlp       = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.SheetName, sheetName);
                        JDFRunList rlF       = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Front);
                        rlF.appendLayoutElement().setMimeURL(sheetName + "Front.pdf");
                        JDFRunList rlB = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Back);
                        rlB.appendLayoutElement().setMimeURL(sheetName + "Back.pdf");
                    }
                }
                if (loop == 1) // instantiate individually
                {
                    rlSheet.appendLayoutElement().setMimeURL("AllSheets.pdf");
                    PrintfFormat        fmt = new PrintfFormat(format);
                    JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList();
                    for (int i = 0; i < 128; i += 4)
                    {
                        string     sheetName = fmt.tostr(1 + i / 4);
                        JDFRunList rlp       = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.SheetName, sheetName);
                        JDFRunList rlF       = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Front);
                        integerRangeList.Clear();
                        integerRangeList.Append(i / 2);
                        rlF.setPages(integerRangeList);
                        JDFRunList rlB = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Back);
                        integerRangeList.Clear();
                        integerRangeList.Append(1 + i / 2);
                        rlB.setPages(integerRangeList);
                    }
                }
                else
                // instantiate by template
                {
                    JDFFileSpec fs = rlSheet.appendLayoutElement().appendFileSpec();
                    fs.setMimeType("application/pdf");
                    fs.setFileFormat(format + "%s_%s.pdf");
                    fs.setFileTemplate("SheetNum,Surface,Separation");
                }

                doc.write2File(sm_dirTestDataTemp + "AutomatedLayout_Plateset" + loop + ".jdf", 2, false);
                n.getResourceLinkPool().deleteNode();
                n.getResourcePool().deleteNode();
            }
        }