コード例 #1
0
 ///
 ///	 <summary> * returns true if this is the same phase, i.e. the
 ///	 *  </summary>
 ///	 * <param name="lastphase"> the phase to compare with </param>
 ///	 * <param name="bExact"> if true, use startTime as hook, else compare stati
 ///	 * @return </param>
 ///
 public virtual bool isSamePhase(JDFJobPhase lastphase, bool bExact)
 {
     if (lastphase == null)
     {
         return(false);
     }
     if (bExact)
     {
         JDFDate startTime     = getPhaseStartTime();
         JDFDate lastStartTime = lastphase.getPhaseStartTime();
         return(startTime != null && startTime.Equals(lastStartTime));
     }
     if (!ContainerUtil.Equals(getStatus(), lastphase.getStatus()))
     {
         return(false);
     }
     if (!ContainerUtil.Equals(getStatusDetails(), lastphase.getStatusDetails()))
     {
         return(false);
     }
     if (!ContainerUtil.Equals(getIdentifier(), lastphase.getIdentifier()))
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
ファイル: JDFDeviceInfoTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testMergeLastPhase()
        {
            JDFDoc       d  = new JDFDoc("JDF");
            JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool();
            JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null);
            JDFJobPhase  jp = di.createJobPhaseFromPhaseTime(pt);

            jp.setPhaseAmount(200);
            jp.setAmount(200);
            jp.setPhaseWaste(100);
            JDFDate       d1  = jp.getPhaseStartTime();
            JDFDoc        doc = new JDFDoc(ElementName.DEVICEINFO);
            JDFDeviceInfo di2 = (JDFDeviceInfo)doc.getRoot();

            JDFJobPhase jp2 = (JDFJobPhase)di2.copyElement(jp, null);

            jp2.setPhaseStartTime(new JDFDate());
            StatusCounter.sleep(1000);
            jp2.setPhaseAmount(300);
            jp2.setPhaseWaste(30);
            jp2.setAmount(500);
            Assert.IsTrue(di2.mergeLastPhase(di));
            Assert.AreEqual(d1, jp2.getPhaseStartTime());
            Assert.AreEqual(130.0, jp2.getPhaseWaste(), 0.0);
            Assert.AreEqual(500.0, jp2.getPhaseAmount(), 0.0);
            Assert.AreEqual(500.0, jp2.getAmount(), 0.0);
        }
コード例 #3
0
 ///
 ///	 <summary> * return the differential waste amount produced between this phase and lastphase
 ///	 *  </summary>
 ///	 * <param name="lastphase">
 ///	 * @return </param>
 ///
 public virtual double getWasteDifference(JDFJobPhase lastphase)
 {
     if (isSamePhase(lastphase, true))
     {
         return(getPhaseWaste() - lastphase.getPhaseWaste());
     }
     return(getPhaseWaste());
 }
コード例 #4
0
        public virtual void testGetPhaseWaste()
        {
            JDFDoc       d  = new JDFDoc("JDF");
            JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool();
            JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null);
            JDFJobPhase  jp = di.createJobPhaseFromPhaseTime(pt);

            jp.setWaste(42);
            Assert.AreEqual(42.0, jp.getPhaseWaste(), 0.0);
        }
コード例 #5
0
 ///
 ///	 <summary> * creates a new phasetime that spans lastphase and this phase
 ///	 *  </summary>
 ///	 * <param name="lastphase"> the phase to merge </param>
 ///	 * <returns> true if successful </returns>
 ///
 public virtual bool mergeLastPhase(JDFJobPhase lastphase)
 {
     if (!isSamePhase(lastphase, false))
     {
         return(false);
     }
     setStartTime(lastphase.getStartTime());
     setPhaseAmount(getPhaseAmount() + lastphase.getPhaseAmount());
     setPhaseWaste(getPhaseWaste() + lastphase.getPhaseWaste());
     return(true);
 }
コード例 #6
0
        public virtual void testGetAmountDifference()
        {
            JDFDoc       d  = new JDFDoc("JDF");
            JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool();
            JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null);
            JDFJobPhase  jp = di.createJobPhaseFromPhaseTime(pt);

            jp.setAmount(42);
            Assert.AreEqual(42.0, jp.getAmountDifference(null), 0.0);
            JDFJobPhase jp2 = (JDFJobPhase)di.copyElement(jp, null);

            jp2.setAmount(62);
            Assert.AreEqual(20.0, jp2.getAmountDifference(jp), 0.0);
        }
コード例 #7
0
        public virtual void testApplyNode()
        {
            JDFNode n = new JDFDoc("JDF").getJDFRoot();

            n.setJobID("j1");
            n.setJobPartID("p2");
            JDFJobPhase jp = di.appendJobPhase();

            jp.applyNode(null);
            Assert.IsNull(jp.getJobID());
            jp.applyNode(n);
            Assert.AreEqual("j1", jp.getJobID());
            Assert.AreEqual(jp.getActivation().getName(), n.getActivation(true).getName());
        }
コード例 #8
0
        public virtual void testInheritedPhase()
        {
            JDFDeviceInfo di = signal.appendDeviceInfo();

            di.setDeviceCondition(EnumDeviceCondition.NeedsAttention);
            di.setDeviceStatus(EnumDeviceStatus.Stopped);
            di.setStatusDetails("OutputAreaFull PaperJam Repair");

            JDFJobPhase jp = di.appendJobPhase();

            Assert.AreEqual(jp.getJobID(), sqp.getJobID());
            Assert.AreEqual(jp.getJobPartID(), sqp.getJobPartID());
            jp.setJobID("foo");
            Assert.AreEqual("foo", jp.getJobID());
        }
コード例 #9
0
        public virtual void testJobPhaseFromPhaseTime()
        {
            JDFDoc       d  = new JDFDoc("JDF");
            JDFAuditPool ap = d.getJDFRoot().getCreateAuditPool();
            JDFPhaseTime pt = ap.setPhase(EnumNodeStatus.InProgress, "dummy", null, null);
            JDFJobPhase  jp = di.createJobPhaseFromPhaseTime(pt);

            Assert.IsFalse(pt.hasChildElement(ElementName.MISDETAILS, null));
            JDFMISDetails misDetails = pt.appendMISDetails();

            misDetails.setWorkTypeDetails("FooBar");
            misDetails.setWorkType(EnumWorkType.Alteration);
            jp = di.createJobPhaseFromPhaseTime(pt);
            Assert.AreEqual(pt.getMISDetails().getWorkType(), jp.getMISDetails().getWorkType());
            Assert.IsTrue(jp.hasAttribute(AttributeName.PHASESTARTTIME));
        }
コード例 #10
0
        public virtual void testJobPhase()
        {
            JDFDoc    doc = new JDFDoc(ElementName.JMF);
            JDFJMF    jmf = doc.getJMFRoot();
            JDFSignal s   = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, null);

            s.setType("Status");
            JDFStatusQuParams sqp = s.appendStatusQuParams();

            sqp.setDeviceDetails(EnumDeviceDetails.Brief);
            JDFDeviceInfo di = s.appendDeviceInfo();
            JDFJobPhase   jp = di.appendJobPhase();

            Assert.AreEqual(di.getJobPhase(0), jp);
            jp = (JDFJobPhase)di.appendElement("jdf:JobPhase", JDFElement.getSchemaURL());
            Assert.AreEqual(di.getJobPhase(1), jp);
            Assert.IsNull(di.getJobPhase(2));
            jp.appendNode();
            Assert.IsTrue(jp.isValid(EnumValidationLevel.Incomplete));
        }