private static XElement DeleteIfExists(string clientAccessPolicyFilePath, XElement xePolicyFileTemplate) { if (xePolicyFileTemplate != null) { xePolicyFileTemplate = null; IOUtil.EnsureFileDeleted(clientAccessPolicyFilePath); } return(xePolicyFileTemplate); }
protected void RetrieveAPICallLog() { string directoryPath = Path.Combine(Workspace.DataService.DestinationFolder, APICallLog.DirectoryName); string markerFilePath = Path.Combine(directoryPath, APICallLog.MarkerFileName); if (!this.LogAPICalls) { AstoriaTestLog.IsFalse(TrustedMethods.IsFileExists(markerFilePath), "Marker file should have been cleaned up by prior request"); return; } IOUtil.EnsureFileDeleted(markerFilePath); this.APICallLogXml = new XElement("APICallLog"); this.APICallLogEntries = new List <APICallLogEntry>(); string[] files; // re-query each time, in case any new files were created while ((files = Directory.GetFiles(directoryPath, "*.xml")).Length > 0) { foreach (string filePath in files.OrderBy(f => f)) //NEED TO BE IN CORRECT ORDER { string text = File.ReadAllText(filePath); XElement element = null; try { element = XElement.Parse(text); } catch { } if (element != null) { this.APICallLogXml.Add(element); this.APICallLogEntries.Add(APICallLogEntry.FromXml(element)); } else { this.APICallLogXml.Add(text); this.APICallLogEntries.Add(new APICallLogEntry(text, new KeyValuePair <string, string> [0])); //this will hopefully ALWAYS fail to compare } IOUtil.EnsureFileDeleted(filePath); } } //if (APICallLogEntries.Any(e => e.MethodName == APICallLog.UnterminatedCall)) //{ // foreach (APICallLogEntry entry in APICallLogEntries) // AstoriaTestLog.WriteLine("(Observed) - " + entry.ToString()); // AstoriaTestLog.FailAndContinue(new Microsoft.Test.ModuleCore.TestFailedException("Un-terminated API calls detected")); //} }
public override void ApplyFriendlyFeeds() { if (GenerateServerMappings) { string partialClassPath = Path.Combine(Path.Combine(this.DataService.DestinationFolder, "App_Code"), this.ObjectLayerOutputFileName.Replace("InMemory", "InMemoryPartial")); IOUtil.EnsureFileDeleted(partialClassPath); StreamWriter textStream = IOUtil.CreateTextStream(partialClassPath); ReflectionProvider.CSharpCodeLanguageHelper codeHelper = new ReflectionProvider.CSharpCodeLanguageHelper(textStream); WritePartialClassAttributes(this.ContextNamespace, codeHelper); textStream.Close(); this.ObjectLayerFileNames.Add(partialClassPath); } if (GenerateClientTypes) { GenerateAndLoadClientTypes(); PopulateClientTypes(); } this.RestoreData(); }
public override void ApplyFriendlyFeeds() { if (GenerateServerMappings) { string partialClassPath = Path.Combine(Path.Combine(this.DataService.DestinationFolder, "App_Code"), this.ObjectLayerOutputFileName.Replace("LinqToSql", "LinqToSqlPartial")); if (File.Exists(partialClassPath)) { IOUtil.EnsureFileDeleted(partialClassPath); } StreamWriter textStream = File.CreateText(partialClassPath); ReflectionProvider.CSharpCodeLanguageHelper codeHelper = new ReflectionProvider.CSharpCodeLanguageHelper(textStream); WritePartialClassAttributes(this.ContextNamespace, codeHelper); textStream.Close(); } if (GenerateClientTypes || GenerateClientTypesManually) { GenerateAndLoadClientTypes(); } PopulateClientTypes(); }