Пример #1
0
        public virtual void testConvertResponse()
        {
            JDFDoc      doc  = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf  = doc.getJMFRoot();
            JDFDoc      doc2 = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf2 = doc2.getJMFRoot();
            JDFSignal   s    = jmf.appendSignal();
            JDFResponse r    = jmf2.appendResponse();
            JDFQuery    q    = jmf.appendQuery();

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

            JDFMessageService ms = r.appendMessageService();

            ms.setType("KnownMessages");
            s.convertResponse(r, q);
            Assert.AreEqual(r.getType(), s.getType(), "type");
            Assert.IsTrue(ms.isEqual(s.getMessageService(0)), "ms equal");
            s = jmf.appendSignal();
            s.convertResponse(r, null);
            Assert.AreEqual(r.getType(), s.getType(), "type");
            Assert.IsTrue(ms.isEqual(s.getMessageService(0)), "ms equal");
            Assert.IsTrue(s.getXSIType().StartsWith("Signal"));
        }
Пример #2
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());
        }
Пример #3
0
        ///
        ///	 <summary> * convert all responses that match the query q to signals
        ///	 *  </summary>
        ///	 * <returns> the newly created JMF with multiple responses </returns>
        ///
        public virtual void convertResponses(JDFQuery q)
        {
            EnumType t   = q == null ? null : q.getEnumType();
            VElement v   = getMessageVector(EnumFamily.Response, t);
            string   qID = q == null ? null : q.getID();

            for (int i = 0; i < v.Count; i++)
            {
                JDFResponse r = (JDFResponse)v[i];
                if (qID == null || qID.Equals(r.getrefID()))
                {
                    JDFSignal s = appendSignal();
                    moveElement(s, r); // retain ordering
                    s.convertResponse(r, q);
                    r.deleteNode();
                }
            }
        }