Data collection method, device, computer equipment and storage medium for service simulation

In the data collection method of service simulation, the request from the service consumer is received, the existing input message template is matched, and the IP port information of the target service provider is obtained from the target registration center when the matching is not matched, and the matching in the existing technology is solved The problem of low efficiency achieves efficient packet matching.

CN115996251BActive Publication Date: 2025-02-14INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211412132.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-11
Publication Date
2025-02-14
Estimated Expiration
2042-11-11

AI Technical Summary

Technical Problem

In the prior art, the data acquisition method for service simulation has the problem of low matching efficiency, especially in the cloud computing environment, due to different messages in different scenarios, the messages cannot be matched, and messages in different scenarios need to be manually written. , resulting in a decrease in matching efficiency.

Method used

By receiving the service simulation request from the service consumer, the simulation service class corresponding to the service information to be simulated is obtained, and the existing input message template corresponding to the method information to be simulated is matched from the existing input message template. If there is no matching template, the IP port information of the target service provider is obtained from the target registration center, the target service provider is called to obtain the target message, and the input message template is generated based on the target message.

Benefits of technology

Improve the efficiency of packet matching, avoid the inefficient process of manually writing packets, and obtain target packets through generalized calls, realizing automated packet matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115996251B_ABST
    Figure CN115996251B_ABST
Patent Text Reader

Abstract

The present application relates to a data collection method, device, computer equipment and storage medium for service simulation, which can be used in the financial field or other fields. By determining the existing input message template corresponding to the method information to be simulated in the service simulation request from the existing message template, if there is no existing input message template that matches the input message in the service simulation request, the IP port information of the target service provider is obtained from the target registration center, the target message determined based on the input message returned by the target service provider is obtained, and the simulation result is returned to the service consumer according to the target message. Compared with the traditional method of manually writing messages, this solution improves the efficiency of message matching by adopting a generalized call method to obtain the target message returned by the target service provider corresponding to the registration center based on the input message when the input message does not match.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data collection method, device, computer equipment, storage medium and computer program product for service simulation. Background Art

[0002] When developing cloud computing, it is necessary to test the remote calls between the developed services. However, since the development of each service is not completed synchronously, there may be a situation where one service needs to remotely call another service, but the other service is not completed and cannot be called. Therefore, it is necessary to simulate the called service so that the service that initiates the call can complete the message matching in the simulated service and obtain the information returned after matching. Since there are different scenarios in cloud computing business, the messages in different scenarios will also be different, resulting in different messages in different simulated services. Therefore, when matching messages by calling simulated services, there will be situations where matching messages cannot be obtained. At present, the way to solve the problem of being unable to match messages is usually to manually write messages for different scenarios for simulated services. However, manually writing messages will reduce the efficiency of matching.

[0003] Therefore, the current data collection method for service simulation has the defect of low matching efficiency. Summary of the invention

[0004] Based on this, it is necessary to provide a data collection method, device, computer equipment, computer-readable storage medium and computer program product for service simulation that can match efficiency in response to the above technical problems.

[0005] In a first aspect, the present application provides a data collection method for service simulation, which is applied to a first server, and the method includes:

[0006] Receive a service simulation request from a service consumer; the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and an input message corresponding to the method information to be simulated;

[0007] Obtaining a simulated service class corresponding to the service information to be simulated in the first server, determining at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and matching the input message with the at least one existing input message template;

[0008] If there is no existing input message template matching the input message, obtain the IP port information of the target service provider from the target registration center; the target registration center has pre-registered IP port information of at least one service provider of the service corresponding to the method information to be simulated, and the service corresponding to the method information to be simulated includes the input message template matching the input message;

[0009] Calling the target service provider based on the IP port information of the target service provider, and obtaining the target message returned by the target service provider; the target service provider is used to determine the corresponding target message based on the input message;

[0010] According to the target message, an input message template corresponding to the simulation service class is generated and saved, and a simulation result of the service simulation request is returned to the service consumer.

[0011] In one embodiment, if there are multiple existing input message templates corresponding to the method information to be simulated; matching the input message with the at least one existing input message template includes:

[0012] Sort the multiple existing input message templates in descending order of priority of each existing input message template to obtain a sequence of input message templates to be matched;

[0013] The input message is sequentially matched with each existing input message template in the sequence of input message templates to be matched.

[0014] In one embodiment, the input message includes an input message field and input message content corresponding to the input message field, and sequentially matching the input message with each existing input message template in the input message template to be matched includes:

[0015] For each existing input message template, detecting whether the existing input message template contains a message field corresponding to the input message field and whether the message content of the message field is the input message content;

[0016] If the message field of the existing input message template does not contain the input message field, or the message content of the message field is not the input message content corresponding to the input message field, it is determined that the existing input message template does not match the input message.

[0017] In one embodiment, generating and saving an input message template corresponding to the simulated service class according to the target message includes:

[0018] If the input message field is a preset field, a new input message template is generated according to the input message field and the target message, and the new input message template is stored as an existing input message template corresponding to the simulated service class.

[0019] In one of the embodiments, after matching the input message with the at least one existing input message template, the method further includes:

[0020] If there is an existing input message template matching the input message in the sequence of input message templates to be matched, obtaining the first existing input message template matching the input message in the sequence of input message templates to be matched as the target existing input message template;

[0021] The message corresponding to the input message in the target existing input message template is used as the target message for responding to the service simulation request.

[0022] In one embodiment, the step of obtaining the IP port information of the target service provider from the target registration center includes:

[0023] Querying a target registration center for the IP port information of the service provider including the service information to be simulated and the method information to be simulated, and obtaining the address of the target registration center;

[0024] According to the separator in the parameter type of the input message, the parameter type is processed into a string array, and the input message is converted into an object array;

[0025] Initialize the generalized service information configuration based on the dubbo distributed service framework, encapsulate the caller information corresponding to the input message, the address of the target registration center and the service information to be simulated into the generalized service information configuration, and cache the generalized service abstract class in the generalized service information configuration;

