예제 #1
0
        public virtual void testCreateJMF()
        {
            JDFJMF jmf = JDFJMF.createJMF(EnumFamily.Response, EnumType.AbortQueueEntry);

            Assert.AreEqual(EnumType.AbortQueueEntry, jmf.getResponse(0).getEnumType());
            Assert.AreEqual("Response", jmf.getResponse(0).LocalName);
        }
예제 #2
0
        public virtual void testSenderIDBlank()
        {
            JDFJMF.setTheSenderID("a b");
            JDFJMF      jmf      = JDFJMF.createJMF(EnumFamily.Response, EnumType.AbortQueueEntry);
            JDFResponse response = jmf.getResponse(0);

            Assert.IsTrue(response.getID().IndexOf(".ab.") > 0, "thge sender id was added but stripped");
        }
예제 #3
0
        ///
        ///	 <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);
        }
예제 #4
0
        public virtual void testCreateResponse()
        {
            JDFDoc     doc     = new JDFDoc(ElementName.JMF);
            JDFJMF     jmf     = doc.getJMFRoot();
            JDFCommand command = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command,EnumType.UpdateJDF);

            Assert.AreEqual("CommandUpdateJDF",command.getXSIType());
            command.setType("foo:bar");
            Assert.IsNull(command.getXSIType());
            Assert.AreEqual("foo:bar",command.getType());
            JDFJMF      resp     = command.createResponse();
            JDFResponse response = resp.getResponse(0);

            Assert.AreEqual(resp.getMessageElement(null,null,0),response);
            Assert.AreEqual("foo:bar",response.getType());
            Assert.AreEqual(command.getID(),response.getrefID());
        }
예제 #5
0
        public virtual void testConvertResponses()
        {
            JDFDoc      doc  = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf  = doc.getJMFRoot();
            JDFDoc      doc2 = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf2 = doc2.getJMFRoot();
            JDFResponse r    = jmf2.appendResponse();
            JDFQuery    q    = jmf.appendQuery();

            q.setType("KnownMessages");
            r.setQuery(q);
            Assert.AreEqual(q.getID(), r.getrefID(), "refID");

            jmf2.convertResponses(q);
            Assert.IsNull(jmf2.getResponse(0));
            Assert.AreEqual(q.getID(), jmf2.getSignal(0).getrefID());
        }