public ActionResult StopRecordingActionHandler(ProcessStepData stepData) { _log.Info("Starting execution of StopRecordingActionHandler"); if (neoLoadDesignApiInstance == null || !neoLoadDesignApiInstance.IsRecordStarted()) { _log.Info("Recording not started, nothing to stop."); return(new ActionResult(false, "No recording started", "")); } string advanced = stepData.GetActionArg(Parameters.ADVANCED, ""); AdvancedParameters advancedParameters = new AdvancedParameters(advanced); bool frameworkParameterSearch = advancedParameters.GetBooleanValue(Parameters.FRAMEWORK_PARAMETER_SEARCH, "true"); bool genericParameterSearch = advancedParameters.GetBooleanValue(Parameters.GENERIC_PARAMETER_SEARCH, "false"); StopRecordingParamsBuilder stopRecordingParamsBuilder = new StopRecordingParamsBuilder(); stopRecordingParamsBuilder.frameworkParameterSearch(frameworkParameterSearch).genericParameterSearch(genericParameterSearch); bool deleteRecording = advancedParameters.GetBooleanValue(Parameters.DELETE_RECORDING, "true"); bool includeVariables = advancedParameters.GetBooleanValue(Parameters.INCLUDE_VARIABLES_IN_USER_PATH_UPDATE, "true"); bool updateSharedContainers = advancedParameters.GetBooleanValue(Parameters.UPDATE_SHARED_CONTANERS, "false"); string matchingThreshold = advancedParameters.GetValue(Parameters.MATCHING_THRESHOLD, ""); UpdateUserPathParamsBuilder updateUserPathParamsBuilder = new UpdateUserPathParamsBuilder(); updateUserPathParamsBuilder.deleteRecording(deleteRecording).includeVariables(includeVariables).updateSharedContainers(updateSharedContainers); if (!matchingThreshold.Equals("")) { updateUserPathParamsBuilder.matchingThreshold(int.Parse(matchingThreshold)); } string message; bool status; try { _log.Info("Sending API call StopRecording"); neoLoadDesignApiInstance.StopRecording(stopRecordingParamsBuilder, updateUserPathParamsBuilder); message = "record stopped"; if (systemProxyHelper != null) { _log.Info("Restoring system proxy"); systemProxyHelper.restoreProxy(); systemProxyHelper = null; } status = true; } catch (Exception e) { _log.Error("Unable to send API call StopRecording", e); status = false; message = e.Message; } return(new ActionResult(status, message, "")); }
public void stopRecording(int timeout, bool frameworkParameterSearch = true, bool genericParameterSearch = true, bool deleteExistingRecording = false, bool includeVariablesInUserpathMerge = true, int matchingThreshold = 60, bool updateSharedContainers = false) { if (_mode != Mode.DESIGN) { return; } this.CheckDesignIsConnected(); var status = _client.GetStatus(); if (status != DesignState.BUSY) { throw (new Exception("Error!! No recording currently running!")); } if (pathExists) { _updateUserPathPB.name(this.userPathName); _updateUserPathPB.deleteRecording(deleteExistingRecording); _updateUserPathPB.includeVariables(includeVariablesInUserpathMerge); _updateUserPathPB.matchingThreshold(matchingThreshold); _updateUserPathPB.updateSharedContainers(updateSharedContainers); _stopRecordingPB.updateParams(_updateUserPathPB.Build()); Report.Log(ReportLevel.Debug, _updateUserPathPB.Build().ToString()); } _stopRecordingPB.timeout(timeout); _stopRecordingPB.frameworkParameterSearch(frameworkParameterSearch); _stopRecordingPB.genericParameterSearch(genericParameterSearch); Report.Log(ReportLevel.Debug, _stopRecordingPB.Build().ToString()); try { _client.StopRecording(_stopRecordingPB.Build()); } catch (Exception e) { Report.Log(ReportLevel.Debug, e.Message); } }