/// <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); } }
public void AsDictionary_Should_ReturnTheDictionaryOfProperties() { // Arrange var entry = new ODataEntry(InitializeProperties()); // Act var actual = entry.AsDictionary(); // Assert Assert.IsType <Dictionary <string, object> >(actual); }
/// <summary> /// Create a new Data Exchange client, connected to the server at the end point 'url', with the context <seealso cref="Context"/>, and authenticating with 'apiKey'. </summary> /// <param name="url"> </param> /// <param name="context"> </param> /// <param name="apiKey"> </param> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="ODataException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> internal DataExchangeAPIClientOlingo(string url, Context context, string apiKey) : base(url) { if (Enabled) { ODataEntry createdSession = ReadEntity(SessionIds.SESSION, Sessions.ToProperties(context, apiKey)); this.sessionId = SessionIds.FromEntryProperties(createdSession.AsDictionary()); } else { this.sessionId = ""; } }
/// <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); } }
/// <summary> /// Stop Virtual Users. </summary> /// <param name="stopVirtualUsersParams"> </param> /// <exception cref="ODataException"> </exception> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public int StopVirtualUsers(StopVirtualUsersParams stopVirtualUsersParams) { if (!Enabled) { return(0); } IDictionary <string, object> properties = RuntimeApiUtils.getStopVirtualUsersProperties(stopVirtualUsersParams); properties[RuntimeApiUtils.API_KEY] = apiKey; try { ODataEntry entity = ReadEntity(RuntimeApiUtils.STOP_VIRTUAL_USERS, properties); return(RuntimeApiUtils.getStoppedVirtualUser(entity.AsDictionary())); } catch (Microsoft.OData.Core.ODataException oDataException) { throw new NeotysAPIException(oDataException); } }