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 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()); }
public virtual void testResourceQuParams() { 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); List <ValuedEnum> vClasses = new List <ValuedEnum>(); vClasses.Add(EnumResourceClass.Consumable); vClasses.Add(EnumResourceClass.Handling); rqp.setClasses(vClasses); Assert.AreEqual(vClasses.ToString(), rqp.getClasses().ToString()); }
public virtual void testMediaCatalog() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); jmf.setSenderID("DeviceSenderID"); JDFQuery q = jmf.appendQuery(EnumType.Resource); q.setXMLComment("This is the query for a catalog"); JDFResourceQuParams rqp = q.appendResourceQuParams(); rqp.setExact(true); rqp.setXMLComment("Scope=Allowed is a new attribute to describe that we want a complet list of all known resources"); rqp.setResourceName(ElementName.MEDIA); // rqp.setAttribute("Scope", "Allowed"); JDFResponse r = q.createResponse().getResponse(0); r = (JDFResponse)jmf.moveElement(r, null); r.setXMLComment("This is the response to the query - generally it will be in it's own jmf...\nThe list of ResourceInfo + the ResourceQuParams could also be specified in a Signal."); for (int i = 1; i < 5; i++) { JDFResourceInfo ri = r.appendResourceInfo(); ri.setResourceName("Media"); JDFMedia m = (JDFMedia)ri.appendResource("Media"); m.setDescriptiveName("Description of Media #" + i); m.setDimensionCM(new JDFXYPair(i * 10, 13 + i % 2 * 20)); m.setBrand("Brand #" + i); m.setProductID("ProductID_" + i); m.setMediaType(EnumMediaType.Paper); m.setResStatus((i < 2 ? EnumResStatus.Available : EnumResStatus.Unavailable), false); ri.setXMLComment("More attributes can be added as needed; Available = loaded"); } doc.write2File(sm_dirTestDataTemp + "MediaCatalog.jmf", 2, false); Assert.IsTrue(jmf.isValid(EnumValidationLevel.Complete)); }