Esempio n. 1
0
 ///
 ///	 <summary> * return true if this qe matches the input QueueFilter
 ///	 *  </summary>
 ///	 * <param name="ni">
 ///	 * @return </param>
 ///
 public virtual bool matchesQueueFilter(JDFQueueFilter filter)
 {
     if (filter == null)
     {
         return(true);
     }
     return(filter.matches(this));
 }
Esempio n. 2
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc d = new JDFDoc(ElementName.QUEUE);

            theQueue = (JDFQueue)d.getRoot();
            d        = new JDFDoc(ElementName.JMF);
            theJMF   = d.getJMFRoot();
            filter   = theJMF.appendCommand(EnumType.AbortQueueEntry).appendQueueFilter();
        }
Esempio n. 3
0
        public virtual void testFlushQueue()
        {
            JDFQueueFilter qf = (JDFQueueFilter) new JDFDoc(ElementName.QUEUEFILTER).getRoot();

            qf.appendQueueEntryDef("qe5");
            VElement v = q.flushQueue(qf);

            Assert.AreEqual(1, v.Count);
            Assert.AreEqual("qe5", ((JDFQueueEntry)v[0]).getQueueEntryID());
            Assert.AreEqual(4, q.numEntries(null));
        }
Esempio n. 4
0
 ///
 ///	 <summary> * create a queuefilter from the zapped queuentries
 ///	 *  </summary>
 ///	 * <param name="zapped"> vector of <seealso cref="JDFQueueEntry"/> </param>
 ///
 public virtual void setQueueEntryDefsFromQE(VElement zapped)
 {
     if (zapped != null)
     {
         int            zs = zapped.Count;
         JDFQueueFilter qf = appendQueueFilter();
         for (int i = 0; i < zs; i++)
         {
             qf.appendQueueEntryDef(((JDFQueueEntry)zapped[i]).getQueueEntryID());
         }
     }
 }
Esempio n. 5
0
        public virtual JDFQueue copyToResponse(JDFResponse resp, JDFQueueFilter filter)
        {
            if (resp == null)
            {
                return(null);
            }
            resp.removeChildren(ElementName.QUEUE, null, null);
            JDFQueue newQueue = (JDFQueue)resp.copyElement(this, null);

            if (filter != null)
            {
                filter.match(newQueue);
            }
            return(newQueue);
        }
Esempio n. 6
0
        public virtual void testCopyToResponse()
        {
            JDFResponse    r  = JDFJMF.createJMF(JDFMessage.EnumFamily.Response, EnumType.AbortQueueEntry).getResponse(0);
            JDFQueueFilter qf = (JDFQueueFilter) new JDFDoc(ElementName.QUEUEFILTER).getRoot();

            qf.setMaxEntries(3);
            JDFQueue q2 = q.copyToResponse(r, qf);

            Assert.AreEqual(r.getQueue(0), q2);
            Assert.AreEqual(3, q2.numEntries(null));
            Assert.AreNotEqual(q, q2);
            Assert.IsTrue(q.numEntries(null) > 3);
            q2 = q.copyToResponse(r, qf);
            Assert.AreEqual(r.getQueue(0), q2);
            Assert.IsNull(r.getElement("Queue", null, 1));
            Assert.AreEqual(3, q2.numEntries(null));
            Assert.AreNotEqual(q, q2);
            Assert.IsTrue(q.numEntries(null) > 3);
        }
Esempio n. 7
0
        public virtual void testMatchesFilter()
        {
            q.setAutomated(true);
            JDFQueue      q2 = (JDFQueue) new JDFDoc("Queue").getRoot();
            JDFQueueEntry qe = q2.appendQueueEntry();

            qe.setQueueEntryID("qeNew");
            qe.setQueueEntryStatus(EnumQueueEntryStatus.Waiting);
            Assert.IsTrue(qe.matchesQueueFilter(null));
            JDFQueueFilter    filter = (JDFQueueFilter)q.appendElement(ElementName.QUEUEFILTER);
            List <ValuedEnum> v      = new List <ValuedEnum>();

            v.Add(EnumQueueEntryStatus.Completed);
            filter.setStatusList(v);
            Assert.IsFalse(qe.matchesQueueFilter(filter));
            v.Add(EnumQueueEntryStatus.Waiting);
            filter.setStatusList(v);
            Assert.IsTrue(qe.matchesQueueFilter(filter));
        }
Esempio n. 8
0
        public virtual VElement flushQueue(JDFQueueFilter qf)
        {
            int siz = 0;

            VElement ve = getQueueEntryVector();

            if (ve != null)
            {
                siz = ve.Count;
                for (int i = siz - 1; i >= 0; i--)
                {
                    JDFQueueEntry qe = (JDFQueueEntry)ve[i];
                    if (qe.matchesQueueFilter(qf))
                    {
                        if (cleanupCallback != null)
                        {
                            cleanupCallback.cleanEntry(qe);
                        }

                        qe.deleteNode();
                    }
                    else
                    {
                        ve.RemoveAt(i);
                        siz--;
                    }
                }
            }

            if (automated)
            {
                setStatusFromEntries();
            }

            return(siz == 0 ? null : ve);
        }