Beispiel #1
0
        public virtual void testIsValidMessageElement()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal sig = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, EnumType.UpdateJDF);

            Assert.IsTrue(sig.isValidMessageElement(ElementName.UPDATEJDFCMDPARAMS, 0));
            Assert.IsFalse(sig.isValidMessageElement(ElementName.MODIFYNODECMDPARAMS, 0));

            JDFResponse resp = (JDFResponse)jmf.appendMessageElement(EnumFamily.Response, EnumType.RepeatMessages);

            Assert.IsTrue(resp.isValidMessageElement(ElementName.SIGNAL,3));
            Assert.IsTrue(resp.isValidMessageElement(ElementName.REGISTRATION,3));
            Assert.IsFalse(resp.isValidMessageElement(ElementName.QUEUE,0));

            JDFRegistration reg = (JDFRegistration)jmf.appendMessageElement(EnumFamily.Registration,EnumType.RepeatMessages);

            Assert.IsFalse(reg.isValidMessageElement(ElementName.SIGNAL,3));
        }
Beispiel #2
0
        public virtual void testMessage()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            jmf.setSenderID("Pippi Langstrumpf");

            IEnumerator it = JDFMessage.EnumFamily.iterator();

            while (it.MoveNext())
            {
                JDFMessage.EnumFamily f = (JDFMessage.EnumFamily)it.Current;
                if (f == null)
                {
                    continue;
                }
                JDFMessage m = jmf.appendMessageElement(f, null);
                m.setType("KnownMessages");

                if (f.Equals(JDFMessage.EnumFamily.Acknowledge))
                {
                    JDFAcknowledge a = (JDFAcknowledge)m;
                    a.setrefID("refID");
                }

                if (f.Equals(JDFMessage.EnumFamily.Registration))
                {
                    JDFRegistration r = (JDFRegistration)m;
                    r.appendSubscription();
                }

                Assert.IsTrue(jmf.getMessageVector(f, null).Count == 1, " added messages");
                Assert.IsTrue(jmf.getMessageElement(f, null, 0).hasAttribute(AttributeName.XSITYPE), "xsi type");
                Assert.AreEqual(f.getName() + "KnownMessages", jmf.getMessageElement(f, null, 0).getAttribute(AttributeName.XSITYPE), "xsi type");
            }

            Assert.IsTrue(jmf.getMessageVector(null, null).Count == 6, " added messages");
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete), "valid");
        }