Esempio n. 1
0
        public virtual void testGetTargetVectorNullPart()
        {
            JDFDoc          d  = JDFTestCaseBase.creatXMDoc();
            JDFNode         n  = d.getJDFRoot();
            JDFResourceLink rl = n.getMatchingLink("ExposedMedia", EnumProcessUsage.Plate, 0);

            rl.appendPart();
            VElement v = rl.getTargetVector(0);

            Assert.AreEqual(1, v.Count, "The target vector is the node with two leaves");
            JDFResource linkRoot = rl.getLinkRoot();

            Assert.AreEqual(linkRoot, v[0], "The target vector is the node with two leaves");
            linkRoot.setPartUsage(EnumPartUsage.Implicit);
            v = rl.getTargetVector(0);
            Assert.AreEqual(1, v.Count, "The target vector is the node with two leaves");
            Assert.AreEqual(linkRoot, v[0], "The target vector is the node with two leaves");

            linkRoot.setPartUsage(EnumPartUsage.Explicit);

            JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1");

            mPart.put("SheetName", "S1");
            rl.setPartMap(mPart);
            rl.appendPart();

            v = rl.getTargetVector(0);
            Assert.AreEqual(2, v.Count, "The target vector is the node with two leaves");
            Assert.IsTrue(v.Contains(linkRoot));
            Assert.IsTrue(v.Contains(linkRoot.getPartition(mPart, null)));
            linkRoot.setPartUsage(EnumPartUsage.Implicit);
            v = rl.getTargetVector(0);
            Assert.IsTrue(v.Contains(linkRoot));
            Assert.IsTrue(v.Contains(linkRoot.getPartition(mPart, null)));
        }
Esempio n. 2
0
        public virtual void testLinkRootDeadLoop()
        {
            JDFDoc      jdfDoc = new JDFDoc("JDF");
            JDFNode     node   = jdfDoc.getJDFRoot();
            JDFResource r      = node.addResource(ElementName.ADHESIVEBINDINGPARAMS, EnumUsage.Input);

            node.getResourcePool().insertBefore(ElementName.ADHESIVEBINDINGPARAMS + "Ref", r, null).setAttribute("rRef", "badLink");
            JDFResourceLink link = node.getLink(r, null);

            Assert.IsNotNull(link.getLinkRoot()); // Endlos-Schleife !!!!
        }
Esempio n. 3
0
        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");
        }