public CheckTriggersQueueFeeder( WaitHandle stopSignal, JobQueue <ProjectRelatedJob> buildQueue, IThreadFactory threadFactory, IWorkerMonitor workerMonitor, IProjectRegistry projectRegistry) : base("CheckTriggersQueueFeeder", stopSignal, threadFactory, workerMonitor) { this.projectRegistry = projectRegistry; this.checkTriggersQueue = new JobQueue <ProjectRelatedJob> ("Check triggers queue", stopSignal); for (int i = 0; i < checkTriggersWorkersCount; i++) { CheckTriggersWorker worker = new CheckTriggersWorker( string.Format( CultureInfo.InvariantCulture, "CheckTriggersWorker {0}", i), checkTriggersQueue, buildQueue, threadFactory, projectRegistry, workerMonitor); checkTriggersQueue.AddWorker(worker); } checkTriggersQueue.StartWorkers(); }
public void CheckTriggersQueue() { HeadlessMother mother = new HeadlessMother(); IThreadFactory threadFactory = new DefaultThreadFactory(); IWorkerMonitor workerMonitor = mother.WorkerMonitor; using (ManualResetEvent stopSignal = new ManualResetEvent(false)) { JobQueue <ProjectRelatedJob> buildQueue = new JobQueue <ProjectRelatedJob>("buildQueue", stopSignal); using (CheckTriggersQueueFeeder checkTriggersQueueFeeder = new CheckTriggersQueueFeeder( stopSignal, buildQueue, threadFactory, workerMonitor, mother.ProjectRegistry)) { checkTriggersQueueFeeder.Start(); Thread.Sleep(TimeSpan.FromSeconds(10)); stopSignal.Set(); threadFactory.WaitForAllThreadsToStop(TimeSpan.FromSeconds(5)); } } mother.ProjectRegistry.AssertWasCalled(r => r.ChangeProjectStatus("ProjectPilot", ProjectStatus.CheckingTriggers)); mother.ProjectRegistry.AssertWasCalled(r => r.ChangeProjectStatus("Headless", ProjectStatus.CheckingTriggers)); mother.ProjectRegistry.AssertWasCalled(r => r.ChangeProjectStatus("Flubu", ProjectStatus.CheckingTriggers)); mother.ProjectRegistry.VerifyAllExpectations(); }
public CheckTriggersWorker( string workerName, JobQueue <ProjectRelatedJob> jobQueue, JobQueue <ProjectRelatedJob> buildQueue, IThreadFactory threadFactory, IProjectRegistry projectRegistry, IWorkerMonitor workerMonitor) : base(workerName, jobQueue, threadFactory, workerMonitor) { this.buildQueue = buildQueue; this.projectRegistry = projectRegistry; }
public HeadlessService( IProjectRegistry projectRegistry, IThreadFactory threadFactory, IWorkerMonitor workerMonitor, IHeadlessLogger headlessLogger) { this.projectRegistry = projectRegistry; this.threadFactory = threadFactory; this.workerMonitor = workerMonitor; this.headlessLogger = headlessLogger; }
public BuildWorker( string workerName, JobQueue <ProjectRelatedJob> buildQueue, IThreadFactory threadFactory, IProjectRegistry projectRegistry, IWorkerMonitor workerMonitor, IHeadlessLogger headlessLogger) : base(workerName, buildQueue, threadFactory, workerMonitor) { this.projectRegistry = projectRegistry; this.headlessLogger = headlessLogger; }
public TestWorker(string workerName, JobQueue <Job> jobQueue, IThreadFactory threadFactory, IWorkerMonitor workerMonitor) : base(workerName, jobQueue, threadFactory, workerMonitor) { }
protected AbstractWorker(BusyWatcher busyWatcher) { _workerMonitor = new WorkerMonitor(busyWatcher, this); }
protected QueuedWorker(string workerName, JobQueue <TJob> jobQueue, IThreadFactory threadFactory, IWorkerMonitor workerMonitor) : base(workerName, jobQueue.StopWorkingSignal, threadFactory, workerMonitor) { this.jobQueue = jobQueue; }
protected Worker(string workerName, WaitHandle stopSignal, IThreadFactory threadFactory, IWorkerMonitor workerMonitor) { this.threadFactory = threadFactory; this.workerName = workerName; this.stopSignal = stopSignal; this.workerMonitor = workerMonitor; }