[0026] Subscribe the method information to be simulated, the string array of the parameter type and the object array of the input message to the list containing the IP port information of at least one service provider in the target registration center in a generalized calling manner through the generalized service abstract class;

[0027] The IP port information of the target service provider is determined from the list.

[0028] In one embodiment, obtaining the target message returned by the target service provider includes:

[0029] Acquire the IP port information of at least one service provider including the service information to be simulated, and at least one candidate method information corresponding to the service information to be simulated in each service provider from the IP port information of the service providers registered with the target registration center;

[0030] The target IP port information of the target service provider is determined from the IP port information of the at least one service provider, the target service provider is called according to the target IP port information, the target service provider obtains at least one target method information corresponding to the method information to be simulated in the at least one candidate method information, and the target message is determined and returned according to the input message and the at least one target method information.

[0031] In a second aspect, the present application provides a data collection device for service simulation, which is applied to a first server, and the device includes:

[0032] A first receiving module is used to receive a service simulation request from a service consumer; the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and an input message corresponding to the method information to be simulated;

[0033] a determination module, configured to obtain a simulated service class corresponding to the service information to be simulated in the first server, determine at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and match the input message with the at least one existing input message template;

[0034] a forwarding module, configured to obtain IP port information of a target service provider from a target registration center if there is no existing input message template matching the input message; the target registration center pre-registers IP port information of at least one service provider of a service corresponding to the method information to be simulated, and the service corresponding to the method information to be simulated includes an input message template matching the input message;

[0035] A first matching module, configured to call the target service provider based on the IP port information of the target service provider, and obtain a target message returned by the target service provider; the target service provider is configured to determine a corresponding target message based on the input message;

[0036] The return module is used to generate and save the input message template corresponding to the simulation service class according to the target message, and return the simulation result of the service simulation request to the service consumer.

[0037] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0038] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0039] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.

[0040] The data collection method, device, computer equipment, storage medium and computer program product of the service simulation described above determine at least one existing input message template corresponding to the method information to be simulated in the service simulation request sent by the service consumer from the existing message templates. If there is no existing input message template that matches the input message in the service simulation request, the IP port information of the target service provider is obtained from the target registration center, the target message determined based on the input message returned by the target service provider is obtained, and the simulation result is returned to the service consumer according to the target message. Compared with the traditional method of manually writing messages, this solution improves the efficiency of message matching by adopting a generalized call method to obtain the target message returned by the target service provider corresponding to the registration center based on the input message when the input message does not match. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 An application environment diagram of a data collection method for service simulation in one embodiment;

[0042] Figure 2 A schematic diagram of a flow chart of a data collection method for service simulation in one embodiment;

[0043] Figure 3 A schematic diagram of a forwarding step in an embodiment;

[0044] Figure 4 A schematic diagram of a flow chart of steps for initializing configuration of generalized service information in an embodiment;

[0045] Figure 5 A flowchart of a matching step in an embodiment;

[0046] Figure 6 A flow chart of a data collection method for service simulation in another embodiment;

[0047] Figure 7 A schematic diagram of the structure of a message matching system in an embodiment;

[0048] Figure 8 A structural block diagram of a data acquisition device for service simulation in one embodiment;

[0049] Fig. 9 A structural block diagram of a data acquisition device for service simulation in another embodiment;

[0050] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0052] The service simulation data collection method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the first server 102 communicates with the registration center 104 through the network. The data storage system can store the data that the first server 102 and the registration center 104 need to process. The data storage system can be integrated on the first server 102, can also be integrated on the registration center 104, and can also be placed on the cloud or other network servers. The first server 102 can receive the service simulation request sent by the service consumer, and match the input message of the method information to be simulated in the service simulation request based on the existing input message template. When the match is unsuccessful, the IP port information of the target service provider is determined from at least one service provider corresponding to the target registration center 104 through a generalized call, and the target service provider corresponding to the IP port information determines the target message that matches the input message, and the first server 102 can determine the simulation result based on the obtained target message. Among them, both the first server 102 and the registration center 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0053] In one embodiment, Figure 2 As shown, a data collection method for service simulation is provided, which is applied to Figure 1 Taking the first server in the example as an example, the following steps are included:

[0054] Step S202, receiving a service simulation request from a service consumer; the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and input message corresponding to the method information to be simulated.

[0055] The service consumer may be a party that needs to call a service, such as an application in a computer. The first server may receive a service simulation request from the service consumer, wherein the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and input message corresponding to the method information to be simulated. The service information to be simulated may be relevant information about the service that needs to be called, the service information to be simulated includes at least one method information to be simulated, the method information to be simulated may be information about a method in the service corresponding to the service information to be simulated, and the method information to be simulated includes a corresponding input message. The above-mentioned service simulation may be a process of obtaining a target message based on an input message. The first server may match the corresponding target message based on the above-mentioned input message, and use the target message as the simulation result of the service simulation request.

[0056] Among them, the above-mentioned service that needs to be called can be a Mock simulation service. Mock means simulation, that is, simulating the information returned by the interface, replacing the information it needs to return with the existing information, so as to realize the test of the upper-level module. The above-mentioned Mock is a mock for the interface test level. For example, for some object interfaces that are not easy to construct and have not yet been completed, the first server can mock a virtual object interface, and return the pre-set mock data by calling the mock virtual object interface, so that the test can be completed. The above-mentioned service consumer and the first server can respectively include application 1 and application 2, application 1 includes service 1 and service 2, and application 2 includes service 3 and service 4. Application 1 and application 2 can be different applications, existing in different application deployment environments, and there is a calling relationship between them. The process of the above service simulation can be that environment 1 deploys applications 1 and 2, that is, environment 1 contains services 1, 2, 3, and 4; because of insufficient server performance, environment 2 only deploys application 2, that is, environment 2 only has services 3 and 4; but service 3 needs to call service 1 to complete the operation, and there is no service 1 in environment 2; at this time, the first server needs to mock service 1 in environment 2, so that when service 3 in environment 2 calls service 1, it returns some predefined mock messages. Therefore, the first server can match the input message in the above service simulation request.

