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); }
public virtual void testAddPhaseTime() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFAuditPool ap = n.getCreateAuditPool(); JDFProcessRun pr = ap.addProcessRun(EnumNodeStatus.Completed, null, null); JDFPhaseTime pt0 = null; for (int i = 0; i < 10; i++) { JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); if (i == 0) { pt0 = pt; } JDFDate start = new JDFDate(); start.TimeInMillis = start.TimeInMillis + i * 1000 * 1000; pt.setStart(start); JDFDate end = new JDFDate(); end.TimeInMillis = end.TimeInMillis + 100 * 1000 + i * 1000 * 1000; pt.setEnd(end); Assert.AreEqual(100, pt.getDuration().Duration, 1.0); pr.addPhase(pt); Assert.AreEqual((i + 1) * 100, pr.getDuration().Duration, 1.0); if (pt0 != null) { Assert.AreEqual(pr.getStart(), pt0.getStart()); } Assert.AreEqual(pr.getEnd(), pt.getEnd()); } }
public virtual void testMergeLastPhase() { JDFDoc d = new JDFDoc("JDF"); JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool(); JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null); JDFJobPhase jp = di.createJobPhaseFromPhaseTime(pt); jp.setPhaseAmount(200); jp.setAmount(200); jp.setPhaseWaste(100); JDFDate d1 = jp.getPhaseStartTime(); JDFDoc doc = new JDFDoc(ElementName.DEVICEINFO); JDFDeviceInfo di2 = (JDFDeviceInfo)doc.getRoot(); JDFJobPhase jp2 = (JDFJobPhase)di2.copyElement(jp, null); jp2.setPhaseStartTime(new JDFDate()); StatusCounter.sleep(1000); jp2.setPhaseAmount(300); jp2.setPhaseWaste(30); jp2.setAmount(500); Assert.IsTrue(di2.mergeLastPhase(di)); Assert.AreEqual(d1, jp2.getPhaseStartTime()); Assert.AreEqual(130.0, jp2.getPhaseWaste(), 0.0); Assert.AreEqual(500.0, jp2.getPhaseAmount(), 0.0); Assert.AreEqual(500.0, jp2.getAmount(), 0.0); }
/// /// <summary> * </summary> /// public virtual JDFProcessRun setProcessResult(EnumNodeStatus endStatus) { JDFAuditPool ap = m_Node.getCreateAuditPool(); JDFProcessRun pr = ap.addProcessRun(endStatus, null, m_vPartMap); return(pr); }
/// /// <summary> * </summary> /// public virtual void initAuditPool(JDFNode node) { JDFAuditPool auditPool = node.getCreateAuditPool(); JDFAudit a = auditPool.getAudit(-1, EnumAuditType.Created, null, null); if (a == null) { a = auditPool.addAudit(EnumAuditType.Created, null); } }
public virtual void testGetPhaseWaste() { JDFDoc d = new JDFDoc("JDF"); JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool(); JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null); JDFJobPhase jp = di.createJobPhaseFromPhaseTime(pt); jp.setWaste(42); Assert.AreEqual(42.0, jp.getPhaseWaste(), 0.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)); }
/// /// <summary> * overwrite this method in case you want to customize the hotfolder for submitqueentry and paramtetrizing /// * the QueueSubmissionParams template is insufficient /// * </summary> /// * <param name="stringURL"> the file url of the hotfolder jdf in the local storage directory (NOT the hf) </param> /// * <param name="newCommand"> the command that was generated from the template </param> /// * <param name="jdfRoot"> the root jdfnode of the dropped file </param> /// protected internal virtual void extractSubmitParams(string stringURL, JDFCommand newCommand, JDFNode jdfRoot) { JDFQueueSubmissionParams sqp = newCommand.getCreateQueueSubmissionParams(0); sqp.setURL(stringURL); JDFAuditPool ap = jdfRoot == null ? null : jdfRoot.getCreateAuditPool(); if (ap != null) { ap.createSubmitProcessRun(null); } }
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); }
public virtual void testModuleIDs() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFAuditPool ap = n.getCreateAuditPool(); JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); pt.setModules(new VString("m1 m2", " "), new VString("RIP Press", " ")); Assert.AreEqual(2, pt.numChildElements(ElementName.MODULEPHASE, null)); Assert.AreEqual("m1", pt.getModulePhase(0).getModuleID()); Assert.AreEqual("m2", pt.getModulePhase(1).getModuleID()); Assert.AreEqual("Press", pt.getModulePhase(1).getModuleType()); // Assert.IsTrue(pt.isValid(EnumValidationLevel.Complete)); }
public virtual void testGetDuration() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFAuditPool ap = n.getCreateAuditPool(); JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); pt.setStart(new JDFDate()); JDFDate end = new JDFDate(); end.TimeInMillis = end.TimeInMillis + 100 * 1000; pt.setEnd(end); Assert.AreEqual(100.0, pt.getDuration().Duration, 1.0); }
public virtual void testGetAmountDifference() { JDFDoc d = new JDFDoc("JDF"); JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool(); JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null); JDFJobPhase jp = di.createJobPhaseFromPhaseTime(pt); jp.setAmount(42); Assert.AreEqual(42.0, jp.getAmountDifference(null), 0.0); JDFJobPhase jp2 = (JDFJobPhase)di.copyElement(jp, null); jp2.setAmount(62); Assert.AreEqual(20.0, jp2.getAmountDifference(jp), 0.0); }
public virtual void testGetDuration() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFAuditPool ap = n.getCreateAuditPool(); JDFProcessRun pt = ap.addProcessRun(EnumNodeStatus.Completed, null, null); pt.setStart(new JDFDate()); JDFDate end = new JDFDate(); end.TimeInMillis = end.TimeInMillis + 100 * 1000; pt.setEnd(end); Assert.AreEqual(100.0, pt.getDuration().Duration, 1.0); pt.setDurationSeconds(50); Assert.AreEqual(50.0, pt.getDuration().Duration, 1.0); }
/// /// * <param name="bag"> </param> /// * <returns> JDFResourceAudit the generated audit </returns> /// public virtual JDFResourceAudit setResourceAudit(AmountBag bag, EnumReason reason) { JDFAuditPool ap = m_Node.getCreateAuditPool(); JDFResourceAudit ra = ap.addResourceAudit(null); ra.setContentsModified(false); ra.setReason(reason); LinkAmount la = getLinkAmount(bag.refID); ra.copyElement(la.getResourceAuditLink(bag), null); ra.setPartMapVector(m_vPartMap); return(ra); }
public virtual void testJobPhaseFromPhaseTime() { JDFDoc d = new JDFDoc("JDF"); JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool(); JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null); JDFJobPhase jp = di.createJobPhaseFromPhaseTime(pt); Assert.IsFalse(pt.hasChildElement(ElementName.MISDETAILS, null)); JDFMISDetails misDetails = pt.appendMISDetails(); misDetails.setWorkTypeDetails("FooBar"); misDetails.setWorkType(EnumWorkType.Alteration); jp = di.createJobPhaseFromPhaseTime(pt); Assert.AreEqual(pt.getMISDetails().getWorkType(), jp.getMISDetails().getWorkType()); Assert.IsTrue(jp.hasAttribute(AttributeName.PHASESTARTTIME)); }
/// /// <summary> * overwrite this method in case you want to customize the hotfolder for returnqueueentryparams and paramtetrizing /// * the ReturnQueueEntryParams template is insufficient /// * </summary> /// * <param name="stringURL"> the file url of the hotfolder jdf in the local storage directory (NOT the hf) </param> /// * <param name="newCommand"> the command that was generated from the template </param> /// * <param name="jdfRoot"> the root jdfnode of the dropped file </param> /// protected internal virtual void extractReturnParams(string stringURL, JDFCommand newCommand, JDFNode jdfRoot) { JDFReturnQueueEntryParams rqp = newCommand.getCreateReturnQueueEntryParams(0); rqp.setURL(stringURL); JDFAuditPool ap = jdfRoot == null ? null : jdfRoot.getCreateAuditPool(); if (ap != null) { JDFProcessRun pr = (JDFProcessRun)ap.getAudit(-1, EnumAuditType.ProcessRun, null, null); string queueEID = pr == null ? null : pr.getAttribute(AttributeName.QUEUEENTRYID); if (!KElement.isWildCard(queueEID)) { rqp.setQueueEntryID(queueEID); } } }
/// /// <summary> * create an update audit for this /// * /// * @return </summary> /// public virtual JDFAudit createUpdateAudit() { JDFAuditPool pool = getAuditPool(); if (pool == null) { return(null); } JDFAudit copy = (JDFAudit)pool.copyElement(this, null); copy.removeAttribute(AttributeName.ID); copy.removeAttribute(AttributeName.AGENTNAME); copy.removeAttribute(AttributeName.AGENTVERSION); copy.init(); copy.setRef(this); return(copy); }
public virtual void testGetParentJDFNode() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType("ProcessGroup", true); JDFNode n2 = n.addJDFNode("Scanning"); Assert.AreEqual(n, n2.getParentJDF(), "n2.parent n"); Assert.IsNull(n.getParentJDF(), "n parent"); JDFAuditPool ap = n.getCreateAuditPool(); Assert.AreEqual(n, ap.getParentJDF(), "ap.parent n"); ap = n2.getCreateAuditPool(); Assert.AreEqual(n2, ap.getParentJDF(), "ap.parent n2"); Assert.AreEqual(n2, ap.addCreated("me", n2).getParentJDF(), "a.parent n2"); }
public virtual void testGetLink() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFResource r = n.addResource("www.foo", EnumResourceClass.Parameter, EnumUsage.Input, null, null, "www.www.com", null); JDFResourceLink rl = n.getLink(r, null); VElement vRL = new VElement(); vRL.Add(rl); JDFAuditPool ap = n.getCreateAuditPool(); JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); pt.appendComment().setText("foo"); pt.setLinks(vRL); pt.setStart(new JDFDate()); Assert.AreEqual(rl.ToString(), pt.getLink(0).ToString()); }
public virtual void testModulesUpdate() { JDFAuditPool ap = n.getCreateAuditPool(); ap.appendXMLComment("JDF 1.3 compatible auditing of module phases with updates", null); JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.Setup, null, null); JDFPhaseTime pt2 = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); JDFPhaseTime pt3 = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); JDFDate date = new JDFDate(); JDFModulePhase mpRIP = pt.appendModulePhase(); mpRIP.setModuleType("Imaging"); JDFModulePhase mpJob = pt.appendModulePhase(); mpJob.setModuleType("Manual"); mpJob.setStatus(EnumNodeStatus.InProgress); JDFModulePhase mpPrint = pt.appendModulePhase(); mpPrint.setModuleType("Printing"); mpRIP.setStatus(EnumNodeStatus.InProgress); pt.setStart(date); mpRIP.setStart(date); date.addOffset(0, 5, 0, 0); pt.setEnd(date); pt2.copyElement(mpRIP, null); pt2.copyElement(mpJob, null); pt2.copyElement(mpPrint, null); mpPrint.setStatus(EnumNodeStatus.InProgress); pt2.setStart(date); mpPrint.setStart(date); date.addOffset(0, 30, 0, 0); mpRIP.setEnd(date); date.addOffset(0, 70, 0, 0); pt2.setEnd(date); mpPrint.setEnd(date); pt3.copyElement(mpRIP, null); pt3.copyElement(mpJob, null); pt3.copyElement(mpPrint, null); doc.write2File(sm_dirTestDataTemp + "DigiPrintModuleUpdate.jdf", 2, false); }
public virtual void testInit() { JDFDoc doc = new JDFDoc(ElementName.JDF); JDFNode root = doc.getJDFRoot(); JDFComment cRoot = root.appendComment(); Assert.IsNotNull(cRoot.getAttribute(AttributeName.ID, null, null)); Assert.IsTrue(cRoot.isValid(EnumValidationLevel.Complete)); root.setVersion(JDFElement.EnumVersion.Version_1_2); JDFAuditPool ap = root.getCreateAuditPool(); JDFNotification notif = ap.addNotification(JDFNotification.EnumClass.Information, "Me", null); JDFComment c = notif.appendComment(); c.setText("This element should have no ID attribute"); string id = c.getAttribute(AttributeName.ID, null, null); Assert.IsNull(id); }
public virtual void testModules() { JDFAuditPool ap = n.getCreateAuditPool(); ap.appendXMLComment("JDF 1.3 compatible auditing of module phases - note that modulephase start and end times are set outside of the phasetime start and end times", null); JDFPhaseTime pt = ap.addPhaseTime(EnumNodeStatus.Setup, null, null); JDFPhaseTime pt2 = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); JDFDate date = new JDFDate(); JDFModulePhase mpRIP = pt.appendModulePhase(); JDFModulePhase mpRIP2 = pt2.appendModulePhase(); mpRIP.setStatus(EnumNodeStatus.InProgress); mpRIP2.setStatus(EnumNodeStatus.InProgress); mpRIP2.setDescriptiveName("This ModulePhase is actually the same as the initial ModulePhase in the setup PhaseTime"); mpRIP.setModuleType("Imaging"); mpRIP2.setModuleType("Imaging"); pt.setStart(date); mpRIP.setStart(date); mpRIP2.setStart(date); date.addOffset(0, 5, 0, 0); pt.setEnd(date); JDFModulePhase mpPrint = pt2.appendModulePhase(); mpPrint.setStatus(EnumNodeStatus.InProgress); pt2.setStart(date); mpPrint.setStart(date); date.addOffset(0, 30, 0, 0); mpRIP.setEnd(date); mpRIP2.setEnd(date); date.addOffset(0, 70, 0, 0); pt2.setEnd(date); mpPrint.setEnd(date); mpPrint.setModuleType("Printer"); doc.write2File(sm_dirTestDataTemp + "DigiPrintModule1.jdf", 2, false); }
/// /// <summary> * Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate /// * also prepare a status JMF /// * </summary> /// * <param name="nodeStatus"> the new status of the node </param> /// * <param name="nodeStatusDetails"> the new statusDetails of the node </param> /// * <param name="deviceStatus"> the new status of the device </param> /// * <param name="deviceStatusDetails"> the new statusDetails of the device </param> /// * <param name="vPartMap"> the vector of parts to that should be set </param> /// * <param name="vResLink"> the resourcelinks that are used to fill the various amount attributes in jobphase and phasetime /// * </param> /// public virtual void setPhase(EnumNodeStatus nodeStatus, string nodeStatusDetails, EnumDeviceStatus deviceStatus, string deviceStatusDetails, AmountBag[] amounts) { docJMFPhaseTime = new JDFDoc(ElementName.JMF); JDFJMF jmf = docJMFPhaseTime.getJMFRoot(); docJMFResource = new JDFDoc(ElementName.JMF); JDFJMF jmfRes = docJMFResource.getJMFRoot(); AmountBag ab = getBag(getFirstRefID(), amounts); LinkAmount la = getLinkAmount(getFirstRefID()); AmountBag lastAb = la == null ? null : la.lastBag; JDFAuditPool ap = m_Node.getCreateAuditPool(); // TODO rethink when to send 2 phases JDFPhaseTime pt1 = ap.getLastPhase(m_vPartMap, null); JDFPhaseTime pt2 = pt1; bool bEnd = nodeStatus.Equals(EnumNodeStatus.Completed) || nodeStatus.Equals(EnumNodeStatus.Aborted); pt2 = ap.setPhase(nodeStatus, nodeStatusDetails, m_vPartMap, null); if (bEnd) { JDFProcessRun pr = (JDFProcessRun)ap.addAudit(EnumAuditType.ProcessRun, null); pr.setPartMapVector(m_vPartMap); VElement audits = ap.getAudits(EnumAuditType.PhaseTime, null, m_vPartMap); for (int i = 0; i < audits.Count; i++) { pr.addPhase((JDFPhaseTime)audits[i]); } pr.setEndStatus(nodeStatus); } if (pt1 != null && pt2 != pt1) // we explicitly added a new phasetime // audit, thus we need to add a closing // JMF for the original jobPhase { JDFSignal s = (JDFSignal)jmf.appendMessageElement(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Status); JDFDeviceInfo deviceInfo = s.appendDeviceInfo(); JDFJobPhase jp = deviceInfo.createJobPhaseFromPhaseTime(pt1); jp.setJobID(m_Node.getJobID(true)); jp.setJobPartID(m_Node.getJobPartID(false)); setJobPhaseAmounts(lastAb, jp); if (m_deviceID != null) { deviceInfo.setDeviceID(m_deviceID); } } if (pt2 != null) { JDFSignal s = (JDFSignal)jmf.appendMessageElement(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Status); JDFDeviceInfo deviceInfo = s.appendDeviceInfo(); if (!bEnd) // don't write a jobphase for an idle device { JDFJobPhase jp = deviceInfo.createJobPhaseFromPhaseTime(pt2); setJobPhaseAmounts(ab, jp); } deviceInfo.setDeviceStatus(deviceStatus); deviceInfo.setStatusDetails(deviceStatusDetails); deviceInfo.setDeviceID(m_deviceID); m_Node.setPartStatus(m_vPartMap, nodeStatus, null); getVResLink(amounts, 2); // update the nodes links generateResourceSignal(amounts, jmfRes); if (bEnd) { pt2.deleteNode(); // zapp the last phasetime } else { pt2.setLinks(getVResLink(amounts, 1)); pt2.eraseEmptyAttributes(true); } } // cleanup! if (vLinkAmount != null) { for (int i = 0; i < vLinkAmount.Length; i++) { string refID = vLinkAmount[i].rl.getrRef(); AmountBag bag = getBag(refID, amounts); vLinkAmount[i].lastBag = new AmountBag(bag); } } jmf.eraseEmptyAttributes(true); }
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); } }
public void testUsageCounter() { JDFElement.setLongID(false); JDFDoc doc = new JDFDoc("JDF"); JDFNode root = doc.getJDFRoot(); root.setType(EnumType.DigitalPrinting); JDFUsageCounter uc = (JDFUsageCounter)root.appendMatchingResource( ElementName.USAGECOUNTER, EnumProcessUsage.AnyInput, null); Assert.IsTrue(uc.isValid(EnumValidationLevel.Incomplete)); Assert.IsFalse(uc.isValid(EnumValidationLevel.Complete)); uc.setCounterID("c1"); uc.setScope(EnumScope.Job); uc.setCounterTypes(new VString( "NormalSize Black OneSided TwoSided Impressions", " ")); Assert.IsTrue(uc.isValid(EnumValidationLevel.Complete)); Assert.AreEqual(StringUtil.setvString(uc.getEnumCounterTypes()), StringUtil.setvString(uc.getCounterTypes())); JDFResourceLink rl = root.getLink(uc, null); rl.setActualAmount(10, null); JDFAuditPool ap = root.getCreateAuditPool(); JDFResourceAudit ra = (JDFResourceAudit)ap.addAudit( EnumAuditType.ResourceAudit, null); ra.updateLink(rl); JDFUsageCounter uc2 = (JDFUsageCounter)root.appendMatchingResource( ElementName.USAGECOUNTER, EnumProcessUsage.AnyInput, null); uc2.setCounterID("c2"); uc2.setScope(EnumScope.Job); uc2.setCounterTypes(new VString( "NormalSize Color OneSided TwoSided Impressions", " ")); Assert.IsTrue(uc2.isValid(EnumValidationLevel.Complete)); Assert.AreEqual(StringUtil.setvString(uc2.getEnumCounterTypes()), StringUtil.setvString(uc2.getCounterTypes())); rl = root.getLink(uc2, null); rl.setActualAmount(20, null); ra = (JDFResourceAudit)ap.addAudit(EnumAuditType.ResourceAudit, null); ra.updateLink(rl); JDFUsageCounter uc3 = (JDFUsageCounter)root.appendMatchingResource( ElementName.USAGECOUNTER, EnumProcessUsage.AnyInput, null); uc3.setCounterID("c3"); uc3.setScope(EnumScope.Job); uc3.setCounterTypes(new VString( "LargeSize Black OneSided TwoSided Impressions", " ")); Assert.IsTrue(uc3.isValid(EnumValidationLevel.Complete)); Assert.AreEqual(StringUtil.setvString(uc3.getEnumCounterTypes()), StringUtil.setvString(uc3.getCounterTypes())); rl = root.getLink(uc3, null); rl.setActualAmount(30, null); ra = (JDFResourceAudit)ap.addAudit(EnumAuditType.ResourceAudit, null); ra.updateLink(rl); JDFUsageCounter uc4 = (JDFUsageCounter)root.appendMatchingResource( ElementName.USAGECOUNTER, EnumProcessUsage.AnyInput, null); uc4.setCounterID("c4"); uc4.setScope(EnumScope.Job); uc4.setCounterTypes(new VString( "LargeSize Color OneSided TwoSided Impressions", " ")); Assert.IsTrue(uc4.isValid(EnumValidationLevel.Complete)); Assert.AreEqual(StringUtil.setvString(uc4.getEnumCounterTypes()), StringUtil.setvString(uc4.getCounterTypes())); rl = root.getLink(uc4, null); rl.setActualAmount(40, null); ra = (JDFResourceAudit)ap.addAudit(EnumAuditType.ResourceAudit, null); ra.updateLink(rl); Assert.IsTrue(root.isValid(EnumValidationLevel.Incomplete)); doc.write2File(sm_dirTestDataTemp + "UCList.jdf", 2, false); }
public virtual void testStatusEquals() { // test if the auto classes implement the correct status // compare EnumNodeStatus JDFAuditPool myAuditPool = null; JDFDoc jdfDoc = new JDFDoc(ElementName.JDF); JDFNode jdfRoot = (JDFNode)jdfDoc.getRoot(); Assert.IsTrue(jdfRoot != null, "No Root found"); if (jdfRoot == null) { return; // soothe findbugs ;) } JDFAncestor ancestor = jdfRoot.appendAncestorPool().appendAncestor(); ancestor.setStatus(EnumNodeStatus.Completed); myAuditPool = jdfRoot.getCreateAuditPool(); JDFPhaseTime phaseTime = myAuditPool.addPhaseTime(JDFElement.EnumNodeStatus.Completed, null, null); JDFSpawned spawned = myAuditPool.addSpawned(jdfRoot, null, null, null, null); spawned.setStatus(JDFElement.EnumNodeStatus.Completed); Assert.AreEqual(spawned.getStatus(), phaseTime.getStatus()); Assert.AreEqual(spawned.getStatus(), ancestor.getStatus()); JDFDoc jmfDoc = new JDFDoc(ElementName.JMF); JDFJMF jmfRoot = jmfDoc.getJMFRoot(); Assert.IsTrue(jmfRoot != null, "No Root found"); if (jmfRoot == null) { return; // soothe findbugs ;) } JDFAcknowledge acknowledge = jmfRoot.appendAcknowledge(); acknowledge.setType("PipePush"); // Type is required and its existance // is validated for messages JDFJobPhase jobPhase = acknowledge.appendJobPhase(); jobPhase.setStatus(EnumNodeStatus.Completed); JDFMessage message = jmfRoot.appendMessageElement(EnumFamily.Command, null); message.setType("PipePush"); // Type is required and its existance is // validated for messages JDFPipeParams pipeParams = message.appendPipeParams(); pipeParams.setStatus(EnumNodeStatus.Completed); Assert.AreEqual(jobPhase.getStatus(), pipeParams.getStatus()); Assert.AreEqual(spawned.getStatus(), pipeParams.getStatus()); // compare EnumResStatus JDFDoc responseDoc = new JDFDoc(ElementName.RESPONSE); JDFResponse responseRoot = (JDFResponse)responseDoc.getRoot(); Assert.IsTrue(responseRoot != null, "No Root found"); if (responseRoot == null) { return; // soothe findbugs ;) } responseRoot.setType(ElementName.RESOURCE); JDFResourceInfo resInfo = responseRoot.appendResourceInfo(); resInfo.setResStatus(EnumResStatus.Available); JDFDoc commandDoc = new JDFDoc(ElementName.COMMAND); JDFCommand commandRoot = (JDFCommand)commandDoc.getRoot(); Assert.IsTrue(commandRoot != null, "No Root found"); if (commandRoot == null) { return; // soothe findbugs ;) } commandRoot.setType(ElementName.RESOURCE); JDFResourceCmdParams resCmdParams = commandRoot.appendResourceCmdParams(); resCmdParams.setResStatus(EnumResStatus.Available); Assert.AreEqual(resInfo.getStatus(), resCmdParams.getStatus()); // check EnumQueueStatus JDFDoc queueDoc = new JDFDoc(ElementName.QUEUE); JDFQueue queueRoot = (JDFQueue)queueDoc.getRoot(); Assert.IsTrue(queueRoot != null, "No Root found"); if (queueRoot == null) { return; // soothe findbugs ;) } queueRoot.setQueueStatus(EnumQueueStatus.Running); // check EnumQueueEntryStatus JDFQueueEntry queueEntry = queueRoot.appendQueueEntry(); queueEntry.setQueueEntryStatus(EnumQueueEntryStatus.Running); }
public virtual void testModules14() { VString v = new VString("orig fullList end", null); for (int i = 0; i < v.Count; i++) { reSetUp(); string testType = v.stringAt(i); JDFAuditPool ap = n.getCreateAuditPool(); ap.appendXMLComment("JDF 1.3 incompatible auditing of module phases the REQUIRED time attributes are not set in the ModulePhase elements\n" + "- note that phases may now arbitrarily overlap\n" + "The modulePhase elements now only specify which modules are involved, times are all defined by the phasetime proper", null); ap.appendXMLComment("The following phaseTime is executed by one module - the RIP,which executes two process steps (Interpreting and Rendering)", null); JDFPhaseTime ptRIP = ap.addPhaseTime(EnumNodeStatus.Setup, null, null); JDFDate date = new JDFDate(); ptRIP.setStart(date); JDFDoc jmfDoc = new JDFDoc("JMF"); JDFJMF jmf = jmfDoc.getJMFRoot(); jmf.setDescriptiveName("Initial phase when the RIP starts up"); JDFSignal signal = jmf.appendSignal(JDFMessage.EnumType.Status); JDFDeviceInfo di = signal.appendDeviceInfo(); JDFJobPhase jpRIP = di.appendJobPhase(); di.setDeviceStatus(EnumDeviceStatus.Setup); jpRIP.setStartTime(date); jpRIP.setStatus(EnumNodeStatus.Setup); jpRIP.setJobID(n.getJobID(true)); jpRIP.setJobPartID(n.getJobPartID(true)); JDFModuleStatus msRIP = jpRIP.appendModuleStatus(); msRIP.setCombinedProcessIndex(new JDFIntegerList("0 1")); msRIP.setModuleType("Imaging"); msRIP.setModuleID("ID_Imaging"); JDFModulePhase mpRIP = ptRIP.appendModulePhase(); mpRIP.setCombinedProcessIndex(new JDFIntegerList("0 1")); mpRIP.setModuleType("Imaging"); mpRIP.setModuleID("ID_Imaging"); JDFModuleStatus msPrint = di.appendModuleStatus(); msPrint.setCombinedProcessIndex(new JDFIntegerList("2")); msPrint.setModuleType("Printer"); msPrint.setModuleID("ID_Printer"); JDFModuleStatus msStitch = di.appendModuleStatus(); msStitch.setCombinedProcessIndex(new JDFIntegerList("3")); msStitch.setModuleType("Stitcher"); msStitch.setModuleID("ID_Stitcher"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "0.jmf", 2, false); date.addOffset(0, 5, 0, 0); jmf.setTimeStamp(date); JDFJobPhase jpPrint = di.appendJobPhase(); di.setDeviceStatus(EnumDeviceStatus.Running); jpPrint.setStatus(EnumNodeStatus.InProgress); jpPrint.setStartTime(date); jpPrint.setJobID(n.getJobID(true)); jpPrint.setJobPartID(n.getJobPartID(true)); msPrint = jpPrint.appendModuleStatus(); msPrint.setCombinedProcessIndex(new JDFIntegerList("2")); msPrint.setModuleType("Printer"); msPrint.setModuleID("ID_Printer"); msStitch = jpPrint.appendModuleStatus(); msStitch.setCombinedProcessIndex(new JDFIntegerList("3")); msStitch.setModuleType("Stitcher"); msStitch.setModuleID("ID_Stitcher"); di.removeChildren(ElementName.MODULESTATUS, null, null); jmf.setDescriptiveName("Phase when the Printer and Finisher start up; RIP is still RIPping"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "1.jmf", 2, false); ap.appendXMLComment("The following phaseTime is executed by two modules - sticher and printer", null); JDFPhaseTime ptPrint = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); JDFModulePhase mpPrint = ptPrint.appendModulePhase(); mpPrint.setCombinedProcessIndex(new JDFIntegerList("2")); mpPrint.setModuleType("Printer"); mpPrint.setModuleID("ID_Printer"); ptPrint.setStart(date); JDFModulePhase mpStitch = ptPrint.appendModulePhase(); mpStitch.setCombinedProcessIndex(new JDFIntegerList("3")); mpStitch.setModuleType("Stitcher"); mpStitch.setModuleID("ID_Stitcher"); date.addOffset(0, 30, 0, 0); ptRIP.setEnd(date); JDFDeviceInfo di2 = null; if (i < 2) { JDFSignal signal2 = jmf.appendSignal(JDFMessage.EnumType.Status); di2 = (JDFDeviceInfo)signal2.copyElement(di, null); di2.removeChild(ElementName.JOBPHASE, null, 0); if (i == 1) { JDFModuleStatus directMSRip = (JDFModuleStatus)di2.copyElement(msRIP, null); directMSRip.setDeviceStatus(EnumDeviceStatus.Idle); } } else { jpRIP.setAttribute("EndTime", date.DateTimeISO); jpRIP.setDescriptiveName("Added EndTime to explicitly close phase"); } jmf.setTimeStamp(date); jmf.setDescriptiveName("Phase when the RIP has completed, Printer and Finisher are still RIPping"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "2.jmf", 2, false); date.addOffset(0, 70, 0, 0); ptPrint.setEnd(date); jmf.setTimeStamp(date); if (i < 2) { signal.deleteNode(); signal = jmf.appendSignal(JDFMessage.EnumType.Status); di = (JDFDeviceInfo)signal.copyElement(di2, null); di.removeChild(ElementName.JOBPHASE, null, 0); di.removeChild(ElementName.MODULESTATUS, null, 0); di.setDeviceStatus(EnumDeviceStatus.Idle); signal.appendXMLComment("Or should the complete list of modules also be specified here?", di); } else { jpRIP.deleteNode(); jpPrint.setAttribute("EndTime", date.DateTimeISO); jpPrint.setDescriptiveName("Added EndTime to explicitly close phase"); } jmf.setDescriptiveName("Phase when the Printer and Finisher have completed"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "3.jmf", 2, false); doc.write2File(sm_dirTestDataTemp + "DigiPrintModule.1.4" + testType + ".jdf", 2, false); } }