예제 #1
0
        public virtual void testEmptyString()
        {
            JDFDoc inMessageDoc = new JDFDoc(ElementName.JMF);
            JDFJMF jmfIn        = inMessageDoc.getJMFRoot();

            jmfIn.appendMessageElement(JDFMessage.EnumFamily.Response, null);
            string s = inMessageDoc.write2String(0);

            Assert.IsNotNull(s);
        }
예제 #2
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc      d  = new JDFDoc("JDF");
            JDFNode     n  = d.getJDFRoot();
            JDFResource rl = n.addResource("RunList", EnumUsage.Input);

            rl.setDescriptiveName("Runlist für 10 € &&&"); // sum special characters
            s       = d.write2String(2);
            bSearch = JDFParser.m_searchStream;
        }
예제 #3
0
        public virtual void testNS()
        {
            JDFDoc doc = new JDFDoc("foo:bar");
            string s   = doc.write2String(2);

            Assert.IsTrue(s.IndexOf(JDFConstants.JDFNAMESPACE) > 0);
            XMLDoc doc2 = new XMLDoc("abc", null);
            string s2   = doc2.write2String(2);

            Assert.IsTrue(s2.IndexOf(JDFConstants.JDFNAMESPACE) < 0);
            doc2.getRoot().copyElement(doc.getRoot(), null);
            s2 = doc2.write2String(2);
            Assert.IsTrue(s2.IndexOf(JDFConstants.JDFNAMESPACE) > 0);
        }
예제 #4
0
 public virtual void testSchemaDefault()
 {
     for (int i = 0; i < 3; i++)
     {
         JDFDoc  doc = new JDFDoc("JDF");
         JDFNode n   = (JDFNode)doc.getRoot();
         Assert.IsFalse(n.hasAttribute(AttributeName.TEMPLATE), "no schema - no default");
         string    s           = doc.write2String(2);
         JDFParser parser      = new JDFParser();
         JDFDoc    docNoSchema = parser.parseString(s);
         JDFNode   as2         = (JDFNode)docNoSchema.getRoot();
         Assert.IsFalse(as2.hasAttribute(AttributeName.TEMPLATE), "no schema - no default");
         parser.m_SchemaLocation = sm_dirTestSchema + @"\JDF.xsd";
         JDFDoc  docSchema = parser.parseString(s);
         JDFNode as3       = (JDFNode)docSchema.getRoot();
         Assert.IsTrue(as3.hasAttribute(AttributeName.TEMPLATE), "schema parse - default is set");
         Assert.IsFalse(as3.getTemplate(), "schema parse - default is set");
     }
 }
예제 #5
0
        public virtual void testPerformance()
        {
            {
                JDFDoc   doc  = new JDFDoc("JDF");
                KElement root = doc.getRoot();
                long     l    = DateTime.Now.Ticks;
                // Java to C# Conversion - Divide number of tests by 1000 for now
                for (int i = 0; i < 10; i++)
                {
                    root.appendElement("Elem00");
                }
                Console.WriteLine("Append With factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                string s = doc.write2String(0);
                Console.WriteLine("Write With factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                JDFParser p = new JDFParser();
                Console.WriteLine("Parser With factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                p.parseString(s);
                Console.WriteLine("Parse With factory: " + (DateTime.Now.Ticks - l));
            }
            {
                JDFDoc   doc  = new JDFDoc("JDF");
                KElement root = doc.getRoot();
                ((DocumentJDFImpl)root.OwnerDocument).bKElementOnly = true;
                long l = DateTime.Now.Ticks;
                // Java to C# Conversion - Divide number of tests by 1000 for now
                for (int i = 0; i < 10; i++)
                {
                    root.appendElement("Elem00");
                }
                Console.WriteLine("Append Without factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                string s = doc.write2String(0);
                Console.WriteLine("Write Without factory: " + (DateTime.Now.Ticks - l) + " " + s.Length);
                l = DateTime.Now.Ticks;
                JDFParser p = new JDFParser();
                Console.WriteLine("Parser Without factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                p.parseString(s);
                Console.WriteLine("Parse Without factory: " + (DateTime.Now.Ticks - l));
            }

            {
                JDFDoc   doc  = new JDFDoc("JDF");
                KElement root = doc.getRoot();
                ((DocumentJDFImpl)root.OwnerDocument).bKElementOnly = true;
                long l = DateTime.Now.Ticks;
                // Java to C# Conversion - Divide number of tests by 1000 for now
                for (int i = 0; i < 10; i++)
                {
                    root.appendElement("Elem00");
                }
                Console.WriteLine("Append00 Without factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                string s = doc.write2String(0);
                Console.WriteLine("Write00 Without factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                JDFParser p = new JDFParser();
                Console.WriteLine("Parser00 Without factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                p.parseString(s);
                Console.WriteLine("Parse00 Without factory: " + (DateTime.Now.Ticks - l));
            }

            {
                JDFDoc   doc  = new JDFDoc("JDF");
                KElement root = doc.getRoot();
                long     l    = DateTime.Now.Ticks;
                // Java to C# Conversion - Divide number of tests by 1000 for now
                for (int i = 0; i < 10; i++)
                {
                    root.appendElement("Elem00");
                }
                Console.WriteLine("Append With factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                string s = doc.write2String(0);
                Console.WriteLine("Write With factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                JDFParser p = new JDFParser();
                Console.WriteLine("Parser With factory: " + (DateTime.Now.Ticks - l));
                l = DateTime.Now.Ticks;
                p.parseString(s);
                Console.WriteLine("Parse With factory: " + (DateTime.Now.Ticks - l));
            }
        }