/// <summary> /// Touches the job after it is queryable. /// </summary> /// <param name="job">The job</param> private void CheckJob(Job job) { string dummyString; string[] dummyList; int dummyInt; bool dummyBool; DateTime dummyDateTime; double dummyDouble; // wait until job is queryable this.Ready(job); dummyDateTime = job.CursorTime; dummyString = job.Delegate; dummyInt = job.DiskUsage; dummyString = job.DispatchState; dummyDouble = job.DoneProgress; dummyInt = job.DropCount; dummyDateTime = job.EarliestTime; dummyInt = job.EventAvailableCount; dummyInt = job.EventCount; dummyInt = job.EventFieldCount; dummyBool = job.EventIsStreaming; dummyBool = job.EventIsTruncated; dummyString = job.EventSearch; dummyString = job.EventSorting; dummyString = job.IndexEarliest; dummyString = job.IndexLatest; dummyString = job.Keywords; dummyString = job.Label; dummyDateTime = job.LatestTime; dummyInt = job.NumPreviews; dummyInt = job.Priority; dummyString = job.RemoteSearch; dummyString = job.ReportSearch; dummyInt = job.ResultCount; dummyBool = job.ResultIsStreaming; dummyInt = job.ResultPreviewCount; dummyDouble = job.RunDuration; dummyInt = job.ScanCount; dummyString = job.Search; dummyString = job.SearchEarliestTime; dummyString = job.SearchLatestTime; dummyList = job.SearchProviders; dummyString = job.Sid; dummyInt = job.StatusBuckets; dummyInt = job.Ttl; dummyBool = job.IsDone; dummyBool = job.IsFailed; dummyBool = job.IsFinalized; dummyBool = job.IsPaused; dummyBool = job.IsPreviewEnabled; dummyBool = job.IsRealTimeSearch; dummyBool = job.IsRemoteTimeline; dummyBool = job.IsSaved; dummyBool = job.IsSavedSearch; dummyBool = job.IsZombie; Assert.AreEqual(job.Name, job.Sid, this.assertRoot + "#1"); }
/// <summary> /// Returns a value indicating whether a specific Job SID exists /// in the job history. /// </summary> /// <param name="history">The job history</param> /// <param name="sid">The SID</param> /// <returns>True or false</returns> private bool Contains(Job[] history, string sid) { for (int i = 0; i < history.Length; ++i) { if (history[i].Sid.Equals(sid)) { return true; } } return false; }
/// <summary> /// Wait for the given job to complete /// </summary> /// <param name="job">The job</param> /// <returns>The same job</returns> public Job Wait(Job job) { while (!job.IsDone) { Thread.Sleep(1000); } return job; }
/// <summary> /// Wait for a job to be queryable /// </summary> /// <param name="job">The job</param> /// <returns>The same job</returns> public Job Ready(Job job) { while (!job.IsReady) { Thread.Sleep(10); } return job; }
/// <summary> /// Returns an array of search jobs created from this saved search. /// </summary> /// <returns>An array of <see cref="Job">Jobs</see>.</returns> public Job[] History() { ResponseMessage response = this.Service.Get(this.ActionPath("history")); AtomFeed feed; feed = AtomFeed.Parse(response.Content); int count = feed.Entries.Count; Job[] result = new Job[count]; for (int i = 0; i < count; ++i) { string sid = feed.Entries[i].Title; result[i] = new Job(this.Service, "search/jobs/" + sid); } return result; }
/// <summary> /// Runs the saved search using dispatch arguments. /// </summary> /// <param name="args">The arguments.</param> /// <returns>The <see cref="Job"/>.</returns> public Job Dispatch(Args args) { ResponseMessage response = this.Service.Post(this.ActionPath("dispatch"), args); this.Invalidate(); string sid = Job.SidExtraction(response); Job job; JobCollection jobs = this.Service.GetJobs(); job = jobs.Get(sid); // If job not yet scheduled, create an empty job object if (job == null) { job = new Job(this.Service, "search/jobs/" + sid); } return job; }