[0057] Step S204, obtain the simulated service class corresponding to the service information to be simulated in the first server, determine at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and match the input message with at least one existing input message template.

[0058] Among them, the first server may include a variety of simulated service classes obtained through mock, and the simulated service classes may correspond to at least one existing input message template. The existing input message template may be an input message template that already exists in the database of the first server, and the existing input message template may be used to match the input message, and the input message template includes input message fields, input message content corresponding to the input message fields, and message content corresponding to the input message. For example, an input message template includes input message fields and input message content corresponding to the input message fields "{"a":1, "c":{"d":4}}", and message content corresponding to the input message: "{"msg":"matching template 1"}". Then, when the input message fields and input message content in the input message are both fields in "{"a":1, "c":{"d":4}}" and corresponding input message content, it can be considered that the input message matches the input message template. After receiving the service simulation request, the first server may determine at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and match the input message in the method information to be simulated with the at least one existing input message template.

[0059] After the first server obtains the input message and the existing input message template in the service simulation request, it can detect the input message and the template. When receiving the input message and the existing input message template, the first server can determine whether the integrity and data structure of the input message and the existing input message template are consistent. If so, it means that further matching can be performed. Otherwise, it returns matching exception information to the service consumer.

[0060] Step S206, if there is no existing input message template that matches the input message, obtain the IP port information of the target service provider from the target registration center; the target registration center pre-registers the IP port information of at least one service provider of the service corresponding to the method information to be simulated, and the service corresponding to the method information to be simulated contains the input message template that matches the input message.

[0061] There may be multiple existing input message templates, and the first server may match the input message with each existing input message template. However, there may not be a template matching the input message in the existing input message templates. In this case, the first server may determine the IP port information of the target service provider from the registration center through a generalized call, and obtain the target message matching the input message from the target service provider corresponding to the IP port information. In the generalized call, the service consumer does not need any interface definition implementation of the service to complete the service call, which greatly reduces the coupling between the consumer and the provider. When the first server detects that there is no existing input message template matching the input message in the above-mentioned existing input message templates, the first server can obtain the IP port information of the target service provider from the target registration center, wherein the IP port information of the target service provider can be the IP port information of a service provider selected by the first server from the IP port information of at least one service provider in the target registration center, and the first server can determine the target registration center containing the IP port information of the service provider corresponding to the method information to be simulated based on the above-mentioned service information to be simulated and the method information to be simulated, and the determination can be determined through a generalized call method.

[0062] Among them, the target registration center may contain the IP port information of at least one service provider. The service provider may be the party being called, that is, the party providing the interface, and each service provider may be a server. The IP port information of at least one service provider corresponding to the method information to be simulated is pre-registered in the above-mentioned target registration center, and the service corresponding to the method information to be simulated contains an input message template that matches the input message. The method information corresponding to the service in each service provider may be different or the same. That is, the above-mentioned at least one service provider has a corresponding identifier and port, and each service may exist in at least one service provider. The methods in the same service in each service provider may be different or the same. The first server calls the IP port information of the service provider in the above-mentioned registration center, and can call it through the identifier and port of the service provider, for example, through the above-mentioned IP port information.

[0063] The above-mentioned first server and registration center are only for the needs of entity expression. In fact, the first server and the registration center may be different services in the same server.

[0064] Step S208, calling the target service provider based on the IP port information of the target service provider, and obtaining the target message returned by the target service provider; the target service provider is used to determine the corresponding target message based on the input message.

[0065] Among them, the target service provider contains method information corresponding to the method information to be simulated. After the first server determines the target registration center, it can query the method information corresponding to the method information to be simulated. The first server can determine the IP port information of a target service provider from at least one service provider based on the corresponding method information. The target service provider can be randomly selected or can be a service provider containing method information corresponding to the method information to be simulated. The server can call the target service provider based on the IP port information of a target service provider registered in the target center. The target service provider processes based on the input message, and then generates a target message matching the input message, and returns it to the simulated service in the first server, so that the first server can obtain the target message returned by the target service provider.

[0066] Step S210: Generate and save an input message template corresponding to the simulation service class according to the target message, and return the simulation result of the service simulation request to the service consumer.

[0067] Among them, the target message can be that when there is no existing input message template matching the input message in the first server, the first server obtains the address of a target service provider from the target registration center, such as IP port information, and passes the above input message to the target service provider through a generalized call. The target service provider returns the target message to the first server after processing, so that the first server can return the simulation result of the service simulation request to the service consumer according to the target message. Specifically, the first server can send the above target message to the application corresponding to the above service consumer, so that the application can obtain the simulation result corresponding to the service simulation request sent by it based on the above target message. In addition, the first server can also generate and save the input message template corresponding to the simulation service class based on the above target message.

[0068] In the data collection method for the above-mentioned service simulation, at least one existing input message template corresponding to the method information to be simulated in the service simulation request sent by the service consumer is determined from the existing message templates. If there is no existing input message template that matches the input message in the service simulation request, the IP port information of the target service provider is obtained from the target registration center, the target message determined based on the input message returned by the target service provider is obtained, and the simulation result is returned to the service consumer according to the target message. Compared with the traditional method of manually writing messages, this solution improves the efficiency of message matching by adopting a generalized call method to obtain the target message returned by the target service provider corresponding to the registration center based on the input message when the input message does not match.

[0069] In one embodiment, if there are multiple existing input message templates corresponding to the information of the method to be simulated; matching the input message with at least one existing input message template includes: sorting the multiple existing input message templates in order from high to low priority of each existing input message template to obtain a sequence of input message templates to be matched; and sequentially matching the input message with each existing input message template in the sequence of input message templates to be matched.

