예제 #1
0
        public new void Init(object objParam)
        {
            // Get parameter info
            _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApi\");

            xsltArg1 = new XsltArgumentList();

            MyObject obj1 = new MyObject(1, _output);
            MyObject obj2 = new MyObject(2, _output);
            MyObject obj3 = new MyObject(3, _output);
            MyObject obj4 = new MyObject(4, _output);
            MyObject obj5 = new MyObject(5, _output);

            xsltArg1.AddExtensionObject("urn:my-obj1", obj1);
            xsltArg1.AddExtensionObject("urn:my-obj2", obj2);
            xsltArg1.AddExtensionObject("urn:my-obj3", obj3);
            xsltArg1.AddExtensionObject("urn:my-obj4", obj4);
            xsltArg1.AddExtensionObject("urn:my-obj5", obj5);

            xsltArg1.AddParam("myArg1", szEmpty, "Test1");
            xsltArg1.AddParam("myArg2", szEmpty, "Test2");
            xsltArg1.AddParam("myArg3", szEmpty, "Test3");
            xsltArg1.AddParam("myArg4", szEmpty, "Test4");
            xsltArg1.AddParam("myArg5", szEmpty, "Test5");

            return;
        }
예제 #2
0
        public override int Init(object objParam)
        {
            int ret = base.Init(objParam);

            // These steps use to be part of javascript files and these were copied and executed as test setup step.
            // I belive this to be a much better way of accomplishing the same task.
            // Logic from CreateApiTestFiles.js
            string sourceFile = Path.Combine(FilePathUtil.GetTestDataPath(), "XsltApiV2", "xmlResolver_document_function.xml");
            string targetFile = @"c:\temp\xmlResolver_document_function.xml";

            if (!Directory.Exists(@"c:\temp"))
            {
                Directory.CreateDirectory(@"c:\temp");
            }
            if (!File.Exists(targetFile))
            {
                File.Copy(sourceFile, targetFile, true);
            }

            // Logic from CreateStrasse.js
            using (XmlWriter writer = XmlWriter.Create("Stra\u00DFe.xml"))
            {
                writer.WriteComment(" ");
            }

            return(ret);
        }
예제 #3
0
 public /*override*/ new void Init(object objParam)
 {
     _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApiV2\");
     counter  = 0;
     InitTestData();
     return;
 }
예제 #4
0
        private new void Init(object objParam)
        {
#pragma warning disable 0618
            xsltSameInstance = new XslTransform();
#pragma warning restore 0618
            _strPath = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApi");
            return;
        }
예제 #5
0
        public override int Init(object o)
        {
            int ret = base.Init(o);

            _testData = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlReader");

            return(ret);
        }
예제 #6
0
        public void Init(object objParam)
        {
            //This is a temporary fix to restore the baselines. Refer to Test bug #
            _strPath       = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApiV2");
            _httpPath      = Path.Combine(FilePathUtil.GetHttpTestDataPath(), "XsltApiV2");
            _standardTests = Path.Combine("TestFiles", FilePathUtil.GetHttpStandardPath(), "xslt10", "Current");

            return;
        }
예제 #7
0
        public int LoadAndTransformWithMethodInfo(Object args)
        {
            XslCompiledTransform xslt = new XslCompiledTransform();

            xslt.Load(_meth, _staticData, _ebTypes);
            string filePath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"xsltc\precompiled\Scripting28.xsl");

            xslt.Transform(filePath, String.Format("out{0}.txt", System.Threading.Interlocked.Increment(ref counter)));
            return(1);
        }
예제 #8
0
        public void Init(object objParam)
        {
            // FullFilePath and FullHttpPath attempt to normalize file paths, however
            // as an extra step we can normalize them here, when they are first read
            // from the LTM file.
            _strPath  = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApi");
            _httpPath = FilePathUtil.GetHttpTestDataPath() + @"/XsltApi/";

            return;
        }
예제 #9
0
        private void InitTestData()
        {
            string filePath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"xsltc\precompiled\Scripting28.dll");

            _asm        = AssemblyLoadContext.Default.LoadFromAssemblyPath(Path.GetFullPath(filePath));
            _type       = _asm.GetType("Scripting28");
            _meth       = ReflectionTestCaseBase.GetStaticMethod(_type, "Execute");
            _staticData = (Byte[])_type.GetTypeInfo().GetField("staticData", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static).GetValue(_type);
            _ebTypes    = (Type[])_type.GetTypeInfo().GetField("ebTypes", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static).GetValue(_type);
        }
예제 #10
0
        public override int Init(object objParam)
        {
            int ret = base.Init(objParam);

            // copy all the data files to working folder
            CopyDataFiles(Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "xsltc"), TargetDirectory);
            CopyDataFiles(Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "xsltc", "precompiled"), TargetDirectory);
            CopyDataFiles(Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "xsltc", "baseline"), TargetDirectory);

            return(ret);
        }
