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); }
public override void setUp() { base.setUp(); JDFElement.setLongID(false); JDFDoc doc = new JDFDoc(ElementName.DEVICEINFO); di = (JDFDeviceInfo)doc.getRoot(); }
public virtual void testStatusDetails() { JDFDeviceInfo di = signal.appendDeviceInfo(); di.setDeviceCondition(EnumDeviceCondition.NeedsAttention); di.setDeviceStatus(EnumDeviceStatus.Stopped); di.setStatusDetails("OutputAreaFull PaperJam Repair"); doc.write2File(sm_dirTestDataTemp + "JMFStatusSignal.jmf", 2, false); Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete)); }
public virtual void testGetDeviceID() { JDFJMF jmf = (JDFJMF) new JDFDoc("JMF").getRoot(); jmf.setSenderID("S1"); di = jmf.appendSignal(EnumType.Status).appendDeviceInfo(); Assert.AreEqual(jmf.getSenderID(), di.getDeviceID()); di.appendDevice().setDeviceID("dd"); Assert.AreEqual("dd", di.getDeviceID()); di.setDeviceID("da"); Assert.AreEqual("da", di.getDeviceID()); }
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()); }
public virtual void testIsSamePhase() { JDFDeviceInfo di1 = (JDFDeviceInfo) new JDFDoc(ElementName.DEVICEINFO).getRoot(); JDFDeviceInfo di2 = (JDFDeviceInfo) new JDFDoc(ElementName.DEVICEINFO).getRoot(); Assert.IsTrue(di1.isSamePhase(di2, false)); di1.appendEmployee().setPersonalID("p1"); Assert.IsFalse(di1.isSamePhase(di2, false)); di2.appendEmployee().setPersonalID("p1"); Assert.IsTrue(di1.isSamePhase(di2, false)); di1.appendEmployee().setPersonalID("p2"); Assert.IsFalse(di1.isSamePhase(di2, false)); di2.appendEmployee().setPersonalID("p3"); Assert.IsFalse(di1.isSamePhase(di2, false)); }
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)); }
public virtual void testJMFDevCaps() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmfDC = doc.getJMFRoot(); JDFResponse r = jmfDC.appendResponse(EnumType.KnownMessages); jmfDC.setSenderID("DeviceSenderID"); JDFMessageService ms = r.appendMessageService(); ms.setJMFRole(EnumJMFRole.Sender); ms.setQuery(true); ms.setType("KnownDevices"); JDFDevCaps dcs = ms.appendDevCaps(); dcs.setName("DeviceList"); JDFDevCap dc = dcs.appendDevCapInPool(); JDFDevCap dcDI = dc.appendDevCap(); dcDI.setName(ElementName.DEVICEINFO); dcDI.setMinOccurs(1); dcDI.setMaxOccurs(1); JDFStringState state = dcDI.appendStringState(AttributeName.DEVICEID); state.setRequired(true); state = dcDI.appendStringState(AttributeName.DEVICESTATUS); state.setRequired(true); state.appendValueAllowedValue("Running"); ms = r.appendMessageService(); ms.setJMFRole(EnumJMFRole.Sender); ms.setQuery(true); ms.setType("KnownMessages"); dcs = ms.appendDevCaps(); dcs.setName("MessageService"); dc = dcs.appendDevCapInPool(); state = dc.appendStringState(AttributeName.TYPE); state.setRequired(true); state = dc.appendStringState("Foo"); state.setRequired(false); JDFActionPool ap = ms.appendActionPool(); JDFAction a = ap.appendActionTest(EnumTerm.IsPresentEvaluation, true); JDFTest t = a.getTest(); // JDFTerm term= t.getTerm(); // TODO JDFDoc docJMF = new JDFDoc("JMF"); JDFJMF jmf = docJMF.getJMFRoot(); for (int i = 0; i < 3; i++) { JDFResponse resp = jmf.appendResponse(EnumType.KnownDevices); JDFDeviceList dl = resp.appendDeviceList(); JDFDeviceInfo di = dl.appendDeviceInfo(); di.setDeviceID("d123"); di.setDeviceStatus(EnumDeviceStatus.Running); XMLDoc report = JDFDeviceCap.getJMFInfo(jmf, r, EnumFitsValue.Allowed, EnumValidationLevel.Complete, true); Assert.AreEqual("true", report.getRoot().getAttribute("IsValid")); } { JDFResponse resp = jmf.appendResponse(EnumType.KnownMessages); JDFMessageService mi = resp.appendMessageService(); mi.setType("FooBar"); doc.write2File(sm_dirTestDataTemp + "JMFDevCap.xml", 2, false); docJMF.write2File(sm_dirTestDataTemp + "JMFDevCapTest.jmf", 2, false); } XMLDoc report_1 = JDFDeviceCap.getJMFInfo(jmf, r, EnumFitsValue.Allowed, EnumValidationLevel.Complete, true); Assert.AreEqual("true", report_1.getRoot().getAttribute("IsValid")); doc.write2File(sm_dirTestDataTemp + "JMFDevCap.xml", 2, false); docJMF.write2File(sm_dirTestDataTemp + "JMFDevCapTest.jmf", 2, false); { jmf.appendResponse(EnumType.AbortQueueEntry); } report_1 = JDFDeviceCap.getJMFInfo(jmf, r, EnumFitsValue.Allowed, EnumValidationLevel.Complete, true); Assert.AreEqual("false", report_1.getRoot().getAttribute("IsValid")); }