public virtual void testDirectImage() { JDFElement.setLongID(false); doc = new JDFDoc("JDF"); node = doc.getJDFRoot(); node.setType(EnumType.Combined); VString vTypes = new VString("ImageSetting ConventionalPrinting", " "); node.setTypes(vTypes); nodeInfo = node.appendNodeInfo(); nodeInfo.setResStatus(EnumResStatus.Available, true); JDFRunList rl = (JDFRunList)node.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyInput, null); JDFByteMap bm = rl.appendByteMap(); bm.appendFileSpec().setURL("FileInfo:///foo.tif"); JDFExposedMedia xm = (JDFExposedMedia)node.appendMatchingResource(ElementName.EXPOSEDMEDIA, EnumProcessUsage.Plate, null); xm.setDescriptiveName("Real Plate"); xm.appendMedia(); JDFExposedMedia xmCyl = (JDFExposedMedia)node.appendMatchingResource(ElementName.EXPOSEDMEDIA, EnumProcessUsage.Cylinder, null); xmCyl.setDescriptiveName("Optional cylinder"); node.linkMatchingResource(xmCyl, EnumProcessUsage.AnyOutput, null); Assert.AreEqual(3, node.getResourceLinkPool().numChildElements("ExposedMediaLink", null), "2 for cylinder one for plate"); doc.write2File(sm_dirTestDataTemp + "webDirect.jdf", 2, false); }
public virtual void testInheritedVersionInfo() { JDFDoc doc = new JDFDoc(ElementName.JDF); JDFNode node = doc.getJDFRoot(); node.setVersion(JDFElement.EnumVersion.Version_1_3); node.setType(JDFConstants.PROCESSGROUP, true); node = node.addJDFNode("Scanning"); JDFNodeInfo ni = node.appendNodeInfo(); Assert.IsTrue(ni.hasAttribute(AttributeName.CLASS)); Assert.AreEqual(EnumVersion.Version_1_3, ni.getVersion(true)); }
public virtual void testMatchesPath() { JDFDoc doc = new JDFDoc(ElementName.JDF); JDFNode node = doc.getJDFRoot(); node.setType("Product", true); node.setVersion(JDFElement.EnumVersion.Version_1_3); JDFNodeInfo ni = node.appendNodeInfo(); ni = (JDFNodeInfo)ni.addPartition(EnumPartIDKey.Run, "R1"); JDFContact c = (JDFContact)node.addResource(ElementName.CONTACT, null, null, null, null, null, null); ni.refElement(c); JDFComChannel cc = (JDFComChannel)node.addResource(ElementName.COMCHANNEL, null, null, null, null, null, null); c.refElement(cc); Assert.IsTrue(ni.getContact() == c, "contact"); Assert.IsTrue(ni.hasChildElement(ElementName.CONTACT, null), "hasrefelement"); JDFRefElement re = (JDFRefElement)ni.getElement("ContactRef"); Assert.IsTrue(re.getTarget() == c, "refelementok"); Assert.IsTrue(c.getComChannel(0) == cc, "comchannel"); Assert.IsTrue(c.hasChildElement(ElementName.COMCHANNEL, null), "hasrefelement"); JDFNode n2 = node.addProduct(); JDFNodeInfo ni2 = n2.appendNodeInfo(); ni2.refElement(c); Assert.IsTrue(c.matchesPath("ResourcePool/NodeInfo/Contact", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("/JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("//JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("/JDF/*/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow * in matchespath"); Assert.IsFalse(cc.matchesPath("JDF/JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsFalse(cc.matchesPath("JDF/JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsFalse(c.matchesPath("ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); }
public virtual void testRefElement() { JDFDoc doc = new JDFDoc(ElementName.JDF); JDFNode node = doc.getJDFRoot(); node.setType("Product", true); node.setVersion(JDFElement.EnumVersion.Version_1_2); JDFNodeInfo ni = node.appendNodeInfo(); ni.appendElement("foo:bar", "www.foo.com"); // want a non jdf ns element // to see if any class casts // occur JDFContact c = (JDFContact)node.addResource(ElementName.CONTACT, null, null, null, null, null, null); VString vCTypes = new VString(); vCTypes.Add("Customer"); c.setContactTypes(vCTypes); ni.refElement(c); JDFComChannel cc = (JDFComChannel)node.addResource(ElementName.COMCHANNEL, null, null, null, null, null, null); c.refElement(cc); Assert.AreEqual(c, ni.getChildWithMatchingAttribute(ElementName.CONTACT, "ContactTypes", null, "Customer", 0, true, null), "contact"); Assert.AreEqual(c, ni.getParentJDF().getChildWithAttribute(ElementName.CONTACT, "ContactTypes", null, "Customer", 0, false), "contact"); Assert.AreEqual(c, ni.getContact(), "contact"); Assert.IsTrue(ni.hasChildElement(ElementName.CONTACT, null), "hasrefelement"); JDFRefElement re = (JDFRefElement)ni.getElement("ContactRef"); Assert.IsTrue(re.getTarget() == c, "refelementok"); Assert.IsTrue(c.getComChannel(0) == cc, "comchannel"); Assert.IsTrue(c.hasChildElement(ElementName.COMCHANNEL, null), "hasrefelement"); JDFNode n2 = node.addProduct(); JDFNodeInfo ni2 = n2.appendNodeInfo(); ni2.refElement(c); Assert.IsTrue(c.matchesPath("NodeInfo/Contact", true), "follow refs in matchespath"); Assert.IsTrue(cc.matchesPath("NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsFalse(c.matchesPath("NodeInfo/Contact/ComChannel", true), "follow refs in matchespath"); Assert.IsTrue(ni2.getContact() == c, "contact 2"); Assert.IsTrue(ni2.hasChildElement(ElementName.CONTACT, null), "hasrefelement 2"); re = (JDFRefElement)ni2.getElement("ContactRef"); Assert.IsTrue(re.getTarget() == c, "refelementok 2"); ni2.inlineRefElements(null, null, true); Assert.IsNull(ni2.getElement("ContactRef"), "get ref post inline"); Assert.IsNotNull(node.getResourcePool().getElement("Contact"), "refElement has been removed"); Assert.IsTrue(ni2.hasChildElement(ElementName.CONTACT, null), "haselement 3"); c = ni2.getContact(); re = (JDFRefElement)c.getElement("ComChannelRef"); Assert.IsTrue(re.getTarget() == cc, "refelementok 2"); ni2.inlineRefElements(null, null, false); Assert.IsNull(ni2.getElement("ComChannelRef"), "get ref post inline 2"); Assert.IsTrue(c.hasChildElement(ElementName.COMCHANNEL, null), "haselement 4"); ni.inlineRefElements(null, null, true); Assert.IsNull(ni.getElement("ContactRef"), "get ref post inline"); Assert.IsNull(node.getResourcePool().getElement("Contact"), "refElement has been removed"); Assert.IsTrue(ni.hasChildElement(ElementName.CONTACT, null), "haselement 3"); c = ni.getContact(); c.makeRootResource(null, null, true); re = (JDFRefElement)ni.getElement("ContactRef"); re.deleteRef(true); Assert.IsNull(c.getElement("ContactRef")); }
public virtual void testCombinedVarnish() { JDFElement.setLongID(false); JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); VString vCombiNodes = new VString("ConventionalPrinting Varnishing", " "); VString vSeparations = new VString("Cyan Magenta Yellow Black Varnish", " "); n.setCombined(vCombiNodes); JDFConventionalPrintingParams cpp = (JDFConventionalPrintingParams)n.addResource(ElementName.CONVENTIONALPRINTINGPARAMS, null, EnumUsage.Input, null, null, null, null); cpp.setModuleAvailableIndex(new JDFIntegerRangeList("1 ~ 6")); cpp.setModuleIndex(new JDFIntegerRangeList("1 ~ 4 6")); cpp.appendXMLComment("Module 0 and 7 are varnishing modules, 1-4 are process colors and 6 is the ink module used to varnish", null); n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null); JDFExposedMedia xm = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null); n.appendNodeInfo(); JDFMedia media = xm.appendMedia(); media.setMediaType(EnumMediaType.Plate); JDFInk ink = (JDFInk)n.appendMatchingResource("Ink", JDFNode.EnumProcessUsage.AnyInput, null); JDFResource vp = n.addResource("VarnishingParams", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null); JDFExposedMedia xmVarnish = (JDFExposedMedia)n.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null); JDFMedia mediaVarnish = xmVarnish.appendMedia(); mediaVarnish.setAttribute("MediaType", "Sleeve"); JDFResourceLink rl = n.getLink(xmVarnish, null); JDFColorantControl cc = (JDFColorantControl)n.appendMatchingResource(ElementName.COLORANTCONTROL, JDFNode.EnumProcessUsage.AnyInput, null); cc.getCreateDeviceColorantOrder().appendXMLComment("Should the VarnishingParams seps be excluded, as is shown here?", null); cc.getCreateDeviceColorantOrder().setSeparations(vSeparations); rl.setCombinedProcessIndex(new JDFIntegerList("1")); vSeparations.addAll(new VString("PreVarnish Varnish2", " ")); for (int i = 0; i < vSeparations.Count; i++) { string sep = vSeparations.stringAt(i); ink.addPartition(EnumPartIDKey.Separation, sep); if (!sep.Equals("PreVarnish") && !sep.Equals("Varnish2")) { xm.addPartition(EnumPartIDKey.Separation, sep); } if (sep.Equals("Varnish2")) { vp.appendXMLComment("full varnishing in a varnishing module with or wihtout a sleeve. Full varnishing means to cover the complete media surface.", null); xmVarnish.addPartition(EnumPartIDKey.Separation, sep); JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep); varnishPart.setAttribute("ModuleIndex", "7"); varnishPart.setAttribute("VarnishMethod", "Sleeve"); varnishPart.setAttribute("VarnishArea", "Spot"); } else if (sep.Equals("Varnish")) { vp.appendXMLComment("varnishing in a printing module only with a mandatory plate. The plate may be exposed or not, for example, for full varnihing. ", null); // xmVarnish.addPartition(EnumPartIDKey.Separation, sep); JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep); varnishPart.setAttribute("ModuleIndex", "6"); varnishPart.setAttribute("VarnishMethod", "Plate"); varnishPart.setAttribute("VarnishArea", "Full"); } else if (sep.Equals("PreVarnish")) { vp.appendXMLComment("varnishing in a varnishing module only with a mandatory prepared sleeve ", null); xmVarnish.addPartition(EnumPartIDKey.Separation, sep); JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep); varnishPart.setAttribute("ModuleIndex", "0"); varnishPart.setAttribute("VarnishMethod", "Sleeve"); varnishPart.setAttribute("VarnishArea", "Full"); } } d.write2File(sm_dirTestDataTemp + "varnishing.jdf", 2, true); }
protected internal static JDFDoc creatXMDoc() { JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_3); JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); n.setJobPartID("P1"); n.setJobID("J1"); n.setType("ConventionalPrinting", true); n.appendElement("NS:Foobar", "www.foobar.com"); n.appendMatchingResource("Layout", JDFNode.EnumProcessUsage.AnyInput, null); JDFComponent comp = (JDFComponent)n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null); JDFExposedMedia xm = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null); JDFNodeInfo ni = n.appendNodeInfo(); JDFMedia m = xm.appendMedia(); m.appendElement("NS:FoobarMedia", "www.foobar.com"); Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass(), "m Class"); VString vs = new VString(); vs.Add("SignatureName"); vs.Add("SheetName"); vs.Add("Side"); JDFAttributeMap mPart1 = new JDFAttributeMap("SignatureName", "Sig1"); mPart1.put("SheetName", "S1"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("SheetName", "S2"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("SignatureName", "Sig2"); mPart1.put("SheetName", "S1"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); comp.appendElement("foo:bar", "www.foobar.com"); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("SheetName", "S2"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); return(doc); }