Exemplo n.º 1
0
        public virtual void testGetContact()
        {
            JDFDoc          doc  = new JDFDoc("JDF");
            JDFNode         n    = doc.getJDFRoot();
            JDFCustomerInfo info = n.appendCustomerInfo();

            info.appendContact().setContactTypes(new VString("foo", null));
            Assert.IsNotNull(info.getContact(0));
        }
Exemplo n.º 2
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");
        }
Exemplo n.º 3
0
        public virtual void testGetContactVectorWithContactType()
        {
            JDFDoc          doc  = new JDFDoc("JDF");
            JDFCustomerInfo info = prepareInfo(doc);

            VElement v = info.getContactVectorWithContactType("Customer");

            Assert.IsNotNull(v);
            Assert.AreEqual(3, v.Count);
            v = info.getContactVectorWithContactType("Administrator");
            Assert.IsNotNull(v);
            Assert.AreEqual(1, v.Count);
            v = info.getContactVectorWithContactType("beagle");
            Assert.IsNull(v);
        }
Exemplo n.º 4
0
        public virtual void testDraftOK()
        {
            JDFDoc  d = new JDFDoc(ElementName.JDF);
            JDFNode n = d.getJDFRoot();

            n.setVersion(JDFElement.EnumVersion.Version_1_3);
            n.setType("ProcessGroup", true);
            JDFCustomerInfo ci = (JDFCustomerInfo)n.addResource(ElementName.CUSTOMERINFO, null, EnumUsage.Input, null, null, null, null);
            JDFComponent    co = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null);
            JDFResourceLink rl = n.getLink(ci, null);

            Assert.AreEqual(JDFResource.EnumResStatus.Available, rl.getMinStatus(), "available");

            rl.setDraftOK(true);
            Assert.AreEqual(JDFResource.EnumResStatus.Draft, rl.getMinStatus(), "draft");
            Assert.IsTrue(!rl.hasAttribute(AttributeName.DRAFTOK), "has no draft");
            Assert.IsTrue(rl.getMinLateStatus() == JDFResource.EnumResStatus.Draft, "late draft");
            Assert.IsTrue(rl.isValid(EnumValidationLevel.Complete), "1.3 valid");
            rl.setDraftOK(false);
            Assert.AreEqual(JDFResource.EnumResStatus.Available, rl.getMinStatus(), "draft");
            Assert.IsTrue(!rl.hasAttribute(AttributeName.DRAFTOK), "has no draft");
            Assert.IsTrue(rl.getMinLateStatus() == JDFResource.EnumResStatus.Available, "late draft");
            Assert.IsTrue(rl.isValid(EnumValidationLevel.Complete), "1.3 valid");
            rl.removeAttribute(AttributeName.MINSTATUS);

            n.setVersion(JDFElement.EnumVersion.Version_1_2);
            rl.setDraftOK(true);
            Assert.IsTrue(rl.getMinStatus() == JDFResource.EnumResStatus.Draft, "draft");
            Assert.IsTrue(rl.hasAttribute(AttributeName.DRAFTOK), "has draft");
            Assert.IsTrue(!rl.hasAttribute(AttributeName.MINSTATUS), "has no MinStatus");
            Assert.AreEqual(rl.getMinLateStatus(), JDFResource.EnumResStatus.Draft, "late draft");
            Assert.IsTrue(rl.isValid(EnumValidationLevel.Complete), "1.2 valid");
            rl.setDraftOK(false);
            Assert.IsTrue(rl.getMinStatus() == JDFResource.EnumResStatus.Available, "draft");
            Assert.IsTrue(rl.hasAttribute(AttributeName.DRAFTOK), "has draft");
            Assert.IsTrue(!rl.hasAttribute(AttributeName.MINSTATUS), "has no MinStatus");
            Assert.AreEqual(rl.getMinLateStatus(), JDFResource.EnumResStatus.Available, "late draft");
            Assert.IsTrue(rl.isValid(EnumValidationLevel.Complete), "1.2 valid");

            rl = n.getLink(co, null);
            Assert.AreEqual(JDFResource.EnumResStatus.Unavailable, rl.getMinStatus(), "unavailable");
        }
Exemplo n.º 5
0
        private JDFCustomerInfo prepareInfo(JDFDoc doc)
        {
            JDFNode         n    = doc.getJDFRoot();
            JDFCustomerInfo info = n.appendCustomerInfo();
            VString         vct  = new VString();

            vct.Add("Customer");
            info.appendContact().setContactTypes(vct);
            vct.Add("Administrator");
            info.appendContact().setContactTypes(vct);
            JDFContact c = info.appendContact();

            vct = new VString();
            vct.Add("Delivery");
            c.setContactTypes(vct);
            c.makeRootResource(null, null, true);
            vct.Add("Customer");
            info.appendContact().setContactTypes(vct);
            return(info);
        }
Exemplo n.º 6
0
        public virtual void testGetContactWithContactType()
        {
            JDFDoc          doc  = new JDFDoc("JDF");
            JDFCustomerInfo info = prepareInfo(doc);

            JDFContact cc = info.getContactWithContactType("Customer", 0);

            Assert.IsNotNull(cc, "cc");
            cc = info.getContactWithContactType("Customer", 2);
            Assert.IsNotNull(cc, "cc");
            cc = info.getContactWithContactType("Customer", 1);
            Assert.IsNotNull(cc, "cc");
            JDFContact cc2 = info.getContactWithContactType("Administrator", 0);

            Assert.IsNotNull(cc2, "cc2");
            Assert.AreEqual(cc, cc2, "cc2");
            cc = info.getContactWithContactType("Delivery", 0);
            Assert.IsNotNull(cc, "cc");
            cc = info.getContactWithContactType("fnarf", 0);
            Assert.IsNull(cc, "cc");
        }
Exemplo n.º 7
0
        public virtual void testgetContactVector()
        {
            JDFDoc          doc  = new JDFDoc("JDF");
            JDFCustomerInfo info = prepareInfo(doc);

            VElement v = null;

            info = doc.getJDFRoot().getCustomerInfo();
            if (info != null)
            {
                v = info.getChildElementVector(ElementName.CONTACT, null, null, true, 0, false);
                Assert.AreEqual(4, v.Count, "v does not contain 4 contact");
            }

            v    = null;
            info = doc.getJDFRoot().getCustomerInfo();
            if (info != null)
            {
                v = info.getChildElementVector(ElementName.CONTACT, null, null, true, 0, false);
                Assert.IsTrue(v.Count == 4, "v does not contain 4 contacts");
            }
        }