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); }
/// /// <summary> * Append a Notification audit element with a Class attribute of Severity /// * </summary> /// * <param name="by"> the author keyword </param> /// * <param name="s"> the severity /// * </param> /// * <returns> JDFAudit - the newly created Notification audit </returns> /// public virtual JDFNotification addNotification(JDFNotification.EnumClass severity, string by, VJDFAttributeMap vmParts) { JDFNotification l = (JDFNotification)addAudit(JDFAudit.EnumAuditType.Notification, by); if (l != null) { if (severity != null) { l.setClass(severity); } l.setPartMapVector(vmParts); } return(l); }
public virtual void testError() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFResponse r = (JDFResponse)jmf.appendMessageElement(EnumFamily.Response, null); r.setType("Status"); r.setrefID("r1"); JDFNotification n = r.setErrorText("blub"); Assert.AreEqual("blub", n.getComment(0).getText(), "get comment text"); Assert.AreEqual("Error", n.getType(), "type"); Assert.IsTrue(r.isValid(EnumValidationLevel.Complete)); jmf.setSenderID("S1"); Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete)); }
public virtual void testAuditsImageSetting() { for (int i = 0; i < vsSheet.Count; i++) { string sheet = vsSheet.stringAt(i); VJDFAttributeMap vmP = new VJDFAttributeMap(); JDFAttributeMap attributeMap = new JDFAttributeMap(EnumPartIDKey.SheetName, sheet); attributeMap.put("SignatureName", "Sig1"); vmP.Add(attributeMap); statCounter.setActiveNode(n, vmP, vRL); string refXM = rlXMOut.getrRef(); string refMedia = rlMediaIn.getrRef(); statCounter.setTrackWaste(refXM, true); statCounter.setTrackWaste(refMedia, false); statCounter.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn"); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); statCounter.addPhase(refMedia, 5, 0, true); statCounter.addPhase(refXM, 5, 0, true); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); // JDFResourceAudit ra= statCounter.setResourceAudit(refMedia, EnumReason.ProcessResult); JDFProcessRun pr = statCounter.setProcessResult(EnumNodeStatus.Completed); pr.setDescriptiveName("we even have the utterly useless ProcessRun"); } d.write2File(sm_dirTestDataTemp + "ImageSetAmount_.jdf", 2, false); JDFDoc d2 = statCounter.getDocJMFResource(); JDFJMF jmf = d2.getJMFRoot(); jmf.convertResponses(null); JDFSignal sig = jmf.appendSignal(org.cip4.jdflib.jmf.JDFMessage.EnumType.Notification); JDFNotification not = sig.appendNotification(); not.setXPathAttribute("MileStone/@MileStoneType", "PrepressCompleted"); not.setXPathAttribute("MileStone/@Amount", "5"); d2.write2File(sm_dirTestDataTemp + "ImageSetAmount_.jmf", 2, false); JDFDoc dStatusJMF = statCounter.getDocJMFPhaseTime(); jmf = dStatusJMF.getJMFRoot(); jmf.convertResponses(null); dStatusJMF.write2File(sm_dirTestDataTemp + "ImageSetPhaseTime_.jmf", 2, false); }
public virtual void testInit() { JDFDoc doc = new JDFDoc(ElementName.JDF); JDFNode root = doc.getJDFRoot(); JDFComment cRoot = root.appendComment(); Assert.IsNotNull(cRoot.getAttribute(AttributeName.ID, null, null)); Assert.IsTrue(cRoot.isValid(EnumValidationLevel.Complete)); root.setVersion(JDFElement.EnumVersion.Version_1_2); JDFAuditPool ap = root.getCreateAuditPool(); JDFNotification notif = ap.addNotification(JDFNotification.EnumClass.Information, "Me", null); JDFComment c = notif.appendComment(); c.setText("This element should have no ID attribute"); string id = c.getAttribute(AttributeName.ID, null, null); Assert.IsNull(id); }
/// /// <summary> * Set ErrorText, (Notification/Comment/#text) also sets Notification/@Type=Error and Notification/@Class=Error /// * doesn't create a notification if ErroerText=null /// * </summary> /// * <param name="errorText"> new error text </param> /// * <returns> JDFNotification the newly created Notification element </returns> /// public virtual JDFNotification setErrorText(string errorText) { JDFNotification n = getCreateNotification(); n.setType("Error"); n.setClass(JDFNotification.EnumClass.Error); if (errorText != null) { JDFComment c = n.getComment(0); if (c != null) { c.appendText("\n"); } else { c = n.appendComment(); } c.appendText(errorText); } return(n); }