/// <summary> /// Teardowns the environment. /// </summary> /// <param name="url">The URL.</param> /// <param name="credentials">The credentials.</param> /// <param name="path">The path to delete.</param>/param> /// <exception cref="System.ArgumentException"> /// url /// or /// path /// </exception> public static void TeardownEnvironment(string url, ICredentials credentials, string path) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException("url"); } if (string.IsNullOrEmpty(path)) { throw new ArgumentException("path"); } ReportingService2005 service = ReportingService2005TestEnvironment.GetReportingService(url, credentials); // If the path exists, delete it to clean up after the tests if (ReportingService2005TestEnvironment.ItemExists(service, path, ItemTypeEnum.Folder)) { service.DeleteItem(path); } if (ReportingService2005TestEnvironment.ItemExists(service, path, ItemTypeEnum.Folder)) { service.DeleteItem(path); } }
public string deleteFolder(string name, string parent) { try { if (!CheckExist(ItemTypeEnum.Folder, parent, name)) { return(String.Format("Folder {0} is not exist in parent folder {1}!", name, parent)); } rs.DeleteItem("/" + parent + "/" + name); return(""); } catch (Exception ex) { return(ex.Message); } }
private void DeployLinkedReports(List <ReportInfo> reports, string parentReportsLocation, string linkedReportsLocation, int dateTypeValue) { string targetLocation = CreateTargetLocation(linkedReportsLocation); foreach (ReportInfo report in reports) { string newReport = linkedReportsLocation + "/" + report.Name; if (_bgWorker.CancellationPending) { return; } //// Skip this report when deploying linked - it does not have dates //if (report.FileName.Equals("SQLcmReportAlertRules.rdl")) // continue; // See if we should over if (ItemExists(newReport, ItemTypeEnum.LinkedReport)) { if (_drd.OverwriteExisting) { _rs.DeleteItem(newReport); } else { _bgWorker.ReportProgress(1, String.Format("Skipping linked report: {0}...", linkedReportsLocation + "/" + report.Name)); continue; } } // Create the report _bgWorker.ReportProgress(1, String.Format("Deploying linked report: {0}...", linkedReportsLocation + "/" + report.Name)); _rs.CreateLinkedReport(report.Name, targetLocation, parentReportsLocation + "/" + report.Name, null); // Fix the parameters ReportParameter[] parameters = _rs.GetReportParameters(newReport, null, false, null, null); foreach (ReportParameter parameter in parameters) { if (parameter.Name == "dateType") { parameter.DefaultValues[0] = dateTypeValue.ToString(); } else if (parameter.Name == "startDate") { parameter.PromptUser = false; parameter.PromptUserSpecified = true; } else if (parameter.Name == "endDate") { parameter.PromptUser = false; parameter.PromptUserSpecified = true; } } _rs.SetReportParameters(newReport, parameters); } }
public static void SetupReportWriterEnvironment(string url, ICredentials credentials, string path, List <ReportItem> reports) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException("path"); } if (string.IsNullOrEmpty(url)) { throw new ArgumentException("path"); } if (reports == null) { throw new ArgumentNullException("reports"); } ReportingService2005 service = ReportingService2005TestEnvironment.GetReportingService(url, credentials); // If the path exists, delete it so we don't get any unexpected 'ItemAlreadyExists' exceptions while testing if (ReportingService2005TestEnvironment.ItemExists(service, path, ItemTypeEnum.Folder)) { service.DeleteItem(path); } // Go through each report and if it exists, delete it and then recreate it foreach (ReportItem report in reports) { if (ReportingService2005TestEnvironment.ItemExists(service, report.Path, ItemTypeEnum.Report)) { service.DeleteItem(report.Path); } ReportingService2005TestEnvironment.CreateReport(service, report); } }
public static void TeardownReportWriterEnvironment(string url, ICredentials credentials, string path, List <ReportItem> reports) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException("url"); } if (string.IsNullOrEmpty(path)) { throw new ArgumentException("path"); } if (reports == null) { throw new ArgumentNullException("reports"); } ReportingService2005 service = ReportingService2005TestEnvironment.GetReportingService(url, credentials); // Go through each folder and delete it if it exists foreach (ReportItem report in reports) { if (ReportingService2005TestEnvironment.ItemExists(service, report.Path, ItemTypeEnum.Folder)) { service.DeleteItem(report.Path); } } // Delete the path if it exists if (ReportingService2005TestEnvironment.ItemExists(service, path, ItemTypeEnum.Folder)) { service.DeleteItem(path); } }
/// <summary> /// Deletes the item. /// </summary> /// <param name="type">The type.</param> /// <param name="path">The path.</param> /// <param name="folderName">Name of the folder.</param> /// <returns></returns> public bool DeleteItem(ItemTypeEnum type, string path, string folderName) { path = path.Substring(path.Length - 1, 1) == @"\" ? path.Substring(0, path.Length - 1).Replace(@"\", @"/") : path.Replace(@"\", @"/"); bool resVal = false; if (CheckItemExist(type, path, folderName)) { _reportsServerInstance2005.DeleteItem(path + "/" + folderName); resVal = true; } return(resVal); }
/// <summary> /// Setups the ReportServerWriter integration tests environment for ReportingService2005 /// </summary> /// <param name="url">The URL.</param> /// <param name="credentials">The credentials.</param> /// <param name="path">The parent path to write items to (e.g. /SSRSMigrate_Tests).</param> /// <exception cref="System.ArgumentException"> /// url /// or /// path /// </exception> public static void SetupEnvironment(string url, ICredentials credentials, string path, string testPath) { if (string.IsNullOrEmpty(url)) { throw new ArgumentException("url"); } if (string.IsNullOrEmpty(path)) { throw new ArgumentException("path"); } mTestPath = testPath; // Create a report named 'Report Already Exists' so when we run integration tests that expect // this report to exist, it does SetupReportItems.Add(new ReportItem() { Name = "Report Already Exists", Path = "{0}/Reports/Report Already Exists", Definition = TesterUtility.StringToByteArray( TesterUtility.LoadRDLFile(Path.Combine(mTestPath, "Test AW Reports\\2005\\Company Sales.rdl"))) }); ReportingService2005 service = ReportingService2005TestEnvironment.GetReportingService(url, credentials); if (ReportingService2005TestEnvironment.ItemExists(service, path, ItemTypeEnum.Folder)) { service.DeleteItem(path); } // Create the parent (base) folder where the integration tests will be written to (e.g. /DEST_SSRSMigrate_Tests) ReportingService2005TestEnvironment.CreateFolderFromPath(service, path); // Create folder structure ReportingService2005TestEnvironment.CreateFolders(service, path); // Create the the data sources ReportingService2005TestEnvironment.CreateDataSources(service, path); // Create the the reports //ReportingService2005TestEnvironment.CreateReports(service, path); }
public void DeleteAllReports(string folder) { string path = "/" + folder; _reportService.DeleteItem(path); }
public void DeleteItem(string path) { webserviceProxy.DeleteItem(path); }