[0070] In this embodiment, in the above-mentioned first server, there may be multiple existing input message templates corresponding to the information of the method to be simulated. When there are multiple existing input message templates, each existing input message template has a corresponding priority. When the first server matches the input message with the existing input message template, it can sort the multiple existing input message templates in order from high to low priority of each existing input message template, so as to obtain a sequence of input message templates to be matched. That is, the sequence of input message templates to be matched includes multiple existing input message templates arranged in order from high to low priority. The first server can sequentially match the above-mentioned input message with each existing input message template in the sequence of input message templates to be matched, so as to achieve the matching of the input message with the existing input message templates.

[0071] Among them, the priority of each of the above existing input message templates can be set according to actual conditions, and when the above first server matches the input message with the existing input message template, it can start matching from the existing input message template with the highest priority in the sequence of input message templates to be matched. For example, in one embodiment, after matching the input message with at least one existing input message template, it also includes: if there is an existing input message template that matches the input message in the sequence of input message templates to be matched, obtain the first existing input message template that matches the input message in the sequence of input message templates to be matched as the target existing input message template; and use the message corresponding to the input message in the target existing input message template as the target message in response to the service simulation request. In this embodiment, when the first server matches the input message with each existing input message template in the sequence of input message templates to be matched, it can start matching from the existing input message template with the highest priority in the sequence of input message templates to be matched, and match with other existing input message templates in descending order of priority. If the first server determines that there is an existing input message template matching the above input message in the sequence of input message templates to be matched, the first server can obtain the first existing input message template matching the input message in the sequence of input message templates to be matched as the target input message template. And the first server can also use the message content corresponding to the input message in the target existing input message template as the target message in response to the above service simulation request.

[0072] Specifically, the above existing input message template includes an input message field, an input message content corresponding to the input message field, and a message corresponding to the input message. The above input message may be a message of a field type. When matching, the first server may match based on the input message field. And the above method information to be simulated may be a mock method. After the first server sends the above input message to the method to be simulated, the integrity of the input message may be detected by the method to be simulated. If the information is wrong or missing, an error message is returned. After the detection is passed, the first server may query all existing input message matching templates belonging to the method to be simulated in the database. The first server may pass the input message and the existing input message template to the input message matching module in a certain order for data matching, for example, matching in order from high to low according to the priority of the existing input message template; if a certain match is successful in the above priority-based matching, the first server may interrupt the remaining matches and return the Mock message corresponding to the current successful matching result, that is, return the above target message to the above service consumer.

[0073] Specifically, the above-mentioned input message template is also called a matching template. For example, the first server may include an existing matching template 1 and an existing matching template 2, wherein the message field in matching template 1 is “{“a”:1, “c”:{“d”:4}}”, and the message corresponding to the message field is: “{“msg”:“matching template 1”}”; the message field in matching template 2 is “{“a”:1, “c”:{“d”:3}}”, and the message corresponding to the message field is: “{“msg”:“matching template 2”}”. And the above input message is "{"a":1, "b":2, "c":{"d":3}}", the first server matches the above input message with matching template 1 and matching template 2 respectively, and the first server compares the input message with matching template 1 and finds that the values ​​of c and d are not equal, so the match is unsuccessful; the first server matches the input message with matching template 2, and all key-values ​​of template 2 match the input message. Therefore, the first server determines that matching template 2 is the target input message template, and the Mock message "{"msg":"matching template 2"}" in matching template 2 can be used as the target message.

[0074] Through the above embodiment, the first server can match the input message with each existing input message template in order of high to low priority of the existing input message templates, and use the input message content in the existing input message template that successfully matches for the first time as the target message, thereby improving the efficiency of message matching.

[0075] In one embodiment, the input message is sequentially matched with each existing input message template in the input message template to be matched, including: for each existing input message template, detecting whether the existing input message template contains a message field corresponding to the input message field and whether the message content of the message field is the input message content; if the message field of the existing input message template does not contain an input message field, or the message content of the message field is not the input message content corresponding to the input message field, determining that the existing input message template does not match the input message.

[0076] In this embodiment, the input message includes an input message field and an input message content corresponding to the input message field. The input message field may be information for participating in the matching, and the input message content may be message information returned after the matching is passed. There may be multiple existing input message templates, and each existing input message template may include a message field and a message content, and may also include a corresponding message. For each existing input message template, the first server may detect whether the existing message template contains a message field corresponding to the input message field. If so, it is detected whether the message content of the message field is the input message content. If the first server detects that the message field corresponding to the input message field does not exist in the existing input message template, or detects that there is a corresponding message field, but the message content of the message field is not the input message content corresponding to the input message field, the first server may determine that the existing input message template does not match the input message. If the first server detects that the input message field is the above-mentioned input message field, and the message content of the above-mentioned message field is the input message content corresponding to the above-mentioned input message field, it is determined that the input message template matches the above-mentioned input message to be simulated.

[0077] Specifically, the above-mentioned message content can be a field value. The first server can parse the above-mentioned received input message, and compare the input message fields and input message content in the input message with the corresponding message fields and field values ​​in the existing input message template one by one. If the field value of a certain field is inconsistent, the comparison is interrupted and a matching failure message is returned. If all input message fields are consistent with the corresponding fields in the existing input message template, a matching success message is returned. For example, the above-mentioned input message can be "{"a":1, "b":2, "c":{"d":3}}", where a, b and c are input message fields, respectively, and 1, 2, and 3 are the input message contents corresponding to their respective input message fields, that is, the above-mentioned field values. If the message field in matching template 1 is "{"a":1, "c":{"d":4}}", the message field corresponds to: "{"msg": "matching template 1"}"; the message field in matching template 2 is "{"a":1, "c":{"d":3}}", the message field corresponds to: "{"msg":"matching template 2"}". The first server matches the above input message with matching template 1 and matching template 2 respectively. The first server compares the input message with matching template 1 and finds that the values ​​of c and d are not equal, so the match fails; the first server matches the input message with matching template 2 and finds that the fields and field values ​​are consistent, which means that the above input message matches the matching template 2, and then the first server can use the message of matching template 2 as the target message.

