private JDFResourceCmdParams createResourceParams(string strJobPartID, string strResourceID, JDFAttributeMap amParts, JDFAttributeMap amAttr) { JDFJMF jmf = JDFJMF.createJMF(EnumFamily.Command, JDFMessage.EnumType.Resource); JDFCommand cmd = jmf.getCommand(0); JDFResourceCmdParams @params = cmd.appendResourceCmdParams(); const string strJobID = "RefJob-1"; const string strPartIDKeys = "SignatureName SheetName Side"; @params.setJobID(strJobID); @params.setJobPartID(strJobPartID); @params.setResourceID(strResourceID); @params.setResourceName("NodeInfo"); @params.setUpdateMethod(EnumUpdateMethod.Incremental); @params.setPartMap(amParts); JDFResource nodeInfo = @params.appendResource("NodeInfo"); JDFResource resLeaf = nodeInfo.getCreatePartition(amParts, new VString(strPartIDKeys, null)); resLeaf.setAttributes(amAttr); return(@params); }
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")); }
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"); }
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)); }
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); }
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)); }
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); }
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)); }
public virtual void testApplyResourceCmdNodeInfo() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFCommand c = jmf.appendCommand(); jmf.setSenderID("DeviceSenderID"); c.setType(EnumType.Resource); JDFResourceCmdParams rqp = c.appendResourceCmdParams(); rqp.setJobID("JobID"); rqp.setJobPartID("JobPartID"); rqp.setResourceName(ElementName.NODEINFO); rqp.setUsage(EnumUsage.Input); JDFNodeInfo niRQP = (JDFNodeInfo)rqp.appendElement(ElementName.NODEINFO); JDFAttributeMap sheetMap = new JDFAttributeMap("SheetName", "S1"); rqp.setPartMap(sheetMap); JDFNodeInfo niRQPS1 = (JDFNodeInfo)niRQP.getCreatePartition(sheetMap, null); niRQPS1.setNodeStatus(EnumNodeStatus.Aborted); JDFDoc docJDF = new JDFDoc(ElementName.JDF); JDFNode jdf = docJDF.getJDFRoot(); jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting); jdf.setStatus(EnumNodeStatus.Waiting); jdf.setJobID("JobID"); jdf.setJobPartID("JobPartID"); Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getPartStatus(null)); Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getStatus()); rqp.applyResourceCommand(jdf); Assert.AreEqual(EnumNodeStatus.Part, jdf.getStatus()); Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getNodeInfo().getNodeStatus()); Assert.AreEqual(EnumNodeStatus.Aborted, jdf.getPartStatus(sheetMap)); sheetMap = new JDFAttributeMap("SheetName", "S2"); rqp.setPartMap(sheetMap); niRQPS1.setAttributes(sheetMap); niRQPS1.setNodeStatus(EnumNodeStatus.Completed); rqp.applyResourceCommand(jdf); Assert.AreEqual(EnumNodeStatus.Part, jdf.getStatus()); Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getNodeInfo().getNodeStatus()); Assert.AreEqual(EnumNodeStatus.Completed, jdf.getPartStatus(sheetMap)); }
public virtual void testgetSubmissionParams() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); Assert.IsNull(jmf.getSubmissionURL()); JDFCommand c = jmf.appendCommand(EnumType.ResubmitQueueEntry); Assert.IsNull(jmf.getSubmissionURL()); JDFResubmissionParams rsp = c.appendResubmissionParams(); Assert.IsNull(jmf.getSubmissionURL()); rsp.setURL("url"); Assert.AreEqual("url", jmf.getSubmissionURL()); }
public virtual void testGetIdentifier() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFQuery c = jmf.appendQuery(); jmf.setSenderID("MISSenderID"); c.setType(EnumType.Resource); JDFResourceQuParams rqp = c.getCreateResourceQuParams(0); rqp.setJobID("J1"); rqp.setJobPartID("p2"); Assert.AreEqual(new NodeIdentifier("J1", "p2", null), rqp.getIdentifier()); }
public virtual void testConvertResponses() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFDoc doc2 = new JDFDoc(ElementName.JMF); JDFJMF jmf2 = doc2.getJMFRoot(); JDFResponse r = jmf2.appendResponse(); JDFQuery q = jmf.appendQuery(); q.setType("KnownMessages"); r.setQuery(q); Assert.AreEqual(q.getID(), r.getrefID(), "refID"); jmf2.convertResponses(q); Assert.IsNull(jmf2.getResponse(0)); Assert.AreEqual(q.getID(), jmf2.getSignal(0).getrefID()); }