Exemple #1
0
        public static WikiJob GetWikiJob(WikiJobRequest request, Serilog.ILogger log, IWikiAccessLogic wikiAccessLogic, IConfiguration config, RequestData jobData, IWikiJobRetriever retriever)
        {
            WikiJob job;
            var     throttleSpeedInSeconds = int.Parse(config["ThreadThrottleSpeedInSeconds"]);

            switch (request.JobType)
            {
            case JobType.TextReplacementJob:
                job = new TextReplacementJob(log, wikiAccessLogic, retriever, jobData, throttleSpeedInSeconds);
                break;

            case JobType.LinkFixJob:
                job = new LinkFixJob(log, wikiAccessLogic, retriever, jobData, throttleSpeedInSeconds);
                break;

            case JobType.ContinuityLinkFixJob:
                job = new ContinuityLinkFixJob(log, wikiAccessLogic, retriever, jobData, throttleSpeedInSeconds);
                break;

            default:
                throw new Exception("Job type is undefined");
            }

            job.Configuration = config;
            job.JobData       = jobData;
            job.Request       = request;
            job.Log           = log;

            return(job);
        }
Exemple #2
0
        public void ExecuteLinkFixJobLinkTextNotRetainedIfNoCustomText()
        {
            var        iConfig         = Utilities.GetIConfigurationRoot();
            var        wikiAccessLogic = new WikiAccessLogic();
            var        log             = Utilities.GetLogger(iConfig, _output);
            var        jobData         = Utilities.GetRequestData(null);
            var        request         = Utilities.GetSampleLinkFixJobRequest();
            var        textFileManager = new TextFileManager();
            var        jobRetriever    = new TextFileJobRetriever(iConfig, "WikiJobTest.txt", textFileManager);
            LinkFixJob job             = (LinkFixJob)WikiJobFactory.GetWikiJob(request, log, wikiAccessLogic, iConfig, jobData, jobRetriever);

            job.Configuration = iConfig;
            job.Execute();
        }