public void CreateUrlFromPath() { var helper = new ContextHelper(new ScenarioContext()); helper.SetContextValue <string>(Context.ServiceUrl, "https://server"); var url = helper.CreateUrl("/api/flows"); Assert.AreEqual($"https://server/api/flows", url); }
public static StepResult DeleteKernel(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.DeleteKernel); dynamic result = helper.DoHttpPostJsonObject(baseAddress, GetDeleteKernelJson(helper)); string response = result.result.ToString(); return new StepResult( success: response.Contains("Success"), description: nameof(DeleteKernel), result: $"Delete the kernel '{helper.GetContextValue<string>(Context.KernelId)}' "); }
public static StepResult RefreshSample(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.RefreshSample); dynamic result = helper.DoHttpPostJsonObject(baseAddress, GetInferSchemaJson(helper)); string response = result.result.ToString(); return new StepResult( success: response.Contains("success"), description: nameof(RefreshSample), result: $"Refreshing Sample"); }
public static StepResult InferSchema(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.InferSchema); dynamic result = helper.DoHttpPostJsonObject(baseAddress, GetInferSchemaJson(helper)); string inputSchema = JsonConvert.SerializeObject(result.result.Schema.ToString()); helper.SetContextValue<string>(Context.InputSchema, inputSchema); return new StepResult( success: !string.IsNullOrWhiteSpace(inputSchema), description: nameof(InferSchema), result: $"Inferring Schema '{inputSchema}' "); }
public static StepResult RestartJob(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.RestartFlowJobs); dynamic result = helper.DoHttpPostJsonString(baseAddress, GetFlowName(helper)); string restartJobsName = result.result.IsSuccess.ToString(); helper.SetContextValue <string>(Context.RestartJobsName, restartJobsName); return(new StepResult( success: !string.IsNullOrWhiteSpace(restartJobsName), description: nameof(RestartJob), result: $"created configs for the flow: '{restartJobsName}' ")); }
public static StepResult GenerateConfigs(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.GenerateConfigs); dynamic result = helper.DoHttpPostJsonString(baseAddress, GetFlowName(helper)); string generateConfigsRuntimeConfigFolder = result.result.Properties.runtimeConfigFolder.ToString(); helper.SetContextValue <string>(Context.GenerateConfigsRuntimeConfigFolder, generateConfigsRuntimeConfigFolder); return(new StepResult( success: !string.IsNullOrWhiteSpace(generateConfigsRuntimeConfigFolder), description: nameof(GenerateConfigs), result: $"created configs for the flow: '{generateConfigsRuntimeConfigFolder}' ")); }
public static StepResult GetFlow(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl($"{ScenarioUri.GetFlow}?{ScenarioUri.GetFlowParamName}={GetFlowName(helper)}"); dynamic result = helper.DoHttpGet(baseAddress); string flowConfig = result.result.name.ToString(); helper.SetContextValue <string>(Context.FlowConfig, flowConfig); return(new StepResult( success: !string.IsNullOrWhiteSpace(flowConfig), description: nameof(GetFlow), result: "acquired flow")); }
public static StepResult RefreshKernel(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.RefreshKernel); dynamic result = helper.DoHttpPostJsonObject(baseAddress, GetInitializeKernelJson(helper)); string kernelId = result.result.result.ToString(); string message = result.result.message.ToString(); helper.SetContextValue<string>(Context.KernelId, kernelId); return new StepResult( success: !(string.IsNullOrWhiteSpace(kernelId) && message == ""), description: nameof(RefreshKernel), result: $"Refresh the kernel '{kernelId}' "); }
public static StepResult SaveJob(ScenarioContext context) { ContextHelper helper = new ContextHelper(context); var baseAddress = helper.CreateUrl(ScenarioUri.SaveFlow); string input = GetFlowConfigContentJson(helper); dynamic result = helper.DoHttpPostJsonObject(baseAddress, input); string flowName = result.result.name.ToString(); helper.SetContextValue <string>(Context.FlowName, flowName); return(new StepResult( success: !string.IsNullOrWhiteSpace(flowName), description: nameof(SaveJob), result: $"created a flow '{flowName}' ")); }