[0078] Through this embodiment, the first server can match the input message with the input message template based on the message fields and the corresponding message contents, thereby improving the efficiency of message matching.

[0079] In one embodiment, an input message template corresponding to the simulated service class is generated and saved based on the target message, including: if the input message field is a preset field, a new input message template is generated based on the input message field and the target message, and the new input message template is stored as an existing input message template corresponding to the simulated service class.

[0080] In this embodiment, the first server may pre-set a preset field, and the preset field may be a field of great significance. When none of the existing input message templates can match the input message, the first server may obtain the address of at least one service provider from the target registration center through a generalized call method, and determine the IP port information of the target service provider from the IP port information of at least one service provider, and transmit the input message to the target service provider, and the target service provider generates a target message based on the above input message. When the first server obtains the target message returned by the target registration center, it may detect whether the input message field is the above preset field. If so, the first server may generate a new input message template based on the above input message field and the target message, and store the new input message template as the existing input message template corresponding to the above simulation service class.

[0081] Specifically, the first server can configure the business keywords of the input message for each service method that needs to be mocked. For example, the input message can be "{"a":0, "b":2,":{"d": 6}}", and the first server can set a and d as business keywords. When the input message does not match any existing template, the above-mentioned target message is obtained through service forwarding, and the fields a and d of the current input message and their corresponding values ​​are saved as a new template, and the message in the template is the above-mentioned target message. For example, for the above-mentioned input message "{"a":0, "b":2,": {"d":6}}", it can be known that it does not match the above-mentioned matching template 1 and matching template 2, and a and d are business keywords. The terminal can integrate the above-mentioned input message, and integrate the input message fields corresponding to the business keywords and the input message fields matching the matching template into the input message fields in the new input message template, that is, integrated into "{"a":0, "c":{"d":6}}". The first server can obtain the target message corresponding to the above-mentioned input message through the above-mentioned generalized call. For example, the returned target message can be "{"msg":"forward return"}". Then the first server can generate a new input message template based on the above-mentioned input message "{"a":0, "c":{"d":6}}" and the target message "{"msg":"forward return"}", and store the new input message template as an existing input message template. For example, the above-mentioned existing input message template includes matching template 1 and matching template 2. After adding the above-mentioned new input message template, the new input message template can be used as matching template 3.

[0082] Through this embodiment, the first server can combine the above input message and the target message returned by the real target service provider into a new input message template, thereby improving the efficiency of input message matching.

[0083] In one embodiment, the IP port information of the target service provider is obtained from the target registration center, including: querying the target registration center for the IP port information of the service provider containing the service information to be simulated and the method information to be simulated, and obtaining the address of the target registration center; processing the parameter type into a string array according to the separator in the parameter type of the input message, and converting the input message into an object array; initializing the generalized service information configuration based on the dubbo distributed service framework, encapsulating the caller information corresponding to the input message, the address of the target registration center, and the service information to be simulated into the generalized service information configuration, and caching the generalized service abstract class in the generalized service information configuration; through the generalized service abstract class, subscribing the method information to be simulated, the string array of the parameter type, and the object array of the input message in a generalized calling manner to a list containing the IP port information of at least one service provider in the target registration center.

[0084] In this embodiment, the first server may include a service forwarding module. When the first server forwards the input message to the target service provider, the input message may be processed by the service forwarding module. The method information corresponding to the service information may correspond to the address of the target registration center. The first server may query the database to obtain the address of the target registration center containing the IP port information of the service provider corresponding to the method information to be simulated, which may be the address of the target registration center. The input message may have multiple parameter types, each of which may be distinguished by a separator. The first server may process the parameter type of the input message into a string array according to the separator in the parameter type of the input message, and convert the input message into an object array. The first server may also initialize the generalized service information configuration based on the dubbo distributed service framework, and encapsulate the caller information corresponding to the input message, the address of the target registration center, and the service information to be simulated into the generalized service information configuration. The caller information may be the information of the service consumer. The first server may also cache the generalized service abstract class in the generalized service information configuration, and through the generalized service abstract class, in a generalized calling manner, subscribe the method information to be simulated, the string array of the parameter type and the object of the input message to a list containing the IP port information of at least one service provider in the target registration center, and determine the IP port information of the target service provider from the IP port information of at least one service provider corresponding to the target registration center, so that the first server can forward the input message based on the IP port information of the target service provider.

[0085] Specifically, when the input message does not match any existing input message template, the first server may determine that the input message needs to be forwarded to the target service provider for generalized call. The first server may pass the forwarded target registration center address, input message, and service method information to the service forwarding module, and store the target message returned by the target service provider after the forwarding is completed. Figure 3 As shown, Figure 3 It is a flowchart of the forwarding step in an embodiment. The first server can determine whether the service name, service version, method name, input parameter type and registration center address of the service information to be simulated, the service information to be simulated, the method information to be simulated, the input parameter type and the registration center address of the service information to be simulated are normal through the service forwarding module. If not, a prompt message of abnormal input parameter verification is returned. Among them, the input parameter type can be the type of input parameter in the method name, and the registration center can be a module in the target registration center. Among them, the input parameter type may be a multi-parameter type. The first server can first process the multiple parameters into a string array according to a preset separator, such as an English comma or other special characters, and remove the spaces before and after each parameter type. For example, the input parameter type can be "java.lang.String,java.util.Map", and the converted string array is "["java.lang.String", "java.util.Map"]". In addition, the first server can also use a json framework, such as fastjson, to convert the input message of string type into an Object array type. The first server can also determine whether the length of the above input parameter type array is consistent with the length of the input message Object array. Only when it is detected that they are completely consistent can the dubbo service be called normally, otherwise an error message will be directly returned. Among them, each value in the array corresponding to the above input parameter type can correspond to each object in the Object array corresponding to the input message; dubbo is a distributed service framework that is committed to providing high-performance and transparent RPC (Remote Procedure Call) remote service call solutions, the core of which includes remote communication, cluster fault tolerance, and automatic discovery.

[0086] The first server can also configure ReferenceConfig for the generalized service information <genericservice>Initialize. Figure 4 As shown, Figure 4 The flowchart of the steps of initializing the generalized service information configuration in one embodiment is shown in FIG. Among them, GenericService is a generalized service abstract class provided by the dubbo framework, which is used to replace the actual service class. Because the service forwarding module cannot contain the interface files of all services, the general service class GenericService is used to replace the actual service class. The first server can encapsulate the current caller application information into ApplicationConfig and set it to the properties of ReferenceConfig. The caller application information can declare the caller's application name, organization, version and other properties. The first server can also encapsulate the above-mentioned registration center address configuration, and add the registration center protocol type to the address prefix, such as zookeeper: / / . If there are multiple registration centers, the first server can process the above-mentioned encapsulation steps separately, and finally inject them into the registries property of the above-mentioned ReferenceConfig. The first server can also set the service name and service version of ReferenceConfig, and declare that ReferenceConfig uses a generalized call method through setGeneric(true), so that the first server can use the generalized call protocol path when making an RPC service call through the $invoke method. In addition, the first server can also customize the key generation rules of the above ReferenceConfigCache (generalized service information configuration cache) to avoid the problem that different registration centers obtain the same ReferenceConfig through service name and service version. The key format can be: address / interface name: interface version.

[0087] After the first server initializes the above-mentioned generalized service information configuration, it can obtain the GenericService object corresponding to ReferenceConfig through the above-mentioned ReferenceConfigCache cache, that is, the above-mentioned generalized service abstract class. Among them, the above-mentioned GenericService object can be an already initialized object, and can be cached through ReferenceConfigCache, so that the first server can maintain the long connection between the first server and the registration center and the service provider through the GenericService object. Finally, the first server can use the $invoke method of the above-mentioned GenericService object to pass the method name, input parameter type array, and input message Object array to the service forwarding module according to the above-mentioned target registration center address, for example, according to the identifier and port of the target registration center, so that the first server can call up the corresponding IP port information of at least one service provider from the target registration center, and based on the IP port information of the target service provider determined from the IP port information of at least one service provider, obtain the target message returned by the target service provider based on the IP port information of the target service provider. The first server can determine the validity of the target message obtained based on the generalized call. If the target message is obtained normally, the first server converts the message type according to the output parameter type in the method information, and encapsulates and returns it to the Mock receiving module; if the target message throws an exception or other unexpected situation, the first server can encapsulate the exception information and return it to the Mock receiving module.

[0088] Through this embodiment, the first server can process the service information to be simulated, the method information to be simulated, the input message and other data based on the service forwarding module, and then send them to the target service provider corresponding to the target registration center for generalized call, so as to obtain the target message matching the input message, thereby improving the efficiency of message matching.

[0089] In one embodiment, Figure 5 As shown, Figure 5 The following is a flow chart of a matching step in an embodiment. Obtaining a target message returned by the target service provider includes:

[0090] Step S302: Acquire IP port information of at least one service provider including service information to be simulated and at least one candidate method information corresponding to the service information to be simulated in each service provider from the IP port information of service providers registered with the target registration center.

[0091] Among them, the service information to be simulated can be relevant information of the service that needs to be called, and the service information to be simulated includes at least one method information to be simulated. The method information to be simulated can be information about the method in the service corresponding to the service information to be simulated, and the method information to be simulated includes the corresponding input message.

[0092] The target registration center contains the IP port information of at least one service provider. The service provider may be the party whose service is called and may be embodied in the form of a server. The target registration center may obtain the IP port information of at least one service provider containing the service information to be simulated, and at least one candidate method information corresponding to the service information in the IP port information of each service provider from the service providers that have registered with the registration center and are in the registering state. Each service provider may contain a corresponding service, and each service may correspond to at least one method information.

[0093] Step S304, determine the target IP port information of the target service provider from the IP port information of at least one service provider, call the target service provider according to the target IP port information, and the target service provider obtains at least one target method information corresponding to the method information to be simulated from at least one candidate method information, and determines and returns the target message according to the input message and the at least one target method information.

[0094] The first server may obtain at least one target method information corresponding to the method information to be simulated from the target service provider based on the IP port information of the target service provider corresponding to the target registration center. The target method information may be a method consistent with the method information to be simulated, for example, the method names of the two are consistent. Thus, the first server may process the input message based on the target service provider according to the target method information through the target IP port information of the target service provider corresponding to the target registration center.

[0095] Among them, the first server can forward the input message to the IP port information of the target service provider corresponding to the target registration center, and the target service provider processes the input message, obtains the corresponding target message and returns it to the first server. The first server can return the simulation result of the service simulation request to the service consumer based on the above target message. For example, after matching, the registration center obtains the target message "{"msg":"forward return"}", then the first server can obtain the simulation result based on the target message.

[0096] In the data collection method for service simulation, when the input message does not match, a generalized calling method is used to obtain the target message from the target service provider corresponding to the registration center based on the input message, thereby improving the efficiency of message matching.

[0097] In one embodiment, Figure 6 As shown, Figure 6 FIG. 1 is a flow chart of a data collection method for service simulation in another embodiment. In this embodiment, the method can be applied to Figure 7 The system shown, Figure 7 It is a structural diagram of a message matching system in an embodiment. The system includes a first server, and the first server includes a mock receiving module, a service forwarding module, an input message matching module, and a mock configuration module. The mock receiving module can be used to receive a call request from a service consumer, including a mock method, and return a mock message to the service consumer. The service forwarding module can be used to pass the target registration center address, input message, and service information to the IP port information of the target service provider in the registration center when none of the templates match, and the target service provider returns a simulation result containing the target message; the input message matching module can be used to match the input message with an existing input message template; the mock configuration module can be used to query the mock configuration, save new templates and mock messages, and store them in a database.

[0098] Specifically, the first server can receive the Mock request, receive the input message corresponding to the method to be simulated, and check the integrity of the message. If there is any information error or omission, an error message will be directly returned. After the detection is passed, the first server can search for all existing input message modules belonging to this method in the database, and pass the input message and input message template to the input message matching module for data matching in order of priority; if a certain match is successful, the remaining matches will be interrupted, and the Mock message corresponding to the current successful matching result will be returned.

[0099] If all existing input message templates do not match, the first server can query the database for the target registration center address of the method to be simulated, and pass the target registration center address, input message and service method information to the service forwarding module, so that the target registration center can be determined based on the above input message and service method information, and the target message returned by the target service provider corresponding to the target registration center can be obtained based on the generalized call. Among them, if the first server receives the target message returned by the above target service provider, it means that the generalized call is successful. At this time, the first server can query whether there is a business keyword in the input message, obtain the value corresponding to the business keyword in the input message, combine the above target message to form a new input message template, and save it to the database. The first server can return the above target message to the service consumer who initiated the call request. If the above target message is not received, it means that the generalized call has failed. At this time, the first server can receive information about the failure of the generalized call.

[0100] Through the above embodiment, when the input message does not match, a generalized calling method is adopted to obtain the target message returned by the target service provider corresponding to the registration center based on the input message, thereby improving the efficiency of message matching.

[0101] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0102] Based on the same inventive concept, the embodiment of the present application also provides a service simulation data collection device for implementing the service simulation data collection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more service simulation data collection device embodiments provided below can refer to the limitations of the service simulation data collection method above, and will not be repeated here.

