CN115994077A - Service simulation processing method and related equipment - Google Patents

Service simulation processing method and related equipment Download PDF

Info

Publication number
CN115994077A
CN115994077A CN202111208721.8A CN202111208721A CN115994077A CN 115994077 A CN115994077 A CN 115994077A CN 202111208721 A CN202111208721 A CN 202111208721A CN 115994077 A CN115994077 A CN 115994077A
Authority
CN
China
Prior art keywords
service
simulation
processing
business
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111208721.8A
Other languages
Chinese (zh)
Inventor
翁彦彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111208721.8A priority Critical patent/CN115994077A/en
Publication of CN115994077A publication Critical patent/CN115994077A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a business simulation processing method and related equipment; a service request sent by a service request end can be received, and the service request accords with a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service. According to the embodiment of the application, various service requests can be processed through the simulation service corresponding to the target communication protocol, and the method and the device can be applied to simulation tests under the scenes of various communication protocols, so that the applicability of service simulation is improved.

Description

Service simulation processing method and related equipment
Technical Field
The application relates to the technical field of computers, in particular to a business simulation processing method and related equipment.
Background
With the development of computer technology, a wide range of applications for a wide variety of software is becoming increasingly available. In the development process of software, a Mock test is an important link. Mock testing is a test method in which a virtual object is created for testing for objects that are not easily constructed or easily obtained during the testing process. By utilizing the Mock test, the coupling between the front end and the rear end can be reduced in the software development process, so that front-end personnel do not need to wait for data returned by the rear end and then debug, and the separation of the front end and the rear end and the parallel development of the front end and the rear end are realized.
In the testing process of computer software, for a piece of software, because the software has various used scenes, in order to ensure that the software is suitable for various scenes when being online, the software needs to be tested to cover different scenes, for example, various communication protocols need to be simulated and adapted.
In the current simulation test method, the Mock test cannot adapt to various communication protocols, cannot be applied to tests of various scenes, and has low applicability.
Disclosure of Invention
The embodiment of the application provides a service simulation processing method and related equipment, wherein the related equipment can comprise a service simulation processing device, electronic equipment, a computer readable storage medium and a computer program product, so that the applicability of service simulation can be improved.
The embodiment of the application provides a service simulation processing method, which comprises the following steps:
receiving a service request sent by a service request end, wherein the service request accords with a target communication protocol;
determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol;
performing simulation analysis processing on the service request through the target simulation service to obtain service data;
according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result;
and sending the business simulation processing result to the business request terminal based on the target simulation service.
Accordingly, an embodiment of the present application provides a service simulation processing device, including:
the receiving unit is used for receiving a service request sent by the service request end, and the service request accords with a target communication protocol;
a determining unit, configured to determine a target analog service corresponding to the target communication protocol from at least one analog service deployed by the service device, where one analog service corresponds to processing one communication protocol;
The analysis unit is used for carrying out simulation analysis processing on the service request through the target simulation service to obtain service data;
the simulation unit is used for carrying out service simulation processing on the service data according to the service processing rules configured by the service equipment to obtain a service simulation processing result;
and the sending unit is used for sending the business simulation processing result to the business request terminal based on the target simulation service.
Optionally, in some embodiments of the present application, the service simulation processing apparatus may further include a real service processing unit, as follows:
the real service processing unit is used for performing service processing on the service data through real service to obtain a service real processing result when the service data is determined to be not matched with the service processing rule according to the service simulation processing result; and sending the real business processing result to the business request terminal based on the target simulation service.
Optionally, in some embodiments of the present application, the parsing unit may include a decoding subunit and a deserializing subunit, as follows:
the decoding subunit is configured to decode, through the target analog service, the service request based on the target communication protocol, to obtain a decoded service request;
And the deserializing subunit is used for deserializing the decoded service request according to the service protocol corresponding to the target simulation service to obtain service data.
Optionally, in some embodiments of the present application, the deserializing subunit may be specifically configured to determine a manner of deserializing according to a service protocol corresponding to the target analog service; and based on the reverse serialization processing mode, decrypting the decoded service request to obtain service data.
Optionally, in some embodiments of the present application, the service processing rule configured by the service device includes at least one service processing sub-rule;
the simulation unit may include a sequence determination subunit and an execution subunit, as follows:
the sequence determining subunit is configured to determine a service processing logic sequence for the service data;
and the execution subunit is used for executing each service processing sub-rule on the service data according to the service processing logic sequence to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the service processing rule includes a service field replacement rule;
The simulation unit may include a replacement character determination subunit and a replacement subunit as follows:
the replacement character determining subunit is used for determining a character to be replaced from at least one character corresponding to the service data;
and the replacing subunit is used for replacing the simulation field of the character to be replaced according to the service field replacement rule configured by the service equipment to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the simulation unit may include a determination subunit and a simulation subunit, as follows:
the determining subunit is configured to determine a preset data processing type of a service processing rule configured by the service device;
and the simulation subunit is used for performing service simulation processing on the service data according to the service processing rule when the data processing type corresponding to the service data is identified to be matched with the preset data processing type, so as to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the sending unit may include a serialization subunit, an encapsulation subunit, and a sending subunit, as follows:
the serialization subunit is configured to perform serialization processing on the service simulation processing result based on a service protocol corresponding to the target simulation service, so as to obtain a serialized service simulation processing result;
The packaging subunit is used for packaging the serialized service simulation processing result to obtain service result information conforming to the target communication protocol;
and the sending subunit is used for sending the service result information to the service request terminal.
Optionally, in some embodiments of the present application, the serialization subunit may specifically be configured to determine a manner of serialization processing based on a service protocol corresponding to the target analog service; and according to the serialization processing mode, encrypting the service simulation processing result to obtain the serialized service simulation processing result.
Optionally, in some embodiments of the present application, the service simulation processing apparatus may further include a rule updating unit, as follows:
the rule updating unit is used for acquiring the identification information of the target service processing rule corresponding to the service equipment from the simulation service management end; comparing the identification information of the service processing rule currently configured by the service equipment with the identification information of the target service processing rule to obtain a comparison result; and updating the service processing rule currently configured by the service equipment according to the comparison result.
Optionally, in some embodiments of the present application, the service analog processing device may further include a configuration unit, as follows:
the configuration unit is used for receiving a service configuration request corresponding to a preset communication protocol sent by the analog service management end, wherein the service configuration request indicates analog service to be configured; and deploying the simulation service corresponding to the preset communication protocol on the service equipment according to the service configuration request.
Optionally, in some embodiments of the present application, the service analog processing device may further include an updating unit, as follows:
the updating unit is used for receiving a target business rule updating request sent by the simulated service management end, wherein the target business rule updating request indicates business equipment needing to update business processing rules in a business equipment cluster, the business equipment cluster comprises at least two business equipment which are distributed and deployed, and different business equipment corresponds to different business processing rules; and updating the business processing rule of the business equipment according to the target business rule updating request.
The electronic device provided by the embodiment of the application comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the steps in the business simulation processing method provided by the embodiment of the application.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps in the service simulation processing method provided by the embodiment of the application.
In addition, the embodiment of the application further provides a computer program product, which comprises a computer program or instructions, and the computer program or instructions realize the steps in the business simulation processing method provided by the embodiment of the application when being executed by a processor.
The embodiment of the application provides a service simulation processing method and related equipment, which can receive a service request sent by a service request end, wherein the service request accords with a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service. The service equipment in the embodiment of the application is deployed with at least one simulation service corresponding to the communication protocol, and can perform simulation analysis processing on service requests transmitted based on various communication protocols, so as to perform service simulation processing on service data obtained through the simulation analysis processing; in a simulation test scenario of a service request transmitted based on a target communication protocol, a target simulation service corresponding to the target communication protocol can be selected from at least one simulation service deployed by service equipment, so that the service request is simulated and analyzed through the target simulation service; therefore, the embodiment of the application can be applied to simulation tests under the scenes of various communication protocols, and the applicability of service simulation is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1a is a schematic view of a scenario of a service simulation processing method provided in an embodiment of the present application;
fig. 1b is a flowchart of a service simulation processing method provided in an embodiment of the present application;
fig. 1c is a system architecture diagram of a service simulation processing method provided in an embodiment of the present application;
FIG. 1d is another flow chart of a business simulation processing method provided in an embodiment of the present application;
fig. 1e is an explanatory diagram of a service simulation processing method provided in an embodiment of the present application;
FIG. 1f is another flow chart of a business simulation processing method provided in an embodiment of the present application;
FIG. 2a is another flow chart of a business simulation processing method provided in an embodiment of the present application;
FIG. 2b is another flowchart of a business simulation processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a service simulation processing device provided in an embodiment of the present application;
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The embodiment of the application provides a business simulation processing method and related equipment, wherein the related equipment can comprise a business simulation processing device, electronic equipment, a computer readable storage medium and a computer program product. The service simulation processing device can be integrated in an electronic device, and the electronic device can be a terminal, a server or the like.
It can be appreciated that the service simulation processing method of the present embodiment may be executed on the terminal, or may be executed on the server, or may be executed by both the terminal and the server. The above examples should not be construed as limiting the present application.
As shown in fig. 1a, an example is a method in which a terminal and a server perform service simulation processing together. The service simulation processing system provided by the embodiment of the application comprises a terminal 10, a server 11 and the like; the terminal 10 and the server 11 are connected via a network, for example, a wired or wireless network connection, wherein the service simulation processing means may be integrated in the server.
Wherein, the server 11 can be used for: receiving a service request sent by a service request end, wherein the service request accords with a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service. The server 11 may be a single server, or may be a server cluster or cloud server composed of a plurality of servers.
The terminal 10 may send a service request to the server 11 based on the target communication protocol, and may also be used to receive a service simulation processing result sent by the server 11. The terminal 10 may include a mobile phone, a smart tv, a tablet computer, a notebook computer, or a personal computer (PC, personal Computer), among others. A client may also be provided on the terminal 10, which may be an application client or a browser client, etc.
The step of performing the service simulation processing by the server 11 may be performed by the terminal 10.
The following will describe in detail. The following description of the embodiments is not intended to limit the preferred embodiments.
The present embodiment will be described in terms of a business simulation processing apparatus, which may be integrated in an electronic device, which may be a device such as a server or a terminal.
As shown in fig. 1b, the specific flow of the service simulation processing method may be as follows:
101. and receiving a service request sent by a service request end, wherein the service request accords with a target communication protocol.
The service request end is specifically a device for requesting service processing. The service request may be sent by the service request end based on a target communication protocol. Specifically, the service request may carry service data to be processed, which may include service data to be processed through service simulation, and may also include service data for requesting real service processing, which is not limited in this embodiment.
In some embodiments, the service request may be received by a service device, and based on a target communication protocol for transmitting the service request, a target simulation service corresponding to the target communication protocol in the service device is invoked to process the service request. The service equipment can be specifically equipment for service simulation processing and can provide the service of the Mock test; the business scenario of the simulation processing is various, for example, the payment test business scenario and the like can be realized.
Wherein Mock can be used to simulate the return results of a target service. Mock testing is a test method that utilizes virtual objects to create a test for some objects that are not easily constructed or easily obtained during code, program, or application testing. For example, in the unit testing of code, programs or applications, it is often encountered that written code modules need to rely on additional classes or external dependent interfaces; if at this point, these classes or interfaces may not have been written or developed, or the environment setup of the external dependent interface service may require more cost, the required dependent interfaces or classes may be simulated by defining Mock objects for testing or cost reduction.
102. And determining the target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol.
The simulation service is specifically a simulation service program, and can perform preprocessing such as unpacking and the like on the service request based on a communication protocol. The business equipment comprises one or more analog services, and in some embodiments, different analog services can correspondingly process different communication protocols; the method is suitable for simulation test under the scene corresponding to various communication protocols. For example, for a service request sent based on the HTTP protocol, a simulation service corresponding to the HTTP protocol may be determined as a target simulation service; for a service request sent based on the Mysql protocol, the simulation service corresponding to the Mysql protocol may be determined as a target simulation service.
The communication protocol is specifically defined as a rule or rule that two computers in a computer communication network must commonly adhere to. HTTP is commonly referred to as Hyper Text Transfer Protocol, the hypertext transfer protocol, which is a communication protocol that allows the transfer of hypertext markup language documents from a server to a browser on a client. Mysql is a proprietary communication protocol.
Types of communication protocols described in this embodiment include, but are not limited to, HTTP (Hyper Text Transfer Protocol ), HTTPs (HyperText Transfer Protocol Secure, hypertext transfer security protocol), TCP (Transmission Control Protocol ), UDP (User Datagram Protocol, user datagram protocol), UDS (unixdoain socket), and the like.
Optionally, in this embodiment, the service simulation processing method may further include:
receiving a service configuration request corresponding to a preset communication protocol sent by an analog service management end, wherein the service configuration request indicates analog service to be configured;
and deploying the simulation service corresponding to the preset communication protocol on the service equipment according to the service configuration request.
The simulation service management end can be understood as a central management server, which can manage one or more service devices (i.e. service machines) for service simulation processing, and different service devices can correspondingly process different services; for each service device, analog services corresponding to various communication protocols can be deployed on the service device, so that the service device can support the various communication protocols, and service requests transmitted based on various communication protocols can be processed. Specifically, the analog service management end may send a service configuration request to the service device managed by the analog service management end, so that the service device performs configuration of the corresponding analog service.
Optionally, the step of deploying, according to the service configuration request, the analog service corresponding to the preset communication protocol on the service device may specifically include: and generating an implementation program of a simulation analysis processing process corresponding to the service request of the preset communication protocol according to parameter setting in a protocol file of the preset communication protocol corresponding to the service configuration request, thereby realizing deployment of the simulation service corresponding to the preset communication protocol on the service equipment.
Specifically, an operator of the simulation service may obtain a protocol file corresponding to a preset communication protocol based on the service configuration request, and set parameters of an implementation program of a simulation analysis processing procedure corresponding to a service request related to the preset communication protocol according to the protocol file, so as to implement deployment of the simulation service corresponding to the preset communication protocol on the service device.
In some embodiments, if a new version of a protocol file exists in a preset communication protocol, some parameter settings in an implementation program of a simulation service corresponding to the preset communication protocol need to be updated, specifically, a service device may modify, according to the new version of the protocol file corresponding to the preset communication protocol sent by a simulation service management end, the corresponding parameter settings in the implementation program, where the modification of the parameter settings may include adding or deleting parameters, and the like.
In some embodiments, a service device to which a service request is to be sent may be determined based on a service requirement, and then the service request is sent to the service device based on a target communication protocol, so that the service device receives the service request, and invokes a target simulation service to process the service request based on the target communication protocol.
103. And carrying out simulation analysis processing on the service request through the target simulation service to obtain service data.
Optionally, in this embodiment, the step of performing, by the target simulation service, a simulation analysis process on the service request to obtain service data may include:
decoding the service request based on the target communication protocol through the target simulation service to obtain a decoded service request;
and performing deserialization processing on the decoded service request according to the service protocol corresponding to the target simulation service to obtain service data.
In this embodiment, an appropriate parsing protocol needs to be selected according to a packaging manner of a service request for parsing, so as to obtain service data corresponding to the service request.
The service request can be decoded through a protocol file corresponding to the target communication protocol. For example, if the service request is sent by the service request end based on the TCP protocol, the service request may be decoded based on a protocol file corresponding to the TCP protocol.
In general, in data transmission, the manner of packaging data (specifically, the communication protocol used) may include TCP (Transmission Control Protocol ) and UDP (User Data Protocol, user data protocol). Specifically, an IP (Internet Protocol, protocol) header of a data packet may be removed to obtain a protocol number (protocols number), and a packing manner is determined according to the protocol number, for example, when the protocol number is 6, the packing manner is TCP, when the protocol number is 17, the packing manner is UDP, and different packing manners correspond to different parsing protocols.
Likewise, the service request may be specifically obtained by serializing a service protocol corresponding to the target analog service, and the decoded service request may be deserialized according to a protocol file of the service protocol corresponding to the target analog service, so as to obtain service data.
In some embodiments, each analog service in the service device has a designated communication protocol and a service protocol. The communication protocol can be regarded as a data packing and unpacking mode during data transmission, and the service protocol can be regarded as a packing and unpacking mode aiming at service data, such as encrypting and decrypting the service data. The service protocol can be a private service protocol, which can be a set of enterprise self-defined protocol standard, is generally only suitable for all or part of product equipment of the enterprise, is customized for enabling the equipment to carry out safe communication with a control end, and avoids malicious attack, control and the like of the equipment by unknown signals.
Serialization is a process of converting an object into a byte stream, i.e., a memory protocol object is processed into continuous binary stream data, so as to facilitate network transmission, and the continuous binary stream data is stored in a file, a memory and a database. The deserialization is to convert a byte stream into an object, specifically to parse a binary data stream into a memory protocol object according to the definition of a protocol structure. That is, serialization and deserialization are processes that convert data into a reversible data structure, which is then converted back into data.
Optionally, in this embodiment, the step of performing, according to a service protocol corresponding to the target analog service, deserializing processing on the decoded service request to obtain service data may include:
determining a deserialization processing mode according to a business protocol corresponding to the target simulation service;
and based on the reverse serialization processing mode, decrypting the decoded service request to obtain service data.
The service request may be specifically obtained through serialization, so that deserialization is also required to be performed on the decoded service request. The serialization process may be an encryption process and the deserialization process may be a decryption process.
The service request end encrypts the service request in various manners, which is not limited in this embodiment. It will be appreciated that in the decryption of the service request, a corresponding decryption is required according to the algorithm it encrypts.
For example, in some embodiments, the encryption algorithm may include some logic operations, such as extracting all even bytes in the service request to obtain an even byte sequence; extracting all odd bytes in the service request to obtain an odd byte sequence; and performing logic operation on the even number section sequence and the odd number byte sequence to obtain a byte sequence corresponding to the service request, namely the encrypted service request, and further sending the service request to the service equipment through the service request end.
The logic operation rules of the logic operation are numerous, and the logic operation in the embodiment can be phase or phase, etc. without limitation in the embodiment.
104. And carrying out service simulation processing on the service data according to the service processing rules configured by the service equipment to obtain a service simulation processing result.
The service processing rules may include some custom logic rules for service processing, for example, the service processing rules may include substitution of a specified field (specifically, substitution of a single field or substitution of multiple fields), delay return, reservation of a specific field, and the like, which is not limited in this embodiment. The service simulation processing may specifically be a process of obtaining a simulation return result corresponding to the service data. Through the service simulation processing, the service processing result can be directly obtained, and the service data does not need to be processed by real service.
In an embodiment, different service simulation processing results are provided for different service data, i.e. different returned information is provided for different service data. For example, the business processing rules are: and returning to Y when the service data belong to Arabic numbers, and returning to N if not. Specifically, the service device may be configured to determine whether a correct mobile phone number is input to a certain interface, so that according to a service processing rule, if the service data obtained by parsing is 0123456789, Y (indicating that the correct mobile phone number is input) is returned, and if the service data obtained by parsing is abcdefgf, N (indicating that the correct mobile phone number is not input) is returned.
In some embodiments, the business device may include a business simulation agent module that may be used to perform business simulation processing on business data. Specifically, after preprocessing a service request, the target simulation service obtains service data; the business data can be sent to a business simulation agent module through a target simulation service; and carrying out service simulation processing on the service data through the service processing rules configured by the service simulation proxy module to obtain a service simulation processing result.
Optionally, in this embodiment, the service processing rule configured by the service device includes at least one service processing sub-rule;
the step of performing service simulation processing on the service data according to the service processing rule configured by the service equipment to obtain a service simulation processing result, includes:
determining a service processing logic sequence for the service data;
and executing each business processing sub-rule on the business data according to the business processing logic sequence to obtain a business simulation processing result.
The service simulation processing process may include a plurality of service processing steps, each service processing step corresponds to a service processing sub-rule, each service processing step accords with a preset service processing logic sequence, and according to each service processing step, each service processing sub-rule may be executed on service data, so as to obtain a service simulation processing result.
Optionally, in some embodiments, the service processing rules include a service field replacement rule;
the step of performing service simulation processing on the service data according to the service processing rule configured by the service equipment to obtain a service simulation processing result, includes:
determining a character to be replaced from at least one character corresponding to the service data;
and according to the service field replacement rule configured by the service equipment, performing simulated field replacement on the character to be replaced to obtain a service simulation processing result.
Specifically, the service field replacement rule may specify a position of a character to be replaced in the service data and a target character for replacing the character to be replaced, so that the character to be replaced may be determined according to the service field replacement rule; after the character to be replaced is determined, the field to be replaced can be replaced by the target character according to the service field replacement rule.
In some embodiments, the business processing rules may include reserved specific field rules. After the service data is obtained, determining a character to be reserved from at least one character corresponding to the service data according to a rule of reserving a specific field; and deleting other characters except the character to be reserved in the service data to obtain a service simulation processing result.
In other embodiments, the traffic handling rules may include delayed returns. In some scenarios, it is desirable to simulate some abnormal situations; for example, under normal conditions, the response time for the service request is 1 second, if it is required to verify what abnormal situation occurs when the response time exceeds 1 second, then service simulation processing can be adopted, delay service is provided through service equipment, and the service processing rule is set to delay for two seconds to return, so as to observe what abnormal situation occurs when no response is obtained within 1 second.
Optionally, before performing the service simulation processing, a service processing rule needs to be acquired, and specifically, the service processing rule may be loaded in a memory of the service device; when loading fails, the service processing rule may be acquired from a fixed storage area of the service device, where the fixed storage area may be a local disk or the like.
Optionally, in this embodiment, the step of performing, according to a service processing rule configured by the service device, service simulation processing on the service data to obtain a service simulation processing result includes:
determining a preset data processing type of a service processing rule configured by the service equipment;
And when the data processing type corresponding to the service data is identified to be matched with the preset data processing type, carrying out service simulation processing on the service data according to the service processing rule to obtain a service simulation processing result.
The preset data processing type may specifically be a service type to be subjected to analog processing. Specifically, the service data may be the service data to be subjected to service simulation processing, or may be the service data requesting real service processing. In this embodiment, the data processing type may specifically indicate whether the service data needs to be subjected to service simulation processing (specifically, whether the mock test needs to be performed), and the data processing type corresponding to the service data may indicate whether the service data is service data requiring simulation processing or service data requiring real service processing. If the data processing type corresponding to the service data is identified as the service type requiring the simulation processing, the data processing type is matched with the preset data processing type, and the service simulation processing can be performed on the service data according to the service processing rule, so that a service simulation processing result is obtained. If the data processing type corresponding to the service data is the service type requesting real service processing, the data processing type is not matched with the preset data processing type, the service data is not processed, and the service data is directly returned as a service simulation processing result.
Optionally, in this embodiment, the service simulation processing method may further include:
when the service data is determined to be unmatched with the service processing rule according to the service simulation processing result, performing service processing on the service data through real service to obtain a service real processing result;
and sending the real business processing result to the business request terminal based on the target simulation service.
According to the service simulation processing result, whether the data processing type corresponding to the service data is matched with the preset data processing type of the service processing rule or not can be known, and whether the service data is matched with the service processing rule or not is further determined. Specifically, if the service simulation processing result is still service data, the data processing type corresponding to the service data is not matched with the preset data processing type of the service processing rule, that is, the service data is not matched with the service processing rule.
In this embodiment, when matching between service data and a service processing rule fails, the service data may be sent to a real service, so as to perform service processing on the service data through the real service, obtain a service real processing result, and send the service real processing result obtained by processing to a target simulation service, so as to send the service real processing result to a service request end through the target simulation service; specifically, the target simulation service can perform serialization processing on the real business processing result based on the corresponding business protocol to obtain the serialized real business processing result; and then, carrying out encapsulation processing on the serialized real service processing result to obtain service result information conforming to the target communication protocol, and then, sending the service result information to the service request terminal.
The real service is a service process for processing a real service, and the service simulation process can be regarded as a simulation process corresponding to the real service.
Specifically, the service data may carry an access address (i.e., a real interface address) of the real service, and the target simulation service may transmit the service data to the real service according to the access address carried therein to perform service processing for the service data through the real service. The access address may be a URL (Uniform Resource Locator ).
The business simulation processing method can judge that the business data is not matched with the business processing rules based on the business simulation processing result, forward the business data to the real service, and avoid the condition that a developer forgets to modify the access address in the configuration file to cause errors in subsequent use without manually restoring the access address to the real address of the interface or class to be accessed by the developer.
Optionally, in this embodiment, the service simulation processing method may further include:
acquiring identification information of a target service processing rule corresponding to the service equipment from a simulation service management end;
comparing the identification information of the service processing rule currently configured by the service equipment with the identification information of the target service processing rule to obtain a comparison result;
And updating the service processing rule currently configured by the service equipment according to the comparison result.
The identification information may specifically be a version number. The target service processing rule is the latest service processing rule corresponding to the service equipment. When the version number of the service processing rule currently configured by the service device is found to be inconsistent with the version number of the target service processing rule through comparison, the target service processing rule corresponding to the service device can be obtained from the simulation service management end, and the service processing rule currently configured by the service device is updated to be the target service processing rule.
Specifically, the service device may automatically query, at intervals, identification information of a target service processing rule corresponding to the service device from the analog service management end, and compare the identification information with identification information of a service processing rule currently configured by the service device.
In some embodiments, the step of updating the service processing rule currently configured by the service device according to the comparison result may include:
updating the current business processing rule in the memory of the business equipment into the target business processing rule according to the comparison result;
And storing the target business processing rule into a fixed storage area of the business equipment.
The fixed storage area of the service device may specifically be a storage area such as a local disk of the service device.
In some embodiments, the service simulation processing result may also be sent to the simulation service management end; and carrying out statistical analysis on the service simulation processing result through the simulation service management end.
Optionally, in some embodiments, the service simulation processing method may further include:
receiving a target business rule updating request sent by a simulated service management end, wherein the target business rule updating request indicates business equipment needing to update business processing rules in a business equipment cluster, the business equipment cluster comprises at least two business equipment which are distributed and deployed, and different business equipment corresponds to different business processing rules;
and updating the business processing rule of the business equipment according to the target business rule updating request.
The simulated service management end can manage a plurality of service devices, which can be understood as a central management server, the managed service devices can also be regarded as service device clusters, each service device in the service device clusters corresponds to different service requirements, and the different service requirements have different service processing rules. The simulation service management end can carry out configuration of service processing rules on each service device managed by the simulation service management end, can realize fine rule isolation through distributing and deploying the service devices, and can also realize different service logic processing aiming at the same service object so as to meet the requirements of different services.
The management of each service device by the simulated service management end can be represented as follows: the method updates the business processing rules corresponding to each business device managed by the business device, and particularly can send a business rule updating request to the business device needing to update the business processing rules, when the business device needing to update the business processing rules receives the business rule updating request, the latest business processing rules corresponding to the business device can be obtained according to the business rule updating request, and the current business processing rules of the business device are updated into the latest business processing rules.
105. And sending the business simulation processing result to the business request terminal based on the target simulation service.
Optionally, in this embodiment, the step of "sending the service simulation processing result to the service request end based on the target simulation service" includes:
based on a service protocol corresponding to the target simulation service, carrying out serialization processing on the service simulation processing result to obtain a serialized service simulation processing result;
packaging the serialized service simulation processing result to obtain service result information conforming to the target communication protocol;
And sending the service result information to the service request terminal.
Wherein the business protocol corresponding to the target simulation service is consistent with the business protocol in step 103. The service simulation processing result can be subjected to serialization processing based on a protocol file of a service protocol corresponding to the target simulation service, so that the serialized service simulation processing result is obtained; packaging the serialized service simulation processing result according to the target communication protocol to obtain service result information; and then the service result information is sent to the service request terminal through the target simulation service.
Optionally, in this embodiment, step "based on a service protocol corresponding to the target simulation service, the serializing processing is performed on the service simulation processing result to obtain a serialized service simulation processing result", including:
determining a serialization processing mode based on a business protocol corresponding to the target simulation service;
and according to the serialization processing mode, encrypting the service simulation processing result to obtain the serialized service simulation processing result.
The serialization process may be performed by an encryption process, and the encryption algorithm used may be the same as the encryption algorithm in step 103.
In a specific scenario, based on the service simulation processing method provided by the application, a service simulation processing system is deployed, the service simulation processing system can be composed of a simulation service management end and a plurality of service devices, different service devices correspond to different service requirements, each service device is deployed with at least one simulation service, one simulation service corresponds to processing a communication protocol, and in addition, each service device further comprises a service simulation proxy module, and the service simulation proxy module can be used for performing service simulation processing on service data. In this embodiment, the analog service management end may be denoted as MatrixMgrServer, the service analog proxy module may be denoted as MatrixAgent, and the analog service may be denoted as MatrixServer. The business simulation processing system can operate in the environment of Python, which is a high-level programming language of interpreted, object-oriented, dynamic data types.
As shown in fig. 1c, the overall architecture of the service simulation processing system is a distributed architecture of a/S (agent agent+server service), and the service simulation processing system includes a central simulation service management end and a plurality of distributed service devices managed by the simulation service management end, where each service device deploys a service simulation agent module, and each service device can start a plurality of simulation services. The simulation service deployed in the service equipment can realize supporting various communication protocols; meanwhile, the service simulation processing of the private protocol can be supported through the rule engine of the service simulation proxy module. In addition, by means of the characteristic of a distributed architecture, different business devices can be configured with different business processing rules, so that fine rule isolation can be realized, different business logic processing can be realized aiming at the same business object, and the requirements of different businesses are met.
The simulation service management end can be used for managing each service device, and specifically includes rule management, protocol management, PB (protocol buffer) file management, authority management, service management, result query and the like. Wherein, rule management can be used for storing business processing rules of business equipment, etc.; protocol management can be used for managing various communication protocols and service protocols corresponding to service equipment; PB file management can be used to store management related binary files; rights management may be used to manage rights for each business device; the service management may be configured to send a service configuration request to the service device, so that the service device performs configuration of the analog service; the result query can be used for checking the service simulation processing result obtained by processing the service request through the service equipment and carrying out statistical analysis on the service simulation processing result. It can be appreciated that the service simulation proxy module needs to maintain a normal network connection with the simulation service manager in order to be effectively managed.
In addition, the simulation service management end can be designed based on the software architecture style of the RESTful API. REST, full scale Representational State Transfer, means: representational state transfer, a network system of architectural style is described, which refers to a set of architectural constraints and principles. An application or design that meets these constraints and principles is RESTful. RESTful can guarantee that each component can operate alone or modify evolution over a large or distributed architecture. The RESTful API (network interface conforming to the REST style) is a software architecture style and design style, and software designed based on the style can be simpler, more hierarchical and easier to realize mechanisms such as caching. Among them, API, generic name Application Programming Interface, i.e. "application programming interface".
REST itself does not create new technologies, components or services that use only existing features, scripts, and capabilities of the Web (World Wide Web), better using some of the criteria and constraints in existing Web standards.
In one embodiment, the flow of processing the service request based on the service simulation processing system is shown in fig. 1d, and the specific steps are as follows:
A. invoking a target simulation service to receive a service request: the service request end sends a service request to the service equipment through a target communication protocol according to the service requirement; the service equipment calls a target simulation service MatrixServer corresponding to the target communication protocol to receive a service request;
B. unpacking and standardized data conversion are carried out on the service request: the target simulation service decodes the service request based on the target communication protocol, and then performs deserialization processing on the decoded service request according to the service protocol appointed by the target simulation service to obtain service data, namely the unpacked service request; then, standard data conversion is carried out on the business data according to a standard interface in the target simulation service, so that the processing program can conveniently process the data;
C. And carrying out service simulation processing on the service data based on the service processing rule: the target simulation service can request the standardized service data to the service simulation proxy module through the UDS, and the service simulation proxy module performs service simulation processing on the service data based on service processing rules to obtain service simulation processing results;
D. and returning a service simulation processing result: the business simulation agent module returns a business simulation processing result to the target simulation service;
the service simulation agent module can report the execution result of the service data, namely the service simulation processing result, to the simulation service management end in an asynchronous mode for subsequent statistical analysis;
in addition, it should be noted that, the service simulation proxy module can manage the service processing rules configured by the corresponding service equipment, and concretely can synchronize the service processing rules with the simulation service management end through the timing task, so as to ensure that the service processing rules in the service simulation proxy module are up-to-date;
E. judging whether the service data is matched with the service processing rule or not: the target simulation service can judge whether the service data is matched with the service processing rule or not through the service simulation processing result returned by the service simulation proxy module, so as to determine whether the service data is required to be forwarded to the real service for processing; if the business data is not matched with the business processing rule, executing the step F;
F. When the service data is not matched with the service processing rule, forwarding the service data to a real service: when the service data is not matched with the service processing rule according to the service simulation processing result, the service data can be forwarded to the real service so as to carry out service data on the service data through the real service to obtain the service real processing result, and the service real processing result is returned to the target simulation service;
G. packaging the returned result to obtain service result information: the target simulation service can perform serialization processing on the acquired return result (specifically, the service simulation processing result or the service real processing result) according to the corresponding service protocol, and package the serialized return result based on the target communication protocol to obtain service result information conforming to the target communication protocol;
H. and returning service result information: and the target simulation service returns the service result information conforming to the target communication protocol to the service request terminal.
In particular, in some embodiments, the simulation service may include a protocol processing engine and an execution engine, and the business simulation agent module may include a rule processing engine. In this embodiment, the communication protocol and the service protocol (including the private protocol) are managed in the analog service, and the analog service can support the plug-in loading communication protocol, and in addition, the private protocol can be dynamically loaded through the protocol processing engine, so as to support the custom access of the private protocol, and the private protocols that can be supported by the analog service include various private protocols such as wind control, cmdb (Configuration Management Database ), and the like. The protocol processing engine may refer to a service analysis script set, that is, a set of processing of a communication protocol and a service protocol (including a private protocol); specifically, the service protocol may be defined according to the service requirement, and the protocol processing engine may enable the service to write the serialized and de-serialized scripts of the protocol for adapting to different service protocols. The execution engine can be used for carrying out simulation analysis processing on the service request; the rule processing engine may perform business simulation processing on the business data based on the business processing rules.
Referring to fig. 1e, a specific flow of the service simulation process is described as follows:
a. the service equipment can start the simulation service corresponding to the target communication protocol according to the service request which is transmitted by the received service request end and accords with the target communication protocol;
the service equipment is provided with a plurality of simulation services, and different simulation services can correspondingly process different communication protocols; the communication protocol processed may include TCP (transmission control protocol), UDP (user datagram protocol), UDS (network socket protocol), etc., which is not limited in this embodiment;
b. after the service request is sent to the simulation service corresponding to the target communication protocol, the simulation service can distribute the service request to the execution engine, decode the service request based on the target communication protocol through the execution engine, and acquire a script file of the service protocol corresponding to the simulation service from the service analysis script set so as to perform deserialization processing on the decoded service request to obtain service data; the acquired service data is standardized and converted into a standard data structure in the simulation service, wherein the service analysis script set can comprise a protocol file (script file) of a service protocol corresponding to the simulation service;
c. The execution engine transmits the standardized service data to the rule engine, the rule engine can acquire the service processing rule corresponding to the service simulation agent module from the service processing rule set, and according to the service processing rule, the service data is subjected to service simulation processing to obtain a service simulation processing result, the service simulation processing result is standardized, and the standardized service simulation processing result is returned to the execution engine;
d. the execution engine can judge whether the service data needs to be forwarded to the real service according to the returned service simulation processing result, and if the service simulation processing result indicates that the service data is not matched with the service processing rule, the service data can be forwarded to the real service so as to perform service processing on the service data through the real service and obtain a service real processing result;
e. after the execution engine obtains the standardized return result (specifically, the standardized return result may be a service simulation processing result or a service real processing result), the return result may be serialized and data packed based on the target communication protocol, so as to obtain service result information, and the service result information is returned to the service request end.
In some embodiments, the service processing rule configured by the service simulation agent module in the service device may also be updated by the simulation service management end, as shown in fig. 1f, which is specifically described as follows:
1. entering a business processing rule: the user inputs new business processing rules in the simulation service management end;
2. updating the business processing rule: the simulation service management end triggers rule change based on the newly input service processing rule, namely, the service processing rule and the identification information (particularly, version number) of the service processing rule are updated;
3. inquiring whether the version numbers of the business processing rules are consistent: the service simulation agent module in the service equipment queries the target service processing rule corresponding to the service equipment in the simulation service management end at regular time, and specifically, may query whether the version number of the latest target service processing rule corresponding to the service equipment in the simulation service management end is consistent with the version number of the currently configured service processing rule in the service equipment;
4. acquiring the latest business processing rule: when the version number of the latest target business processing rule corresponding to the business equipment in the simulated service management end is inquired and is inconsistent with the version number of the business processing rule currently configured in the business equipment, acquiring the latest business processing rule of the business equipment from the simulated service management end;
5. Updating the business processing rule in the memory: after the service simulation agent module obtains the latest service processing rule, the service processing rule in the memory of the service simulation agent module can be updated, so that the latest service processing rule in the memory is ensured;
6. backup the latest business processing rules to the local file: the service simulation agent module can also load the latest service processing rule dump into the local file, so that the service simulation agent module can be loaded into the latest service processing rule during restarting after being hung up due to special faults.
Wherein dump can refer to exporting and spool data into a file or static form, which can be understood as: and (3) converting the content of the memory at a certain moment into a file, namely backing up the data.
The business simulation processing method provided by the application can support various communication protocols and various business protocols, and can be suitable for simulation tests among different protocols; an automation interface can also be provided to support the packaging and use of upper layer services. In some specific scenes, a data message in network transmission can be extracted, and the data message is subjected to field modification based on the service simulation processing method, and then is put back into a queue to continue the normal flow.
As can be seen from the above, the present embodiment may receive a service request sent by a service request end, where the service request meets a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service. The service equipment in the embodiment of the application is deployed with at least one simulation service corresponding to the communication protocol, and can perform simulation analysis processing on service requests transmitted based on various communication protocols, so as to perform service simulation processing on service data obtained through the simulation analysis processing; in a simulation test scenario of a service request transmitted based on a target communication protocol, a target simulation service corresponding to the target communication protocol can be selected from at least one simulation service deployed by service equipment, so that the service request is simulated and analyzed through the target simulation service; therefore, the embodiment of the application can be applied to simulation tests under the scenes of various communication protocols, and the applicability of service simulation is improved.
The method according to the previous embodiment will be described in further detail below with the specific integration of the service simulation processing device in the server.
The embodiment of the application provides a service simulation processing method, as shown in fig. 2a, the specific flow of the service simulation processing method may be as follows:
201. and the server receives a service request sent by the service request end, wherein the service request accords with a target communication protocol.
The service request may be sent by the service request end based on a target communication protocol. Specifically, the service request may carry service data to be processed, which may include service data to be processed through service simulation, and may also include service data for requesting real service processing, which is not limited in this embodiment.
202. The server determines a target simulation service corresponding to the target communication protocol from at least one simulation service deployed from the service equipment, wherein one simulation service corresponds to processing one communication protocol.
The simulation service is specifically a simulation service program, and can perform preprocessing such as unpacking and the like on the service request based on a communication protocol. The business equipment comprises one or more analog services, and in some embodiments, different analog services can correspondingly process different communication protocols; the method is suitable for simulation test under the scene corresponding to various communication protocols.
In some embodiments, a service device to which a service request is to be sent may be determined based on a service requirement, and then the service request is sent to the service device based on a target communication protocol, so that the service device receives the service request, and invokes a target simulation service to process the service request based on the target communication protocol.
203. And the server decodes the service request based on the target communication protocol through the target simulation service to obtain a decoded service request.
The service request can be decoded through a protocol file corresponding to the target communication protocol. For example, if the service request is sent by the service request end based on the TCP protocol, the service request may be decoded based on a protocol file corresponding to the TCP protocol.
204. And the server performs deserialization processing on the decoded service request according to the service protocol corresponding to the target simulation service to obtain service data.
The service request can be specifically obtained by serializing based on the service protocol corresponding to the target simulation service, so that the decoded service request can be processed in an anti-serialization manner according to the protocol file of the service protocol corresponding to the target simulation service to obtain service data.
Serialization is a process of converting an object into a byte stream, i.e., a memory protocol object is processed into continuous binary stream data, so as to facilitate network transmission, and the continuous binary stream data is stored in a file, a memory and a database. The deserialization is to convert a byte stream into an object, specifically to parse a binary data stream into a memory protocol object according to the definition of a protocol structure. That is, serialization and deserialization are processes that convert data into a reversible data structure, which is then converted back into data.
Optionally, in this embodiment, the step of performing, according to a service protocol corresponding to the target analog service, deserializing processing on the decoded service request to obtain service data may include:
determining a deserialization processing mode according to a business protocol corresponding to the target simulation service;
and based on the reverse serialization processing mode, decrypting the decoded service request to obtain service data.
205. And the server determines the preset data processing type of the service processing rule configured by the service equipment.
The preset data processing type may specifically be a service type to be subjected to analog processing.
206. When the data processing type corresponding to the service data is identified to be matched with the preset data processing type, the server performs service simulation processing on the service data according to the service processing rule to obtain a service simulation processing result.
The service processing rules may include some custom logic rules for service processing, for example, the service processing rules may include substitution of a specified field (specifically, substitution of a single field or substitution of multiple fields), delay return, reservation of a specific field, and the like, which is not limited in this embodiment. The service simulation processing may specifically be a process of obtaining a simulation return result corresponding to the service data. Through the service simulation processing, the service processing result can be directly obtained, and the service data does not need to be processed by real service.
Specifically, the service data may be the service data to be subjected to service simulation processing, or may be the service data requesting real service processing. In this embodiment, the data processing type may specifically indicate whether the service data needs to be subjected to service simulation processing (specifically, whether the mock test needs to be performed), and the data processing type corresponding to the service data may indicate whether the service data is service data requiring simulation processing or service data requiring real service processing. If the data processing type corresponding to the service data is identified as the service type requiring the simulation processing, the data processing type is matched with the preset data processing type, and the service simulation processing can be performed on the service data according to the service processing rule, so that a service simulation processing result is obtained. If the data processing type corresponding to the service data is the service type requesting real service processing, the data processing type is not matched with the preset data processing type, the service data is not processed, and the service data is directly returned as a service simulation processing result.
Optionally, in this embodiment, the service simulation processing method may further include:
when the service data is determined to be unmatched with the service processing rule according to the service simulation processing result, performing service processing on the service data through real service to obtain a service real processing result;
and sending the real business processing result to the business request terminal based on the target simulation service.
The business simulation processing method can judge that the business data is not matched with the business processing rules based on the business simulation processing result, forward the business data to the real service, and avoid the situation that the developer forgets to modify the access address in the configuration file to cause incorrect use in the subsequent use process without manually restoring the access address to the real address of the interface or class to be accessed by the developer.
207. And the server performs serialization processing on the service simulation processing result based on the service protocol corresponding to the target simulation service to obtain the serialized service simulation processing result.
Wherein the business protocol corresponding to the target simulation service is consistent with the business protocol in step 204. The service simulation processing result can be serialized based on the protocol file of the service protocol corresponding to the target simulation service, and the serialized service simulation processing result is obtained.
Optionally, in this embodiment, step "the server performs serialization processing on the service simulation processing result based on the service protocol corresponding to the target simulation service to obtain a serialized service simulation processing result" includes:
determining a serialization processing mode based on a business protocol corresponding to the target simulation service;
and according to the serialization processing mode, encrypting the service simulation processing result to obtain the serialized service simulation processing result.
208. And the server performs encapsulation processing on the serialized service simulation processing result to obtain service result information conforming to the target communication protocol.
209. And the server sends the service result information to the service request terminal.
In one embodiment, as shown in fig. 2b, a specific flow of performing service simulation processing on a service request is described as follows:
2001. de-serializing the service request: when the service equipment receives a service request sent based on a target communication protocol, a target simulation service corresponding to the target communication protocol can be called, decoding operation is carried out on the service request based on the target communication protocol, and deserialization processing is carried out on the decoded service request according to the service protocol corresponding to the target simulation service, so that service data are obtained;
2002. Loading rules from memory: the service equipment loads the service processing rule configured by the service equipment from the memory;
2003. whether the loading is successful: judging whether the business processing rule is loaded from the memory successfully, if so, entering step 2005; if not, go to step 2004;
2004. loading the business processing rule from the local file, and proceeding to step 2005;
2005. carrying out structural processing on the service processing rule so as to obtain the service processing rule configured by the service equipment;
2006. calculating whether the service processing rule is matched with the service data, if so, entering a step 2007; if not, go to step 2009;
2007. executing a business processing rule: executing a service processing rule on the service data to obtain a service simulation processing result;
2008. serializing and returning data: carrying out serialization processing on the service simulation processing result, and packaging the serialized service simulation processing result based on a target communication protocol to obtain service result information, so that the service result information is returned to a service request end, and the flow is ended;
2009. whether to forward the real service: judging whether the service data is required to be forwarded to a real service for processing; if yes, go to step 20010; if not, ending the flow;
20010. Forwarding to the real service: and sending the business data to the real service through the target simulation service, carrying out business processing on the business data through the real service to obtain a business real processing result, and returning the business real processing result to the business request terminal.
In step 2005, the "structure processing is performed on the service processing rule", because when the computer stores data, the data is generally stored according to a predetermined format, for example, the data can be stored according to a storage mode that saves more resource space, so that when the program reads the data, specifically, when the program reads the service processing rule, the program needs to parse the service processing rule into structural information that can be identified by the program, that is, the service processing rule is structured, so that the program can identify the service processing rule.
As can be seen from the above, in this embodiment, a service request sent by a service request end may be received by a server, where the service request meets a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; decoding the service request based on the target communication protocol through the target simulation service to obtain a decoded service request; performing deserialization processing on the decoded service request according to a service protocol corresponding to the target simulation service to obtain service data; determining a preset data processing type of a service processing rule configured by the service equipment; when the data processing type corresponding to the service data is identified to be matched with the preset data processing type, the server performs service simulation processing on the service data according to the service processing rule to obtain a service simulation processing result; based on a service protocol corresponding to the target simulation service, carrying out serialization processing on the service simulation processing result to obtain a serialized service simulation processing result; packaging the serialized service simulation processing result to obtain service result information conforming to the target communication protocol; and sending the service result information to the service request terminal. The service equipment in the embodiment of the application is deployed with at least one simulation service corresponding to the communication protocol, and can perform simulation analysis processing on service requests transmitted based on various communication protocols, so as to perform service simulation processing on service data obtained through the simulation analysis processing; in a simulation test scenario of a service request transmitted based on a target communication protocol, a target simulation service corresponding to the target communication protocol can be selected from at least one simulation service deployed by service equipment, so that the service request is simulated and analyzed through the target simulation service; therefore, the embodiment of the application can be applied to simulation tests under the scenes of various communication protocols, and the applicability of service simulation is improved.
In order to better implement the above method, the embodiment of the present application further provides a service simulation processing apparatus, as shown in fig. 3, where the service simulation processing apparatus may include a receiving unit 301, a determining unit 302, an parsing unit 303, a simulation unit 304, and a sending unit 305, as follows:
(1) A receiving unit 301;
the receiving unit 301 is configured to receive a service request sent by a service request end, where the service request meets a target communication protocol.
(2) A determination unit 302;
a determining unit 302, configured to determine a target simulation service corresponding to the target communication protocol from at least one simulation service deployed from the service device, where one simulation service corresponds to processing one communication protocol.
(3) An analysis unit 303;
and the parsing unit 303 is configured to perform a simulation parsing process on the service request through the target simulation service, so as to obtain service data.
Optionally, in some embodiments of the present application, the parsing unit may include a decoding subunit and a deserializing subunit, as follows:
the decoding subunit is configured to decode, through the target analog service, the service request based on the target communication protocol, to obtain a decoded service request;
And the deserializing subunit is used for deserializing the decoded service request according to the service protocol corresponding to the target simulation service to obtain service data.
Optionally, in some embodiments of the present application, the deserializing subunit may be specifically configured to determine a manner of deserializing according to a service protocol corresponding to the target analog service; and based on the reverse serialization processing mode, decrypting the decoded service request to obtain service data.
(4) A simulation unit 304;
and the simulation unit 304 is configured to perform service simulation processing on the service data according to the service processing rule configured by the service device, so as to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the service processing rule configured by the service device includes at least one service processing sub-rule;
the simulation unit may include a sequence determination subunit and an execution subunit, as follows:
the sequence determining subunit is configured to determine a service processing logic sequence for the service data;
and the execution subunit is used for executing each service processing sub-rule on the service data according to the service processing logic sequence to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the service processing rule includes a service field replacement rule;
the simulation unit may include a replacement character determination subunit and a replacement subunit as follows:
the replacement character determining subunit is used for determining a character to be replaced from at least one character corresponding to the service data;
and the replacing subunit is used for replacing the simulation field of the character to be replaced according to the service field replacement rule configured by the service equipment to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the simulation unit may include a determination subunit and a simulation subunit, as follows:
the determining subunit is configured to determine a preset data processing type of a service processing rule configured by the service device;
and the simulation subunit is used for performing service simulation processing on the service data according to the service processing rule when the data processing type corresponding to the service data is identified to be matched with the preset data processing type, so as to obtain a service simulation processing result.
Optionally, in some embodiments of the present application, the service simulation processing apparatus may further include a real service processing unit, as follows:
The real service processing unit is used for performing service processing on the service data through real service to obtain a service real processing result when the service data is determined to be not matched with the service processing rule according to the service simulation processing result; and sending the real business processing result to the business request terminal based on the target simulation service.
(5) A transmitting unit 305;
and the sending unit 305 is configured to send the service simulation processing result to the service request end based on the target simulation service.
Optionally, in some embodiments of the present application, the sending unit may include a serialization subunit, an encapsulation subunit, and a sending subunit, as follows:
the serialization subunit is configured to perform serialization processing on the service simulation processing result based on a service protocol corresponding to the target simulation service, so as to obtain a serialized service simulation processing result;
the packaging subunit is used for packaging the serialized service simulation processing result to obtain service result information conforming to the target communication protocol;
and the sending subunit is used for sending the service result information to the service request terminal.
Optionally, in some embodiments of the present application, the serialization subunit may specifically be configured to determine a manner of serialization processing based on a service protocol corresponding to the target analog service; and according to the serialization processing mode, encrypting the service simulation processing result to obtain the serialized service simulation processing result.
Optionally, in some embodiments of the present application, the service simulation processing apparatus may further include a rule updating unit, as follows:
the rule updating unit is used for acquiring the identification information of the target service processing rule corresponding to the service equipment from the simulation service management end; comparing the identification information of the service processing rule currently configured by the service equipment with the identification information of the target service processing rule to obtain a comparison result; and updating the service processing rule currently configured by the service equipment according to the comparison result.
Optionally, in some embodiments of the present application, the service analog processing device may further include a configuration unit, as follows:
the configuration unit is used for receiving a service configuration request corresponding to a preset communication protocol sent by the analog service management end, wherein the service configuration request indicates analog service to be configured; and deploying the simulation service corresponding to the preset communication protocol on the service equipment according to the service configuration request.
Optionally, in some embodiments of the present application, the service analog processing device may further include an updating unit, as follows:
the updating unit is used for receiving a target business rule updating request sent by the simulated service management end, wherein the target business rule updating request indicates business equipment needing to update business processing rules in a business equipment cluster, the business equipment cluster comprises at least two business equipment which are distributed and deployed, and different business equipment corresponds to different business processing rules; and updating the business processing rule of the business equipment according to the target business rule updating request.
As can be seen from the foregoing, in this embodiment, the receiving unit 301 may receive a service request sent by a service request end, where the service request meets a target communication protocol; determining, by the determining unit 302, a target analog service corresponding to the target communication protocol from at least one analog service deployed from the service device, where one analog service corresponds to processing one communication protocol; the analysis unit 303 performs simulation analysis processing on the service request through the target simulation service to obtain service data; performing service simulation processing on the service data through a simulation unit 304 according to a service processing rule configured by the service equipment to obtain a service simulation processing result; and the sending unit 305 sends the service simulation processing result to the service request end based on the target simulation service. The service equipment in the embodiment of the application is deployed with at least one simulation service corresponding to the communication protocol, and can perform simulation analysis processing on service requests transmitted based on various communication protocols, so as to perform service simulation processing on service data obtained through the simulation analysis processing; in a simulation test scenario of a service request transmitted based on a target communication protocol, a target simulation service corresponding to the target communication protocol can be selected from at least one simulation service deployed by service equipment, so that the service request is simulated and analyzed through the target simulation service; therefore, the embodiment of the application can be applied to simulation tests under the scenes of various communication protocols, and the applicability of service simulation is improved.
The embodiment of the application further provides an electronic device, as shown in fig. 4, which shows a schematic structural diagram of the electronic device according to the embodiment of the application, where the electronic device may be a terminal or a server, specifically:
the electronic device may include one or more processing cores 'processors 401, one or more computer-readable storage media's memory 402, power supply 403, and input unit 404, among other components. Those skilled in the art will appreciate that the electronic device structure shown in fig. 4 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components. Wherein:
the processor 401 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 402, and calling data stored in the memory 402, thereby performing overall monitoring of the electronic device. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, an application program, etc., and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by executing the software programs and modules stored in the memory 402. The memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
The electronic device further comprises a power supply 403 for supplying power to the various components, preferably the power supply 403 may be logically connected to the processor 401 by a power management system, so that functions of managing charging, discharging, and power consumption are performed by the power management system. The power supply 403 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may further comprise an input unit 404, which input unit 404 may be used for receiving input digital or character information and generating keyboard, mouse, joystick, optical or trackball signal inputs in connection with user settings and function control.
Although not shown, the electronic device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 401 in the electronic device loads executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 executes the application programs stored in the memory 402, so as to implement various functions as follows:
receiving a service request sent by a service request end, wherein the service request accords with a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
As can be seen from the above, the present embodiment may receive a service request sent by a service request end, where the service request meets a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service. The service equipment in the embodiment of the application is deployed with at least one simulation service corresponding to the communication protocol, and can perform simulation analysis processing on service requests transmitted based on various communication protocols, so as to perform service simulation processing on service data obtained through the simulation analysis processing; in a simulation test scenario of a service request transmitted based on a target communication protocol, a target simulation service corresponding to the target communication protocol can be selected from at least one simulation service deployed by service equipment, so that the service request is simulated and analyzed through the target simulation service; therefore, the embodiment of the application can be applied to simulation tests under the scenes of various communication protocols, and the applicability of service simulation is improved.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform steps in any of the business simulation processing methods provided by the embodiments of the present application. For example, the instructions may perform the steps of:
receiving a service request sent by a service request end, wherein the service request accords with a target communication protocol; determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol; performing simulation analysis processing on the service request through the target simulation service to obtain service data; according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result; and sending the business simulation processing result to the business request terminal based on the target simulation service.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the computer-readable storage medium may comprise: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
Because the instructions stored in the computer readable storage medium may execute the steps in any service simulation processing method provided in the embodiments of the present application, the beneficial effects that any service simulation processing method provided in the embodiments of the present application may be achieved, which are detailed in the previous embodiments and are not described herein.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in various alternative implementations of the business simulation processing aspects described above.
The foregoing describes in detail a service simulation processing method and related devices provided in the embodiments of the present application, and specific examples are applied to illustrate principles and implementations of the present application, where the foregoing description of the embodiments is only for helping to understand the method and core ideas of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.

