public virtual void testgetMatchingElementsFromParentMulti() { JDFDoc ddc = new JDFDoc("DevCap"); JDFDoc dde = new JDFDoc("Layout"); JDFDevCap dc = (JDFDevCap)ddc.getRoot(); JDFLayout e = (JDFLayout)dde.getRoot(); for (int i = 0; i < 2; i++) { JDFDevCap dc1 = dc.appendDevCap(); dc1.setName("Media"); dc1.setMaxOccurs(1); dc1.setMinOccurs(1); JDFEnumerationState es = dc1.appendEnumerationState("MediaType"); string mediaType = i == 0 ? "Paper" : "Plate"; es.setAllowedValueList(new VString(mediaType, null)); e.appendElement("Media").setAttribute("MediaType", mediaType); } VElement devCapVector = dc.getDevCapVector(null, true); for (int i = 0; i < 2; i++) { VElement vMatch = ((JDFDevCap)devCapVector.item(i)).getMatchingElementsFromParent(e, devCapVector); Assert.AreEqual(1, vMatch.Count); Assert.AreEqual(e.getElement("Media", null, i), vMatch.item(0)); } }
public virtual void testgetMatchingElementsFromParentSingle() { JDFDoc ddc = new JDFDoc("DevCap"); JDFDoc dde = new JDFDoc("Layout"); JDFDevCap dc = (JDFDevCap)ddc.getRoot(); JDFLayout e = (JDFLayout)dde.getRoot(); JDFDevCap dc1 = dc.appendDevCap(); dc1.setName("Media"); dc1.setMaxOccurs(1); dc1.setMinOccurs(1); for (int i = 0; i < 2; i++) { string mediaType = i == 0 ? "Paper" : "Plate"; e.appendElement("Media").setAttribute("MediaType", mediaType); } VElement devCapVector = dc.getDevCapVector(null, true); VElement vMatch = ((JDFDevCap)devCapVector.item(0)).getMatchingElementsFromParent(e, devCapVector); Assert.AreEqual(2, vMatch.Count); Assert.AreEqual(e.getElement("Media", null, 0), vMatch.item(0)); Assert.AreEqual(e.getElement("Media", null, 1), vMatch.item(1)); }
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")); }
public override void setUp() { JDFDoc doc = new JDFDoc("Device"); device = (JDFDevice)doc.getRoot(); base.setUp(); { devicecap = device.appendDeviceCap(); devicecap.setCombinedMethod(EnumCombinedMethod.None); devicecap.setTypeExpression("(fnarf)|(blub)"); devicecap.setTypes(new VString("fnarf blub", null)); devicecap.setGenericAttributes(new VString("*", null)); JDFDevCapPool dcp = devicecap.appendDevCapPool(); JDFDevCaps dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Element); dcs.setName("AuditPool"); dcs.setRequired(true); JDFDevCap dc = dcp.appendDevCap(); dc.setID("dc_AuditPool"); dcs.setDevCapRef(dc); dc = dc.appendDevCap(); dc.setName("Created"); dc.setID("dc_Created"); dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Element); dcs.setName("AncestorPool"); dc = dcs.appendDevCap(); dc.setMinOccurs(0); dc.setID("dc_AncestorPool"); JDFDevCap dc2 = dc.appendDevCap(); dc2.setID("dc_Ancestor"); dc2.setName("Ancestor"); for (int pu = 0; pu < 2; pu++) { dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Resource); dcs.setName("RunList"); dcs.setLinkUsage(EnumUsage.Input); dcs.setProcessUsage(pu == 0 ? "Document" : "Marks"); dc = dcs.appendDevCap(); if (pu == 0) { dc.setID("dc_RL_Doc"); dc.setMinOccurs(1); } else { dc.setID("dc_RL_Mark"); dc.setMinOccurs(0); } } dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Resource); dcs.setName("Layout"); dcs.setLinkUsage(EnumUsage.Input); dc = dcs.appendDevCap(); dc.setID("dc_Layout"); dc.setMinOccurs(1); JDFDevCap coDC = dc.appendDevCap(); coDC.setName(ElementName.CONTENTOBJECT); coDC.setMinOccurs(2); JDFNumberState st = coDC.appendNumberState(AttributeName.CTM); st.setRequired(true); st.setListType(EnumListType.List); st.setMinOccurs(6); st.setMaxOccurs(6); st.setHasDefault(true); st.setAttribute("DefaultValue", "1 0 0 1 1 1"); dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Link); dcs.setLinkUsage(EnumUsage.Input); dcs.setName("Layout"); dc = dcs.appendDevCap(); dc.setID("dc_LayoutLink"); dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Element); dcs.setName("JDF"); dc = dcp.appendDevCap(); dc.setID("dc_JDF"); dcs.setDevCapRef(dc); doc.write2File(sm_dirTestDataTemp + "devCapDefaults.jdf", 2, false); } { devicecapProduct = device.appendDeviceCap(); List <ValuedEnum> vMethods = new List <ValuedEnum>(); vMethods.Add(EnumCombinedMethod.None); vMethods.Add(EnumCombinedMethod.ProcessGroup); vMethods.Add(EnumCombinedMethod.Combined); devicecapProduct.setCombinedMethod(vMethods); devicecapProduct.setTypeExpression("((fnarf)|(blub))( (fnarf)|(blub))*"); devicecapProduct.setTypes(new VString("fnarf blub", null)); JDFDevCapPool dcp = devicecapProduct.appendDevCapPool(); JDFDevCaps dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Element); dcs.setName("AuditPool"); dcs.setRequired(true); JDFDevCap dc = dcp.appendDevCap(); dc.setID("dc_AuditPool"); dcs.setDevCapRef(dc); dc = dc.appendDevCap(); dc.setName("Created"); dc.setID("dc_Created"); dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Resource); dcs.setName("Layout"); dcs.setLinkUsage(EnumUsage.Input); dc = dcs.appendDevCap(); dc.setID("dc_Layout"); dc.setMinOccurs(1); JDFDevCap coDC = dc.appendDevCap(); coDC.setName(ElementName.CONTENTOBJECT); coDC.setMinOccurs(2); coDC.setMaxOccurs(999); JDFNumberState st = coDC.appendNumberState(AttributeName.CTM); st.setRequired(true); st.setListType(EnumListType.List); st.setMinOccurs(6); st.setMaxOccurs(6); st.setHasDefault(true); st.setAttribute("DefaultValue", "1 0 0 1 1 1"); dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Link); dcs.setLinkUsage(EnumUsage.Input); dcs.setName("Layout"); dc = dcs.appendDevCap(); dc.setID("dc_LayoutLink"); dcs = devicecap.appendDevCaps(); dcs.setContext(EnumContext.Element); dcs.setName("JDF"); dc = dcp.appendDevCap(); dc.setID("dc_JDF"); dcs.setDevCapRef(dc); } }