Esempio n. 1
0
        public virtual void testGetMessageElement()
        {
            JDFDoc     d   = new JDFDoc("JMF");
            JDFJMF     jmf = d.getJMFRoot();
            JDFCommand c   = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command, EnumType.Events);

            Assert.AreEqual(c, jmf.getMessageElement(EnumFamily.Command, EnumType.Events, 0));
            jmf.appendComment();

            JDFSignal s = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, EnumType.Events);

            Assert.AreEqual(s, jmf.getMessageElement(EnumFamily.Signal, EnumType.Events, 0));
            Assert.AreEqual(s, jmf.getMessageElement(null, EnumType.Events, 1));
            Assert.AreEqual(s, jmf.getMessageElement(null, null, 1));

            JDFSignal s2 = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, EnumType.Status);

            Assert.AreEqual(s2, jmf.getMessageElement(EnumFamily.Signal, EnumType.Status, 0));
            Assert.AreEqual(s2, jmf.getMessageElement(EnumFamily.Signal, null, 1));
            Assert.AreEqual(s2, jmf.getMessageElement(null, null, 2));
            Assert.AreEqual(s2, jmf.getMessageElement(null, null, -1));
            Assert.AreEqual(s, jmf.getMessageElement(null, null, -2));
            Assert.AreEqual(c, jmf.getMessageElement(null, null, -3));
            Assert.IsNull(jmf.getMessageElement(null, null, -4));
        }
Esempio n. 2
0
        public virtual void testGetMessageVector()
        {
            JDFDoc     doc     = new JDFDoc(ElementName.JMF);
            JDFJMF     jmf     = doc.getJMFRoot();
            JDFCommand command = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command, EnumType.Status);

            Assert.AreEqual(command, jmf.getMessageVector(null, EnumType.Status)[0]);
            Assert.AreEqual(1, jmf.getMessageVector(null, EnumType.Status).Count);
            JDFSignal signal = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, EnumType.Status);

            Assert.AreEqual(command, jmf.getMessageVector(null, EnumType.Status)[0]);
            Assert.AreEqual(signal, jmf.getMessageVector(null, EnumType.Status)[1]);
            Assert.AreEqual(2, jmf.getMessageVector(null, EnumType.Status).Count);
        }
Esempio n. 3
0
        public virtual void testAppendValidElement()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal sig = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal,EnumType.UpdateJDF);

            Assert.IsNotNull(sig.appendValidElement(ElementName.UPDATEJDFCMDPARAMS,null));
        }
Esempio n. 4
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));
        }
Esempio n. 5
0
        public virtual void testSenderID()
        {
            JDFDoc     doc     = new JDFDoc(ElementName.JMF);
            JDFJMF     jmf     = doc.getJMFRoot();
            JDFCommand command = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command,EnumType.UpdateJDF);

            Assert.AreEqual(command.getSenderID(),jmf.getSenderID());
            command.setSenderID("foo:bar");
            Assert.AreEqual("foo:bar",command.getSenderID());
        }
Esempio n. 6
0
        public virtual void testGetInvalidAttributes()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal sig = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal,EnumType.UpdateJDF);

            Assert.IsNotNull(sig.appendValidElement(ElementName.UPDATEJDFCMDPARAMS,null));
            Assert.IsFalse(sig.getInvalidAttributes(EnumValidationLevel.Complete,true,999).Contains(AttributeName.XSITYPE));
            sig.setAttribute("Type",EnumType.AbortQueueEntry.getName());
            Assert.IsTrue(sig.getInvalidAttributes(EnumValidationLevel.Complete,true,999).Contains(AttributeName.XSITYPE));
        }
Esempio n. 7
0
        public virtual void testPrivateMessage()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal s   = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, null);

            s.setType("foo:test");
            s.appendDevice();
            Assert.IsNull(s.getXSIType());
            Assert.IsTrue(s.getDevice(0) != null, "get device");
        }
Esempio n. 8
0
        public virtual void testReturnQueueEntry()
        {
            JDFDoc     doc = new JDFDoc(ElementName.JMF);
            JDFJMF     jmf = doc.getJMFRoot();
            JDFCommand c   = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command, null);

            c.setType("ReturnQueueEntry");
            JDFReturnQueueEntryParams rqe = c.appendReturnQueueEntryParams();

            rqe.setURL("http://foo.jdf");
            rqe.setQueueEntryID("dummyID");
            Assert.IsTrue(rqe.isValid(EnumValidationLevel.Complete), "JDFReturnQueueEntryParams");
        }
Esempio n. 9
0
        public virtual void testError()
        {
            JDFDoc      doc = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf = doc.getJMFRoot();
            JDFResponse r   = (JDFResponse)jmf.appendMessageElement(EnumFamily.Response, null);

            r.setType("Status");
            r.setrefID("r1");
            JDFNotification n = r.setErrorText("blub");

            Assert.AreEqual("blub", n.getComment(0).getText(), "get comment text");
            Assert.AreEqual("Error", n.getType(), "type");
            Assert.IsTrue(r.isValid(EnumValidationLevel.Complete));
            jmf.setSenderID("S1");
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
        }
