public void StopRecording() { StopRecordingParamsBuilder _stopRecordingBuilder = new StopRecordingParamsBuilder(); if (_userPathExist) { UpdateUserPathParamsBuilder _updateUserPathBuilder = new UpdateUserPathParamsBuilder(); _updateUserPathBuilder.name(_userPathName); _updateUserPathBuilder.deleteRecording(true); _stopRecordingBuilder.updateParams(_updateUserPathBuilder.Build()); } try { _client.StopRecording(_stopRecordingBuilder.Build()); _client.SaveProject(); if (_systemProxyHelper != null) { _systemProxyHelper.restoreProxy(); } } finally { _recordStarted = false; _instance = null; _systemProxyHelper = null; } }
public void StartRecording(Protocol protocol) { _recordStarted = true; try { StartRecordingParamsBuilder _startRecordingPB = new StartRecordingParamsBuilder(); if (_userPathName != null && _userPathName.Length != 0) { ContainsUserPathParamsBuilder _containsBuilder = new ContainsUserPathParamsBuilder(); _containsBuilder.name(_userPathName); _userPathExist = _client.ContainsUserPath(_containsBuilder.Build()); if (_userPathExist) { _startRecordingPB.virtualUser(_userPathName + "_recording"); } else { _startRecordingPB.virtualUser(_userPathName); } } if (Protocol.SAP.Equals(protocol)) { _startRecordingPB.isSapGuiProtocol(true); _startRecordingPB.isCreateTransactionBySapTCode(_createTransactionBySapTCode); } else if (Protocol.WEB.Equals(protocol)) { _startRecordingPB.isHTTP2Protocol(_http2); if (_systemProxyHelper == null) { _systemProxyHelper = new SystemProxyHelper(_apiPort); _systemProxyHelper.setProxy(_apiHost, _recorderProxyPort, ""); } } _client.StartRecording(_startRecordingPB.Build()); } catch (Exception e) { _recordStarted = false; _instance = null; _systemProxyHelper = null; WriteExceptionToFile(e); throw e; } try { NeoloadRestApiInstance.GetInstance().SendUsageEvent("recording", protocol); } catch (Exception e) { // Do nothing if send event fails } }
public static NeoLoadDesignApiInstance GetInstance() { if (_instance == null) { Dictionary <string, string> properties = NeoLoadSettings.ReadSettingsFromUserFile(); string host = properties[NeoLoadSettings.API_HOSTNAME_KEY]; string port = properties[NeoLoadSettings.API_PORT_KEY]; string token = properties[NeoLoadSettings.API_KEY_KEY]; bool createTransactionBySapTCode = Boolean.Parse(properties[NeoLoadSettings.CREATE_TRANSACTION_BY_SAP_TCODE_KEY]); Protocol protocolToRecord = (Protocol)Enum.Parse(typeof(Protocol), properties[NeoLoadSettings.RECORD_WEB_OR_SAP]); _instance = new NeoLoadDesignApiInstance(host, port, token, createTransactionBySapTCode, protocolToRecord); _instance.intialize(); } return(_instance); }