示例#1
0
        public virtual void testAddCreated()
        {
            // Test AddCreated with one parameter
            myAuditPool.addCreated("A_Test_Author", null);
            JDFAudit myAudit = myAuditPool.getAudit(1, JDFAudit.EnumAuditType.Created, new JDFAttributeMap(), null);
            string   myText  = myAudit.getAuthor();

            Assert.AreEqual("A_Test_Author", myText, "Error: Author should be \"A_Test_Author\"");
            // Test AddCreate with two Parameter

            // Get Create a ResourcePool
            JDFResourcePool myResourcePool = jdfRoot.getCreateResourcePool();

            // Append a ResoureElement
            myResourcePool.appendElement("BindingIntent", "");

            // Get that element back
            JDFResource e = (JDFResource)myResourcePool.getElement("BindingIntent", "", 0);

            myAuditPool.addCreated("A Test Author for JUnitTest 2", e);

            string     strResourceID  = e.buildXPath("/JDF", 1);
            JDFCreated kResourceAudit = (JDFCreated)myAuditPool.getChildWithAttribute(null, "XPath", null, strResourceID, 0, true);

            Assert.IsNotNull(kResourceAudit, "Error: Audit not found ");
        }
示例#2
0
        public virtual void testAudit()
        {
            JDFAuditPool ap = n.getAuditPool();

            Assert.IsNotNull(ap);
            JDFCreated crea  = (JDFCreated)ap.getAudit(0, EnumAuditType.Created, null, null);
            string     agent = crea.getAgentName();

            Assert.IsNotNull(agent);
            string author = crea.getAuthor();

            Assert.IsNotNull(author);

            n.fixVersion(EnumVersion.Version_1_1);
            author = crea.getAuthor();
            Assert.AreEqual(agent, StringUtil.token(author, 1, "_|_"));
            Assert.IsTrue(author.StartsWith(agent));
            string agent2 = crea.getAgentName();

            Assert.AreEqual("", agent2);

            n.fixVersion(EnumVersion.Version_1_3);
            author = crea.getAuthor();
            Assert.AreEqual(-1, author.IndexOf("_|_"));
            agent2 = crea.getAgentName();
            Assert.AreEqual(agent, agent2);

            n.fixVersion(EnumVersion.Version_1_2);
            author = crea.getAuthor();
            Assert.AreEqual(-1, author.IndexOf("_|_"));
            agent2 = crea.getAgentName();
            Assert.AreEqual(agent, agent2);
        }
示例#3
0
        ///
        ///	 <summary> * Append a Created audit element, if createdElem==null only add if it is not yet there
        ///	 *  </summary>
        ///	 * <param name="by"> the author keyword </param>
        ///	 * <param name="createdElem"> the created element </param>
        ///	 * <returns> the newly created Created audit
        ///	 *
        ///	 *         default: AddCreated(by, null) </returns>
        ///
        public virtual JDFCreated addCreated(string by, KElement createdElem)
        {
            JDFCreated created = (JDFCreated)addAudit(JDFAudit.EnumAuditType.Created, by);

            if (createdElem != null)
            {
                string xpath = createdElem.buildXPath(getParentJDF().buildXPath(null, 1), 1);
                created.setXPath(xpath);
            }

            return(created);
        }
示例#4
0
        ///
        ///	 <summary> *  </summary>
        ///
        public virtual void ensureCreated()
        {
            JDFAudit created = getAudit(0, EnumAuditType.Created, null, null);

            if (created == null)
            {
                JDFAudit   a = getAudit(0, null, null, null);
                JDFCreated c = addCreated(null, null);
                if (a != null)
                {
                    c.setTimeStamp(a.getTimeStampDate());
                    moveElement(c, a);
                }
            }
        }