Beispiel #1
0
        public virtual void testIdle()
        {
            JDFExposedMedia m        = (JDFExposedMedia)n.getMatchingResource("ExposedMedia",null,null,0);
            bool            bChanged = sc.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");

            Assert.IsTrue(bChanged);
            JDFDoc        docJMF     = sc.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);
            JDFJobPhase   jp         = deviceInfo.getJobPhase(0);

            Assert.AreEqual(200,jp.getAmount(),0);
            sc.addPhase(resID,0,100,true);
            sc.setTrackWaste(m.getID(),true);
            bChanged = sc.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");
            Assert.IsFalse(bChanged);
            docJMF   = sc.getDocJMFPhaseTime();
            sig      = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            bChanged = sc.setPhase(EnumNodeStatus.Completed,null,EnumDeviceStatus.Idle,null);
            Assert.IsTrue(bChanged);

            sc.setActiveNode(null,null,null);
            bChanged = sc.setPhase(null,null,EnumDeviceStatus.Idle,null);
            Assert.IsFalse(bChanged);
            bChanged = sc.setPhase(null,null,EnumDeviceStatus.Idle,"very idle");
            Assert.IsTrue(bChanged);

            docJMF     = sc.getDocJMFPhaseTime();
            sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            deviceInfo = sig.getDeviceInfo(0);
            jp         = deviceInfo.getJobPhase(0);
            Assert.IsNull(jp);
        }
Beispiel #2
0
        public virtual void testAddPhase()
        {
            bool bChanged = sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");

            Assert.IsTrue(bChanged);
            JDFDoc      docJMF = sc.getDocJMFPhaseTime();
            JDFResponse sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            JDFJobPhase jp     = sig.getDeviceInfo(0).getJobPhase(0);

            Assert.AreEqual(200, jp.getAmount(), 0);
            sc.addPhase(resID, 0, 100, true);
            sc.setTrackWaste(resID, true);
            JDFResourceLink rlXM = n.getLink(xpMedia, null);

            for (int loop = 1; loop < 4; loop++)
            {
                bChanged = sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");
                Assert.IsFalse(bChanged);
                docJMF = sc.getDocJMFPhaseTime();
                sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
                jp     = sig.getDeviceInfo(0).getJobPhase(0);
                Assert.AreEqual(200, jp.getAmount(), 0, "multiple setPhase calls do not modify");
                Assert.AreEqual(200, rlXM.getActualAmount(new JDFAttributeMap("Condition", "Good")), 0, "multiple setPhase calls do not modify: " + loop);
                Assert.AreEqual(200.0, jp.getPercentCompleted(), 0, "% " + loop);
                sc.addPhase(resID, 0, 100, true);
                Assert.AreEqual(loop * 100, jp.getWaste(), 0, "" + loop);
                Assert.AreEqual(100 * loop, rlXM.getActualAmount(new JDFAttributeMap("Condition", "Waste")), 0, "multiple setPhase calls do Stack: " + loop);
            }
            sc.setWorkType(EnumWorkType.Alteration);
            bChanged = sc.setPhase(EnumNodeStatus.InProgress, "ii", EnumDeviceStatus.Running, "r");
            Assert.IsTrue(bChanged);
            docJMF = sc.getDocJMFPhaseTime();
            sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            jp     = sig.getDeviceInfo(0).getJobPhase(0);
            Assert.AreEqual(200, jp.getAmount(), 0);
            Assert.AreEqual(400, jp.getWaste(), 0);
            Assert.IsTrue(jp.hasAttribute(AttributeName.PHASEAMOUNT));
            sig = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 1);
            jp  = sig.getDeviceInfo(0).getJobPhase(0);
            Assert.AreEqual(0.0, jp.getPhaseAmount(), 0.0);
            Assert.AreEqual(EnumWorkType.Alteration, jp.getMISDetails().getWorkType());

            sc.setFirstRefID("dummy");
            sc.addPhase(resID, 0, 100, true);
            sc.setTrackWaste(resID, true);
            sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");
            docJMF = sc.getDocJMFPhaseTime();
            sig    = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            jp     = sig.getDeviceInfo(0).getJobPhase(0);
            Assert.IsFalse(jp.hasAttribute(AttributeName.AMOUNT));
            Assert.AreEqual(EnumWorkType.Alteration, jp.getMISDetails().getWorkType());
        }
        ///
        ///	 <summary> * return the jmf root of the status jmf that contains all modules, null if no modules are active
        ///	 *
        ///	 * @return </summary>
        ///
        public virtual JDFDoc getStatusResponse()
        {
            if (counters.Count == 0)
            {
                return(null);
            }

            StatusCounter root = counters[0];
            JDFDoc        d    = new JDFDoc("JMF");
            JDFJMF        jmf  = d.getJMFRoot();

            jmf.mergeElement(root.getDocJMFPhaseTime().getJMFRoot(), false);
            JDFDeviceInfo di = jmf.getResponse(0).getDeviceInfo(0);

            for (int i = 1; i < counters.Count; i++)
            {
                StatusCounter counter         = counters[i];
                JDFDoc        docJMFPhaseTime = counter.getDocJMFPhaseTime();
                if (docJMFPhaseTime == null)
                {
                    continue;
                }
                JDFDeviceInfo di2    = docJMFPhaseTime.getJMFRoot().getResponse(0).getDeviceInfo(0);
                VElement      phases = di2.getChildElementVector(ElementName.JOBPHASE, null, null, true, -1, false);
                for (int j = 0; j < phases.Count; j++)
                {
                    di.copyElement(phases[j], null);
                }
                di.setDeviceStatus(getDeviceStatus());
            }
            return(d);
        }
