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 testGetLinkRoot() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType("ProcessGroup", true); JDFNode n2 = n.addJDFNode("ConventionalPrinting"); JDFCustomerInfo ci = (JDFCustomerInfo)n.addResource(ElementName.CUSTOMERINFO, null, EnumUsage.Input, null, null, null, null); JDFResourceLink ciLink = n.getLink(ci, null); Assert.IsTrue(ci == ciLink.getLinkRoot(), "getLinkRoot in same node"); Assert.IsTrue(ci == ciLink.getTarget(), "getLinkTarget in same node"); Assert.IsTrue(ci == ciLink.getTarget(), "getTarget in same node"); JDFResourceLink ciLink2 = n2.linkResource(ci, EnumUsage.Input, null); Assert.IsTrue(ci == ciLink2.getLinkRoot(), "getLinkRoot in child node"); Assert.IsTrue(ci == ciLink2.getTarget(), "getLinkTarget in child node"); Assert.IsTrue(ci == ciLink2.getTarget(), "getTarget in child node"); JDFNodeInfo ni = (JDFNodeInfo)n2.addResource(ElementName.NODEINFO, null, null, null, null, null, null); JDFResourceLink niLink = n2.linkResource(ni, EnumUsage.Input, null); Assert.IsTrue(ni == niLink.getLinkRoot(), "getLinkRoot both in child node"); Assert.IsTrue(ni == niLink.getTarget(), "getLinkTarget both in child node"); Assert.IsTrue(ni == niLink.getTarget(), "getTarget both in child node"); JDFResourceLink niLink2 = (JDFResourceLink)n.getCreateResourceLinkPool().appendElement("NodeInfoLink", null); niLink2.setrRef(ni.getID()); Assert.IsTrue(niLink2.getLinkRoot() == null, "getLinkRoot illegal in child node"); Assert.IsTrue(niLink2.getTarget() == null, "getLinkTarget illegal in child node"); Assert.IsTrue(niLink2.getTarget() == null, "getTarget illegal in child node"); JDFDoc d22 = new JDFDoc(ElementName.JDF); JDFNode n22 = d22.getJDFRoot(); JDFResourceLinkPool rlp = n22.getCreateResourceLinkPool(); bool bCaught = false; try { rlp.linkResource(ni, EnumUsage.Input, null); } catch (JDFException) { bCaught = true; } Assert.IsTrue(bCaught, "Resource from other document not linked"); Assert.IsNull(rlp.getElement("NodeInfoLink"), "NI not linked"); }
public virtual void testCPI() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType("Combined", true); n.setTypes(new VString("ConventionalPrinting Folding", " ")); JDFNodeInfo ni = n.getCreateNodeInfo(); // Java to C# Conversion - No ResourceLinkPool found in "n" JDFResourceLink rl = n.getLink(ni, null); Assert.IsFalse(rl.hasAttribute(AttributeName.COMBINEDPROCESSINDEX)); }
public virtual void testPartUsage() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType("ConventionalPrinting", true); JDFNodeInfo ni = n.getCreateNodeInfo(); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.Separation, "Cyan"); n.setPartStatus(map, EnumNodeStatus.Ready, null); JDFNodeInfo niPart = (JDFNodeInfo)ni.getPartition(map, null); Assert.IsNotNull(niPart); Assert.IsNull(niPart.getAttribute_KElement(AttributeName.PARTUSAGE, null, null)); }
public virtual void testSourceResource() { JDFDoc doc = JDFTestCaseBase.creatXMDoc(); JDFNode n = doc.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0); JDFNodeInfo ni = (JDFNodeInfo)n.getMatchingResource("NodeInfo", JDFNode.EnumProcessUsage.AnyInput, null, 0); xm.createSourceResource(ni); Assert.AreEqual(ni, xm.getSourceResource(0).getLinkRoot(), ""); Assert.AreEqual(ni, xm.getSourceResource(0).getTarget(), ""); Assert.AreEqual(ni.Name, xm.getSourceResource(0).getSourcefNodeName()); JDFSourceResource sr = xm.appendSourceResource(); Assert.IsNull(sr.getLinkRoot()); Assert.IsNull(sr.getTarget()); Assert.IsNull(sr.getSourceLocalName()); }
public virtual void testDuration() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType("ConventionalPrinting", true); JDFNodeInfo ni = n.getCreateNodeInfo(); JDFDuration duration = new JDFDuration("PT1H20M30S"); ni.setTotalDuration(duration); Assert.AreEqual(duration, ni.getTotalDuration()); try { ni.setCleanupDuration(new JDFDuration("PS1L20M30S")); Assert.Fail("bad duration"); } catch (System.Exception) { // nop } }
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 testWorkstepID() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType("ConventionalPrinting", true); JDFNodeInfo.setDefaultWorkStepID(true); JDFNodeInfo ni = n.getCreateNodeInfo(); Assert.IsTrue(ni.hasAttribute("WorkStepID")); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.Separation, "Cyan"); n.setPartStatus(map, EnumNodeStatus.Ready, null); JDFNodeInfo niPart = (JDFNodeInfo)ni.getPartition(map, null); Assert.IsNotNull(niPart); Assert.IsTrue(niPart.hasAttribute("WorkStepID")); d.write2File(sm_dirTestDataTemp + "workstepidtest.jdf", 2, false); // VString v = ni.getInvalidAttributes(EnumValidationLevel.Incomplete, true, -1); Assert.IsTrue(ni.isValid(EnumValidationLevel.Incomplete)); }
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")); }