Esempio n. 10
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());
        }
Esempio n. 11
0
        public virtual void testJobPhase()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal s   = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, null);

            s.setType("Status");
            JDFStatusQuParams sqp = s.appendStatusQuParams();

            sqp.setDeviceDetails(EnumDeviceDetails.Brief);
            JDFDeviceInfo di = s.appendDeviceInfo();
            JDFJobPhase   jp = di.appendJobPhase();

            Assert.AreEqual(di.getJobPhase(0), jp);
            jp = (JDFJobPhase)di.appendElement("jdf:JobPhase", JDFElement.getSchemaURL());
            Assert.AreEqual(di.getJobPhase(1), jp);
            Assert.IsNull(di.getJobPhase(2));
            jp.appendNode();
            Assert.IsTrue(jp.isValid(EnumValidationLevel.Incomplete));
        }
Esempio n. 12
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");
        }
Esempio n. 13
0
        public virtual void testUpdateJDF()
        {
            JDFDoc                doc     = new JDFDoc(ElementName.JMF);
            JDFJMF                jmf     = doc.getJMFRoot();
            JDFCommand            command = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command,EnumType.UpdateJDF);
            JDFUpdateJDFCmdParams ujn     = command.appendUpdateJDFCmdParams();

            Assert.IsNotNull(ujn);
            JDFUpdateJDFCmdParams ujn2 = command.getUpdateJDFCmdParams();

            Assert.AreEqual(ujn,ujn2);
            ujn2 = command.getCreateUpdateJDFCmdParams();
            Assert.AreEqual(ujn,ujn2);
            try
            {
                command.appendUpdateJDFCmdParams();
                Assert.Fail("oops");
            }
            catch (JDFException)
            {
                // nop
            }
        }
Esempio n. 14
0
        public virtual void testModifyNode()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal sig = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal,EnumType.ModifyNode);
            JDFModifyNodeCmdParams mnp = sig.appendModifyNodeCmdParams();

            Assert.IsNotNull(mnp);
            JDFModifyNodeCmdParams mnp2 = sig.getModifyNodeCmdParams();

            Assert.AreEqual(mnp,mnp2);
            mnp2 = sig.getCreateModifyNodeCmdParams();
            Assert.AreEqual(mnp,mnp2);
            try
            {
                sig.appendModifyNodeCmdParams();
                Assert.Fail("oops");
            }
            catch (JDFException)
            {
                // nop
            }
        }
        public virtual void testGetMimeURL()
        {
            JDFDoc d1 = new JDFDoc("JMF");

            d1.setOriginalFileName("JMF.jmf");
            JDFJMF     jmf = d1.getJMFRoot();
            JDFCommand com = (JDFCommand)jmf.appendMessageElement(JDFMessage.EnumFamily.Command, JDFMessage.EnumType.SubmitQueueEntry);

            com.appendQueueSubmissionParams().setURL("cid:TheJDF");

            JDFDoc doc = new JDFDoc("JDF");

            doc.setOriginalFileName("JDF.jdf");
            JDFNode n = doc.getJDFRoot();

            n.setType(JDFNode.EnumType.ColorSpaceConversion);
            JDFColorSpaceConversionParams cscp = (JDFColorSpaceConversionParams)n.addResource(ElementName.COLORSPACECONVERSIONPARAMS, null, EnumUsage.Input, null, null, null, null);
            JDFFileSpec fs0 = cscp.appendFinalTargetDevice();

            fs0.setURL(StringUtil.uncToUrl(sm_dirTestData + "test.icc", true));
            JDFRunList rl = (JDFRunList)n.addResource(ElementName.RUNLIST, null, EnumUsage.Input, null, null, null, null);

            rl.addPDF(StringUtil.uncToUrl(sm_dirTestData + "url1.pdf", false), 0, -1);
            System.Net.Mail.AttachmentCollection m = MimeUtil.buildMimePackage(d1, doc, true);

            JDFDoc[] d2 = MimeUtil.GetJMFSubmission(m);
            Assert.IsNotNull(d2);
            JDFQueueSubmissionParams queueSubmissionParams = d2[0].getJMFRoot().getCommand(0).getQueueSubmissionParams(0);

            Assert.AreEqual("cid:JDF.jdf", queueSubmissionParams.getURL());
            Assert.AreEqual(JDFNode.EnumType.ColorSpaceConversion, d2[1].getJDFRoot().getEnumType());
            JDFDoc d3 = queueSubmissionParams.getURLDoc();

            Assert.IsNotNull(d3);
            Assert.AreEqual(JDFNode.EnumType.ColorSpaceConversion, d3.getJDFRoot().getEnumType());
        }