예제 #11
0
        public void Init(object objParam)
        {
            // Get parameter info from runtime variables passed to LTM
            _fTrace = false;

            //This is a temporary fix to restore the baselines. Refer to Test bug #
            _strPath       = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApiV2");
            _httpPath      = Path.Combine(FilePathUtil.GetHttpTestDataPath(), "XsltApiV2");
            _standardTests = Path.Combine("TestFiles", FilePathUtil.GetHttpStandardPath(), "xslt10", "Current");

            return;
        }
예제 #12
0
        public override int Init(object objParam)
        {
            int ret = base.Init(objParam);

            _TestData = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlReader");

            // Create global usage test files
            string strFile = String.Empty;

            NameTable_TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.GENERIC);

            return(ret);
        }
예제 #13
0
        static XsltApiTestCaseBase2()
        {
            // Replace absolute URI in xmlResolver_document_function.xml based on the environment
            string      targetFile = Path.Combine(Path.GetTempPath(), typeof(XsltApiTestCaseBase2) + "_" + Path.GetRandomFileName());
            string      xslFile    = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApiV2", "xmlResolver_document_function_absolute_uri.xsl");
            XmlDocument doc        = new XmlDocument();

            doc.Load(xslFile);
            string xslString = doc.OuterXml.Replace("ABSOLUTE_URI", targetFile);

            doc.LoadXml(xslString);
            doc.Save(xslFile);
        }
예제 #14
0
 static XsltApiTestCaseBase()
 {
     // On uap access is denied to full path and the code below and related tests cannot run
     if (!PlatformDetection.IsUap)
     {
         // Replace absolute URI in xmlResolver_document_function.xml based on the environment
         string      xslFile = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApi", "xmlResolver_document_function_absolute_uri.xsl");
         XmlDocument doc     = new XmlDocument();
         doc.Load(xslFile);
         string xslString = doc.OuterXml.Replace("ABSOLUTE_URI", s_temporaryResolverDocumentFullName);
         doc.LoadXml(xslString);
         doc.Save(xslFile);
     }
 }
예제 #15
0
        private void Init(string schemaFile, string xmlFile, string xslType, string baseline, string ver)
        {
            _utils = new Utils(_output);

#pragma warning disable 0618
            if (ver == "v1")
            {
                _xsltV1 = new XslTransform();
            }
#pragma warning restore 0618

            else if (ver == "v2")
            {
                _xsltV2 = new XslCompiledTransform();
            }

            _schemaFile = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\schematron\" + schemaFile);
            _xmlFile    = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\schematron\" + xmlFile);
            if (baseline == string.Empty)
            {
                _baseline = string.Empty;
            }
            else
            {
                _baseline = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\schematron\" + ver + baseline);
            }

            switch (xslType.ToLower())
            {
            case "basic":
            default:
                _xslFile = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\schematron\" + "schematron-basic.xsl");
                break;

            case "message":
                _xslFile = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\schematron\" + "schematron-message.xsl");
                break;

            case "report":
                _xslFile = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\schematron\" + "schematron-report.xsl");
                break;
            }

            //Delete the output file if it exists
            if (File.Exists(_outFile))
            {
                File.Delete(_outFile);
            }
        }
예제 #16
0
        public override int Init(object objParam)
        {
            _TestData = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlReader");

            _TestData = _TestData.ToLowerInvariant();

            _standardpath = FilePathUtil.GetStandardPath();
            _standardpath = _standardpath.ToLowerInvariant();

            int ret = base.Init(objParam);

            _StartTime = DateTime.Now;

            return(ret);
        }
예제 #17
0
        public void Init(object objParam)
        {
            // Get input and transform type from attribute
            _nInputXsl = GetXslInputType(String.Empty);
            _nOutput   = GetOutputType(String.Empty);

            // Get parameter info from runtime variables passed to LTM
            _fTrace     = false;
            _navType    = GetDocType(InitStringValue("doctype"));
            _readerType = GetReaderType(InitStringValue("readertype"));

            //This is a temporary fix to restore the baselines. Refer to Test bug #
            _strPath       = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApiV2");
            _httpPath      = Path.Combine(FilePathUtil.GetHttpTestDataPath(), "XsltApiV2");
            _standardTests = Path.Combine("TestFiles", FilePathUtil.GetHttpStandardPath(), "xslt10", "Current");

            return;
        }
예제 #18
0
        static XsltApiTestCaseBase()
        {
            // In AppContainer access is denied to full path and the code below and related tests cannot run
            if (!PlatformDetection.IsInAppContainer)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(s_temporaryResolverDocumentFullName));

                // Replace absolute URI in xmlResolver_document_function.xml based on the environment, and store it under a different name
                string xslFile         = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApi", "xmlResolver_document_function_absolute_uri.xsl");
                string replacedXslFile = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApi", "xmlResolver_document_function_absolute_uri_replaced.xsl");
                File.Copy(xslFile, replacedXslFile, true);
                XmlDocument doc = new XmlDocument();
                doc.Load(replacedXslFile);
                string xslString = doc.OuterXml.Replace("ABSOLUTE_URI", s_temporaryResolverDocumentFullName);
                doc.LoadXml(xslString);
                doc.Save(replacedXslFile);
            }
        }