[0103] In one embodiment, Figure 8 As shown, a data collection device for service simulation is provided, comprising: a first receiving module 500, a determining module 502, a forwarding module 504, a first matching module 506 and a returning module 508, wherein:

[0104] The first receiving module 500 is used to receive a service simulation request from a service consumer; the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and an input message corresponding to the method information to be simulated.

[0105] Determination module 502 is used to obtain the simulated service class corresponding to the service information to be simulated in the first server, determine at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and match the input message with at least one existing input message template.

[0106] The forwarding module 504 is used to obtain the IP port information of the target service provider from the target registration center if there is no existing input message template matching the input message; the target registration center pre-registers the IP port information of at least one service provider of the service corresponding to the method information to be simulated, and the service corresponding to the method information to be simulated contains the input message template matching the input message.

[0107] The first matching module 506 is used to call the target service provider based on the IP port information of the target service provider and obtain the target message returned by the target service provider; the target service provider is used to determine the corresponding target message based on the input message.

[0108] The return module 508 is used to generate an input message template corresponding to the simulation service class according to the target message and save it, and return the simulation result of the service simulation request to the service consumer.

[0109] In one embodiment, the above-mentioned determination module 502 is specifically used to sort multiple existing input message templates in descending order of priority of each existing input message template to obtain a sequence of input message templates to be matched; and sequentially match the input message with each existing input message template in the sequence of input message templates to be matched.

