Example #1
0
        public virtual void testGetResource()
        {
            JDFDoc          doc = new JDFDoc(ElementName.JMF);
            JDFJMF          jmf = doc.getJMFRoot();
            JDFCommand      c   = jmf.appendCommand(EnumType.PipePull);
            JDFPipeParams   pp  = c.appendPipeParams();
            JDFExposedMedia xm  = (JDFExposedMedia)pp.appendResource(ElementName.EXPOSEDMEDIA);

            Assert.AreEqual(EnumResourceClass.Handling, xm.getResourceClass());
            JDFMedia m = (JDFMedia)pp.appendResource(ElementName.MEDIA);

            Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass());
            JDFRefElement rm = xm.refElement(m);

            Assert.AreEqual(m, rm.getTarget());
            Assert.AreEqual(xm, pp.getResource(ElementName.EXPOSEDMEDIA));
            Assert.AreEqual(xm, pp.getResource(null));
            Assert.AreEqual(m, pp.getResource(ElementName.MEDIA));
            try
            {
                Assert.IsNull(pp.getResource("MediaLink"));
                Assert.Fail();
            }
            catch (JDFException)
            {
                // nop
            }

            JDFResourceLink rl = pp.appendResourceLink(ElementName.EXPOSEDMEDIA, true);

            rl.setrRef(xm.getID());
            Assert.AreEqual(xm, pp.getResource(null));
            Assert.AreEqual(rl.getTarget(), pp.getResource(null));
        }
Example #2
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc d = new JDFDoc(ElementName.QUEUE);

            theQueue = (JDFQueue)d.getRoot();
            d        = new JDFDoc(ElementName.JMF);
            theJMF   = d.getJMFRoot();
            filter   = theJMF.appendCommand(EnumType.AbortQueueEntry).appendQueueFilter();
        }
        public override void setUp()
        {
            base.setUp();
            JDFDoc d = new JDFDoc(ElementName.QUEUE);

            theQueue = (JDFQueue)d.getRoot();
            d        = new JDFDoc(ElementName.JMF);
            theJMF   = d.getJMFRoot();
            qsp      = theJMF.appendCommand(EnumType.SubmitQueueEntry).appendQueueSubmissionParams();
        }
Example #4
0
        public virtual void testTheSenderID()
        {
            JDFJMF.setTheSenderID("sid");
            JDFDoc     doc = new JDFDoc(ElementName.JMF);
            JDFJMF     jmf = doc.getJMFRoot();
            JDFCommand c   = jmf.appendCommand();

            Assert.IsTrue(c.getID().IndexOf(".sid.") != -1);
            JDFJMF.setTheSenderID(null);
        }
Example #5
0
        public virtual void testInitMaxVersion()
        {
            JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_2);
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            Assert.AreEqual(jmf.getMaxVersion(), jmf.getVersion(false));
            JDFCommand c = jmf.appendCommand();

            Assert.AreEqual(jmf.getMaxVersion(), c.getMaxVersion(true));
        }
Example #6
0
        public virtual void testCreateResponse()
        {
            JDFJMF queries = JDFJMF.createJMF(EnumFamily.Query, EnumType.Status);

            queries.appendCommand(EnumType.Resource);
            queries.appendCommand(EnumType.Resource);
            queries.appendRegistration(EnumType.Resource);

            JDFJMF   responses      = queries.createResponse();
            VElement messageVector  = queries.getMessageVector(null, null);
            VElement responseVector = responses.getMessageVector(null, null);

            Assert.AreEqual(responseVector.Count, 4);
            for (int i = 0; i < responseVector.Count; i++)
            {
                JDFResponse r = (JDFResponse)responseVector[i];
                JDFMessage  m = (JDFMessage)messageVector[i];
                Assert.AreEqual(r.getrefID(), m.getID());
                Assert.AreEqual(r.getType(), m.getType());
            }
        }
Example #7
0
        public virtual void testInit()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

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

            Assert.IsTrue(c.getID().IndexOf(".sid.") != -1);
            Assert.IsTrue(jmf.ToString().IndexOf("xsi:type=") > 0);
            Assert.AreEqual(jmf.getMaxVersion(), jmf.getVersion(false));
            Assert.AreEqual(jmf.getMaxVersion(), c.getMaxVersion(true));
        }
Example #8
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 #9
0
        public virtual void testgetSubmissionParams()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            Assert.IsNull(jmf.getSubmissionURL());
            JDFCommand c = jmf.appendCommand(EnumType.ResubmitQueueEntry);

            Assert.IsNull(jmf.getSubmissionURL());
            JDFResubmissionParams rsp = c.appendResubmissionParams();

            Assert.IsNull(jmf.getSubmissionURL());
            rsp.setURL("url");
            Assert.AreEqual("url", jmf.getSubmissionURL());
        }
Example #10
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");
        }