예제 #1
0
        public virtual void testEmptyString()
        {
            JDFDoc inMessageDoc = new JDFDoc(ElementName.JMF);
            JDFJMF jmfIn        = inMessageDoc.getJMFRoot();

            jmfIn.appendMessageElement(JDFMessage.EnumFamily.Response, null);
            string s = inMessageDoc.write2String(0);

            Assert.IsNotNull(s);
        }
예제 #2
0
        public virtual void testRoots()
        {
            string xmlFile = "job.jdf";

            JDFParser p      = new JDFParser();
            JDFDoc    jdfDoc = p.parseFile(sm_dirTestData + xmlFile);

            Assert.IsTrue(jdfDoc != null, xmlFile + ": Parse Error");
            if (jdfDoc == null)
            {
                return; // soothe findbugs ;)
            }
            Assert.IsNotNull(jdfDoc.getJDFRoot(), "jdf root");
            Assert.IsNull(jdfDoc.getJMFRoot(), "no jmf root");
        }
예제 #3
0
        public virtual void testGetLinkRootJMF()
        {
            JDFDoc d   = new JDFDoc("JMF");
            JDFJMF jmf = d.getJMFRoot();

            jmf.setSenderID("Elvis");
            JDFCommand c = jmf.appendCommand();

            c.setType("PipePull");
            JDFPipeParams pp = c.appendPipeParams();

            pp.setAttribute(AttributeName.PIPEID, "foo", null);
            JDFRunList      ruli = (JDFRunList)pp.appendResource(ElementName.RUNLIST);
            JDFResourceLink rl   = pp.appendResourceLink("RunListLink", true);

            rl.setrRef(ruli.getID());
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete), "valid param");
            Assert.AreEqual(rl.getTarget(), ruli);
        }
예제 #4
0
        public virtual void testDefaultVersion()
        {
            JDFDoc  doc = new JDFDoc("JDF");
            JDFNode n   = doc.getJDFRoot();

            Assert.AreEqual(n.getVersion(true), EnumVersion.Version_1_3);
            JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_2);
            n.setType("ProcessGroup", true);
            n = n.addJDFNode("Combined");
            Assert.AreEqual(EnumVersion.Version_1_3, n.getVersion(true));

            doc = new JDFDoc("JDF");
            n   = doc.getJDFRoot();
            Assert.AreEqual(EnumVersion.Version_1_2, n.getVersion(true));
            n.setType("ProcessGroup", true);
            n = n.addJDFNode("Combined");
            Assert.AreEqual(EnumVersion.Version_1_2, n.getVersion(true));

            doc = new JDFDoc("JMF");
            JDFJMF jmf = doc.getJMFRoot();

            Assert.AreEqual(EnumVersion.Version_1_2, jmf.getVersion(true));
        }
예제 #5
0
        public virtual void testStatusEquals()
        {
            // test if the auto classes implement the correct status

            // compare EnumNodeStatus
            JDFAuditPool myAuditPool = null;

            JDFDoc jdfDoc = new JDFDoc(ElementName.JDF);

            JDFNode jdfRoot = (JDFNode)jdfDoc.getRoot();

            Assert.IsTrue(jdfRoot != null, "No Root found");
            if (jdfRoot == null)
            {
                return; // soothe findbugs ;)
            }
            JDFAncestor ancestor = jdfRoot.appendAncestorPool().appendAncestor();

            ancestor.setStatus(EnumNodeStatus.Completed);

            myAuditPool = jdfRoot.getCreateAuditPool();
            JDFPhaseTime phaseTime = myAuditPool.addPhaseTime(JDFElement.EnumNodeStatus.Completed, null, null);
            JDFSpawned   spawned   = myAuditPool.addSpawned(jdfRoot, null, null, null, null);

            spawned.setStatus(JDFElement.EnumNodeStatus.Completed);

            Assert.AreEqual(spawned.getStatus(), phaseTime.getStatus());
            Assert.AreEqual(spawned.getStatus(), ancestor.getStatus());

            JDFDoc jmfDoc = new JDFDoc(ElementName.JMF);

            JDFJMF jmfRoot = jmfDoc.getJMFRoot();

            Assert.IsTrue(jmfRoot != null, "No Root found");
            if (jmfRoot == null)
            {
                return; // soothe findbugs ;)
            }
            JDFAcknowledge acknowledge = jmfRoot.appendAcknowledge();

            acknowledge.setType("PipePush"); // Type is required and its existance
            // is validated for messages
            JDFJobPhase jobPhase = acknowledge.appendJobPhase();

            jobPhase.setStatus(EnumNodeStatus.Completed);

            JDFMessage message = jmfRoot.appendMessageElement(EnumFamily.Command, null);

            message.setType("PipePush"); // Type is required and its existance is
            // validated for messages
            JDFPipeParams pipeParams = message.appendPipeParams();

            pipeParams.setStatus(EnumNodeStatus.Completed);

            Assert.AreEqual(jobPhase.getStatus(), pipeParams.getStatus());
            Assert.AreEqual(spawned.getStatus(), pipeParams.getStatus());

            // compare EnumResStatus
            JDFDoc      responseDoc  = new JDFDoc(ElementName.RESPONSE);
            JDFResponse responseRoot = (JDFResponse)responseDoc.getRoot();

            Assert.IsTrue(responseRoot != null, "No Root found");
            if (responseRoot == null)
            {
                return; // soothe findbugs ;)
            }
            responseRoot.setType(ElementName.RESOURCE);
            JDFResourceInfo resInfo = responseRoot.appendResourceInfo();

            resInfo.setResStatus(EnumResStatus.Available);

            JDFDoc     commandDoc  = new JDFDoc(ElementName.COMMAND);
            JDFCommand commandRoot = (JDFCommand)commandDoc.getRoot();

            Assert.IsTrue(commandRoot != null, "No Root found");
            if (commandRoot == null)
            {
                return; // soothe findbugs ;)
            }
            commandRoot.setType(ElementName.RESOURCE);
            JDFResourceCmdParams resCmdParams = commandRoot.appendResourceCmdParams();

            resCmdParams.setResStatus(EnumResStatus.Available);

            Assert.AreEqual(resInfo.getStatus(), resCmdParams.getStatus());

            // check EnumQueueStatus
            JDFDoc   queueDoc  = new JDFDoc(ElementName.QUEUE);
            JDFQueue queueRoot = (JDFQueue)queueDoc.getRoot();

            Assert.IsTrue(queueRoot != null, "No Root found");
            if (queueRoot == null)
            {
                return; // soothe findbugs ;)
            }
            queueRoot.setQueueStatus(EnumQueueStatus.Running);

            // check EnumQueueEntryStatus
            JDFQueueEntry queueEntry = queueRoot.appendQueueEntry();

            queueEntry.setQueueEntryStatus(EnumQueueEntryStatus.Running);
        }