Claims (16)

1. The service simulation processing method is characterized by being suitable for service equipment and comprising the following steps:
receiving a service request sent by a service request end, wherein the service request accords with a target communication protocol;
determining a target simulation service corresponding to the target communication protocol from at least one simulation service deployed by the service equipment, wherein one simulation service corresponds to one communication protocol;
performing simulation analysis processing on the service request through the target simulation service to obtain service data;
according to the service processing rule configured by the service equipment, performing service simulation processing on the service data to obtain a service simulation processing result;
and sending the business simulation processing result to the business request terminal based on the target simulation service.
2. The method according to claim 1, wherein the method further comprises:
when the service data is determined to be unmatched with the service processing rule according to the service simulation processing result, performing service processing on the service data through real service to obtain a service real processing result;
and sending the real business processing result to the business request terminal based on the target simulation service.
3. The method according to claim 1, wherein said performing, by the target simulation service, a simulation parsing process on the service request to obtain service data includes:
decoding the service request based on the target communication protocol through the target simulation service to obtain a decoded service request;
and performing deserialization processing on the decoded service request according to the service protocol corresponding to the target simulation service to obtain service data.
4. The method of claim 3, wherein the performing deserialization processing on the decoded service request according to the service protocol corresponding to the target analog service to obtain service data includes:
determining a deserialization processing mode according to a business protocol corresponding to the target simulation service;
and based on the reverse serialization processing mode, decrypting the decoded service request to obtain service data.
5. The method of claim 1, wherein the business process rules configured by the business device include at least one business process sub-rule;
the service data is subjected to service simulation processing according to the service processing rule configured by the service equipment to obtain a service simulation processing result, which comprises the following steps:
Determining a service processing logic sequence for the service data;
and executing each business processing sub-rule on the business data according to the business processing logic sequence to obtain a business simulation processing result.
6. The method of claim 1, wherein the business process rules comprise business field replacement rules;
the service data is subjected to service simulation processing according to the service processing rule configured by the service equipment to obtain a service simulation processing result, which comprises the following steps:
determining a character to be replaced from at least one character corresponding to the service data;
and according to the service field replacement rule configured by the service equipment, performing simulated field replacement on the character to be replaced to obtain a service simulation processing result.
7. The method of claim 1, wherein the performing service simulation processing on the service data according to the service processing rule configured by the service device to obtain a service simulation processing result includes:
determining a preset data processing type of a service processing rule configured by the service equipment;
and when the data processing type corresponding to the service data is identified to be matched with the preset data processing type, carrying out service simulation processing on the service data according to the service processing rule to obtain a service simulation processing result.
8. The method according to claim 1, wherein the sending the service simulation result to the service request terminal based on the target simulation service includes:
based on a service protocol corresponding to the target simulation service, carrying out serialization processing on the service simulation processing result to obtain a serialized service simulation processing result;
packaging the serialized service simulation processing result to obtain service result information conforming to the target communication protocol;
and sending the service result information to the service request terminal.
9. The method of claim 8, wherein the serializing the service simulation result based on the service protocol corresponding to the target simulation service to obtain the serialized service simulation result comprises:
determining a serialization processing mode based on a business protocol corresponding to the target simulation service;
and according to the serialization processing mode, encrypting the service simulation processing result to obtain the serialized service simulation processing result.
10. The method according to claim 1, wherein the method further comprises:
Acquiring identification information of a target service processing rule corresponding to the service equipment from a simulation service management end;
comparing the identification information of the service processing rule currently configured by the service equipment with the identification information of the target service processing rule to obtain a comparison result;
and updating the service processing rule currently configured by the service equipment according to the comparison result.
11. The method according to claim 1, wherein the method further comprises:
receiving a service configuration request corresponding to a preset communication protocol sent by an analog service management end, wherein the service configuration request indicates analog service to be configured;
and deploying the simulation service corresponding to the preset communication protocol on the service equipment according to the service configuration request.
12. The method according to claim 1, wherein the method further comprises:
receiving a target business rule updating request sent by a simulated service management end, wherein the target business rule updating request indicates business equipment needing to update business processing rules in a business equipment cluster, the business equipment cluster comprises at least two business equipment which are distributed and deployed, and different business equipment corresponds to different business processing rules;
And updating the business processing rule of the business equipment according to the target business rule updating request.
13. A service simulation processing apparatus, adapted to a service device, comprising:
the receiving unit is used for receiving a service request sent by the service request end, and the service request accords with a target communication protocol;
a determining unit, configured to determine a target analog service corresponding to the target communication protocol from at least one analog service deployed by the service device, where one analog service corresponds to processing one communication protocol;
the analysis unit is used for carrying out simulation analysis processing on the service request through the target simulation service to obtain service data;
the simulation unit is used for carrying out service simulation processing on the service data according to the service processing rules configured by the service equipment to obtain a service simulation processing result;
and the sending unit is used for sending the business simulation processing result to the business request terminal based on the target simulation service.
14. An electronic device comprising a memory and a processor; the memory stores an application program, and the processor is configured to execute the application program in the memory to perform the operations in the business simulation processing method according to any one of claims 1 to 12.
15. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the business simulation processing method of any of claims 1 to 12.
16. A computer program product comprising computer programs or instructions which, when executed by a processor, implement the steps of the business simulation processing method of any of claims 1 to 12.
CN202111208721.8A 2021-10-18 2021-10-18 Service simulation processing method and related equipment Pending CN115994077A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111208721.8A CN115994077A (en) 2021-10-18 2021-10-18 Service simulation processing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111208721.8A CN115994077A (en) 2021-10-18 2021-10-18 Service simulation processing method and related equipment

