public virtual void testCreateQueueEntry() { q.setAutomated(true); q.setMaxRunningEntries(2); q.setMaxWaitingEntries(3); q.flushQueue(null); JDFQueueEntry qe = q.createQueueEntry(false); Assert.AreEqual(EnumQueueEntryStatus.Waiting, qe.getQueueEntryStatus()); qe = q.createQueueEntry(true); Assert.AreEqual(EnumQueueEntryStatus.Held, qe.getQueueEntryStatus()); q.setMaxWaitingEntries(1); qe = q.createQueueEntry(true); Assert.IsNull(qe); }
/// /// <summary> * add a queueentry to a queue based on the parameters of this you can get the new queueentry by {@link} /// * getQueueEntry(0) on the response /// * </summary> /// * <param name="theQueue"> the queue to submit to, note that the queue IS modified by this call </param> /// * <param name="responseIn"> the jmf that serves as a container for the new response /// * </param> /// * <returns> the response jmf to the submission message </returns> /// public virtual JDFResponse addEntry(JDFQueue theQueue, JDFJMF responseIn) { JDFCommand command = (JDFCommand)getParentNode_KElement(); JDFJMF jmf = command.createResponse(); JDFResponse resp = jmf.getResponse(0); if (responseIn != null) { resp = (JDFResponse)responseIn.copyElement(resp, null); } if (theQueue == null) { resp.setErrorText("No Queue specified"); resp.setReturnCode(2); return(resp); } if (!theQueue.canAccept()) { resp.setReturnCode(112); resp.copyElement(theQueue, null); return(resp); } JDFQueueEntry qe = theQueue.createQueueEntry(getHold()); string[] copyAtts = new string[] { AttributeName.GANGNAME, AttributeName.GANGPOLICY }; for (int i = 0; i < copyAtts.Length; i++) { if (hasAttribute(copyAtts[i])) { qe.copyAttribute(copyAtts[i], this, null, null, null); } } // TODO more attributes e.g prev. next... if (hasAttribute(AttributeName.PRIORITY)) { qe.setPriority(getPriority()); // calls the automated function, } // therfore not in the list above resp.copyElement(theQueue, null); resp.copyElement(qe, null); return(resp); }