예제 #19
0
        public void Init(object objParam)
        {
            // Get input and transform type from attribute
            _nInput     = GetInputType(String.Empty);
            _nTransform = GetTransformType(String.Empty);

            // Get parameter info from runtime variables passed to LTM
            _fTrace     = (InitStringValue("trace").ToUpper() == "TRUE");
            _docType    = GetDocType(InitStringValue("doctype"));
            _readerType = GetReaderType(InitStringValue("readertype"));

            // FullFilePath and FullHttpPath attempt to normalize file paths, however
            // as an extra step we can normalize them here, when they are first read
            // from the LTM file.
            _strPath  = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApi\");
            _httpPath = FilePathUtil.GetHttpTestDataPath() + @"/XsltApi/";

            return;
        }
예제 #20
0
        public override int Init(object objParam)
        {
            baselinePath1 = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlWriter2\");
            string temp = FilePathUtil.GetVariableValue("WriterType").ToUpperInvariant();

            switch (temp)
            {
            case "UTF8WRITER":
                writerType1 = WriterType.UTF8Writer;
                break;

            case "UNICODEWRITER":
                writerType1 = WriterType.UnicodeWriter;
                break;

            case "CUSTOMWRITER":
                writerType1 = WriterType.CustomWriter;
                break;

            case "UTF8WRITERINDENT":
                writerType1 = WriterType.UTF8WriterIndent;
                break;

            case "UNICODEWRITERINDENT":
                writerType1 = WriterType.UnicodeWriterIndent;
                break;

            case "CHARCHECKINGWRITER":
                writerType1 = WriterType.CharCheckingWriter;
                break;

            case "WRAPPEDWRITER":
                writerType1 = WriterType.WrappedWriter;
                break;

            default:
                throw new Exception("Unknown writer type: " + temp);
            }

            writerFactory1 = new XmlCoreTest.Common.WriterFactory(writerType1);
            return(base.Init(objParam));
        }
예제 #21
0
 public /*override*/ new void Init(object objParam)
 {
     xsltSameInstance = new XslCompiledTransform();
     _strPath         = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApiV2\");
     return;
 }
예제 #22
0
 public new void Init(object objParam)
 {
     xsltSameInstance = new XslCompiledTransform();
     _strPath         = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApiV2");
     return;
 }
예제 #23
0
파일: EXslt.cs 프로젝트: wudilab/corefx
        public void RunEXslTest(object param0, object param1, object param2, object param3, object param4)
        {
            string OutFile    = "out_exslt.xml";
            string xmlFile    = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\EXslt\", param0.ToString());
            string xslFile    = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\EXslt\", param1.ToString());
            string resultType = param2.ToString();
            string baseLine   = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltScenarios\EXslt\out\", param3.ToString());

#pragma warning disable 0618
            if (param4.ToString() == "v1")
            {
                _xsltV1 = new XslTransform();
            }
#pragma warning restore 0618
            else if (param4.ToString() == "v2")
            {
                _xsltV2 = new XslCompiledTransform();
            }

            Utils util = new Utils(_output);

            _output.WriteLine("XmlFile : file:\\\\" + xmlFile);
            _output.WriteLine("XslFile : file:\\\\" + xslFile);

            if (resultType == "valid")
            {
                _output.WriteLine("BaseLine : file:\\\\" + baseLine);
            }
            else
            {
                _output.WriteLine("Test Type : Invalid");
            }

            //Create the argument list and load the source document
            XsltArgumentList argList = InitArgumentList();
            XPathDocument    doc     = null;

            try
            {
                doc = new XPathDocument(xmlFile);
            }
            catch (Exception e)
            {
                _output.WriteLine(e.ToString());
                Assert.True(false);
            }

            //Delete the output file if it exists

            using (Stream stm = new FileStream(OutFile, FileMode.Create, FileAccess.ReadWrite))
            {
                try
                {
                    if (param4.ToString() == "v1")
                    {
                        XPathDocument xslDoc = new XPathDocument(xslFile);
                        //Evidence evidence = new Evidence();
                        //evidence.AddHost(new Zone(SecurityZone.MyComputer));
                        //evidence.AddHost(new Zone(SecurityZone.Intranet));

                        _xsltV1.Load(xslDoc, new XmlUrlResolver() /*, evidence*/);
                        _xsltV1.Transform(doc, argList, stm, new XmlUrlResolver());
                    }
                    else if (param4.ToString() == "v2")
                    {
                        _xsltV2.Load(xslFile, XsltSettings.TrustedXslt, new XmlUrlResolver());
                        _xsltV2.Transform(doc, argList, stm);
                    }
                    stm.Dispose();
                    util.VerifyResult(OutFile, baseLine);
                }

                //For V1 Transform
                catch (XPathException ex)
                {
                    _output.WriteLine(ex.Message);
                    if (resultType == "invalid")
                    {
                        return;
                    }
                    else
                    {
                        Assert.True(false);
                    }
                }

                //For V2 Transform
                catch (XsltException ex)
                {
                    _output.WriteLine(ex.Message);
                    if (resultType == "invalid")
                    {
                        return;
                    }
                    else
                    {
                        Assert.True(false);
                    }
                }
            }
        }