CN113688152B - System function self-checking method and device - Google Patents

System function self-checking method and device Download PDF

Info

Publication number
CN113688152B
CN113688152B CN202111005165.4A CN202111005165A CN113688152B CN 113688152 B CN113688152 B CN 113688152B CN 202111005165 A CN202111005165 A CN 202111005165A CN 113688152 B CN113688152 B CN 113688152B
Authority
CN
China
Prior art keywords
interface
service
checking
database
self
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.)
Active
Application number
CN202111005165.4A
Other languages
Chinese (zh)
Other versions
CN113688152A (en
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.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology 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 Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202111005165.4A priority Critical patent/CN113688152B/en
Publication of CN113688152A publication Critical patent/CN113688152A/en
Application granted granted Critical
Publication of CN113688152B publication Critical patent/CN113688152B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a system function self-checking method and device, and relates to the technical field of computers. One embodiment of the method comprises the following steps: finding out a functional interface of a service system and an encapsulated interface method thereof, and adding a self-checking hook before and after the execution of the interface method; acquiring connection configuration of a service database corresponding to the service system, and replacing configuration information of the service database with hijacking configuration information to hijack database operation sentences; and receiving a service request, executing the interface method and executing the self-checking hook, so as to perform self-checking on the service system. The embodiment can solve the technical problems that the existing verification mode depends on manual work, wastes time and labor and has high risk of missing verification links.

Description

System function self-checking method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a system function self-checking method and apparatus.
Background
The functionality of the system often requires personnel to verify that it is correct, for example: order placing function, a requirement on line, a function of supporting preferential distribution, and when a user selects preferential distribution, a bill is placed, how to know whether the system is normal or not, and a plurality of systems (such as an order system, a distribution system, an aging system and the like) need to be manually checked to verify whether the system is normal or not.
Therefore, the existing verification mode relies on manpower, wastes time and energy and has higher risk of missing verification links, especially large projects with complex flow, and the labor and time cost of verification is higher.
Disclosure of Invention
In view of the above, the embodiment of the invention provides a system function self-checking method and device, which are used for solving the technical problems that the existing verification mode depends on personnel, wastes time and labor and has high risk of missing verification links.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a system function self-checking method, including:
finding out a functional interface of a service system and an encapsulated interface method thereof, and adding a self-checking hook before and after the execution of the interface method;
acquiring connection configuration of a service database corresponding to the service system, and replacing configuration information of the service database with hijacking configuration information to hijack database operation sentences;
and receiving a service request, executing the interface method and executing the self-checking hook, so as to perform self-checking on the service system.
Optionally, the method for searching the functional interface and the encapsulated interface of the service system includes adding a self-checking hook before and after the execution of the interface method, including:
Scanning the coding and decoding of a service system to find out the functional interface of the service system, thereby finding out the interface method of the functional interface package;
a byte code addition technique is employed to add a self-checking hook before and after execution of the interface method.
Optionally, the self-checking hook includes a method for acquiring the start execution time and a method for checking the interface entry.
Optionally, replacing the configuration information of the service database with hijacked configuration information to hijack database operation sentences, including:
and replacing url and drive of the service database with url and drive provided by p6spy by adopting p6spy to hijack database operation sentences.
Optionally, receiving a service request, executing the interface method and executing the self-checking hook, so as to perform self-checking on the service system, including:
receiving a service request to analyze an interface parameter carried by the service request;
executing the method for acquiring the starting execution time to acquire the starting execution time of the interface method;
executing the interface method, so that the starting execution time and interface entry are written into the service database;
Hijacking a database operation statement, and analyzing interface entry written into the service database from the database operation statement;
and executing the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database.
Optionally, hijacking a database operation statement, and analyzing an interface entry written into the service database from the database operation statement, including:
hijacking database operation sentences;
subtracting the starting execution time of the interface method from the execution ending time of the interface method to obtain the execution time of the interface method;
adding a preset execution time factor to the execution time of the interface method to obtain an analysis time;
after hijacking the database operation statement, analyzing the interface entry written into the service database from the database operation statement within the analysis duration.
Optionally, checking that the interface carried by the service request participates in writing the interface of the service database includes:
converting the interface field written into the service database into an interface field conforming to hump naming;
and verifying the parameter value corresponding to the interface field carried by the service request and the parameter value corresponding to the interface field carried by the service request.
Optionally, after checking that the interface carried by the service request participates in writing the interface of the service database, the method further includes:
returning a verification result; the verification result comprises an interface, an interface method, the starting execution time of the interface method, interface access parameters carried by the service request, the difference information of the interface access parameters of the interface access participation written into the service database carried by the service request, and the execution time of the interface method.
In addition, according to another aspect of the embodiment of the present invention, there is provided a system function self-checking device, including:
the hook module is used for finding out the functional interface of the service system and the packaged interface method thereof, and adding a self-checking hook before and after the execution of the interface method;
the hijacking module is used for acquiring the connection configuration of the service database corresponding to the service system, and replacing the configuration information of the service database with hijacking configuration information so as to hijack the database operation statement;
and the verification module is used for receiving a service request, executing the interface method and executing the self-verification hook so as to carry out self-verification on the service system.
Optionally, the hook module is further configured to:
Scanning the coding and decoding of a service system to find out the functional interface of the service system, thereby finding out the interface method of the functional interface package;
a byte code addition technique is employed to add a self-checking hook before and after execution of the interface method.
Optionally, the self-checking hook includes a method for acquiring the start execution time and a method for checking the interface entry.
Optionally, the hijacking module is further configured to:
and replacing url and drive of the service database with url and drive provided by p6spy by adopting p6spy to hijack database operation sentences.
Optionally, the verification module is further configured to:
receiving a service request to analyze an interface parameter carried by the service request;
executing the method for acquiring the starting execution time to acquire the starting execution time of the interface method;
executing the interface method, so that the starting execution time and interface entry are written into the service database;
hijacking a database operation statement, and analyzing interface entry written into the service database from the database operation statement;
and executing the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database.
Optionally, the verification module is further configured to:
hijacking database operation sentences;
subtracting the starting execution time of the interface method from the execution ending time of the interface method to obtain the execution time of the interface method;
adding a preset execution time factor to the execution time of the interface method to obtain an analysis time;
after hijacking the database operation statement, analyzing the interface entry written into the service database from the database operation statement within the analysis duration.
Optionally, the verification module is further configured to:
converting the interface field written into the service database into an interface field conforming to hump naming;
and verifying the parameter value corresponding to the interface field carried by the service request and the parameter value corresponding to the interface field carried by the service request.
Optionally, the verification module is further configured to:
after checking that the interface carried by the service request participates in writing the interface of the service database, returning a checking result;
the verification result comprises an interface, an interface method, the starting execution time of the interface method, interface access parameters carried by the service request, the difference information of the interface access parameters of the interface access participation written into the service database carried by the service request, and the execution time of the interface method.
According to another aspect of an embodiment of the present invention, there is also provided an electronic device including:
one or more processors;
storage means for storing one or more programs,
the one or more processors implement the method of any of the embodiments described above when the one or more programs are executed by the one or more processors.
According to another aspect of an embodiment of the present invention, there is also provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the method according to any of the embodiments described above.
One embodiment of the above invention has the following advantages or benefits: because the technical means of adding a self-checking hook before and after the execution of the interface method and replacing the configuration information of the service database with hijacked configuration information to hijack the database operation sentences is adopted, the technical problems that the existing verification mode in the prior art depends on personnel, wastes time and labor and has high risk of missing verification links are solved. The embodiment of the invention gives the verification work of the system function to the system itself, and whether the operation from the verification function is correct or not in the system operation is realized by an automatic means, so that the operation result of the function is timely and efficiently obtained; the user only needs to complete the function release work, and the function verification work is handed to the self-checking system for processing, so that the labor and time cost and verification omission problem are greatly reduced.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a system function self-checking method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a system function self-checking method according to one referenceable embodiment of the invention;
FIG. 3 is a schematic diagram of the main modules of a system function self-checking device according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In fact, the verification process can be completely carried out in an automatic verification mode, and automatic verification is carried out anytime and anywhere, so that the generation link of the problem is known as far as possible in advance. Errors are not known until the final production link, so that the problem influence is avoided, and particularly, the influence is very large for a single millions of projects.
Fig. 1 is a schematic diagram of a main flow of a system function self-checking method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the system function self-checking method may include:
step 101, finding out the functional interface of the service system and the packaged interface method thereof, and adding a self-checking hook before and after the execution of the interface method.
Firstly, the self-checking system searches out the functional interfaces of the service system and the packaged interface methods thereof in a scanning mode, and then adds self-checking hooks before and after the execution of the interface methods. Alternatively, the functional interface may be a rpc interface or a rest interface, which is not limited by the embodiment of the present invention.
Optionally, step 101 may include: scanning the coding and decoding of a service system to find out the functional interface of the service system, thereby finding out the interface method of the functional interface package; a byte code addition technique is employed to add a self-checking hook before and after execution of the interface method. In an embodiment of the present invention, a plug-in technology (for example, java-java agent: selfvalidzer) may be used to scan an interface file (such as a class file) of a service system, scan a functional interface from a byte code of the interface file, further scan each interface method of a functional interface package, and then add a self-checking hook before and after execution of these interface methods.
Optionally, the scanning plug-in may be introduced into the self-checking system in a startup script mode or a hard coding mode, or the self-checking system may be introduced into the service system in a startup script mode or a hard coding mode, so that the functional interface of the service system and the packaged interface method thereof are found out through the scanning plug-in, and then the self-checking hooks are added before and after the execution of the interface method.
Optionally, the self-checking hook includes a method for acquiring the start execution time and a method for checking the interface entry. For example, service system a provides rpc interfaces externally: com.test.testservice; the interface encapsulates the following method: down order. The scan plug-in will scan the issue interface of rpc and then employ byte code enhancement techniques to add hooks, i.e., check logic code and calls, before and after execution of the issuing method of rpc interface. For example, the hook class may be named testservicef autovalidate.java, and includes a method getStartTime () to acquire a start execution time and a method downordeuraavalidate to check an interface ginseng. In an embodiment of the present invention, call new TestServiceForAutoValidate (). DownOrdereutoValidate of the hook class may be added before and after execution of the interface method for calling the method in the hook class.
In addition to default verification, the self-verification system provides user-defined hooks, specifically implementing:
the user may override hooks generated from the verification system, as exemplified by the above example: the user can implement testservicef-automatic valve.java by himself, rewrite the downOrdereutovalve (interface to reference, start time) method, new logic and rely on generating jar packets, upload jar packets to the self-checking system, the self-checking system receives user-defined jar packets, reload check classes (e.g. classloader).
Step 102, obtaining the connection configuration of the service database corresponding to the service system, and replacing the configuration information of the service database with hijacking configuration information to hijack the database operation statement.
The self-checking system also comprises a data extraction plug-in (automatic value-data. Jar), the connection configuration of the service database corresponding to the service system is obtained through the data extraction plug-in, and the configuration information of the service database is replaced by hijacked configuration information so as to hijack database operation sentences. In the embodiment of the invention, the data extraction plug-in is started along with the starting of the service system after receiving the starting event application environment preparedEvent of the service system.
Optionally, replacing the configuration information of the service database with hijacked configuration information to hijack database operation sentences, including: and replacing url and driver of the service database with url and driver provided by the p6spy by adopting the p6spy so as to hijack the database operation statement. When the business system generates database data change, the data extraction plug-in of the self-checking system can hijack to database operation sql statement.
For example: 2020-12-02 12:37:44:111|insert into test (author, name, time) values ('1', '1', '2019-12-02T 10:53:23.941+0800')
In the embodiment of the invention, the data extraction plug-in of the self-checking system adopts a plug-in technology to acquire the data change information generated by the user service system so as to automatically verify the data correctness of the service function.
Step 103, receiving a service request, executing the interface method and executing the self-checking hook, thereby performing self-checking on the service system.
The service system receives and analyzes the service request to obtain the interface parameter carried in the service request, then the self-checking hook is executed before the interface method is executed, and the self-checking hook is executed after the interface method is executed, so that the service system is self-checked.
Optionally, step 103 may include: receiving a service request to analyze an interface parameter carried by the service request; executing the method for acquiring the starting execution time to acquire the starting execution time of the interface method; executing the interface method, so that the starting execution time and interface entry are written into the service database; hijacking a database operation statement, and analyzing interface entry written into the service database from the database operation statement; and executing the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database. After receiving the service request, the service system analyzes the service request to obtain an interface parameter carried in the service request, and before the service system executes an interface method, the self-checking system executes a method for acquiring the start execution time so as to acquire the start execution time of the interface method; then, the service system executes the interface method, and writes the starting execution time and interface entry of the interface method into a service database, and simultaneously, the self-checking system hives a database operation statement, and analyzes the interface entry written into the service database from the database operation statement; after the interface method is executed, the self-checking system executes the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database. The self-checking system verifies the correctness of the execution of the service function by executing the hook, thereby realizing the self-checking of the service system.
Optionally, hijacking a database operation statement, and analyzing an interface entry written into the service database from the database operation statement, including: hijacking database operation sentences; subtracting the starting execution time of the interface method from the execution ending time of the interface method to obtain the execution time of the interface method; adding a preset execution time factor to the execution time of the interface method to obtain an analysis time; after hijacking the database operation statement, analyzing the interface entry written into the service database from the database operation statement within the analysis duration. After the self-checking system hives the database operation statement, calculating the execution time of the interface method, namely the execution ending time of the interface method, the execution starting time of the interface method and the execution time of the interface method, and then analyzing the interface entry written into the service database from the database operation statement within the execution time of the interface method and the preset execution time factor by the self-checking system. The execution time factor is a tolerable additional length of time that is proposed to cover well to the case of asynchronous execution, such as: 1 second, 3 seconds, 5 seconds, 6 seconds, etc., may be set as desired, and embodiments of the present invention are not limited in this regard.
Optionally, checking that the interface carried by the service request participates in writing the interface of the service database includes: converting the interface field written into the service database into an interface field conforming to hump naming; and verifying the parameter value corresponding to the interface field carried by the service request and the parameter value corresponding to the interface field carried by the service request. And the self-checking system compares whether the interface field carried by the service request is consistent with the interface field written into the service database, if not, the underlining of the interface field written into the service database is converted into a field conforming to the hump naming rule according to the hump naming rule for comparison. For example: interface field written into service database: the testName is converted into a testName and the testName parameter value is compared from the interface field carried by the service request.
It should be noted that if the field names of the interface field carried by the service request and the interface field written in the service database are not standard, the self-checking system provides a mapping table of the interface field carried by the service request and the interface field written in the service database for the user to add.
Optionally, after checking that the interface carried by the service request participates in writing the interface of the service database, the method further includes: returning a verification result; the verification result comprises an interface, an interface method, the starting execution time of the interface method, interface access parameters carried by the service request, the difference information of the interface access parameters of the interface access participation written into the service database carried by the service request, and the execution time of the interface method. The self-checking system returns the checking result to the user terminal, and the user terminal displays the checking result, so that the self-checking system can synchronize the checking result to the user in real time, and the user can check the checking result conveniently.
By the self-checking system, the service system can automatically check at any time and any place, so that the generation link of the problem is known as far as possible in advance, and the expansion of the influence of the problem is avoided. For example: the ordering function can go through a plurality of links, and if the first link data has a problem, all the following links can possibly have problems. Therefore, the embodiment of the invention can release the labor verification cost, solve the verification omission problem and reduce the occurrence of the problem.
According to the various embodiments described above, it can be seen that the embodiment of the present invention replaces the configuration information of the service database with hijacked configuration information by adding the self-checking hooks before and after the execution of the interface method, so as to hijack the technical means of the database operation statement, thereby solving the technical problems that the existing verification method in the prior art depends on personnel, wastes time and effort, and has higher risk of missing the verification link. The embodiment of the invention gives the verification work of the system function to the system itself, and whether the operation from the verification function is correct or not in the system operation is realized by an automatic means, so that the operation result of the function is timely and efficiently obtained; the user only needs to complete the function release work, and the function verification work is handed to the self-checking system for processing, so that the labor and time cost and verification omission problem are greatly reduced.
Fig. 2 is a schematic diagram of the main flow of a system function self-checking method according to one reference embodiment of the present invention. As yet another embodiment of the present invention, as shown in fig. 2, the system function self-checking method may include:
step 201, scanning the coding and decoding of the service system to find out the functional interface of the service system, thereby finding out the interface method of the functional interface package.
In the embodiment of the invention, a plug-in technology (for example, java-java agent: selfValidator. Jar) can be adopted to scan an interface file (such as a class file) of a service system, scan a functional interface from byte codes of the interface file, and further scan each interface method of the functional interface package. The scanning plug-in can be introduced into the self-checking system by adopting a starting script mode or a hard coding mode, and the functional interface of the service system and the packaged interface method thereof are searched out through the scanning plug-in.
Step 202, adding a self-checking hook before and after the execution of the interface method by adopting a byte code adding technology.
The self-checking system can be introduced into the service system in a starting script mode or a hard coding mode, and after the functional interface of the service system and the packaged interface method thereof are found out through the scanning plug-in, the self-checking hooks are added before and after the execution of the interface method. The self-checking hook comprises a method for acquiring the starting execution time and a method for checking the interface entry.
And 203, replacing url and drive of the service database with url and drive provided by p6spy by adopting p6spy to hijack the database operation statement.
The connection configuration of the service database corresponding to the service system can be obtained through a data extraction plug-in (such as an autovalve-data. Jar), and the configuration information of the service database is replaced by hijacking configuration information so as to hijack database operation sentences. When the business system generates database data change, the data extraction plug-in of the self-checking system can hijack to database operation sql statement.
And 204, receiving a service request to analyze the interface entry carried by the service request.
After receiving the service request, the service system analyzes the interface entry parameters carried in the service request, such as names, telephones, addresses and the like.
Step 205, executing the method for acquiring the start execution time to acquire the start execution time of the interface method.
Before the business system executes the interface method, the self-checking system executes the method for acquiring the start execution time in the hook to acquire the start execution time of the interface method.
And 206, executing the interface method, so that the starting execution time and the interface entry are written into the service database.
And the service system executes the interface method and writes the starting execution time of the interface method and the interface into a service database.
Step 207, hijacking a database operation statement, and analyzing an interface entry written into the service database from the database operation statement.
The self-checking system hives the database operation statement and analyzes the interface entry written into the service database from the database operation statement.
Step 208, executing the method for checking the interface entry to check the interface entry carried by the service request to participate in writing the interface entry of the service database.
After the interface method is executed, the self-checking system executes the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database. The self-checking system verifies the correctness of the execution of the service function by executing the hook, thereby realizing the self-checking of the service system.
It should be noted that, in order to ensure the accuracy of verification, the self-verification system compares whether the interface field carried by the service request is consistent with the interface field written into the service database, if not, the underline of the interface field written into the service database is converted into a field conforming to the hump naming rule for comparison.
Step 209, returning the verification result.
The verification result comprises an interface, an interface method, the starting execution time of the interface method, interface access parameters carried by the service request, the difference information of the interface access parameters of the interface access participation written into the service database carried by the service request, and the execution time of the interface method.
In addition, in the embodiment of the present invention, the implementation of the system function self-checking method is described in detail in the system function self-checking method, so that the description is not repeated here.
Fig. 3 is a schematic diagram of main modules of a system function self-checking device according to an embodiment of the present invention, and as shown in fig. 3, the system function self-checking device 300 includes a hook module 301, a hijacking module 302, and a checking module 303; the hook module 301 is configured to find out a functional interface of a service system and an interface method of a package thereof, and add a self-checking hook before and after execution of the interface method; the hijacking module 302 is configured to obtain connection configuration of a service database corresponding to the service system, and replace configuration information of the service database with hijacking configuration information to hijack database operation sentences; the verification module 303 is configured to receive a service request, perform the interface method and perform the self-verification hook, thereby performing self-verification on the service system.
Optionally, the hook module 301 is further configured to:
scanning the coding and decoding of a service system to find out the functional interface of the service system, thereby finding out the interface method of the functional interface package;
a byte code addition technique is employed to add a self-checking hook before and after execution of the interface method.
Optionally, the self-checking hook includes a method for acquiring the start execution time and a method for checking the interface entry.
Optionally, the hijacking module 302 is further configured to:
and replacing url and drive of the service database with url and drive provided by p6spy by adopting p6spy to hijack database operation sentences.
Optionally, the verification module 303 is further configured to:
receiving a service request to analyze an interface parameter carried by the service request;
executing the method for acquiring the starting execution time to acquire the starting execution time of the interface method;
executing the interface method, so that the starting execution time and interface entry are written into the service database;
hijacking a database operation statement, and analyzing interface entry written into the service database from the database operation statement;
and executing the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database.
Optionally, the verification module 303 is further configured to:
hijacking database operation sentences;
subtracting the starting execution time of the interface method from the execution ending time of the interface method to obtain the execution time of the interface method;
adding a preset execution time factor to the execution time of the interface method to obtain an analysis time;
after hijacking the database operation statement, analyzing the interface entry written into the service database from the database operation statement within the analysis duration.
Optionally, the verification module 303 is further configured to:
converting the interface field written into the service database into an interface field conforming to hump naming;
and verifying the parameter value corresponding to the interface field carried by the service request and the parameter value corresponding to the interface field carried by the service request.
Optionally, the verification module 303 is further configured to:
after checking that the interface carried by the service request participates in writing the interface of the service database, returning a checking result;
the verification result comprises an interface, an interface method, the starting execution time of the interface method, interface access parameters carried by the service request, the difference information of the interface access parameters of the interface access participation written into the service database carried by the service request, and the execution time of the interface method.
According to the various embodiments described above, it can be seen that the embodiment of the present invention replaces the configuration information of the service database with hijacked configuration information by adding the self-checking hooks before and after the execution of the interface method, so as to hijack the technical means of the database operation statement, thereby solving the technical problems that the existing verification method in the prior art depends on personnel, wastes time and effort, and has higher risk of missing the verification link. The embodiment of the invention gives the verification work of the system function to the system itself, and whether the operation from the verification function is correct or not in the system operation is realized by an automatic means, so that the operation result of the function is timely and efficiently obtained; the user only needs to complete the function release work, and the function verification work is handed to the self-checking system for processing, so that the labor and time cost and verification omission problem are greatly reduced.
It should be noted that, in the embodiment of the system function self-checking device of the present invention, the system function self-checking method has been described in detail, so that the description is not repeated here.
Fig. 4 illustrates an exemplary system architecture 400 to which the system function self-checking method or system function self-checking apparatus of embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 401, 402, 403. The background management server can analyze and other data such as the received article information inquiry request and feed back the processing result to the terminal equipment.
It should be noted that, the method for self-checking the system function provided in the embodiment of the present invention is generally executed by the server 405, and accordingly, the device for self-checking the system function is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprises a hook module, a hijacking module and a verification module, wherein the names of these modules do not constitute a limitation of the module itself in some cases.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, implement the method of: finding out a functional interface of a service system and an encapsulated interface method thereof, and adding a self-checking hook before and after the execution of the interface method; acquiring connection configuration of a service database corresponding to the service system, and replacing configuration information of the service database with hijacking configuration information to hijack database operation sentences; and receiving a service request, executing the interface method and executing the self-checking hook, so as to perform self-checking on the service system.
According to the technical scheme of the embodiment of the invention, the technical means that the configuration information of the service database is replaced by the hijacked configuration information to hijack the database operation statement is adopted by adding the self-checking hooks before and after the execution of the interface method, so that the technical problems that the existing verification mode in the prior art depends on manpower, wastes time and labor and has high risk of missing the verification link are overcome. The embodiment of the invention gives the verification work of the system function to the system itself, and whether the operation from the verification function is correct or not in the system operation is realized by an automatic means, so that the operation result of the function is timely and efficiently obtained; the user only needs to complete the function release work, and the function verification work is handed to the self-checking system for processing, so that the labor and time cost and verification omission problem are greatly reduced.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (9)

1. A system function self-checking method, comprising:
finding out a functional interface of a service system and an encapsulated interface method thereof, and adding a self-checking hook before and after the execution of the interface method; the self-checking hook comprises a method for acquiring the execution starting time and a method for checking the interface entry;
acquiring connection configuration of a service database corresponding to the service system, and replacing configuration information of the service database with hijacking configuration information to hijack database operation sentences;
receiving a service request, executing the interface method and the self-checking hook, so as to perform self-checking on the service system;
executing the interface method and the self-checking hook, thereby self-checking the service system, comprising:
Receiving a service request to analyze an interface parameter carried by the service request;
executing the method for acquiring the starting execution time to acquire the starting execution time of the interface method;
executing the interface method, so that the starting execution time and interface entry are written into the service database;
hijacking a database operation statement, and analyzing interface entry written into the service database from the database operation statement;
and executing the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database.
2. The method of claim 1, wherein finding out the functional interface of the service system and the interface method of its encapsulation, adding a self-checking hook before and after execution of the interface method, comprises:
scanning the coding and decoding of a service system to find out the functional interface of the service system, thereby finding out the interface method of the functional interface package;
a byte code addition technique is employed to add a self-checking hook before and after execution of the interface method.
3. The method of claim 1, wherein replacing the configuration information of the service database with hijacked configuration information to hijack database operation statements comprises:
And replacing url and drive of the service database with url and drive provided by p6spy by adopting p6spy to hijack database operation sentences.
4. The method of claim 1, wherein hijacking database operation statements, parsing interface entries written to the business database from the database operation statements, comprising:
hijacking database operation sentences;
subtracting the starting execution time of the interface method from the execution ending time of the interface method to obtain the execution time of the interface method;
adding a preset execution time factor to the execution time of the interface method to obtain an analysis time;
after hijacking the database operation statement, analyzing the interface entry written into the service database from the database operation statement within the analysis duration.
5. The method of claim 1, wherein verifying that the interface entry carried by the service request participates in writing to an interface entry of the service database comprises:
converting the interface field written into the service database into an interface field conforming to hump naming;
and verifying the parameter value corresponding to the interface field carried by the service request and the parameter value corresponding to the interface field carried by the service request.
6. The method of claim 1, further comprising, after verifying that the interface carried by the service request participates in writing to the interface entry of the service database:
returning a verification result; the verification result comprises an interface, an interface method, the starting execution time of the interface method, interface access parameters carried by the service request, the difference information of the interface access parameters of the interface access participation written into the service database carried by the service request, and the execution time of the interface method.
7. A system function self-checking device, comprising:
the hook module is used for finding out the functional interface of the service system and the packaged interface method thereof, and adding a self-checking hook before and after the execution of the interface method; the self-checking hook comprises a method for acquiring the execution starting time and a method for checking the interface entry;
the hijacking module is used for acquiring the connection configuration of the service database corresponding to the service system, and replacing the configuration information of the service database with hijacking configuration information so as to hijack the database operation statement;
the verification module is used for receiving a service request, executing the interface method and executing the self-verification hook so as to carry out self-verification on the service system;
The verification module is further configured to:
receiving a service request to analyze an interface parameter carried by the service request;
executing the method for acquiring the starting execution time to acquire the starting execution time of the interface method;
executing the interface method, so that the starting execution time and interface entry are written into the service database;
hijacking a database operation statement, and analyzing interface entry written into the service database from the database operation statement;
and executing the method for checking the interface entry so as to check the interface entry carried by the service request to participate in writing the interface entry of the service database.
8. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
the one or more processors implement the method of any of claims 1-6 when the one or more programs are executed by the one or more processors.
9. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
CN202111005165.4A 2021-08-30 2021-08-30 System function self-checking method and device Active CN113688152B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111005165.4A CN113688152B (en) 2021-08-30 2021-08-30 System function self-checking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111005165.4A CN113688152B (en) 2021-08-30 2021-08-30 System function self-checking method and device

Publications (2)

Publication Number Publication Date
CN113688152A CN113688152A (en) 2021-11-23
CN113688152B true CN113688152B (en) 2023-12-05

Family

ID=78584054

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111005165.4A Active CN113688152B (en) 2021-08-30 2021-08-30 System function self-checking method and device

Country Status (1)

Country Link
CN (1) CN113688152B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1399737A (en) * 1999-09-24 2003-02-26 凤凰技术有限公司 Software development system for facilitating selection of components
US8639625B1 (en) * 1995-02-13 2014-01-28 Intertrust Technologies Corporation Systems and methods for secure transaction management and electronic rights protection
CN106936937A (en) * 2015-12-29 2017-07-07 阿里巴巴集团控股有限公司 For the implementation method and device of the general-purpose interface of Internet service interaction
WO2020048391A1 (en) * 2018-09-04 2020-03-12 京东数字科技控股有限公司 Methods and apparatuses for deploying and invoking web services based on multi-tenancy technology
CN112445860A (en) * 2019-09-02 2021-03-05 北京京东振世信息技术有限公司 Method and device for processing distributed transaction

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8639625B1 (en) * 1995-02-13 2014-01-28 Intertrust Technologies Corporation Systems and methods for secure transaction management and electronic rights protection
CN1399737A (en) * 1999-09-24 2003-02-26 凤凰技术有限公司 Software development system for facilitating selection of components
CN106936937A (en) * 2015-12-29 2017-07-07 阿里巴巴集团控股有限公司 For the implementation method and device of the general-purpose interface of Internet service interaction
WO2020048391A1 (en) * 2018-09-04 2020-03-12 京东数字科技控股有限公司 Methods and apparatuses for deploying and invoking web services based on multi-tenancy technology
CN112445860A (en) * 2019-09-02 2021-03-05 北京京东振世信息技术有限公司 Method and device for processing distributed transaction

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Qizhi Yin ; Zhuoran Ding ; Kaimiao Ding ; Guangming Liu.Design of a real-time ship fuel consumption monitoring system with self-checking function.IEEE.2017,全文. *
住房公积金管理系统与银行业务联网接口功能设计及实施;刘国强;;科技视界(第05期);全文 *
通用数据接口装配件的设计与应用;贾国芳;;计算机工程与设计(第21期);全文 *

Also Published As

Publication number Publication date
CN113688152A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN111488286B (en) Method and device for independently developing Android modules
CN113127335B (en) System testing method and device
CN112559024A (en) Method and device for generating transaction code change list
CN113688152B (en) System function self-checking method and device
CN110825622A (en) Software testing method, device, equipment and computer readable medium
CN116069725A (en) File migration method, device, apparatus, medium and program product
CN110806967A (en) Unit testing method and device
CN116382640A (en) Method, device, equipment and storage medium for managing micro-service
CN112783903B (en) Method and device for generating update log
CN112732471B (en) Error correction method and error correction device for interface return data
CN113297087A (en) Test method and device
CN112579428B (en) Interface testing method, device, electronic equipment and storage medium
CN113760274A (en) Front-end component logic injection method and device
CN110830662B (en) Outbound telephone data generation method and device
CN113779018A (en) Data processing method and device
CN113779122A (en) Method and apparatus for exporting data
CN112241332A (en) Interface compensation method and device
CN112783665B (en) Interface compensation method and device
CN110727739B (en) Data storage method and device
CN113268417B (en) Task execution method and device
CN109376023B (en) Method and equipment for generating calling information and issuing return code group
CN108984189B (en) Module parsing method and device
CN115993981A (en) Data processing method, device, electronic equipment and computer readable medium
CN115422067A (en) Interface testing 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
GR01 Patent grant
GR01 Patent grant