/// /// <summary> * Get all QueueEntry from the current element /// * </summary> /// * <returns> Collection<JDFQueueEntry> </returns> /// public virtual ICollection <JDFQueueEntry> getAllQueueEntry() { List <JDFQueueEntry> v = new List <JDFQueueEntry>(); JDFQueueEntry kElem = (JDFQueueEntry)getFirstChildElement(ElementName.QUEUEENTRY, null); while (kElem != null) { v.Add(kElem); kElem = (JDFQueueEntry)kElem.getNextSiblingElement(ElementName.QUEUEENTRY, null); } return(v); }
public virtual void testCreateSubmitProcessRun() { JDFProcessRun pr = myAuditPool.createSubmitProcessRun(null); Assert.IsNotNull(pr.getSubmissionTime()); Assert.IsFalse(new JDFDate().before(pr.getSubmissionTime()), "has submissiontime before now"); Assert.IsTrue(pr.getAttribute(AttributeName.QUEUEENTRYID).StartsWith("qe")); JDFDoc d = new JDFDoc(ElementName.QUEUEENTRY); JDFQueueEntry qe = (JDFQueueEntry)d.getRoot(); JDFDate dat = new JDFDate(); dat.addOffset(0, 0, 6, 2); qe.setSubmissionTime(dat); qe.setQueueEntryID("q1"); pr = myAuditPool.createSubmitProcessRun(qe); Assert.AreEqual(dat, pr.getSubmissionTime()); Assert.AreEqual("q1", pr.getAttribute(AttributeName.QUEUEENTRYID)); }
/// /// <summary> * creates a ProcessRun when this is submitted should be called by the receiving device when it initially receives /// * and enqueues the JDF /// * </summary> /// * <param name="qe"> the queuentry element to copy information from, if null parameters will be genrated on the fly </param> /// * <returns> the newly created processRun </returns> /// public virtual JDFProcessRun createSubmitProcessRun(JDFQueueEntry qe) { JDFProcessRun pr = (JDFProcessRun)addAudit(EnumAuditType.ProcessRun, null); pr.setSubmissionTime(new JDFDate()); if (qe != null) { pr.setPartMapVector(qe.getPartMapVector()); pr.copyAttribute(AttributeName.QUEUEENTRYID, qe, null, null, null); if (qe.hasAttribute(AttributeName.SUBMISSIONTIME)) { pr.copyAttribute(AttributeName.SUBMISSIONTIME, qe, null, null, null); } } if (!pr.hasAttribute(AttributeName.SUBMISSIONTIME)) { pr.setSubmissionTime(new JDFDate()); } if (!pr.hasAttribute(AttributeName.QUEUEENTRYID)) { pr.setAttribute("QueueEntryID", "qe_" + JDFElement.uniqueID(0)); } return(pr); }
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); }