Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        public static IDictionary <string, object> getStartRecordingProperties(StartRecordingParams startRecordingParams)
        {
            IDictionary <string, object> properties = new Dictionary <string, object>();

            properties[VIRTUAL_USER]        = startRecordingParams.VirtualUser;
            properties[BASE_CONTAINER]      = startRecordingParams.RecordInStep;
            properties[PROTOCOL_WEBSOCKET]  = startRecordingParams.WebSocketProtocol;
            properties[PROTOCOL_HTTP2]      = startRecordingParams.Http2Protocol;
            properties[PROTOCOL_ADOBE_RTMP] = startRecordingParams.AdobeRTMPProtocol;
            properties[USER_AGENT]          = startRecordingParams.UserAgent;
            // do not set SapGuiProtocol in properties, this allows to be compatiable with old NeoLoad.
            if (startRecordingParams.SapGuiProtocol)
            {
                properties[PROTOCOL_SAP_GUI]                = startRecordingParams.SapGuiProtocol;
                properties[SAP_CONNECTION_STRING]           = startRecordingParams.SapConnectionString;
                properties[SAP_SESSION_ID]                  = startRecordingParams.SapSessionId;
                properties[CREATE_TRANSACTION_BY_SAP_TCODE] = startRecordingParams.CreateTransactionBySapTCode;
            }
            return(properties);
        }