예제 #1
0
        public virtual void testSetType()
        {
            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());
        }
예제 #2
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");
        }
예제 #3
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));
        }
예제 #4
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());
        }
예제 #5
0
        public virtual void testApplyResourceCmd()
        {
            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("Media");
            JDFMedia mediaRQP = (JDFMedia)rqp.appendElement("Media");

            mediaRQP.setDimension(new JDFXYPair(20, 30));

            JDFDoc  docJDF = new JDFDoc(ElementName.JDF);
            JDFNode jdf    = docJDF.getJDFRoot();

            jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting);
            JDFMedia mediaJDF = (JDFMedia)jdf.addResource("Media", null, EnumUsage.Input, null, null, null, null);

            mediaJDF.setDimension(new JDFXYPair(40, 60));
            rqp.setJobID(jdf.getJobID(true));
            rqp.setJobPartID(jdf.getJobPartID(true));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2 = (JDFMedia)jdf.getMatchingResource("Media", EnumProcessUsage.AnyInput, null, 0);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension());

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

            rqp.setPartMap(sheetMap);
            mediaRQP.setDimension(new JDFXYPair(200, 300));

            JDFMedia m2Sheet = (JDFMedia)m2.addPartition(EnumPartIDKey.SheetName, "S1");

            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(200, 300), m2Sheet.getDimension(), "overwrote leaf root dimension");

            sheetMap.put(EnumPartIDKey.SheetName, "S2");
            rqp.setPartMap(sheetMap);
            mediaRQP.setDimension(new JDFXYPair(300, 400));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet2 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.IsNotNull(m2Sheet2);
            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(300, 400), m2Sheet2.getDimension(), "overwrote leaf root dimension");

            JDFMedia mPartRQP = (JDFMedia)mediaRQP.addPartition(EnumPartIDKey.SheetName, "S3");

            sheetMap.put(EnumPartIDKey.SheetName, "S3");
            rqp.setPartMap(sheetMap);
            mPartRQP.setDimension(new JDFXYPair(400, 600));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet3 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(400, 600), m2Sheet3.getDimension(), "overwrote leaf root dimension");
            Assert.IsFalse(m2Sheet3.hasAttribute_KElement("ID", null, false));

            mPartRQP.setAttribute(AttributeName.DIMENSION, "");
            mediaRQP.removeAttribute(AttributeName.DIMENSION);
            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet4 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.IsFalse(m2Sheet4.hasAttribute_KElement(AttributeName.DIMENSION, null, false), "removed leaf dimension");
        }