public virtual void testGetNumberState() { JDFDoc d = new JDFDoc("DevCap"); JDFDevCap dc = (JDFDevCap)d.getRoot(); JDFNumberState ns = dc.appendNumberState("foo"); Assert.AreEqual("foo", ns.getName()); ns = dc.getNumberState("bar"); Assert.IsNull(ns); ns = dc.getCreateNumberState("bar"); Assert.IsNotNull(ns); Assert.AreEqual("bar", ns.getName()); ns = dc.getNumberState("bar"); Assert.IsNotNull(ns); Assert.AreEqual("bar", ns.getName()); }
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); } }