Beispiel #4
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));
        }
Beispiel #5
0
        public virtual void testUsageCounter()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.USAGECOUNTER);

            JDFResourceInfo ri = s.appendResourceInfo();

            ri.setActualAmount(42);
            JDFUsageCounter uc = (JDFUsageCounter)ri.appendElement(ElementName.USAGECOUNTER);

            uc.setID("UsageCounterID");
            uc.setScope(EnumScope.Job);
            uc.setCounterID("DeviceCounterID");
            uc.setResStatus(EnumResStatus.Available, true);
            uc.setCounterTypes(new VString("NormalSize", " "));
            doc.write2File(sm_dirTestDataTemp + "JMFResourceSignal.jmf", 2, false);
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
        }
Beispiel #6
0
        public virtual void testEvent()
        {
            Assert.IsNull(sc.getDocJMFNotification(false));
            sc.setEvent("id", "value", "blah blah");
            d = sc.getDocJMFNotification(false);
            JDFDoc d2 = sc.getDocJMFNotification(false);

            Assert.IsTrue(d.getRoot().isEqual(d2.getRoot()));
            d  = sc.getDocJMFNotification(true);
            d2 = sc.getDocJMFNotification(false);
            Assert.IsNull(d2);
            JDFJMF          jmf  = d.getJMFRoot();
            JDFNotification noti = jmf.getSignal(0).getNotification();

            Assert.AreEqual(noti.getJobID(), n.getJobID(true));
            Assert.IsNotNull(noti.getEvent());
            d.write2File(sm_dirTestDataTemp + "jmfNotification.jmf", 2, false);
            Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete));
            sc.setEvent("id1", "value", "blah blah");
            sc.setEvent("id2", "value", "blah blah blah");
            d   = sc.getDocJMFNotification(false);
            jmf = d.getJMFRoot();
            Assert.AreEqual(2, jmf.numChildElements(ElementName.SIGNAL,null));
            sc.setEvent("id2","value","blah blah blah");
            d   = sc.getDocJMFNotification(true);
            jmf = d.getJMFRoot();
            Assert.AreEqual(3,jmf.numChildElements(ElementName.SIGNAL,null));
            d = sc.getDocJMFNotification(true);
            Assert.IsNull(d);
        }
Beispiel #7
0
        public virtual void testMediaRef()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.EXPOSEDMEDIA);

            JDFResourceInfo ri = s.appendResourceInfo();
            JDFExposedMedia xm = (JDFExposedMedia)ri.appendElement("ExposedMedia");

            JDFResourceInfo ri2 = s.appendResourceInfo();
            JDFMedia        m   = (JDFMedia)ri2.appendElement("Media");
            JDFRefElement   rm  = xm.refElement(m);

            Assert.AreEqual(m, rm.getTarget(), "works initially ");
            Assert.AreEqual(m, rm.getTarget(), "also works with cache");
        }
Beispiel #8
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));
        }
Beispiel #9
0
        public virtual void testBuildMimePackageDocJMF()
        {
            JDFDoc docJMF = new JDFDoc("JMF");

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

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

            JDFDoc doc = new JDFDoc("JDF");

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

            n.setType(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);
            for (int i = 0; i < 100; i++)
            {
                rl.addPDF(StringUtil.uncToUrl(sm_dirTestData + "url?.pdf", false), 0, -1);
            }
            AttachmentCollection m = MimeUtil.buildMimePackage(docJMF, doc, true);

            MimeUtil.writeToFile(m, sm_dirTestDataTemp + "testMimePackageDoc.mjm", null);
        }
