public TestCase204(ILog log, TargetSiteWrapper target, int load_factor, IEnumerable <Data.Mission> missions, OfflineDataStatus offlineDataStatus, out List <IOpenSearchResultItem> foundItems) : base(log, target, load_factor, missions, out foundItems) { Id = "TC204"; Title = "Offline Data Query"; this.offlineDataStatus = offlineDataStatus; }
public IEnumerable <TestCase> CreateTestCases() { if (target.Type == TargetType.DATAHUB) { UriBuilder urib = new UriBuilder(target.Wrapper.Settings.ServiceUrl); urib.Path = urib.Path.Replace("/search", ""); urib.Path += target.Wrapper.Settings.ServiceUrl.AbsolutePath.TrimEnd('/').EndsWith("odata/v1") ? "" : "/odata/v1"; target.Wrapper.Settings.ServiceUrl = urib.Uri; target.Wrapper.Settings.MetadataModel = "dhus"; target.Wrapper.Settings.ApiId = ApiId.DHUSV1; } List <TestCase> _testCases = new List <TestCase>(); List <IOpenSearchResultItem> foundItems = null; OfflineDataStatus offlineDataStatus = null; FileInfo offlineDataStatusFile = new FileInfo("offlineDataStatusFile.json"); if (offlineDataStatusFile.Exists) { log.InfoFormat("Reading Offline Data Status file"); using (var stream = offlineDataStatusFile.OpenRead()) { try { StreamReader sr = new StreamReader(stream); offlineDataStatus = JsonConvert.DeserializeObject <OfflineDataStatus>(sr.ReadToEnd()); } catch (Exception e) { log.WarnFormat("Error reading Offline Data Status file : {0}", e.Message); log.Debug(e.StackTrace); } } } if (offlineDataStatus == null || offlineDataStatus.OfflineData == null || offlineDataStatus.OfflineData.Count() == 0) { log.DebugFormat("No Previous Offline Data Status"); offlineDataStatus = new OfflineDataStatus(); } _testCases.Add(new TestCase204(log, target, load_factor, Mission.GenerateExistingDataDictionary(target), offlineDataStatus, out foundItems)); _testCases.Add(new TestCase304(log, target, load_factor, offlineDataStatus, foundItems)); return(_testCases); }