Exemple #1
0
        public virtual void testGetElementByID()
        {
            _setUp();
            KElement kelem = m_jdfRoot.getChildWithAttribute("*", "ID", "*", "n0006", 0, true);

            Assert.IsTrue(kelem != null, "kelem==null");
            if (kelem == null)
            {
                return; // soothe findbugs ;)
            }
            string strAtrib = kelem.getAttribute("ID", "", "");

            Assert.IsTrue(strAtrib.Equals("n0006"), "ID!=n0006");

            // second try
            KElement kelem2 = m_jdfRoot.getTarget("n0006", "ID");

            Assert.IsTrue(kelem2 != null, "kelem2==null");
            if (kelem2 == null)
            {
                return; // soothe findbugs ;)
            }
            string strAtrib2 = kelem2.getAttribute("ID", "", "");

            Assert.IsTrue(strAtrib2.Equals("n0006"), "ID!=n0006");

            // third try
            KElement kelem3 = m_jdfRoot.getTarget("198", "Preferred");

            Assert.IsTrue(kelem3 != null, "kelem3==null");
            if (kelem3 == null)
            {
                return; // soothe findbugs ;)
            }
            string strAtrib3 = kelem3.getAttribute("Preferred", "", "");

            Assert.IsTrue(strAtrib3.Equals("198"), "Preferred!=198");

            // fourth try: GetChildWithAttribute does only find direct children but
            // no deep children
            KElement kelem4 = m_jdfRoot.getChildWithAttribute("*", "Preferred", "*", "198", 0, true);

            Assert.IsTrue(kelem4 == null, "kelem4!=null");
        }
Exemple #2
0
        public virtual void testResourceCommand()
        {
            JDFDoc  jdfDoc = JDFDoc.parseFile(sm_dirTestData + "ResourceCommandTest.jdf");
            JDFNode root   = jdfDoc.getJDFRoot();
            JDFResourceCmdParams @params;

            JDFAttributeMap amAttr = new JDFAttributeMap();

            amAttr.put("Start", "2006-11-02T14:13:18+01:00");
            amAttr.put("End", "2006-11-02T15:13:18+01:00");
            string partID, resID;

            for (int i = 0; i < 2; i++)
            {
                JDFAttributeMap amParts = new JDFAttributeMap();
                if (i == 0)
                {
                    amParts.put("SignatureName", "Sig001");
                    amParts.put("SheetName", "FB 001");
                    amParts.put("Side", "Front");
                    partID = "SFP0.C";
                    resID  = "Link49087948_000508";
                }
                else
                {
                    resID = "Link49165276_000704";
                    amParts.put("SignatureName", "Sig002");
                    amParts.put("SheetName", "FB 002");
                    amParts.put("Side", "Back");
                    partID = "SFP1.C";
                }
                @params = createResourceParams(partID, resID, amParts, amAttr);
                JDFNode n = root.getJobPart(partID, null);
                @params.applyResourceCommand(n);
                Assert.IsNotNull(n);
                JDFNodeInfo ni = (JDFNodeInfo)n.getChildWithAttribute(ElementName.NODEINFO, "ID", null, resID, 0, false);
                Assert.IsNotNull(ni);
                JDFNodeInfo nip = (JDFNodeInfo)ni.getPartition(amParts, null);
                Assert.IsNotNull(nip);
                Assert.IsFalse(nip.hasAttribute_KElement("ID", null, false));
                Assert.IsFalse(nip.hasAttribute_KElement("SheetName", null, false));
            }
        }