Beispiel #10
0
        //     (non-Javadoc)
        //     * @see org.cip4.jdflib.util.HotFolderListener#hotFile(java.io.File)
        //
        public virtual void hotFile(FileInfo hotFile)
        {
            FileInfo storedFile = FileUtil.moveFileToDir(hotFile, storageDir);

            if (storedFile == null)
            {
                return; // not good
            }
            string stringURL = UrlUtil.fileToUrl(storedFile, false);

            JDFDoc     jmfDoc     = new JDFDoc("JMF");
            JDFJMF     jmfRoot    = jmfDoc.getJMFRoot();
            JDFCommand newCommand = (JDFCommand)jmfRoot.copyElement(queueCommand, null);

            newCommand.removeAttribute(AttributeName.ID);
            newCommand.appendAnchor(null);
            EnumType cType  = newCommand.getEnumType();
            JDFDoc   jdfDoc = JDFDoc.parseFile(storedFile.FullName);

            JDFNode jdfRoot = jdfDoc == null ? null : jdfDoc.getJDFRoot();

            if (EnumType.ReturnQueueEntry.Equals(cType))
            {
                extractReturnParams(stringURL, newCommand, jdfRoot);
            }
            else if (EnumType.SubmitQueueEntry.Equals(cType))
            {
                extractSubmitParams(stringURL, newCommand, jdfRoot);
            }
            qhfl.submitted(jmfRoot);
        }
Beispiel #11
0
        public static void submitMimeToHDM(JDFNode n)
        {
            // build SubmitQueueEntry
            JDFDoc     docJMF = new JDFDoc("JMF");
            JDFJMF     jmf    = docJMF.getJMFRoot();
            JDFCommand com    = (JDFCommand)jmf.appendMessageElement(JDFMessage.EnumFamily.Command, JDFMessage.EnumType.SubmitQueueEntry);

            com.appendQueueSubmissionParams().setURL("dummy");
            System.Net.Mail.AttachmentCollection mp = MimeUtil.buildMimePackage(docJMF, n.getOwnerDocument_JDFElement(), true);

            try
            {
                MIMEDetails md = new MIMEDetails();
                md.transferEncoding      = UrlUtil.BASE64;
                md.httpDetails.chunkSize = -1;
                HttpWebRequest response = MimeUtil.writeToURL(mp, "http://192.168.40.71:8889/jmfportal", md);
                // Java to C# Converstion - What is the ResponseCode for HttpWebRequest?
                //Assert.AreEqual(200, response.GetResponse().getResponseCode());
                MimeUtil.writeToURL(mp, UrlUtil.fileToUrl(new FileInfo("C:\\data\\test.mim"), false), md);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message); // fail on exception
            }
        }
Beispiel #12
0
        public virtual void testConvertResponse()
        {
            JDFDoc      doc  = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf  = doc.getJMFRoot();
            JDFDoc      doc2 = new JDFDoc(ElementName.JMF);
            JDFJMF      jmf2 = doc2.getJMFRoot();
            JDFSignal   s    = jmf.appendSignal();
            JDFResponse r    = jmf2.appendResponse();
            JDFQuery    q    = jmf.appendQuery();

            q.setType("KnownMessages");
            r.setQuery(q);
            Assert.AreEqual(q.getID(), r.getrefID(), "refID");

            JDFMessageService ms = r.appendMessageService();

            ms.setType("KnownMessages");
            s.convertResponse(r, q);
            Assert.AreEqual(r.getType(), s.getType(), "type");
            Assert.IsTrue(ms.isEqual(s.getMessageService(0)), "ms equal");
            s = jmf.appendSignal();
            s.convertResponse(r, null);
            Assert.AreEqual(r.getType(), s.getType(), "type");
            Assert.IsTrue(ms.isEqual(s.getMessageService(0)), "ms equal");
            Assert.IsTrue(s.getXSIType().StartsWith("Signal"));
        }
Beispiel #13
0
        public virtual void testSetPhaseJMF()
        {
            JDFDoc        docJMF = new JDFDoc("JMF");
            JDFJMF        jmf    = docJMF.getJMFRoot();
            JDFSignal     sig    = jmf.appendSignal(EnumType.Status);
            JDFDeviceInfo di     = sig.appendDeviceInfo();

            di.appendEmployee().setPersonalID("p1");
            JDFJobPhase phase = di.appendJobPhase();

            phase.setPhaseStartTime(new JDFDate());
            phase.setStatus(EnumNodeStatus.Setup);
            phase.setJobID(jdfRoot.getJobID(true));
            phase.setJobPartID(jdfRoot.getJobPartID(true));

            VElement el = myAuditPool.setPhase(jmf);

            Assert.IsNotNull(el);
            Assert.AreEqual(1, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            Assert.IsNotNull(((JDFPhaseTime)myAuditPool.getAudit(0, EnumAuditType.PhaseTime, null, null)).getEmployee(0));
            Assert.AreEqual(el, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true));

            el = myAuditPool.setPhase(jmf);
            Assert.IsNotNull(el);
            Assert.AreEqual(1, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            Assert.AreEqual(el, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true));

            phase.setStatus(EnumNodeStatus.Aborted);
            el = myAuditPool.setPhase(jmf);
            Assert.IsNotNull(el);
            Assert.AreEqual(2, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            Assert.AreEqual(el[0], myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true)[1]);
        }
Beispiel #14
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));
        }
Beispiel #15
0
        public virtual void testEmployee()
        {
            Assert.IsFalse(sc.removeEmployee(employee));
            Assert.AreEqual(sc.addEmployee(employee),1);
            Assert.IsTrue(sc.removeEmployee(employee));
            Assert.AreEqual(sc.addEmployee(employee),1);

            JDFDoc        docJMF     = sc.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,-1);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);

            Assert.IsTrue(deviceInfo.getEmployee(0).isEqual(employee));
            sc.removeEmployee(employee);
            docJMF     = sc.getDocJMFPhaseTime();
            sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            deviceInfo = sig.getDeviceInfo(0);
            Assert.IsNull(deviceInfo.getEmployee(0));
        }
Beispiel #16
0
        public virtual void testWritePerformance()
        {
            long   start  = JDFDate.ToMillisecs(DateTime.Now);
            string big    = sm_dirTestData + "big.pdf";
            string bigger = sm_dirTestDataTemp + "bigger.pdf";
            JDFDoc docJMF = new JDFDoc("JMF");

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

            com.appendQueueSubmissionParams().setURL("TheJDF");
            FileInfo fBigger = new FileInfo(bigger);

            SupportClass.FileSupport.CreateNewFile(fBigger);
            FileStream fis = new FileStream(big, FileMode.Open);
            FileStream fos = new FileStream(bigger, FileMode.Create);

            byte[] b = new byte[10000];
            while (true)
            {
                int i = fis.Read(b, 0, 10000);
                if (i <= 0)
                {
                    break;
                }
                for (int j = 0; j < 3; j++)
                {
                    fos.Write(b, 0, i);
                }
            }
            fis.Close();
            fos.Flush();
            fos.Close();

            JDFDoc doc = new JDFDoc("JDF");

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

            n.setType(EnumType.Interpreting);
            JDFRunList rl = (JDFRunList)n.addResource(ElementName.RUNLIST, EnumUsage.Input);

            rl.addPDF(StringUtil.uncToUrl(bigger, false), 0, -1);
            long setup = JDFDate.ToMillisecs(DateTime.Now);

            Console.WriteLine("Setup time: " + (setup - start));
            AttachmentCollection m = MimeUtil.buildMimePackage(null, doc, true);
            long build             = JDFDate.ToMillisecs(DateTime.Now);

            Console.WriteLine("Build time: " + (build - setup));
            Assert.IsNotNull(MimeUtil.writeToFile(m, sm_dirTestDataTemp + "performance.mjm", null));
            long write = JDFDate.ToMillisecs(DateTime.Now);

            Console.WriteLine("Write time: " + (write - build));
        }
Beispiel #17
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);
        }
Beispiel #18
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc      doc  = new JDFDoc("JMF");
            JDFJMF      jmf  = doc.getJMFRoot();
            JDFResponse resp = (JDFResponse)jmf.appendMessageElement(EnumFamily.Response, JDFMessage.EnumType.KnownDevices);

            deviceCap = resp.appendDeviceList().appendDeviceInfo().appendDevice().appendDeviceCap();
            deviceCap.appendBooleanState("Template");
        }
Beispiel #19
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();
        }
Beispiel #21
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());
        }
Beispiel #22
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");
        }
Beispiel #23
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));
        }
