Beispiel #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"));
        }
Beispiel #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());
        }
Beispiel #3
0
        ///
        ///	 <summary> * create a new response for all messages of this if the message is any message except response correctly fills
        ///	 * refId, type etc.
        ///	 *  </summary>
        ///	 * <returns> the newly created JMF with multiple responses </returns>
        ///
        public virtual JDFJMF createResponse()
        {
            VElement v   = getMessageVector(null, null);
            JDFJMF   jmf = new JDFDoc("JMF").getJMFRoot();

            for (int i = 0; i < v.Count; i++)
            {
                JDFMessage m      = (JDFMessage)v[i];
                EnumFamily family = m.getFamily();
                if (family != null && EnumFamily.Response != family && EnumFamily.Acknowledge != family)
                {
                    if (!m.hasAttribute(AttributeName.ID)) // in case someone sends
                    // crappy requests...
                    {
                        m.appendAnchor(null);
                    }
                    JDFResponse r = jmf.appendResponse();
                    r.setQuery(m);
                }
            }
            return(jmf);
        }