Data synchronization method and device, equipment, storage medium and product
By obtaining the browser request signal from the local client's parent application, downloading and synchronizing the platform server script, it solves the problem of two-way synchronization of browser and local client data, improves user experience and achieves script data consistency. .
Patent Information
- Application Number
- CN202410245114.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2024-10-22
AI Technical Summary
The existing technology cannot achieve two-way data synchronization between the browser and the local client, resulting in a reduced user experience. Especially when local programs need to be called for stress testing and debugging, file downloading and server communication cannot be achieved, and two processes are required. Login verification.
By developing the parent application on the local client, obtain the request signal from the browser, download the script on the platform server and start the local running program, realize the calling and synchronization of the script, use the token for security verification, and realize the data transfer from the browser to Two-way synchronization for local clients.
It achieves two-way data synchronization between the browser and the local client, reduces user login verification steps, improves user experience, and ensures the consistency of script data on the remote platform and near-end programs.
Smart Images

Figure CN118819875A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of IT support technology, and in particular to a data synchronization method, device, equipment, storage medium and product. Background Art
[0002] In order to meet the needs of better localized experience, in some platform systems, especially SAAS platforms, local programs need to be called to complete the task. For example, in the full-link stress testing system, scripts written for the platform are expected to be quickly verified locally (local JMeter has a more efficient orchestration experience and performance, etc.). At this time, you can trigger the opening of the local JMeter client by clicking on the page, and automatically associate the script to perform one-click local stress testing and debugging. The current mainstream technical implementation is based on the Windows system registry and the macOS system schema protocol, using the external network or proxy to invoke local programs.
[0003] Since it is a local software launched directly through the browser, if the local software is only an exe program when installed and is not registered in the system registry, it is impossible to launch the exe software through the browser. The direct launch of the software can only pass some basic parameters, and cannot realize file download and other operations such as communication with the server, which requires deep secondary development and modification of the software. Many application software are not open source or have complex codes, and it is very difficult for third parties to conduct secondary development of these application software. It is impossible to modify the application software so that it will register itself in the system registry when installed, and it is impossible to achieve two-way synchronization of data from the browser and the local client. Even if the local can submit data to the remote platform, it will be necessary to log in due to the login verification on the platform, which reduces the user experience. Summary of the invention
[0004] The main purpose of the present invention is to provide a data synchronization method, device, equipment, storage medium and product, aiming to solve the technical problem that the existing technology cannot achieve two-way synchronization of data from the browser side and the local client side, thereby reducing the user experience.
[0005] To achieve the above object, the present invention provides a data synchronization method, which is applied to a local client, wherein the local client includes a parent application, a local running program, and a local script storage directory, and the method includes the following steps:
[0006] The parent application obtains a request signal sent by the user based on the browser, downloads the target script of the platform server to the target directory in the local script storage directory according to the request signal, and sends the target directory and the start signal to the local running program;
[0007] When the local running program receives the start signal, it calls the target script in the target directory to obtain the called script, and sends the called script to the local script storage directory;
[0008] When the local script storage directory receives the called script, it sends the called script to the platform server, so that the platform server updates the target script based on the called script, thereby completing data synchronization between the local client and the platform server.
[0009] Optionally, the parent application obtains a request signal sent by the user based on the browser, downloads the target script of the platform server to a target directory in the local script storage directory according to the request signal, and sends the target directory and a start signal to the local running program, including:
[0010] The parent application obtains a request signal sent by the user based on the browser;
[0011] The parent application performs protocol analysis on the request signal to obtain the script ID, the platform server address and the port number;
[0012] The parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory;
[0013] The parent application constructs startup parameters according to the target directory, and sends the startup parameters and the target directory to the locally running program.
[0014] Optionally, the parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory, including:
[0015] The parent application creates a file reading stream through the platform server address and port number;
[0016] The parent application reads the target script corresponding to the script ID through a file reading stream;
[0017] The parent application reads the target script in blocks through a file reading stream, divides the data block of the target script by line to obtain a plurality of lines of data, and downloads the plurality of lines of data to a target directory in a local script storage directory respectively.
[0018] Optionally, when the local running program receives the start signal, calling the target script in the target directory to obtain the called script, and sending the called script to the local script storage directory, including:
[0019] When the local running program receives the start signal, the start signal is spliced to obtain the start link of the target directory;
[0020] The local running program loads the target script according to the startup link to obtain the target script, so that the user can edit and perform local stress testing on the target script based on the local running program to obtain the called script, and send the called script to the local script storage directory.
[0021] Optionally, when the local running program receives the start signal, the target script in the target directory is called to obtain the called script, and before the called script is sent to the local script storage directory, the method further includes:
[0022] The parent application obtains a token sent by the platform server, performs a legal verification on the token, and when the verification succeeds, transparently transmits the token to the local running program. The token is obtained by encrypting a string randomly generated by the platform server;
[0023] When the local script storage directory receives the called script, the called script is sent to the platform server, including:
[0024] Generate transmission parameters according to the token and the called script, and send the transmission parameters to the platform server, so that the platform server verifies the token in the transmission parameters.
[0025] Optionally, the local client further includes a JMeter plug-in. When the local running program receives a start signal, the target script in the target directory is called to obtain the called script, and after the called script is sent to the local script storage directory, the method further includes:
[0026] Obtain the current process ID of the locally running program through the JMeter plug-in, and write the current process ID into a reference file;
[0027] When the current process of the locally running program ends through the JMeter plug-in, the current process ID in the reference file is deleted;
[0028] The process ID of the locally running program is identified through the JMeter plug-in, and whether to start the current process is determined according to the process ID.
[0029] In addition, to achieve the above object, the present invention also provides a data synchronization device, the data synchronization device comprising:
[0030] The script local download module is used to obtain the request signal sent by the user based on the browser, download the target script of the platform server to the target directory in the local script storage directory according to the request signal, and send the target directory and the start signal to the local running program;
[0031] A local script calling module is used to call the target script in the target directory when receiving a start signal, obtain the called script, and send the called script to the local script storage directory;
[0032] The data synchronization module is used to send the called script to the platform server when receiving the called script, so that the platform server updates the target script based on the called script to complete the data synchronization between the local client and the platform server.
[0033] In addition, to achieve the above-mentioned purpose, the present invention also proposes a data synchronization device, which includes: a memory, a processor, and a data synchronization program stored in the memory and executable on the processor, and the data synchronization program is configured to implement the steps of the data synchronization method described above.
[0034] In addition, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a data synchronization program is stored, and when the data synchronization program is executed by a processor, the steps of the data synchronization method described above are implemented.
[0035] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer program product, which includes a data synchronization program, and when the data synchronization program is executed by a processor, the steps of the data synchronization method described above are implemented.
[0036] The present invention develops a parent application to connect the local Jmeter program and the server, and automatically synchronizes the platform Jmeter script for communication, thereby completing the two-way synchronization and full life cycle maintenance of remote and localized Jmeter script data. This ensures the consistency of script data in the remote platform and the near-end program, and improves the convenience of user use. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a structural diagram of a data synchronization device in a hardware operating environment involved in an embodiment of the present invention;
[0038] Figure 2 This is a flow chart of a first embodiment of a data synchronization method of the present invention;
[0039] Figure 3 A data synchronization logic diagram of an embodiment of a data synchronization method of the present invention;
[0040] Figure 4 This is a schematic diagram of the process of verifying a token by a platform server in accordance with an embodiment of a data synchronization method of the present invention;
[0041] Figure 5 A schematic diagram of a flow chart of a second embodiment of a data synchronization method of the present invention;
[0042] Figure 6 A schematic diagram of a parsing procedure of an embodiment of a data synchronization method of the present invention;
[0043] Figure 7 It is a structural block diagram of the first embodiment of the data synchronization device of the present invention.
[0044] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0046] Reference Figure 1 , Figure 1 It is a schematic diagram of the structure of a data synchronization device in a hardware operating environment involved in an embodiment of the present invention.
[0047] like Figure 1 As shown, the data synchronization device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0048] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the data synchronization device, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0049] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a data synchronization program.
[0050] exist Figure 1 In the data synchronization device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the data synchronization device of the present invention can be set in the data synchronization device, and the data synchronization device calls the data synchronization program stored in the memory 1005 through the processor 1001, and executes the data synchronization method provided by the embodiment of the present invention.
[0051] The embodiment of the present invention provides a data synchronization method, referring to Figure 2 , Figure 2 Schematic diagram of the flow of the first embodiment of the data synchronization method of the present invention.
[0052] In this embodiment, the data synchronization method includes the following steps:
[0053] Step S10: The parent application obtains a request signal sent by the user based on the browser, downloads the target script of the platform server to the target directory in the local script storage directory according to the request signal, and sends the target directory and a start signal to the local running program.
[0054] It is understandable that the data synchronization method is applied to the local client, and the local client includes a parent application, a local running program, and a local script storage directory. The data synchronization logic diagram of the parent application, the local running program, and the local script storage directory can be referred to Figure 3 .
[0055] It should be noted that the parent application can be a layer of parent application in the middle of the browser to launch the local software. The parent application is responsible for communicating with the server, receiving the server's instructions, and calling the server's interface for communication. On the other hand, it is responsible for launching the child program (i.e. the local running program, i.e. the JMeter program).
[0056] It should be further explained that the JMeter Control in this solution is developed based on the cross-platform desktop application development framework Electron. The overall system architecture is divided into three layers: communication layer, core layer and basic service layer.
[0057] Among them, the communication layer includes API gateway, protocol parsing, token verification and stream processing modules, which are responsible for receiving, parsing, routing and responding to upstream request commands to complete the permission control of request commands, accurate parsing, and ensure the correctness and integrity of the requests.
[0058] The core layer mainly performs file-level cache and management after parsing the script data, and persists it locally. At the same time, it manages the life cycle of the sub-process, such as invoking, controlling, and destroying. This layer implements the acquisition of script parameters and the construction and transparent transmission of sub-process parameters, ensuring the correctness and robustness of various parameters required by the sub-process, and can successfully complete the call management of the sub-process.
[0059] Finally, there is the basic service layer. This module is mainly based on the packaging mechanism of the Electron framework. At the same time, it is compatible with Windows and Mac operating systems to ensure that functions can run normally on different desktops, thereby improving the maintainability and stability of the system.
[0060] It should be noted that the executor of this embodiment is a data synchronization device, wherein the data synchronization device has functions such as data processing, data communication and program running. The data synchronization device can be an integrated controller, a control computer and other devices, and of course it can also be other devices with similar functions, and this embodiment does not limit this.
[0061] Step S20: When the local running program receives the start signal, it calls the target script in the target directory to obtain the called script, and sends the called script to the local script storage directory.
[0062] It should be noted that when the local running program receives a startup signal, it calls the target script in the target directory to obtain the called script, and sends the called script to the local script storage directory, including: when the local running program receives a startup signal, it splices the startup signal to obtain a startup link for the target directory; the local running program loads the target script according to the startup link to obtain the target script, so that the user can edit and locally stress test the target script based on the local running program, obtain the called script, and send the called script to the local script storage directory.
[0063] It is understandable that when the local running program receives a start signal, the start signal may include a connection to a target script in the platform server, and based on the connection, the locally stored target script may be opened.
[0064] Among them, in the specific implementation, the core layer of the parent application also needs to splice the local JMeter process startup parameters, which contain the script file link recorded locally. The corresponding script will be automatically loaded at startup and the relevant script will be opened by default. JMeter users edit the script in real time and perform local stress testing. After the stress testing is completed, the script will be changed.
[0065] It should be further explained that when the local running program receives the start signal, it calls the target script in the target directory to obtain the called script, and before sending the called script to the local script storage directory, it also includes: obtaining the token sent by the platform server through the parent application, and performing a legal verification on the token. When the verification is successful, the token is transmitted to the local running program, and the token is obtained by randomly generating a string by the platform server and encrypting the string; when the local script storage directory receives the called script, the called script is sent to the platform server, including: generating transmission parameters according to the token and the called script, and sending the transmission parameters to the platform server, so that the platform server verifies the token in the transmission parameters.
[0066] Among them, it is understandable that the problem of two-way data synchronization is solved through JMeter Control and local remote return, including synchronization from the platform script to the local, and synchronization back to the platform after local editing. Because there is often user authentication between the server and the local, the traditional solution requires manual entry of the user name and password to log in when starting the local software, and then operate.
[0067] It should be noted that, since there is often user authentication between the server and the local, the traditional solution requires manual input of the user name and password when starting the local software, and then the operation. This solution can save the second login process and improve the user experience while ensuring security.
[0068] In the specific implementation, a token is first generated on the platform side. The token generation algorithm is as follows: First, a random string is generated, which can be obtained using an encryption library or a random number generator. The random string is combined with the user ID and timestamp, and the combined string is hashed with SHA256. The hash result is Base64 encoded to ensure that the token is readable and easy to transmit. The final string is the generated token, which can be used as a credential for user identity authentication. The platform side sends the above-generated Token, JMeter Control verifies the legitimacy of the Token, and transmits it transparently when calling the JMeter local client. Through this solution, when JMeter saves data and transmits it back, the Token and script ID and other data are transmitted back to the platform side as parameters. At this time, the platform side verifies the Token. The specific implementation process can be referred to. Figure 4 Based on this token, when the local client needs to synchronize data, the step of logging in again can be omitted. Under the premise of ensuring security, one login operation is reduced, which greatly improves the user experience.
[0069] Among them, it is understandable that the script of the local download platform is automatically synchronized to the remote platform after editing, maintaining the consistency of remote and local maintenance without the need for secondary login. The consistency of script data on the remote platform and local program is guaranteed, and the Token solution is used to achieve login-free when data is reported back, reducing the cost of each login and improving user experience.
[0070] It should be further explained that the local client also includes a JMeter plug-in. When the local running program receives the start signal, it calls the target script in the target directory to obtain the called script, and sends the called script to the local script storage directory. It also includes: obtaining the current process ID of the local running program through the JMeter plug-in, and writing the current process ID to a reference file; deleting the current process ID in the reference file when the current process of the local running program ends through the JMeter plug-in; identifying the process ID of the local running program through the JMeter plug-in, and determining whether to start the current process based on the process ID.
[0071] It should be noted that after the script content is parsed and the file is persisted, the process control module of the core layer starts the local JMeter process. First, it is necessary to ensure that the local process is not started repeatedly. This is achieved by introducing a process control mechanism based on the interactive reading and writing of Controle and JMeter plug-in process information.
[0072] In the specific implementation, first develop a Jmeter plug-in, which will obtain the current process (i.e., Jmeter's own process) ID when JMeter starts, and write it to a specified file such as process.properties. At the same time, the record of the current process in the file will be deleted before the process exits. The reason for using plug-in development is that there is no need to develop additional programs to monitor the status of sub-processes. The traditional Jmeter plug-in mainly serves the functional modules related to stress testing, but in order to achieve the purpose of process control required by this solution, this plug-in utilizes the life cycle of the JMeter plug-in mechanism. When the Jmeter process starts, it obtains the process ID status and controls it by calling system parameters. If the process ID is not empty, it means that the process has been started. Here we only need to start a process, so no processing is done; if the process ID is empty, it means that the process is not currently started, and the process can be started.
[0073] Step S30: When the local script storage directory receives the called script, it sends the called script to the platform server, so that the platform server updates the target script based on the called script, thereby completing data synchronization between the local client and the platform server.
[0074] It is understandable that the process management module of the parent application will notify the communication layer of the saved script content and transmit the script content back to the remote end (i.e., the platform end), thus completing the key process of local editing of the script and real-time synchronization with the remote end.
[0075] It is understandable that when the user completes the modification, JMeter Control (parent application) will call the server API and synchronize the modified script (stored in the local directory) to the server through the self-developed plug-in. The core of this solution is a built-in HttpClient to transmit local data remotely. Through this step of the parent application, the user can open the browser to access the script again with the latest content, which can solve the pain point that the status and data of the local software cannot be automatically synchronized back to the server in time after operation. There is no need for manual secondary synchronization, which saves user operation costs.
[0076] It is worth noting that users can control the local JMeter stress testing tool through the browser, including remote synchronization of scripts, starting JMeter, stopping JMeter, automatic uploading of scripts, and no need for secondary login, etc., and the whole life cycle management. Even if the JMeter software is started by using exe without installation, users can still directly open the JMeter stress testing engine through the browser, complete the download of the corresponding script file, and then implement fast stress testing through JMeter, which improves the efficiency of script writing for testers; data files, and dependent files upload and download, and simplifies the operation process.
[0077] It is understandable that by developing a parent application to connect the local Jmeter program and the server, the platform Jmeter script is automatically synchronized for communication, thereby completing the full life cycle maintenance of the localized Jmeter script.
[0078] This embodiment develops a parent application to connect the local Jmeter program and the server, automatically synchronizes the platform Jmeter script for communication, and thus completes the two-way synchronization and full life cycle maintenance of remote and localized Jmeter script data. This ensures the consistency of script data on the remote platform and the near-end program, and improves the convenience of user use.
[0079] refer to Figure 5 , Figure 5 Schematic diagram of the flow of the second embodiment of the data synchronization method of the present invention.
[0080] Based on the first embodiment, the data synchronization method of this embodiment includes, in step S10:
[0081] Step S11: the parent application obtains a request signal sent by the user based on the browser.
[0082] It is understandable that a conventional browser can directly launch a local application to execute a platform server program to perform stress testing and other data tests. In this embodiment, the user sends a request signal through the browser to trigger the start of the parent application to launch the local Jmeter program to execute the test data in the platform server.
[0083] It should be noted that when you want to call the local client to edit the platform script through the browser, it will trigger the parent application JMeter Control to start, and the program will receive the request signal sent when the browser is awakened. The purpose of this step is to receive user request parameters through the parent application as an intermediary program, expand the possibility of parameter expansion between the browser and the software, and receive more flexible script commands.
[0084] It should be understood that the request signal may include the ID of the target script, the server host address and port number where the program to be tested is located.
[0085] Step S12: the parent application performs protocol analysis on the request signal to obtain a script ID, a platform server address and a port number.
[0086] It should be noted that when a request initiated by a client browser is detected, the parent application communication layer API gateway triggers protocol parsing after receiving the request. The parsing uses a custom JSON format protocol to obtain the core script ID, server host address and port number, etc.
[0087] In the specific implementation, the explanation of the specific protocol refers to Figure 6 In the figure, script represents the script ID that needs to be edited locally, and the default type is jmeter; token represents the token generated by the system according to the above token algorithm, which will be verified at the Control layer; remote represents the remote server information, and host and port represent the host address and port number respectively. After parsing the protocol parameters, Control automatically initiates an HttpClient instance, makes a remote call to the target host, and obtains the specific content of the script through the script ID. docURL specifies the specific file path where the script content is stored locally.
[0088] Step S13: the parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory.
[0089] It should be noted that the parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory, including: the parent application creates a file read stream through the platform server address and port number; the parent application reads the target script corresponding to the script ID through the file read stream; the parent application reads the target script in blocks through the file read stream, divides the data blocks of the target script by row, obtains multiple rows of data, and downloads the multiple rows of data to the target directory in the local script storage directory respectively.
[0090] It is understandable that the target directory can be understood as a folder storing the target script, and the target script can be understood as a script that needs to be downloaded from the platform server for the user to test on the locally running program.
[0091] It is understandable that the server port number identifies different applications communicating on a host, and the server port number can be used to identify services, data communications, security control, and load balancing.
[0092] In the specific implementation, after obtaining the script ID, the server API is called according to the script ID to download the corresponding script file to the specified directory of the local computer. At the same time, the startup parameters are automatically built to start the local Jmeter process and load the script through the specified directory. This step completes the collection of remote script content specified by the user request parameters and integrates it into the local program as a startup parameter through the interaction between the parent application and the server. The effect achieved is that when the local program is automatically opened, what the user sees is the script content that the user wants to operate, which greatly improves the operation experience.
[0093] It should be further explained that, according to the parsed request address and parameters, the splicing request initiates a remote call to obtain the corresponding script content from the server. At this time, the communication layer stream processing module will receive the script content. For some complex scenarios, the stress test script content is very large, and full reading is likely to cause insufficient memory OOM. The current module uses stream processing.
[0094] In the specific implementation, the script download can be performed through the following sub-steps, for example: 1. Create a file reading stream and specify the path of the large file to be read. 2. Read and process in blocks to achieve streaming processing. In the data processing stream, various operations can be performed, such as parsing, filtering, conversion, etc. 3. Data processing stream configuration, thereby ensuring the fast reading and writing of big data scripts.
[0095] Furthermore, you can configure corresponding processing operations in the data processing flow according to specific needs. Split each block into lines, and then write each line into a file. Through this process, you can view and modify the stress test script in the local JMeter program, and perform local operations such as local execution, debugging, and saving.
[0096] Step S14: the parent application constructs startup parameters according to the target directory, and sends the startup parameters and the target directory to the local running program.
[0097] It is understandable that the startup parameters may include information such as the startup signal and the target directory ID. Sending the startup parameters to the local running program will start the local running program, so that the local running program can find the target script stored in the local target directory according to the target directory ID and perform tests according to the target script.
[0098] This embodiment solves the limitation of single invoking local software by adding an innovative solution of parent application, and establishes an interaction center between the browser and the local program. The browser synchronizes the script ID and platform address to the parent application, and the parent application automatically establishes a connection with the platform and synchronizes the required parameters, and starts the local program through the parameters. The data after the program is opened is what you see is what you get, which solves the problems of not being able to manage the number of local software processes, not being able to transparently transmit data parameters, and not being able to return the results of local operations in real time.
[0099] Reference Figure 7 , Figure 7 It is a structural block diagram of the first embodiment of the data synchronization device of the present invention.
[0100] like Figure 7 As shown, the data synchronization device proposed in the embodiment of the present invention includes:
[0101] The script local download module 10 is used to obtain the request signal sent by the user based on the browser, download the target script of the platform server to the target directory in the local script storage directory according to the request signal, and send the target directory and the start signal to the local running program;
[0102] A local script calling module 20 is used to call the target script in the target directory upon receiving a start signal, obtain the called script, and send the called script to the local script storage directory;
[0103] The data synchronization module 30 is used to send the called script to the platform server when receiving the called script, so that the platform server updates the target script based on the called script to complete the data synchronization between the local client and the platform server.
[0104] In one embodiment, the script local download module 10 is also used for the parent application to obtain a request signal sent by the user based on the browser;
[0105] The parent application performs protocol analysis on the request signal to obtain the script ID, the platform server address and the port number;
[0106] The parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory;
[0107] The parent application constructs startup parameters according to the target directory, and sends the startup parameters and the target directory to the locally running program.
[0108] In one embodiment, the script local download module 10 is also used for the parent application to create a file reading stream through the platform server address and port number;
[0109] The parent application reads the target script corresponding to the script ID through a file reading stream;
[0110] The parent application reads the target script in blocks through a file reading stream, divides the data block of the target script by line to obtain a plurality of lines of data, and downloads the plurality of lines of data to a target directory in a local script storage directory respectively.
[0111] In one embodiment, the local script calling module 20 is further used to splice the startup signal to obtain the startup link of the target directory when the local running program receives the startup signal;
[0112] The local running program loads the target script according to the startup link to obtain the target script, so that the user can edit and perform local stress testing on the target script based on the local running program to obtain the called script, and send the called script to the local script storage directory.
[0113] In one embodiment, the local script calling module 20 is further used to obtain the token sent by the platform server through the parent application, perform a legal verification on the token, and when the verification succeeds, transparently transmit the token to the local running program. The token is obtained by randomly generating a string by the platform server and encrypting the string.
[0114] When the local script storage directory receives the called script, the called script is sent to the platform server, including:
[0115] Generate transmission parameters according to the token and the called script, and send the transmission parameters to the platform server, so that the platform server verifies the token in the transmission parameters.
[0116] In one embodiment, the local script calling module 20 is further used to obtain the current process ID of the local running program through the JMeter plug-in, and write the current process ID into a reference file;
[0117] When the current process of the locally running program ends through the JMeter plug-in, the current process ID in the reference file is deleted;
[0118] The process ID of the locally running program is identified through the JMeter plug-in, and whether to start the current process is determined according to the process ID.
[0119] In addition, to achieve the above-mentioned purpose, the present invention also proposes a data synchronization device, which includes: a memory, a processor, and a data synchronization program stored in the memory and executable on the processor, and the data synchronization program is configured to implement the steps of the data synchronization method described above.
[0120] Since the data synchronization device adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.
[0121] In addition, an embodiment of the present invention further provides a storage medium, on which a data synchronization program is stored. When the data synchronization program is executed by a processor, the steps of the data synchronization method described above are implemented.
[0122] Since the storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.
[0123] In addition, an embodiment of the present invention further provides a computer program product, including a data synchronization program, which implements the steps of the data synchronization method described above when executed by a processor.
[0124] The specific implementation of the computer program product of the present invention is basically the same as the various embodiments of the above-mentioned data synchronization method, and will not be repeated here.
[0125] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0126] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0127] In addition, for technical details that are not described in detail in this embodiment, reference can be made to the data synchronization method provided in any embodiment of the present invention, and will not be repeated here.
[0128] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0129] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0130] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0131] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0132] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A data synchronization method, characterized in that: The method is applied to a local client, the local client includes a parent application, a local running program, and a local script storage directory, and the method includes: The parent application obtains a request signal sent by the user based on the browser, downloads the target script of the platform server to the target directory in the local script storage directory according to the request signal, and sends the target directory and the start signal to the local running program; When the local running program receives the start signal, it calls the target script in the target directory to obtain the called script, and sends the called script to the local script storage directory; When the local script storage directory receives the called script, it sends the called script to the platform server, so that the platform server updates the target script based on the called script, thereby completing data synchronization between the local client and the platform server.
2. The data synchronization method according to claim 1, characterized in that: The parent application obtains a request signal sent by the user based on the browser, downloads the target script of the platform server to the target directory in the local script storage directory according to the request signal, and sends the target directory and the start signal to the local running program, including: The parent application obtains a request signal sent by the user based on the browser; The parent application performs protocol analysis on the request signal to obtain the script ID, the platform server address and the port number; The parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory; The parent application constructs startup parameters according to the target directory, and sends the startup parameters and the target directory to the locally running program.
3. The data synchronization method according to claim 2, characterized in that: The parent application calls the server through the platform server address and port number to download the target script corresponding to the script ID to the target directory in the local script storage directory, including: The parent application creates a file reading stream through the platform server address and port number; The parent application reads the target script corresponding to the script ID through a file reading stream; The parent application reads the target script in blocks through a file reading stream, divides the data block of the target script by line to obtain a plurality of lines of data, and downloads the plurality of lines of data to a target directory in a local script storage directory respectively.
4. The data synchronization method according to claim 1, characterized in that: When the local running program receives the start signal, the target script in the target directory is called to obtain the called script, and the called script is sent to the local script storage directory, including: When the local running program receives the start signal, the start signal is spliced to obtain the start link of the target directory; The local running program loads the target script according to the startup link to obtain the target script, so that the user can edit and perform local stress testing on the target script based on the local running program to obtain the called script, and send the called script to the local script storage directory.
5. The data synchronization method according to claim 1, characterized in that: When the local running program receives the start signal, the target script in the target directory is called to obtain the called script, and before the called script is sent to the local script storage directory, the method further includes: The parent application obtains a token sent by the platform server, performs a legal verification on the token, and when the verification succeeds, transparently transmits the token to the local running program. The token is obtained by encrypting a string randomly generated by the platform server; When the local script storage directory receives the called script, the called script is sent to the platform server, including: Generate transmission parameters according to the token and the called script, and send the transmission parameters to the platform server, so that the platform server verifies the token in the transmission parameters.
6. The data synchronization method according to claim 1, characterized in that: The local client also includes a JMeter plug-in. When the local running program receives a start signal, it calls the target script in the target directory to obtain the called script, and after sending the called script to the local script storage directory, it also includes: Obtain the current process ID of the locally running program through the JMeter plug-in, and write the current process ID into a reference file; When the current process of the locally running program ends through the JMeter plug-in, the current process ID in the reference file is deleted; The process ID of the locally running program is identified through the JMeter plug-in, and whether to start the current process is determined according to the process ID.
7. A data synchronization device, characterized in that: The data synchronization device comprises: The script local download module is used to obtain the request signal sent by the user based on the browser, download the target script of the platform server to the target directory in the local script storage directory according to the request signal, and send the target directory and the start signal to the local running program; A local script calling module is used to call the target script in the target directory when receiving a start signal, obtain the called script, and send the called script to the local script storage directory; The data synchronization module is used to send the called script to the platform server when receiving the called script, so that the platform server updates the target script based on the called script to complete the data synchronization between the local client and the platform server.
8. A data synchronization device, characterized in that: The data synchronization device comprises: a memory, a processor, and a data synchronization program stored in the memory and executable on the processor, wherein the data synchronization program is configured to implement the data synchronization method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a data synchronization program, and when the data synchronization program is executed by the processor, the data synchronization method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product comprises a data synchronization program, and when the data synchronization program is executed by a processor, the steps of the data synchronization method according to any one of claims 1 to 6 are implemented.