Beispiel #24
0
        public virtual void testGetExecutableJDF()
        {
            string docTest   = "MISPrepress_ICS_Minimal.jdf";
            string docDevCap = "DevCaps_Product_MISPrepress_ICS_Minimal.jdf";

            // parse input file
            JDFParser p         = new JDFParser();
            JDFDoc    jmfDevCap = p.parseFile(sm_dirTestData + docDevCap);
            JDFJMF    jmfRoot   = null;

            Assert.IsNotNull(jmfDevCap, "Parse of file " + docDevCap + " failed");
            jmfRoot = jmfDevCap.getJMFRoot();
            Assert.IsNotNull(jmfRoot, "jmfRoot == null Can't start Test");
            XMLDoc docOutDevCap = jmfRoot.getOwnerDocument_KElement();

            docOutDevCap.write2File(sm_dirTestDataTemp + "_" + docDevCap, 0, true);

            JDFDoc  jdfTest = p.parseFile(sm_dirTestData + docTest);
            JDFNode jdfRoot = jdfTest.getJDFRoot();

            Assert.IsTrue(jdfRoot != null, "jdfRoot is null");

            if (jdfRoot != null)
            {
                jdfRoot.getOwnerDocument_KElement();
                JDFDeviceCap deviceCap = (JDFDeviceCap)jmfRoot.getChildByTagName("DeviceCap", null, 0, null, false, true);

                EnumFitsValue       testlists  = EnumFitsValue.Allowed;
                EnumValidationLevel level      = KElement.EnumValidationLevel.Complete;
                VElement            vExecNodes = deviceCap.getExecutableJDF(jdfRoot, testlists, level);
                if (vExecNodes == null)
                {
                    Console.WriteLine(docDevCap + ": found No matching JDFNode");
                }
                else
                {
                    for (int n = 0; n < vExecNodes.Count; n++)
                    {
                        // XMLDoc docExecNodes = ((JDFNode)
                        // vExecNodes.elementAt(n)).getOwnerDocument_KElement();
                        // docExecNodes.write2File ("temp\\" + "_" + docTest
                        // +"_ExecNode" + (n+1) +
                        // ".jdf", 0);
                        Console.WriteLine(vExecNodes[n]);
                    }
                }

                XMLDoc testResult = deviceCap.getBadJDFInfo(jdfRoot, testlists, level);
                if (testResult != null)
                {
                    testResult.write2File(sm_dirTestDataTemp + "_BugReport.xml", 0, true);
                }
            }
        }
Beispiel #25
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));
        }
Beispiel #26
0
        public virtual void testDeviceID()
        {
            bool bChanged = sc.setPhase(EnumNodeStatus.InProgress, "i", EnumDeviceStatus.Running, "r");

            Assert.IsTrue(bChanged);
            JDFDoc        docJMF     = sc.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response, EnumType.Status, 0);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);

            Assert.AreEqual(deviceID, deviceInfo.getDeviceID());
        }
Beispiel #27
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFResponse r = jmf.appendResponse();

            jmf.setSenderID("DeviceSenderID");
            r.setType(EnumType.Resource);
            ri = r.getCreateResourceInfo(0);
        }
Beispiel #28
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");
        }
Beispiel #29
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));
        }
Beispiel #30
0
        public virtual void testMultiModule()
        {
            StatusCounter scRIP = new StatusCounter(n,null,null);

            scRIP.addModule("ID_RIP","RIP");
            StatusCounter scSetter = new StatusCounter(n,null,null);

            scSetter.addModule("ID_Setter","Platesetter");

            MultiModuleStatusCounter msc = new MultiModuleStatusCounter();

            msc.addModule(scRIP);
            msc.addModule(scSetter);

            JDFExposedMedia m = (JDFExposedMedia)n.getMatchingResource("ExposedMedia",null,null,0);

            resID = m.getID();
            scRIP.setFirstRefID(resID);
            scRIP.addPhase(resID,200,0,true);
            bool bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");

            Assert.IsTrue(bChanged);
            JDFDoc        docJMF     = scRIP.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);
            JDFJobPhase   jp         = deviceInfo.getJobPhase(0);

            Assert.AreEqual(200,jp.getAmount(),0);
            scRIP.addPhase(resID,0,100,true);
            scRIP.setTrackWaste(m.getID(),true);
            bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");
            Assert.IsFalse(bChanged);
            JDFDoc dJMFAll = msc.getStatusResponse();

            Assert.AreEqual(dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,1);
            scSetter.setPhase(EnumNodeStatus.InProgress,"seti",EnumDeviceStatus.Running,"run");
            scSetter.setFirstRefID(resID);
            scSetter.addPhase(resID,400,0,true);
            dJMFAll = msc.getStatusResponse();
            Assert.AreEqual(2,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,"1 RIP, 1 setter");

            scRIP.setActiveNode(null,null,null);
            bChanged = scRIP.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(1,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);

            scSetter.setActiveNode(null,null,null);
            bChanged = scSetter.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(0,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);
        }