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> * create a BaseGoldenTicket /// * </summary> /// * <param name="icsLevel"> the level to init to (1,2 or 3) </param> /// * <param name="jdfVersion"> the version to generate a golden ticket for </param> /// public BaseGoldenTicket(int icsLevel, EnumVersion jdfVersion) { baseICSLevel = icsLevel; theVersion = jdfVersion == null ? EnumVersion.Version_1_3 : jdfVersion; theStatusCounter = new StatusCounter(null, null, null); JDFElement.setLongID(false); }
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 testThreads() { q.setAutomated(true); q.removeChildren(ElementName.QUEUEENTRY, null, null); q.setMaxCompletedEntries(999999999); for (int i = 0; i < 10; i++) { QueueTestThread queueTestThread = new QueueTestThread(); Thread runThread = new Thread(new ThreadStart(queueTestThread.Run)); runThread.Name = "Test Thread_" + i; runThread.Start(); } // now also zapp some... for (int j = 0; j < 100; j++) { JDFQueueEntry qex = q.getNextExecutableQueueEntry(); if (qex != null) { qex.setQueueEntryStatus(EnumQueueEntryStatus.Running); qex.setQueueEntryStatus(EnumQueueEntryStatus.Completed); } } while (iThread > 0) { StatusCounter.sleep(100); // wait for threads to be over } Assert.AreEqual(q.getQueueSize(), 1000); VElement v = q.getQueueEntryVector(); JDFQueueEntry qeLast = null; for (int i = 0; i < v.Count; i++) { JDFQueueEntry qe = (JDFQueueEntry)v[i]; Console.WriteLine(qe.getPriority() + " " + qe.getQueueEntryID() + " " + qe.getQueueEntryStatus()); Assert.IsTrue(qe.CompareTo(qeLast) >= 0); qeLast = qe; } v = q.getQueueEntryVector(new JDFAttributeMap(AttributeName.STATUS, "Completed"), null); Assert.AreEqual(100, v.Count); v = q.getQueueEntryVector(new JDFAttributeMap(AttributeName.STATUS, "Running"), null); Assert.IsNull(v); v = q.getQueueEntryVector(new JDFAttributeMap(AttributeName.STATUS, "Held"), null); Assert.AreEqual(500, v.Count); v = q.getQueueEntryVector(new JDFAttributeMap(AttributeName.STATUS, "Waiting"), null); Assert.AreEqual(400, v.Count); }
public virtual void testPrivateValidate() { StatusCounter sc = new StatusCounter(null, null, null); sc.setEvent("id1", "good", "blah"); JDFValidator c = new JDFValidator(); c.setValidatorFactory(new ValidFactory()); JDFDoc d = sc.getDocJMFNotification(true); Assert.IsTrue(c.isValid(d)); sc.setEvent("id2", "oops", "Snafu"); d = sc.getDocJMFNotification(true); // XMLDoc report= c.processSingleDocument(d); Assert.IsFalse(c.isValid(d)); }
public override void setUp() { base.setUp(); JDFElement.setLongID(false); d = new JDFDoc("JDF"); n = d.getJDFRoot(); n.appendXMLComment("Example to illustrate JDF 1.3 Base and MIS compatible amount handling", null); n.setType(EnumType.Combined); inMedia = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null); outXM = (JDFExposedMedia)n.addResource(ElementName.EXPOSEDMEDIA, EnumUsage.Output); outXM.refMedia(inMedia); n.addTypes(EnumType.Interpreting); n.addTypes(EnumType.Rendering); n.addTypes(EnumType.ImageSetting); n.setJobID("RIP-job"); rlXMOut = n.getLink(outXM, null); rlMediaIn = n.getLink(inMedia, null); inMedia.setProductID("Media-ProductID"); inMedia.setMediaType(EnumMediaType.Plate); inMedia.setMediaTypeDetails("Aluminum"); vRL = new VElement(); vRL.Add(rlMediaIn); vRL.Add(rlXMOut); JDFExposedMedia xmPart = (JDFExposedMedia)outXM.addPartition(EnumPartIDKey.SignatureName, "Sig1"); vsSheet = new VString("Cover Sheet1 Sheet2", " "); vsCMYK = new VString("Cyan Magenta Yellow Black Spot1", " "); VElement v = xmPart.addPartitions(EnumPartIDKey.SheetName, vsSheet); for (int i = 0; i < v.Count; i++) { JDFResource xmPart2 = (JDFResource)v[i]; xmPart2.getCreatePartition(EnumPartIDKey.Side, "Front", null).addPartitions(EnumPartIDKey.Separation, vsCMYK); // xmPart2.getCreatePartition(EnumPartIDKey.Side,"Back",null). // addPartitions(EnumPartIDKey.Separation, vsCMYK); } statCounter = new StatusCounter(n, null, vRL); statCounter.setDeviceID("Rip-DeviceID"); statCounter.setCopyResInResInfo(rlMediaIn.getrRef(), true); }
/// /// <summary> * create a BaseGoldenTicket /// * </summary> /// * <param name="parent"> /// * </param> /// public BaseGoldenTicket(BaseGoldenTicket parent) { baseICSLevel = parent.baseICSLevel; theVersion = parent.theVersion; theStatusCounter = new StatusCounter(null, null, null); bExpandGrayBox = parent.bExpandGrayBox; bPartitionedPlateMedia = parent.bPartitionedPlateMedia; cols = new VString(parent.cols); colsActual = new VString(parent.colsActual); nCols = parent.nCols; devID = parent.devID; good = parent.good; waste = parent.waste; paperMedia = parent.paperMedia; partsAtOnce = parent.partsAtOnce; theParentNode = parent.getNode(); vParts = new VJDFAttributeMap(parent.vParts); partIDKeys = new VString(parent.partIDKeys); workStyle = parent.workStyle; JDFElement.setLongID(false); parent.addKid(this); }
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); } }