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; }
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); }
public /*override*/ new void Init(object objParam) { _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApiV2\"); counter = 0; InitTestData(); return; }
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; }
public override int Init(object o) { int ret = base.Init(o); _testData = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlReader"); return(ret); }
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; }
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); }
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; }
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); }
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); }
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; }
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); }
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); }
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); } }
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); } }
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); }
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; }
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); } }
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; }
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)); }
public /*override*/ new void Init(object objParam) { xsltSameInstance = new XslCompiledTransform(); _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApiV2\"); return; }
public new void Init(object objParam) { xsltSameInstance = new XslCompiledTransform(); _strPath = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApiV2"); return; }
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); } } } }