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); }
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)); }
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); }
public override void setUp() { d = creatXMDoc(); n = d.getJDFRoot(); xpMedia = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", null, null, 0); JDFResourceLink rlxp = n.getLink(xpMedia, null); rlxp.setAmount(100, null); sc = new StatusCounter(n, null, null); deviceID = "Status-counter-TestDevice"; sc.setDeviceID(deviceID); resID = xpMedia.getID(); sc.setFirstRefID(resID); sc.addPhase(resID, 200, 0, true); employee = (JDFEmployee) new JDFDoc("Employee").getRoot(); employee.setPersonalID("P1"); base.setUp(); }