Publications (1)

Publication Number Publication Date
CN115994077A true CN115994077A (en) 2023-04-21

Family

ID=85992676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111208721.8A Pending CN115994077A (en) 2021-10-18 2021-10-18 Service simulation processing method and related equipment

Country Status (1)

Country Link
CN (1) CN115994077A (en)

Similar Documents

Publication Publication Date Title
CN109739573B (en) Processing method and device for realizing API (application program interface) call and system for realizing API
CN112035228B (en) Resource scheduling method and device
US9256353B2 (en) Providing application and device management using entitlements
CN101202761B (en) System of distributed resource scheduling and method thereof
US20080147787A1 (en) Method and system for providing load balancing for virtualized application workspaces
US11232405B2 (en) Computer readable storage media for dynamic service deployment and methods and systems for utilizing same
KR20060099392A (en) Dynamic service generation for legacy components
CN111385147B (en) Fault simulation method, device and computer readable storage medium
US11726800B2 (en) Remote component loader
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN113687858A (en) Configuration file checking method and device, electronic equipment and storage medium
CN110324209B (en) Micro-service system monitoring method and device, electronic equipment and computer readable medium
CN109725887B (en) Data interaction method and device based on message research and development framework and terminal equipment
CN113448655B (en) C standard dynamic library calling method and device
US7849472B1 (en) System for instrumenting resources utilizing WS-management resource MBean wrappers for JAXB beans
CN108496157B (en) System and method for providing runtime trace using an extended interface
CN113761412A (en) Application page display method and device, electronic equipment, medium and application system
WO2023083071A1 (en) View interaction method and apparatus, electronic device, and computer readable medium
CN115225482B (en) Method and device for carrying out Pod container network configuration based on Kubernetes
CN115811481A (en) Interactive service testing method and device, computer equipment and storage medium
CN115994077A (en) Service simulation processing method and related equipment
CN112667491B (en) Function test method and device for virtual machine
CN113918245A (en) Data calling method, device, equipment and computer readable storage medium
US20230091903A1 (en) Iterative generation of hypertext transfer protocol traffic
CN110879747B (en) Resource management method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination