/// <summary> /// Start a recording. </summary> /// <param name="startRecordingParams"> </param> /// <exception cref="ODataException"> </exception> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> /// <returns></returns> public StartRecordingInfo StartRecording(StartRecordingParams startRecordingParams) { if (!Enabled) { return(new StartRecordingInfo()); } IEdmEntityType edmSchemaElement = Edm.SchemaElements.Where(schema => schema.Name == DesignApiUtils.START_RECORDING).First() as IEdmEntityType; bool isPresentInNeoloadSchemaCreateTransactionBySapTCode = edmSchemaElement.DeclaredProperties.Where(prop => prop.Name == DesignApiUtils.CREATE_TRANSACTION_BY_SAP_TCODE).Count() > 0; IDictionary <string, object> properties = DesignApiUtils.getStartRecordingProperties(startRecordingParams); if (!isPresentInNeoloadSchemaCreateTransactionBySapTCode) { // Remove this property to keep compatibility with Neoload older than 7.3 properties.Remove(DesignApiUtils.CREATE_TRANSACTION_BY_SAP_TCODE); } properties[DesignApiUtils.API_KEY] = apiKey; try { ODataEntry entity = ReadEntity(DesignApiUtils.START_RECORDING, properties); return(DesignApiUtils.getStartRecordingInfo(entity.AsDictionary())); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Stop a recording. </summary> /// <param name="stopRecordingParams"> </param> /// <exception cref="ODataException"> </exception> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public void StopRecording(StopRecordingParams stopRecordingParams) { if (!Enabled) { return; } IDictionary <string, object> properties = DesignApiUtils.getStopRecordingProperties(stopRecordingParams); properties[DesignApiUtils.API_KEY] = apiKey; try { CreateEntity(DesignApiUtils.STOP_RECORDING, properties); Task t = Task.Factory.StartNew(() => WaitUntilServerIsReady()); //Wait untill timeout, if timeout expires Wait() returns false. if (!t.Wait(stopRecordingParams.Timeout * 1000)) { throw new NeotysAPIException(NeotysAPIException.ErrorType.NL_DESIGN_ILLEGAL_STATE_FOR_OPERATION, "The timeout of " + stopRecordingParams.Timeout + " second(s) has been reached."); } } //Task has been interrupted by another reason than timeout, throw error with real cause. catch (System.AggregateException aggregateException) { throw new NeotysAPIException(aggregateException.InnerException); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Set the base container. </summary> /// <param name="setBaseContainer"> </param> /// <exception cref="ODataException"> </exception> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public void SetBaseContainer(SetBaseContainerParams setBaseContainer) { if (!Enabled) { return; } IDictionary <string, object> properties = DesignApiUtils.getSetBaseContainerProperties(setBaseContainer); properties[DesignApiUtils.API_KEY] = apiKey; try { CreateEntity(DesignApiUtils.SET_BASE_CONTAINER, properties); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Close the project. </summary> /// <param name="closeProjectParams"> </param> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public void CloseProject(CloseProjectParams closeProjectParams) { if (!Enabled) { return; } IDictionary <string, object> properties = DesignApiUtils.getCloseProjectProperties(closeProjectParams); properties[DesignApiUtils.API_KEY] = apiKey; try { CreateEntity(DesignApiUtils.CLOSE_PROJECT, properties); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Set the current screenshot. </summary> /// <param name="setScreenshot"> </param> /// <exception cref="ODataException"> </exception> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public void SetScreenshot(SetScreenshotParams setScreenshot) { if (!Enabled) { return; } IDictionary <string, object> properties = DesignApiUtils.getSetScreenshotProperties(setScreenshot); properties[DesignApiUtils.API_KEY] = apiKey; try { CreateEntity(DesignApiUtils.SET_SCREENSHOT, properties); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Returns true if project is open. </summary> /// <param name="isProjectOpenParams"> </param> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public bool IsProjectOpen(IsProjectOpenParams isProjectOpenParams) { if (!Enabled) { return(false); } IDictionary <string, object> properties = DesignApiUtils.getIsProjectOpenProperties(isProjectOpenParams); properties[DesignApiUtils.API_KEY] = apiKey; try { ODataEntry entity = ReadEntity(DesignApiUtils.IS_PROJECT_OPEN, properties); return(DesignApiUtils.getOpen(entity.AsDictionary())); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Returns true if User Path exist. </summary> /// <param name="containsUserPathParams"> </param> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public bool ContainsUserPath(ContainsUserPathParams containsUserPathParams) { if (!Enabled) { return(false); } IDictionary <string, object> properties = DesignApiUtils.getContainsUserPathProperties(containsUserPathParams); properties[DesignApiUtils.API_KEY] = apiKey; try { ODataEntry entity = ReadEntity(DesignApiUtils.CONTAINS_USER_PATH, properties); return(DesignApiUtils.getContains(entity.AsDictionary())); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Get the status of NeoLoad. </summary> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public Status GetStatus() { if (!Enabled) { return(Status.BUSY); } IDictionary <string, object> properties = new Dictionary <string, object>(); properties[DesignApiUtils.API_KEY] = apiKey; try { ODataEntry entity = ReadEntity(DesignApiUtils.GET_STATUS, properties); return(DesignApiUtils.getStatus(entity.AsDictionary())); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
/// <summary> /// Get the recorder settings. </summary> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public RecorderSettings GetRecorderSettings() { if (!Enabled) { return(new RecorderSettings()); } IDictionary <string, object> properties = new Dictionary <string, object>(); properties[DesignApiUtils.API_KEY] = apiKey; try { ODataEntry entity = ReadEntity(DesignApiUtils.GET_RECORDER_SETTINGS, properties); return(DesignApiUtils.getGetRecorderSettings(entity.AsDictionary())); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }