public void ExtractorConfigValidate_NoPropertiesSet_MissingParameterException() { var extractorConfig = new ExtractorConfig(); var expectedException = Assert.Throws <ArgumentException>(() => extractorConfig.Validate()); Assert.Contains("Missing parameter", expectedException.Message); }
public static IPositionReportExtractor Create(ExtractorConfig config, out Logger logger) { var service = PositionServiceProxyFactory.Create(config.MaxTimeout); var reporter = PositionReporterFactory.Create(config.ReportLocation); logger = CreateLogger(config.LogLocation); return(new PositionReportExtractor(service, reporter, logger)); }
public ExtractorConfig ConvertConfigJsonToExtractorConfig() { string extractorJsonPath = "extractorparams.json"; using (StreamReader r = new StreamReader(extractorJsonPath)) { string extractorJson = r.ReadToEnd(); ExtractorConfig extractorConfig = JsonConvert.DeserializeObject <ExtractorConfig>(extractorJson); return(extractorConfig); } }
public void ExtractorConfigValidate_MinimumPropertiesSet_IsValid() { var extractorConfig = new ExtractorConfig { sourceApimName = "source-apim", destinationApimName = "destination-apim", resourceGroup = "resource-group", fileFolder = "c:/my/folder" }; extractorConfig.Validate(); }
public Extractor(ExtractorConfig exc) { this.sourceApimName = exc.sourceApimName; this.destinationApimName = exc.destinationApimName; this.resourceGroup = exc.resourceGroup; this.fileFolder = exc.fileFolder; this.linkedTemplatesBaseUrl = exc.linkedTemplatesBaseUrl; this.linkedTemplatesUrlQueryString = exc.linkedTemplatesUrlQueryString; this.policyXMLBaseUrl = exc.policyXMLBaseUrl; this.apiVersionSetName = exc.apiVersionSetName; this.includeAllRevisions = checkIncludeRevision(exc.includeAllRevisions); }
public ExtractorJob() { this.JobId = nameof(ExtractorJob); this.config = new ExtractorConfig( maxTimeout: TimeSpan.Parse(ConfigurationManager.AppSettings["MaxTimeout"]), logLocation: ConfigurationManager.AppSettings["LogLocation"], reportLocation: ConfigurationManager.AppSettings["ReportLocation"], cron: ConfigurationManager.AppSettings["Cron"]); this.extractor = PositionReportExtractorFactory.Create(this.config, out var logger); this.logger = logger; }
public ExtractorConfig ConvertConfigJsonToExtractorConfig(string extractorJsonPath) { if (string.IsNullOrWhiteSpace(extractorJsonPath) || !File.Exists(extractorJsonPath)) { throw new FileNotFoundException($"You have to specify an existing file, you specified: '{extractorJsonPath}'"); } using (StreamReader r = new StreamReader(extractorJsonPath)) { string extractorJson = r.ReadToEnd(); ExtractorConfig extractorConfig = JsonConvert.DeserializeObject <ExtractorConfig>(extractorJson); return(extractorConfig); } }
public void ExtractorConfigValidate_VerifyNotSupportedCases_ThrowsException(string splitApis, string apiVersionSetName, string apiName, string includeAllRevisions, string multipleApis) { var extractorConfig = new ExtractorConfig { sourceApimName = "source-apim", destinationApimName = "destination-apim", resourceGroup = "resource-group", fileFolder = "c:/my/folder", splitAPIs = splitApis, apiName = apiName, apiVersionSetName = apiVersionSetName, includeAllRevisions = includeAllRevisions, mutipleAPIs = multipleApis }; Assert.Throws <NotSupportedException>(() => extractorConfig.Validate()); }
public static IPositionReportExtractor Create(ExtractorConfig config) => Create(config, out var logger);