internal async Task TestDeletingUpdatedJob() { using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile()) { var service = new AgentService(); var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath); //seting up a temp notebook job var notebook = AgentTestUtils.SetupNotebookJob(connectionResult).Result; //verifying that the notebook is created Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook)); var originalName = notebook.Name; //Changing the notebookName notebook.Name = "myTestNotebookJob" + Guid.NewGuid().ToString(); Assert.Equal(false, AgentTestUtils.VerifyNotebook(connectionResult, notebook)); await AgentNotebookHelper.UpdateNotebook( service, connectionResult.ConnectionInfo.OwnerUri, originalName, notebook, null, ManagementUtils.asRunType(0) ); Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook)); //cleaning up the job await AgentTestUtils.CleanupNotebookJob(connectionResult, notebook); } }
public static async Task <AgentNotebookInfo> SetupNotebookJob( TestConnectionResult connectionResult, AgentNotebookInfo notebook = null) { var service = new AgentService(); if (notebook == null) { notebook = GetTestNotebookInfo("myTestNotebookJob" + Guid.NewGuid().ToString(), "master"); } string tempNotebookPath = CreateTemplateNotebookFile(); await AgentNotebookHelper.CreateNotebook( service, connectionResult.ConnectionInfo.OwnerUri, notebook, tempNotebookPath, ManagementUtils.asRunType(0) ); var createdNotebook = GetNotebook(connectionResult, notebook.Name); File.Delete(tempNotebookPath); return(createdNotebook); }
public static async Task CleanupNotebookJob(TestConnectionResult connectionResult, AgentNotebookInfo notebook) { var service = new AgentService(); await AgentNotebookHelper.DeleteNotebook( service, connectionResult.ConnectionInfo.OwnerUri, notebook, ManagementUtils.asRunType(0) ); }
internal async Task HandleDeleteAgentJobRequest(DeleteAgentJobParams parameters, RequestContext <ResultStatus> requestContext) { var result = await ConfigureAgentJob( parameters.OwnerUri, parameters.Job, ConfigAction.Drop, ManagementUtils.asRunType(parameters.TaskExecutionMode)); await requestContext.SendResult(new ResultStatus() { Success = result.Item1, ErrorMessage = result.Item2 }); }
internal async Task HandleUpdateAgentJobRequest(UpdateAgentJobParams parameters, RequestContext <UpdateAgentJobResult> requestContext) { var result = await ConfigureAgentJob( parameters.OwnerUri, parameters.OriginalJobName, parameters.Job, ConfigAction.Update, ManagementUtils.asRunType(parameters.TaskExecutionMode)); await requestContext.SendResult(new UpdateAgentJobResult() { Success = result.Item1, ErrorMessage = result.Item2 }); }