[0110] In one embodiment, the above-mentioned determination module 502 is specifically used to detect, for each existing input message template, whether the existing input message template contains a message field corresponding to the input message field and whether the message content of the message field is the input message content; if the message field of the existing input message template does not contain an input message field, or the message content of the message field is not the input message content corresponding to the input message field, it is determined that the existing input message template does not match the input message.

[0111] In one embodiment, the return module 508 is specifically used to generate a new input message template according to the input message field and the target message if the input message field is a preset field, and store the new input message template as an existing input message template corresponding to the simulated service class.

[0112] In one embodiment, the above-mentioned determination module 502 is specifically used to obtain the first existing input message template in the sequence of input message templates to be matched that matches the input message if there is an existing input message template that matches the input message in the sequence of input message templates to be matched, as the target existing input message template; and use the message in the target existing input message template that corresponds to the input message as the target message in response to the service simulation request.

[0113] In one embodiment, the forwarding module 504 is specifically used to query the target registration center for the IP port information of the service provider containing the service information to be simulated and the method information to be simulated, and obtain the address of the target registration center; according to the separator in the parameter type of the input message, the parameter type is processed into a string array, and the input message is converted into an object array; based on the dubbo distributed service framework, the generalized service information configuration is initialized, the caller information corresponding to the input message, the address of the target registration center, and the service information to be simulated are encapsulated into the generalized service information configuration, and the generalized service abstract class in the generalized service information configuration is cached; through the generalized service abstract class, the method information to be simulated, the string array of the parameter type, and the object array of the input message are subscribed to the list of IP port information of at least one service provider in the target registration center in a generalized calling manner; the IP port information of the target service provider is determined from the list.

[0114] In one embodiment, the first matching module 506 includes: a first acquisition module 602 and a second matching module 604, wherein:

[0115] The first acquisition module 602 is used to acquire the IP port information of at least one service provider including the service information to be simulated, and at least one candidate method information corresponding to the service information to be simulated in each service provider from the IP port information of the service providers registered with the target registration center.

[0116] The second matching module 604 is used to determine the target IP port information of the target service provider from the IP port information of at least one service provider, call the target service provider according to the target IP port information, and the target service provider obtains at least one target method information corresponding to the method information to be simulated from at least one candidate method information, and determines and returns the target message according to the input message and the at least one target method information.

[0117] Each module in the data acquisition device for service simulation can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0118] It should be noted that the method and device identified in the present disclosure can be used to implement data collection for service simulation in distributed service businesses in the financial field, and can also be used for data collection for service simulation in any field other than the financial field. The application field of the service simulation data collection method and device disclosed in the present disclosure is not limited.

[0119] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as input message templates. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data collection method for service simulation is implemented.

