public void ReadProperties_ValuesAreSameWiththeInternalWebJobInstance() { //Set up WebJobRun jobRun = new WebJobRun(); WebJob webJob = new WebJob() { DetailedStatus = "some details", ExtraInfoUrl = "an extra info url", HistoryUrl = "a history url", LatestRun = jobRun, LogUrl = "a log url", Name = "my web job name", Status = "my web job status", Type = WebJobType.Triggered, RunCommand = "my run command", Url = new System.Uri("http://myWebJobUrl") }; // Test PSWebJob wrapper = new PSWebJob(webJob); // Assert Assert.AreEqual(webJob.DetailedStatus, wrapper.DetailedStatus); Assert.AreEqual(webJob.ExtraInfoUrl, wrapper.ExtraInfoUrl); Assert.AreEqual(webJob.HistoryUrl, wrapper.HistoryUrl); Assert.AreEqual(webJob.LatestRun, wrapper.LatestRun); Assert.AreEqual(webJob.LogUrl, wrapper.LogUrl); Assert.AreEqual(webJob.Name, wrapper.JobName); Assert.AreEqual(webJob.RunCommand, wrapper.RunCommand); Assert.AreEqual(webJob.Status, wrapper.Status); Assert.AreEqual(webJob.Type, wrapper.JobType); Assert.AreEqual(webJob.Url, wrapper.Url); }
private static AuthenticationHeaderValue GetAuthenticationHeader(WebJob webjob) { var bytes = Encoding.ASCII.GetBytes($"{webjob.UserName}:{webjob.Password}"); var base64 = Convert.ToBase64String(bytes); return(new AuthenticationHeaderValue("Basic", base64)); }
public void RemoveJob(WebJob job) { //foreach (WebJob webjob in jobs) //{ //if (webjob.id == job.id) //{ jobs.Remove(job); }
private void startJob(String jobType) { List <WebJob> jobs = cdb.findBy <WebJob>("Type", jobType); WebJob job = jobs[0]; job.IsRunning = true; job.update(); }
public void WriteProperties_InternalWebJobInstanceIsUpdated() { //Set up WebJobRun jobRun = new WebJobRun(); WebJob webJob = new WebJob() { Type = WebJobType.Triggered, }; string jobName = "My Job Name"; WebJobType jobType = WebJobType.Triggered; string detailedStatus = "some details"; string extraInfoUrl = "an extra info url"; string historyUrl = "a history url"; WebJobRun latestRun = new WebJobRun(); string logUrl = "a log url"; string status = "my web job status"; string runCommand = "my run command"; Uri url = new System.Uri("http://myWebJobUrl"); // Test PSWebJob wrapper = new PSWebJob(webJob); wrapper.JobType = jobType; wrapper.JobName = jobName; wrapper.DetailedStatus = detailedStatus; wrapper.ExtraInfoUrl = extraInfoUrl; wrapper.HistoryUrl = historyUrl; wrapper.LatestRun = latestRun; wrapper.LogUrl = logUrl; wrapper.Status = status; wrapper.RunCommand = runCommand; wrapper.Url = url; // Assert Assert.AreEqual(jobName, wrapper.JobName); Assert.AreEqual(jobType, wrapper.JobType); Assert.AreEqual(detailedStatus, wrapper.DetailedStatus); Assert.AreEqual(extraInfoUrl, wrapper.ExtraInfoUrl); Assert.AreEqual(historyUrl, wrapper.HistoryUrl); Assert.AreEqual(latestRun, wrapper.LatestRun); Assert.AreEqual(logUrl, wrapper.LogUrl); Assert.AreEqual(status, wrapper.Status); Assert.AreEqual(runCommand, wrapper.RunCommand); Assert.AreEqual(url, wrapper.Url); Assert.AreEqual(jobName, webJob.Name); Assert.AreEqual(jobType, webJob.Type); Assert.AreEqual(detailedStatus, webJob.DetailedStatus); Assert.AreEqual(extraInfoUrl, webJob.ExtraInfoUrl); Assert.AreEqual(historyUrl, webJob.HistoryUrl); Assert.AreEqual(latestRun, webJob.LatestRun); Assert.AreEqual(logUrl, webJob.LogUrl); Assert.AreEqual(status, webJob.Status); Assert.AreEqual(runCommand, webJob.RunCommand); Assert.AreEqual(url, webJob.Url); }
private string getLinkStop(WebJob job) { if (job.IsRunning) { return(string.Format("<span class=\"running\">{1} <span href=\"{0}\" class=\"stopCmd cmd\">{2}</span></span>", to(Stop, job.Id), lang("running"), lang("jobStop"))); } else { return(string.Format("<span class=\"stopped\">{1} <span href=\"{0}\" class=\"startCmd cmd\">{2}</span></span>", to(Start, job.Id), lang("stopped"), lang("jobStart"))); } }
public async Task <WebJobInfo> GetWebJobInfoAsync(WebJob webjob) { var(infos, statusCode) = await GetWebJobResponseAsync(webjob); if (infos == null) { _logger.LogError("Failed to get infos for webjob '{webJobName}' [StatusCode = {statusCode}]", webjob.Name, statusCode); } return(infos); }
public virtual void Edit(long id) { target(Update, id); WebJob job = cdb.findById <WebJob>(id); if (job == null) { echoRedirect(lang("exDataNotFound")); return; } set("job.Interval", job.Interval); }
public virtual void Start(long id) { WebJob job = cdb.findById <WebJob>(id); if (job == null) { echoRedirect(lang("exDataNotFound")); return; } job.IsRunning = true; job.update(); HttpRuntime.UnloadAppDomain(); echoAjaxOk(); }
public void PopulateDataWebJob() { List <NoticiaRss> noticias = this.GetRss(); int id = this.GetMaxId(); foreach (NoticiaRss rss in noticias) { WebJob webJob = new WebJob(); webJob.IdTitular = id; webJob.Titulo = rss.Title; webJob.Enlace = rss.Link; webJob.Descripcion = rss.Description; webJob.Fecha = DateTime.Now; id += 1; this.context.WebJobs.Add(webJob); } this.context.SaveChanges(); }
public virtual void Update(long id) { int Interval = ctx.PostInt("Interval"); WebJob job = cdb.findById <WebJob>(id); if (job == null) { echoRedirect(lang("exDataNotFound")); return; } job.Interval = Interval; job.update(); HttpRuntime.UnloadAppDomain(); echoToParentPart(lang("opok"), to(List), 999); }
public PSWebJob(WebJob webJob) { _webJob = webJob; }
//public bool sbPur = false; public AFlat_Rent(GameObject flat, WebJob webJob) { this.flat = flat; this.webJob = webJob; income = webJob.price; }
private async Task <Tuple <WebJobInfo, HttpStatusCode> > GetWebJobResponseAsync(WebJob webjob) { var webJobName = webjob.Name; var webJobType = webjob.Type; var httpClient = _httpClientFactory.CreateClient(); httpClient.BaseAddress = new Uri(webjob.Url); httpClient.DefaultRequestHeaders.Authorization = GetAuthenticationHeader(webjob); var webjobRelativeUrl = BuildRelativeWebJobUrl(webJobName, webJobType); using (var httpResponseMessage = await httpClient.GetAsync(webjobRelativeUrl)) { if (!httpResponseMessage.IsSuccessStatusCode) { return(new Tuple <WebJobInfo, HttpStatusCode>(null, httpResponseMessage.StatusCode)); } var content = await httpResponseMessage.Content.ReadAsStringAsync(); var infos = JsonConvert.DeserializeObject <WebJobInfo>(content); return(new Tuple <WebJobInfo, HttpStatusCode>(infos, httpResponseMessage.StatusCode)); } }
public void GenerateOrder() { //Choosing the crime type JobType jt = (JobType)random.Next(1, 2); //Cheking if it's FRH if (jt == JobType.Flat_RentHouse) { //Choose if it's a random or specyfic flat int o = random.Next(0, wishlisto.Length - 1); if (o != 0) { float income = AFlat_Rent.priceUnit * random.Next(1, 8); //Choosing hoteldays count int vhoteldays = random.Next(1, 7); income *= vhoteldays; if (revenge == true) { //income = (int)(income * 1.5f); income = (int)(income * (EQ / IQ) * revangeStreak); } else { income = (int)(income * (EQ / IQ)); } if (crimelord != 0) { income = (int)(income * crimelord * 1.5f); } income = (int)(income * (1 / ((age - 15) / 25))) / 10; if (!wasCriminalAlready) { income = (int)(income * (random.Next(0, 8) / 4)); } else { income = (int)(income * totalcriminalhistory.Keys.Count / 4 * (crimelord + 1)); } income = (int)(income * (gameObject.GetComponent <FlatMechanics>().equipment * 1.5f)); WebJob webJob = new WebJob { clientName = this.pname, price = (int)income, taken = false, done = false, Jobtype = JobType.Flat_RentHouse }; AFlat_Rent action = new AFlat_Rent(webJob) { hoteldays = vhoteldays, crimeduration = vhoteldays, random = true }; PlayerManager.Instance.AddJob(webJob); PlayerManager.Instance.AddAction(action); } else //its random //Find object on the scene matching the name. //Feed the 1st arg { GameObject goo = GameObject.Find(wishlisto[o]); //Chosing the income float income = AFlat_Rent.priceUnit * random.Next(1, 8); //Choosing hoteldays count int vhoteldays = random.Next(1, 7); income *= vhoteldays; if (revenge == true) { //income = (int)(income * 1.5f); income = (int)(income * (EQ / IQ) * revangeStreak); } else { income = (int)(income * (EQ / IQ)); } if (crimelord != 0) { income = (int)(income * crimelord * 1.5f); } income = (int)(income * (1 / ((age - 15) / 25))) / 10; if (!wasCriminalAlready) { income = (int)(income * (random.Next(0, 8) / 4)); } else { income = (int)(income * totalcriminalhistory.Keys.Count / 4 * (crimelord + 1)); } WebJob webJob = new WebJob { clientName = this.pname, price = (int)income, taken = false, done = false, Jobtype = JobType.Flat_RentHouse }; AFlat_Rent action = new AFlat_Rent(goo, webJob) { hoteldays = vhoteldays, crimeduration = vhoteldays, random = false }; //webjob.ConstructUI(); //webhob.SetActive(); PlayerManager.Instance.AddAction(action); PlayerManager.Instance.AddJob(webJob); } } }
public PSWebJob() { _webJob = new WebJob(); }
public AFlat_Rent(WebJob webJob) { this.webJob = webJob; random = true; }
public void AddJob(WebJob job) { jobs.Add(job); }