Example #1
0
        public virtual void testApplyResourceCmdNodeInfo()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFCommand c = jmf.appendCommand();

            jmf.setSenderID("DeviceSenderID");

            c.setType(EnumType.Resource);
            JDFResourceCmdParams rqp = c.appendResourceCmdParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.NODEINFO);
            rqp.setUsage(EnumUsage.Input);
            JDFNodeInfo niRQP = (JDFNodeInfo)rqp.appendElement(ElementName.NODEINFO);

            JDFAttributeMap sheetMap = new JDFAttributeMap("SheetName", "S1");

            rqp.setPartMap(sheetMap);
            JDFNodeInfo niRQPS1 = (JDFNodeInfo)niRQP.getCreatePartition(sheetMap, null);

            niRQPS1.setNodeStatus(EnumNodeStatus.Aborted);
            JDFDoc  docJDF = new JDFDoc(ElementName.JDF);
            JDFNode jdf    = docJDF.getJDFRoot();

            jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting);
            jdf.setStatus(EnumNodeStatus.Waiting);
            jdf.setJobID("JobID");
            jdf.setJobPartID("JobPartID");

            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getPartStatus(null));
            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getStatus());
            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(EnumNodeStatus.Part, jdf.getStatus());
            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getNodeInfo().getNodeStatus());
            Assert.AreEqual(EnumNodeStatus.Aborted, jdf.getPartStatus(sheetMap));

            sheetMap = new JDFAttributeMap("SheetName", "S2");
            rqp.setPartMap(sheetMap);
            niRQPS1.setAttributes(sheetMap);
            niRQPS1.setNodeStatus(EnumNodeStatus.Completed);

            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(EnumNodeStatus.Part, jdf.getStatus());
            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getNodeInfo().getNodeStatus());
            Assert.AreEqual(EnumNodeStatus.Completed, jdf.getPartStatus(sheetMap));
        }
Example #2
0
            ///
            ///		 * <param name="node"> the jdf node </param>
            ///		 * <param name="resTarget"> </param>
            ///
            private void fixNodeStatusFromNodeInfo(JDFNode node, JDFResource resTarget)
            {
                EnumNodeStatus nodeStatus = node.getStatus();

                if (!EnumNodeStatus.Part.Equals(nodeStatus) && !EnumNodeStatus.Pool.Equals(node.getStatus()))
                {
                    node.setStatus(EnumNodeStatus.Part);
                    JDFNodeInfo ni = (JDFNodeInfo)resTarget;
                    if (!ni.hasAttribute(AttributeName.NODESTATUS))
                    {
                        ni.setNodeStatus(nodeStatus);
                    }
                }
            }