[0120] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0121] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the above-mentioned service simulation data collection method when executing the computer program.

[0122] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the data collection method for service simulation described above is implemented.

[0123] In one embodiment, a computer program product is provided, including a computer program, which implements the above-mentioned data collection method for service simulation when executed by a processor.

[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0125] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0126] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0127] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.< / genericservice>

Claims

1. A data collection method for service simulation, characterized in that: Applied to a first server, the method comprises: Receive a service simulation request from a service consumer; the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and an input message corresponding to the method information to be simulated; Obtaining a simulated service class corresponding to the service information to be simulated in the first server, determining at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and matching the input message with the at least one existing input message template; If there is no existing input message template matching the input message, obtain the IP port information of the target service provider from the target registration center; the target registration center has pre-registered IP port information of at least one service provider of the service corresponding to the method information to be simulated, and the service corresponding to the method information to be simulated includes the input message template matching the input message; Calling the target service provider based on the IP port information of the target service provider, and obtaining the target message returned by the target service provider; the target service provider is used to determine the corresponding target message based on the input message; According to the target message, an input message template corresponding to the simulated service class is generated and saved, and the simulation result of the service simulation request is returned to the service consumer. The step of obtaining the IP port information of the target service provider from the target registration center includes: Querying a target registration center for the IP port information of the service provider including the service information to be simulated and the method information to be simulated, and obtaining the address of the target registration center; According to the separator in the parameter type of the input message, the parameter type is processed into a string array, and the input message is converted into an object array; Initialize the generalized service information configuration based on the dubbo distributed service framework, encapsulate the caller information corresponding to the input message, the address of the target registration center and the service information to be simulated into the generalized service information configuration, and cache the generalized service abstract class in the generalized service information configuration; Subscribe to the list containing IP port information of at least one service provider in the target registration center in a generalized calling manner according to the method information to be simulated, the string array of the parameter type and the object array of the input message through the generalized service abstract class; The IP port information of the target service provider is determined from the list.

2. The method according to claim 1, characterized in that If there are multiple existing input message templates corresponding to the method information to be simulated; matching the input message with the at least one existing input message template includes: Sort the multiple existing input message templates in descending order of priority of each existing input message template to obtain a sequence of input message templates to be matched; The input message is sequentially matched with each existing input message template in the sequence of input message templates to be matched.

3. The method according to claim 2, characterized in that The input message includes an input message field and input message content corresponding to the input message field, and sequentially matching the input message with each existing input message template in the input message template to be matched includes: For each existing input message template, detecting whether the existing input message template contains a message field corresponding to the input message field and whether the message content of the message field is the input message content; If the message field of the existing input message template does not contain the input message field, or the message content of the message field is not the input message content corresponding to the input message field, it is determined that the existing input message template does not match the input message.

4. The method according to claim 3, characterized in that The step of generating and saving an input message template corresponding to the simulated service class according to the target message includes: If the input message field is a preset field, a new input message template is generated according to the input message field and the target message, and the new input message template is stored as an existing input message template corresponding to the simulated service class.

5. The method according to claim 2, characterized in that: After matching the input message with the at least one existing input message template, the method further includes: If there is an existing input message template matching the input message in the sequence of input message templates to be matched, obtaining the first existing input message template matching the input message in the sequence of input message templates to be matched as the target existing input message template; The message corresponding to the input message in the target existing input message template is used as the target message for responding to the service simulation request.

6. The method according to claim 1, characterized in that The obtaining of the target message returned by the target service provider includes: Acquire the IP port information of at least one service provider including the service information to be simulated, and at least one candidate method information corresponding to the service information to be simulated in each service provider from the IP port information of the service providers registered with the target registration center; The target IP port information of the target service provider is determined from the IP port information of the at least one service provider, the target service provider is called according to the target IP port information, the target service provider obtains at least one target method information corresponding to the method information to be simulated in the at least one candidate method information, and the target message is determined and returned according to the input message and the at least one target method information.

7. A data collection device for service simulation, characterized in that: Applied to a first server, the device comprises: A first receiving module is used to receive a service simulation request from a service consumer; the service simulation request includes service information to be simulated, method information to be simulated corresponding to the service information to be simulated, and an input message corresponding to the method information to be simulated; a determination module, configured to obtain a simulated service class corresponding to the service information to be simulated in the first server, determine at least one existing input message template corresponding to the method information to be simulated from the existing input message templates corresponding to the simulated service class, and match the input message with the at least one existing input message template; a forwarding module, configured to obtain IP port information of a target service provider from a target registration center if there is no existing input message template matching the input message; the target registration center pre-registers IP port information of at least one service provider of a service corresponding to the method information to be simulated, and the service corresponding to the method information to be simulated includes an input message template matching the input message; A first matching module, configured to call the target service provider based on the IP port information of the target service provider, and obtain a target message returned by the target service provider; the target service provider is configured to determine a corresponding target message based on the input message; A return module is used to generate and save the input message template corresponding to the simulation service class according to the target message, and return the simulation result of the service simulation request to the service consumer. The step of obtaining the IP port information of the target service provider from the target registration center includes: Querying a target registration center for the IP port information of the service provider including the service information to be simulated and the method information to be simulated, and obtaining the address of the target registration center; According to the separator in the parameter type of the input message, the parameter type is processed into a string array, and the input message is converted into an object array; Initialize the generalized service information configuration based on the dubbo distributed service framework, encapsulate the caller information corresponding to the input message, the address of the target registration center and the service information to be simulated into the generalized service information configuration, and cache the generalized service abstract class in the generalized service information configuration; Subscribe to the list containing IP port information of at least one service provider in the target registration center in a generalized calling manner according to the method information to be simulated, the string array of the parameter type and the object array of the input message through the generalized service abstract class; The IP port information of the target service provider is determined from the list.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Interface mock test method, device and equipment based on information security and storage medium

    CN109656807A

  • Business test method, business test device, equipment and storage medium

    CN114706787A