public virtual void testSetTarget() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setVersion(JDFElement.EnumVersion.Version_1_3); n.setType("ConventionalPrinting", true); JDFExposedMedia xm = (JDFExposedMedia)n.addResource(ElementName.EXPOSEDMEDIA, null, EnumUsage.Input, null, null, null, null); JDFExposedMedia xm1 = (JDFExposedMedia)xm.addPartition(JDFResource.EnumPartIDKey.SignatureName, "Sig1"); VJDFAttributeMap vSig1 = new VJDFAttributeMap(); vSig1.Add(xm1.getPartMap()); // want a lower leaf partition xm1.addPartition(JDFResource.EnumPartIDKey.SheetName, "Sheet1"); JDFMedia m = xm.appendMedia(); JDFResourceLink rl = n.linkResource(xm, EnumUsage.Input, null); try { rl.setTarget(m); Assert.Fail("no link to subelem"); } catch (JDFException) { // nop } rl.setTarget(xm1); Assert.AreEqual(vSig1, rl.getPartMapVector()); }
/// /// * <param name="xm"> /// * @return </param> /// protected internal virtual JDFMedia initPlateMedia() { if (theParentNode != null) { theNode.ensureLink(theParentNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0), EnumUsage.Input, null); } JDFMedia m = (JDFMedia)theNode.getCreateResource(ElementName.MEDIA, EnumUsage.Input, 0); if (EnumMediaType.Paper.Equals(m.getMediaType())) { m = (JDFMedia)theNode.getCreateResource(ElementName.MEDIA, EnumUsage.Input, 1); } m.setResStatus(EnumResStatus.Available, false); m.makeRootResource(null, theNode.getJDFRoot(), true); theNode.getJDFRoot().getCreateResourcePool().moveElement(m, null); m.setDescriptiveName("the plates to use"); m.setMediaType(EnumMediaType.Plate); m.setPartUsage(EnumPartUsage.Implicit); if (bPartitionedPlateMedia && vParts != null) { VJDFAttributeMap vSheets = getReducedMap(new VString("Side Separation PartVersion", null)); for (int i = 0; i < vSheets.Count; i++) { JDFAttributeMap part = new JDFAttributeMap(vSheets[i]); // JDFResource mm= m.getCreatePartition(part, partIDKeys); } } else { m.setDimensionCM(new JDFXYPair(70, 102)); } return(m); }
public virtual void testGetTarget() { JDFDoc d = JDFTestCaseBase.creatXMDoc(); JDFNode n = d.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0); JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1"); mPart.put("SignatureName", "S12234"); mPart.put("SheetName", "S12"); mPart.put("Side", "Front"); JDFExposedMedia xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null); JDFMedia m = xm.getMedia(); m = (JDFMedia)m.makeRootResource(null, null, true); xmPart.refElement(m); Assert.AreEqual(xmPart.getMedia(), m); mPart.put("Side", "Back"); xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null); JDFMedia medPart = (JDFMedia)m.getCreatePartition(mPart, xm.getPartIDKeys()); xmPart.refElement(medPart); Assert.AreEqual(xmPart.getMedia(), medPart); JDFRefElement re = (JDFRefElement)xmPart.getElement("MediaRef"); Assert.AreEqual(re.getPartMap(), mPart); }
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 testWasteAmount() { VJDFAttributeMap singleMap = new VJDFAttributeMap(); singleMap.Add(xpMedia.getPartMapVector(false)[0]); MISCPGoldenTicket gt = new MISCPGoldenTicket(2, EnumVersion.Version_1_3, 2, 2, false, singleMap); gt.good = 1000; gt.waste = 100; gt.assign(null); n = gt.getNode(); JDFComponent c = (JDFComponent)n.getResource(ElementName.COMPONENT, null, 0); JDFMedia m = (JDFMedia)n.getResource(ElementName.MEDIA, null, 0); JDFResourceLink rl = n.getLink(c, null); JDFResourceLink rlMedia = n.getLink(m, null); VElement vRL = new VElement(); vRL.Add(rl); vRL.Add(rlMedia); sc = new StatusCounter(null, null, null); sc.setTrackWaste(rl.getrRef(), true); sc.setTrackWaste(rlMedia.getrRef(), true); sc.setActiveNode(n, c.getPartMapVector(false), vRL); Assert.AreEqual(100, sc.getPlannedWaste(rlMedia.getrRef()), 0); Assert.AreEqual(1000, sc.getPlannedAmount(rl.getrRef()), 0); }
public virtual void testGetResource() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFCommand c = jmf.appendCommand(EnumType.PipePull); JDFPipeParams pp = c.appendPipeParams(); JDFExposedMedia xm = (JDFExposedMedia)pp.appendResource(ElementName.EXPOSEDMEDIA); Assert.AreEqual(EnumResourceClass.Handling, xm.getResourceClass()); JDFMedia m = (JDFMedia)pp.appendResource(ElementName.MEDIA); Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass()); JDFRefElement rm = xm.refElement(m); Assert.AreEqual(m, rm.getTarget()); Assert.AreEqual(xm, pp.getResource(ElementName.EXPOSEDMEDIA)); Assert.AreEqual(xm, pp.getResource(null)); Assert.AreEqual(m, pp.getResource(ElementName.MEDIA)); try { Assert.IsNull(pp.getResource("MediaLink")); Assert.Fail(); } catch (JDFException) { // nop } JDFResourceLink rl = pp.appendResourceLink(ElementName.EXPOSEDMEDIA, true); rl.setrRef(xm.getID()); Assert.AreEqual(xm, pp.getResource(null)); Assert.AreEqual(rl.getTarget(), pp.getResource(null)); }
public virtual void testGetMedia() { JDFLayout lo = (JDFLayout) new JDFDoc("JDF").getRoot().appendElement(ElementName.RESOURCEPOOL).appendElement(ElementName.LAYOUT); JDFLayout s1 = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "s1"); JDFMedia media = lo.appendMedia(); media.setMediaType(EnumMediaType.Plate); Assert.IsNull(lo.getMedia(EnumMediaType.Paper)); Assert.IsNull(s1.getMedia(EnumMediaType.Paper)); Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media); Assert.AreEqual(lo.getMedia(EnumMediaType.Plate), media); JDFMedia media2 = s1.appendMedia(); media2.setMediaType(EnumMediaType.Paper); Assert.IsNull(s1.getMedia(EnumMediaType.Plate)); Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2); JDFMedia media3 = s1.appendMedia(); media3.setMediaType(EnumMediaType.Plate); Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2); Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media3); media3.makeRootResource(null, null, true); Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2); Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media3); }
public virtual void testInlineRefelement() { JDFDoc d = JDFTestCaseBase.creatXMDoc(); JDFNode n = d.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0); JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1"); mPart.put("SignatureName", "S12234"); mPart.put("SheetName", "S12"); mPart.put("Side", "Front"); JDFExposedMedia xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null); JDFMedia m = xm.getMedia(); m = (JDFMedia)m.makeRootResource(null, null, true); m.setGrainDirection(EnumGrainDirection.XDirection); xmPart.refElement(m); Assert.AreEqual(xmPart.getMedia(), m); mPart.put("Side", "Back"); xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null); JDFMedia medPart = (JDFMedia)m.getCreatePartition(mPart, xm.getPartIDKeys()); xmPart.refElement(medPart); Assert.AreEqual(xmPart.getMedia(), medPart); JDFRefElement re = (JDFRefElement)xmPart.getElement("MediaRef"); JDFMedia inlineMedia = (JDFMedia)re.inlineRef(); Assert.IsNull(xmPart.getElement_KElement("MediaRef", null, 0)); Assert.AreEqual(EnumGrainDirection.XDirection, inlineMedia.getGrainDirection()); Assert.AreEqual(xmPart.getMedia(), inlineMedia); Assert.IsFalse(inlineMedia.hasAttribute("ID")); }
/// /// * <param name="icsLevel"> </param> /// protected internal override JDFMedia initPaperMedia() { JDFMedia m = base.initPaperMedia(); JDFResourceLink rl = theNode.getLink(m, null); if (rl == null) { rl = theNode.linkResource(m, EnumUsage.Input, null); } if (vParts != null) { VJDFAttributeMap reducedMap = getReducedMap(new VString("Side Separation", " ")); if (reducedMap != null) { int size = reducedMap.Count; for (int i = 0; i < size; i++) { JDFAttributeMap part = reducedMap[i]; JDFAttributeMap newMap = new JDFAttributeMap(part); newMap.put(AttributeName.CONDITION, "Good"); rl.setAmount(good, newMap); rl.setMaxAmount(good + waste, newMap); newMap.put(AttributeName.CONDITION, "Waste"); rl.setMaxAmount(waste, newMap); } } } return(m); }
/// /// * <param name="media"> </param> /// * <param name="sNode"> /// * @return </param> /// private JDFMedia getMediaFromNode(JDFNode sNode) { if (sNode == null) { return(null); } JDFLayout lo = (JDFLayout)sNode.getResource(ElementName.LAYOUT, EnumUsage.Input, 0); if (lo != null) { JDFMedia m = lo.getMedia(0); if (m != null) { return(m); } } JDFStrippingParams sp = (JDFStrippingParams)sNode.getResource(ElementName.STRIPPINGPARAMS, EnumUsage.Input, 0); if (sp != null) { return(sp.getMedia(0)); } return(null); }
public virtual void testRemoveChild() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType("ConventionalPrinting", true); JDFExposedMedia xmpl = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Plate, null); JDFExposedMedia xmpr = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Proof, null); JDFMedia m = xmpr.appendMedia(); Assert.IsNotNull(xmpr.getMedia()); m.setID("id1"); KElement t1 = n.getTarget("id1", "ID"); m = (JDFMedia)m.makeRootResource(null, null, true); Assert.AreEqual(m, t1); Assert.IsNotNull(xmpr.getMedia()); xmpl.refElement(m); Assert.IsNotNull(xmpl.getMedia()); JDFResourcePool rp = n.getResourcePool(); Assert.IsNotNull(rp.getElement("Media")); xmpl.removeChild("Media", null, 0); Assert.IsNull(xmpl.getMedia()); Assert.IsNotNull(rp.getElement("Media")); xmpr.removeChildren("Media", null, null); Assert.IsNull(xmpr.getMedia()); Assert.IsNotNull(rp.getElement("Media")); }
public virtual void testGetCreateRefElement() { JDFNode n = new JDFDoc("JDF").getJDFRoot(); JDFMedia m = (JDFMedia)n.addResource("Media", null); JDFMedia m1 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T1"); JDFMedia m2 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T2"); JDFExposedMedia xm = (JDFExposedMedia)n.addResource("ExposedMedia", null); Assert.IsNull(xm.getRefElement(m1)); for (int i = 0; i < 10; i++) { JDFRefElement re = xm.getCreateRefElement(m2); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(m2, xm.getMedia()); Assert.IsNull(xm.getRefElement(m1)); Assert.IsNull(xm.getRefElement(m)); Assert.AreEqual(1, xm.numChildElements("MediaRef", null)); } for (int i = 0; i < 10; i++) { JDFRefElement re = xm.getCreateRefElement(m2); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(re, xm.getCreateRefElement(m2)); xm.getCreateRefElement(m); xm.getCreateRefElement(m1); Assert.AreEqual(3, xm.numChildElements("MediaRef", null)); } }
public virtual void testGetResStatus() { JDFMedia m = (JDFMedia)ri.appendResource(ElementName.MEDIA); EnumResStatus name = ri.getResStatus(); Assert.AreEqual(m.getResStatus(false), name); }
public virtual void testGetResourceID() { JDFMedia m = (JDFMedia)ri.appendResource(ElementName.MEDIA); string name = ri.getResourceID(); Assert.AreEqual(m.getID(), name); }
public virtual void testGetResourceNull() { JDFMedia m = (JDFMedia)ri.appendResource(ElementName.MEDIA); JDFMedia m2 = (JDFMedia)ri.getResource(null); Assert.AreEqual(m, m2); Assert.IsTrue(ri.isValid(EnumValidationLevel.Complete)); }
public virtual void testGetCreateElement() { JDFNode n = new JDFDoc("JDF").getJDFRoot(); JDFMedia m = (JDFMedia)n.addResource("Media", null); JDFExposedMedia xm = (JDFExposedMedia)n.addResource("ExposedMedia", null); xm.refMedia(m); Assert.AreEqual(m, xm.getCreateElement("Media")); }
/// /// * <param name="icsLevel"> </param> /// protected internal virtual JDFComponent initOutputComponent() { if (thePreviousNode != null) { JDFResource parentOutComp = thePreviousNode.getResource(ElementName.COMPONENT, EnumUsage.Output, 0); if (parentOutComp != null) { theNode.linkResource(parentOutComp, EnumUsage.Input, null); } } JDFComponent outComp = (JDFComponent)(theParentNode != null ? theParentNode.getResource(ElementName.COMPONENT, EnumUsage.Output, 0) : null); if (outComp == null) { outComp = (JDFComponent)theNode.getCreateResource(ElementName.COMPONENT, EnumUsage.Output, 0); outComp.setComponentType(EnumComponentType.FinalProduct, EnumComponentType.Sheet); outComp.setProductType("Unknown"); } else { theNode.linkResource(outComp, EnumUsage.Output, null); } JDFResourceLink rl = theNode.getLink(outComp, EnumUsage.Output); if (vParts != null) { VJDFAttributeMap reducedMap = getReducedMap(new VString("Side Separation", " ")); if (reducedMap != null) { int size = reducedMap.Count; for (int i = 0; i < size; i++) { JDFAttributeMap part = reducedMap[i]; JDFResource partComp = outComp.getCreatePartition(part, partIDKeys); partComp.setDescriptiveName("Description for Component part# " + i); JDFAttributeMap newMap = new JDFAttributeMap(part); newMap.put(AttributeName.CONDITION, "Good"); rl.setAmount(good, newMap); } } } else { outComp.setDescriptiveName("MIS-CP output Component"); } // outComp.getCreateLayout(); JDFMedia inMedia = (JDFMedia)theNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0); if (inMedia != null) { outComp.setDimensions(inMedia.getDimension()); } return(outComp); }
public virtual void testGetChildElementVector_KElement() { JDFDoc d = new JDFDoc("JDF"); JDFNode root = d.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)root.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null); JDFMedia m = xm.appendMedia(); m.makeRootResource(null, null, true); Assert.AreEqual(0, xm.getChildElementVector_KElement("Media", null, null, true, -1).Count); Assert.AreEqual(1, xm.getChildElementVector_JDFElement("Media", null, null, true, -1, true).Count); }
public virtual void testResourceStatus() { JDFMedia m = (JDFMedia)n.addResource("Media", null, EnumUsage.Input, null, null, null, null); m.setResStatus(EnumResStatus.Available, true); Assert.AreEqual(EnumResStatus.Available, m.getResStatus(true)); Assert.IsTrue(m.fixVersion(EnumVersion.Version_1_1)); Assert.AreEqual(EnumResStatus.Available, m.getResStatus(true)); Assert.IsTrue(m.fixVersion(EnumVersion.Version_1_3)); Assert.AreEqual(EnumResStatus.Available, m.getResStatus(true)); }
public virtual void testGetElement_KElement() { JDFDoc d = new JDFDoc("JDF"); JDFNode root = d.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)root.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null); JDFMedia m = xm.appendMedia(); m.makeRootResource(null, null, true); Assert.IsNull(xm.getElement_KElement("Media", null, 0)); Assert.IsNotNull(xm.getElement_JDFElement("Media", null, 0)); }
public virtual void testMedia() { JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); lo.appendMedia(); JDFMedia m2 = lo.appendMedia(); Assert.IsNotNull(m2, "2. Media ok"); Assert.AreEqual(m2, lo.getMedia(1)); Assert.AreEqual(m2, lo.getCreateMedia(1)); }
/// /// * <param name="icsLevel"> </param> /// protected internal virtual JDFMedia initPaperMedia() { JDFResourceLink rlM = null; if (thePreviousNode != null) { JDFMedia media = (JDFMedia)thePreviousNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0); if (media != null && !EnumMediaType.Paper.Equals(media.getMediaType())) { media = (JDFMedia)thePreviousNode.getResource(ElementName.MEDIA, EnumUsage.Input, 1); } if (media != null && !EnumMediaType.Paper.Equals(media.getMediaType())) { media = null; } if (media == null) { media = getMediaFromNode(thePreviousNode); if (media == null) { VElement v = thePreviousNode.getPredecessors(true, false); if (v != null) { int siz = v.Count; for (int i = 0; i < siz; i++) { media = getMediaFromNode((JDFNode)v[i]); if (media != null) { break; } } } } } rlM = theNode.linkResource(media, EnumUsage.Input, null); } if (rlM == null && theParentNode != null) { rlM = theNode.linkResource(theParentNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0), EnumUsage.Input, null); } paperMedia = (JDFMedia)theNode.getCreateResource(ElementName.MEDIA, null, 0); paperMedia.setDescriptiveName("the paper to print on"); paperMedia.setResStatus(EnumResStatus.Unavailable, false); paperMedia.setMediaType(EnumMediaType.Paper); paperMedia.setDimensionCM(new JDFXYPair(70, 102)); paperMedia.setWeight(90); paperMedia.setThickness(90 / 0.8); return(paperMedia); }
public override void setUp() { base.setUp(); JDFElement.setLongID(false); d = new JDFDoc("JDF"); n = d.getJDFRoot(); n.appendXMLComment("Example to illustrate JDF 1.3 Base and MIS compatible amount handling", null); n.setType(EnumType.ConventionalPrinting); outComp = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null); inMedia = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null); rlOut = n.getLink(outComp, null); rlMediaIn = n.getLink(inMedia, null); }
/// /// <summary> * initializes this node to a given ICS version /// * </summary> /// * <param name="icsLevel"> the level to init to (1,2 or 3) </param> /// public override void init() { initColsFromParent(); initAmountsFromParent(); if (partIDKeys == null) { partIDKeys = new VString("SignatureName SheetName Side Separation", null); } // put level methods? int ncols = getNCols(); while (cols.Count > ncols && ncols > 0) { cols.RemoveAt(ncols); } if (icsLevel < 0) { return; } string icsTag = "MISCPS_L" + icsLevel + "-" + theVersion.getName(); theNode.appendAttribute(AttributeName.ICSVERSIONS, icsTag, null, " ", true); if (!theNode.hasAttribute(AttributeName.DESCRIPTIVENAME)) { theNode.setDescriptiveName("MISCPS Golden Ticket Example Job - version: " + JDFAudit.software()); } if (!grayBox) { theNode.setType(EnumType.ConventionalPrinting); } initColorantControl(); initConventionalPrintingParams(); JDFMedia m = initPaperMedia(); initPlateXM(EnumUsage.Input); initDevice(thePreviousNode); JDFComponent c = initOutputComponent(); initInk(); base.init(); initPreview(); setActivePart(vParts, true); theStatusCounter.setTrackWaste(c.getID(), true); theStatusCounter.setTrackWaste(m.getID(), true); }
/// /// <summary> * Get all Media from the current element /// * </summary> /// * <returns> Collection<JDFMedia> </returns> /// public virtual ICollection <JDFMedia> getAllMedia() { List <JDFMedia> v = new List <JDFMedia>(); JDFMedia kElem = (JDFMedia)getFirstChildElement(ElementName.MEDIA, null); while (kElem != null) { v.Add(kElem); kElem = (JDFMedia)kElem.getNextSiblingElement(ElementName.MEDIA, null); } return(v); }
public virtual void testAmountCondition() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setVersion(JDFElement.EnumVersion.Version_1_3); n.setType("ConventionalPrinting", true); JDFMedia m = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null); JDFResourceLink rl = n.getLink(m, null); JDFAttributeMap map = new JDFAttributeMap("SheetName", "s1"); JDFAttributeMap mapC = new JDFAttributeMap(map); mapC.put("Condition", "Good"); m.setAmount(42); Assert.AreEqual("42", m.getAttribute(AttributeName.AMOUNT), "m amount!=42"); Assert.AreEqual(42.0, rl.getAmount(null), 0.1, "rl amount!=42"); Assert.AreEqual(42.0, rl.getMinAmount(null), 0.1, "rl amount!=42"); Assert.AreEqual(42.0, rl.getMaxAmount(null), 0.1, "rl amount!=42"); rl.setAmount(44, map); Assert.AreEqual(44.0, rl.getAmount(map), 0.1, "rl amount!=42"); Assert.AreEqual(44.0, rl.getMinAmount(map), 0.1, "rl amount!=42"); Assert.AreEqual(44.0, rl.getMaxAmount(map), 0.1, "rl amount!=42"); Assert.AreEqual(-1.0, rl.getAmount(mapC), 0.1, "no good in map"); Assert.AreEqual(-1.0, rl.getMinAmount(mapC), 0.1, "no good in map"); Assert.AreEqual(-1.0, rl.getMaxAmount(mapC), 0.1, "no good in map"); rl.removeChild(ElementName.AMOUNTPOOL, null, 0); rl.setAmount(44, mapC); Assert.AreEqual(44.0, rl.getAmount(mapC), 0.1, "rl amount!=42"); Assert.AreEqual(44.0, rl.getMinAmount(mapC), 0.1, "rl amount!=42"); Assert.AreEqual(44.0, rl.getMaxAmount(mapC), 0.1, "rl amount!=42"); Assert.AreEqual(44.0, rl.getAmount(map), 0.1, "no good in rl"); Assert.AreEqual(44.0, rl.getMinAmount(map), 0.1, "no good in rl"); Assert.AreEqual(44.0, rl.getMaxAmount(map), 0.1, "no good in rl"); JDFAttributeMap mapW = new JDFAttributeMap(map); mapW.put("Condition", "Waste"); rl.setAmount(4, mapW); Assert.AreEqual(48.0, rl.getAmount(map), 0.1, "sum g/w in rl"); Assert.AreEqual(48.0, rl.getMinAmount(map), 0.1, "sum g/w in rl"); Assert.AreEqual(48.0, rl.getMaxAmount(map), 0.1, "sum g/w in rl"); }
public virtual void testValidateExtensionschema() { JDFDoc doc = new JDFDoc("JDF"); JDFValidator checkJDF = new JDFValidator(); checkJDF.setPrint(false); checkJDF.bQuiet = true; checkJDF.level = EnumValidationLevel.Incomplete; DirectoryInfo foo = new DirectoryInfo(sm_dirTestSchema); Assert.IsTrue(foo.Exists, "please mount the svn schema parallel to JDFLibNet"); FileInfo jdfxsd = new FileInfo(sm_dirTestSchema + "JDF.xsd"); checkJDF.setJDFSchemaLocation(jdfxsd); JDFNode n = doc.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); JDFMedia med = (JDFMedia)n.addResource("Media", null, EnumUsage.Input, null, null, null, null); checkJDF.setIgnorePrivate(false); doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true); XMLDoc @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf"); Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile/SchemaValidationOutput/@ValidationResult", null), "Valid"); checkJDF.schemaLocation += " http://www.extension.com " + sm_dirTestData + "extension.xsd"; med.setAttribute("ext:ExtensionAtt", "a", "http://www.extension.com"); KElement fooBar = med.appendElement("ext:FooBar", "http://www.extension.com"); fooBar.setAttribute("ID", "f1"); fooBar.setAttribute("Fnarf", "4"); doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true); @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf"); Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile[2]/SchemaValidationOutput/@ValidationResult", null), "Error"); med.setAttribute("ext:ExtensionAtt", "3", "http://www.extension.com"); doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true); @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf"); Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile[3]/SchemaValidationOutput/@ValidationResult", null), "Valid"); fooBar.setAttribute("Fnarf", "bad"); doc.write2File(sm_dirTestDataTemp + "extension.jdf", 0, true); @out = checkJDF.processSingleFile(sm_dirTestDataTemp + "extension.jdf"); Assert.AreEqual(@out.getRoot().getXPathAttribute("TestFile[4]/SchemaValidationOutput/@ValidationResult", null), "Error"); }
public virtual void testGetRefElement() { JDFNode n = new JDFDoc("JDF").getJDFRoot(); JDFMedia m = (JDFMedia)n.addResource("Media", null); JDFMedia m1 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T1"); JDFMedia m2 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T2"); JDFExposedMedia xm = (JDFExposedMedia)n.addResource("ExposedMedia", null); Assert.IsNull(xm.getRefElement(m1)); JDFRefElement re = xm.refElement(m2); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(re, xm.getRefElement(m2)); Assert.AreEqual(xm.getMedia(), m2); Assert.IsNull(xm.getRefElement(m1)); Assert.IsNull(xm.getRefElement(m)); }
public override void setUp() { base.setUp(); JDFElement.setLongID(false); d = new JDFDoc("JDF"); n = d.getJDFRoot(); n.appendXMLComment("Example to illustrate JDF 1.3 Base and MIS compatible amount handling", null); n.setType(EnumType.Combined); inMedia = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null); outXM = (JDFExposedMedia)n.addResource(ElementName.EXPOSEDMEDIA, EnumUsage.Output); outXM.refMedia(inMedia); n.addTypes(EnumType.Interpreting); n.addTypes(EnumType.Rendering); n.addTypes(EnumType.ImageSetting); n.setJobID("RIP-job"); rlXMOut = n.getLink(outXM, null); rlMediaIn = n.getLink(inMedia, null); inMedia.setProductID("Media-ProductID"); inMedia.setMediaType(EnumMediaType.Plate); inMedia.setMediaTypeDetails("Aluminum"); vRL = new VElement(); vRL.Add(rlMediaIn); vRL.Add(rlXMOut); JDFExposedMedia xmPart = (JDFExposedMedia)outXM.addPartition(EnumPartIDKey.SignatureName, "Sig1"); vsSheet = new VString("Cover Sheet1 Sheet2", " "); vsCMYK = new VString("Cyan Magenta Yellow Black Spot1", " "); VElement v = xmPart.addPartitions(EnumPartIDKey.SheetName, vsSheet); for (int i = 0; i < v.Count; i++) { JDFResource xmPart2 = (JDFResource)v[i]; xmPart2.getCreatePartition(EnumPartIDKey.Side, "Front", null).addPartitions(EnumPartIDKey.Separation, vsCMYK); // xmPart2.getCreatePartition(EnumPartIDKey.Side,"Back",null). // addPartitions(EnumPartIDKey.Separation, vsCMYK); } statCounter = new StatusCounter(n, null, vRL); statCounter.setDeviceID("Rip-DeviceID"); statCounter.setCopyResInResInfo(rlMediaIn.getrRef(), true); }
/// <summary> /// All the setUp calls except for base.setUp. /// Use when you want to redo a setup without doign a teardown. /// </summary> public void reSetUp() { JDFElement.setLongID(false); JDFAudit.setStaticAgentName(null); JDFAudit.setStaticAgentVersion(null); JDFAudit.setStaticAuthor(null); doc = new JDFDoc("JDF"); n = doc.getJDFRoot(); n.setJobID("JobID"); n.setType(EnumType.Combined); n.setTypes(new VString("Interpreting Rendering DigitalPrinting Stitching", " ")); comp = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null); rlComp = n.getLink(comp, null); digiParams = (JDFDigitalPrintingParams)n.addResource(ElementName.DIGITALPRINTINGPARAMS, null, EnumUsage.Input, null, null, null, null); med = (JDFMedia)n.appendMatchingResource(ElementName.MEDIA, EnumProcessUsage.AnyInput, null); med.setResStatus(EnumResStatus.Available, false); rlMedia = n.getLink(med, null); ruli = (JDFRunList)n.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyInput, null); }