Data Processing Method, Apparatus, Electronic Device and Storage Medium

By automatically converting configuration files related to database operations and automatically generating test files, the problem of inefficient development when upgrading or replacing the persistent layer framework is solved, and an efficient development process is achieved.

CN111444161BActive Publication Date: 2025-06-20CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010121673.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-26
Publication Date
2025-06-20
Estimated Expiration
2040-02-26

AI Technical Summary

Technical Problem

When upgrading or replacing the persistence layer framework, it is necessary to rewrite the configuration files and test files related to the database operation, resulting in inefficient development.

Method used

By reading multiple sets of strings from the configuration file to be converted, perform conversion processing, and generate configuration files that meet the requirements of the new format. Then, the target database execution function is determined from the database execution function, and the test file is built using the function and the corresponding database execution statements to realize the automatic conversion of configuration files and the automatic generation of test files.

Benefits of technology

Improve development efficiency, reduce the waste of development time due to the upgrade or replacement of the persistent layer framework, and realize the automatic conversion of configuration files and the automatic generation of test files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111444161B_ABST
    Figure CN111444161B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a data processing method, apparatus, electronic device, and storage medium. The method includes: reading multiple groups of strings from a first configuration file to be converted; performing conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings, and generating a second configuration file including the converted strings corresponding to each group of strings; reading at least one database execution function from a target class file, and determining a target database execution function from the at least one database execution function according to the second configuration file; using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct a test file corresponding to the second configuration file. By adopting the present application, the development efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a data processing method, apparatus, electronic device, and storage medium. Background Art

[0002] A database can be used to store data and provide services such as data query, update, addition, and deletion. To effectively operate the database, relevant files can be written for the database, such as relevant configuration files and other files for operating the database. For example, when facing the problem of upgrading or replacing the persistence layer framework, if a new persistence layer is needed to operate the database, relevant personnel often need to rewrite relevant files based on the new persistence layer framework, such as relevant configuration files and other files for operating the database, and rewrite the test files based on the newly written files. However, this process is time-consuming and reduces development efficiency. Summary of the Invention

[0003] Embodiments of this application provide a data processing method, apparatus, electronic device, and storage medium, which can improve development efficiency.

[0004] In a first aspect, embodiments of this application provide a data processing method, including:

[0005] Read multiple groups of strings from a first configuration file to be converted;

[0006] Perform conversion processing on at least one group of strings in the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings, and generate a second configuration file including the converted strings corresponding to each group of strings; the converted strings conform to the format requirements of the second configuration file;

[0007] Read at least one database execution function from a target class file, and determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is a database execution class file corresponding to the first configuration file;

[0008] Construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file.

[0009] Optionally, before performing conversion processing on at least one group of strings in the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings, the method further includes:

[0010] Obtain a keyword table, where the keyword table records multiple keywords to be converted;

[0011] Match the keyword table with the multiple groups of strings to identify at least one group of strings from the multiple groups of strings, where each group of strings in the at least one group of strings includes at least one keyword to be converted among the multiple keywords to be converted.

[0012] Optionally, performing conversion processing on at least one group of strings among the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings includes:

[0013] According to the corresponding relationship between keywords and conversion functions, determine the conversion function corresponding to each keyword to be converted among the at least one keyword to be converted included in each group of strings in the at least one group of strings;

[0014] Use the conversion function corresponding to each keyword to be converted among the at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively, to obtain the converted strings corresponding to each group of strings.

[0015] Optionally, the using the conversion function corresponding to at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively to obtain the converted strings corresponding to each group of strings includes:

[0016] Intercept at least one keyword to be converted included in each group of strings;

[0017] Perform conversion processing on the keyword to be converted according to the conversion function corresponding to each keyword to be converted among the at least one keyword to be converted, to obtain the converted data; the converted data includes the target keyword after conversion corresponding to the keyword to be converted;

[0018] Use the converted data to perform splicing processing on this group of strings to obtain the converted strings corresponding to this group of strings.

[0019] Optionally, the using the conversion function corresponding to each keyword to be converted among the at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively to obtain the converted strings corresponding to each group of strings includes:

[0020] Intercept at least one keyword to be converted included in each group of strings and the associated data of each keyword to be converted among the at least one keyword to be converted;

[0021] Perform conversion processing on the keyword to be converted and the associated data of the keyword to be converted according to the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted, so as to obtain the converted data; the converted data includes the converted target keyword corresponding to the keyword to be converted and the converted target associated data corresponding to the associated data;

[0022] Use the converted data to splice the group of strings to obtain the converted string corresponding to the group of strings.

[0023] Optionally, the determining the target database execution function from the at least one database execution function according to the second configuration file includes:

[0024] Determine, from the at least one database execution function, the database execution function with a corresponding label in the second configuration file according to the correspondence between the label of the database execution function included in the second configuration file and the database execution statement;

[0025] Determine the database execution function with a corresponding label in the second configuration file as the database execution function with a corresponding database execution statement in the second configuration file.

[0026] Optionally, the constructing the test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file includes:

[0027] Construct statements including parameter definitions, parameter assignments, and calls to the target database execution function according to the input parameters defined in the target database execution function, the input parameters defined in the database execution statement corresponding to the target database execution function in the second configuration file, and the identification information of the target database function;

[0028] Generate a test file including the statements.

[0029] In a second aspect, an embodiment of the present application provides a data processing device, including:

[0030] A reading module, configured to read multiple groups of strings from a first configuration file to be converted;

[0031] A processing module, configured to perform conversion processing on at least one group of strings in the multiple groups of strings to obtain the converted string corresponding to each group of strings in the at least one group of strings, and generate a second configuration file including the converted string corresponding to each group of strings; the converted string meets the format requirements of the second configuration file;

[0032] The reading module is further configured to read at least one database execution function from the target class file;

[0033] The processing module is further configured to determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is the database execution class file corresponding to the first configuration file, and construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file.

[0034] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the processor and the memory are connected to each other. The memory is configured to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect.

[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method described in the first aspect.

[0036] In summary, the electronic device can read multiple groups of strings from the first configuration file to be converted, and perform conversion processing on at least one group of strings in the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings, so as to generate a second configuration file including the converted strings corresponding to each group of strings; the electronic device can read at least one database execution function from the target class file, and determine a target database execution function from the at least one database execution function according to the second configuration file, so as to construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file. By adopting this method, the automatic conversion process of the configuration file can be realized, and the generation process of the automatic test file can be realized based on the converted configuration file, thereby improving the development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0038] Figure 1 It is a schematic flowchart of a data processing method provided by an embodiment of the present application;

[0039] Figure 2 It is a schematic flowchart of another data processing method provided by an embodiment of the present application;

[0040] Figure 3 It is a schematic structural diagram of a data processing device provided by an embodiment of the present application;

[0041] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Specific embodiments

[0042] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application.

[0043] Please refer to Figure 1 , which is a schematic flowchart of a data processing method provided by an embodiment of the present application. This method can be applied to an electronic device, which can be a terminal or a server. The terminal includes but is not limited to intelligent terminals such as laptops and desktop computers. The server can be a single server or a server cluster. Specifically, this method can include the following steps:

[0044] S101. Read multiple groups of strings from a first configuration file to be converted.

[0045] In an embodiment of the present application, the electronic device can obtain the first configuration file to be converted and read multiple groups of strings from the first configuration file to be converted. For example, the first configuration file can be a configuration file of the first persistence layer or a configuration file of the first persistence layer framework, such as an xml configuration file in ibatis.

[0046] In one embodiment, the electronic device can read multiple groups of strings from the first configuration file to be converted in the form of a file input stream.

[0047] In one embodiment, the electronic device can obtain the first configuration file to be converted according to a first path, and the first path indicates the location where the first configuration file is located.

[0048] In one embodiment, the electronic device can obtain the first path input by the user, or obtain the first path and the second path input by the user, where the second path indicates the location where the second configuration file is stored, or obtain the first path, the second path, and a specified processing item input by the user. For example, the specified processing item can be a test.

[0049] In an application scenario, taking an electronic device as an example of a terminal, the electronic device can display a configuration file conversion interface. The configuration file conversion interface can include a first input box and a confirmation button. The first input box can be used to input a first path. The user can input the first path in the first input box and click the confirmation button. The electronic device can respond to the user's click operation on the confirmation button, generate a configuration file conversion instruction, and obtain the first path input by the user through the first input box. In another application scenario, the configuration file conversion interface can further include a second input box, and the second input box can be used to input a second path. The server can obtain the second path input by the user through the second input box. In another application scenario, the configuration file conversion interface can further include a processing item selection box, and the processing item selection box can be used to input a specified processing item. The server can obtain the specified processing item input by the user through the processing item selection box.

[0050] In one embodiment, the electronic device can receive a configuration file conversion request sent by another device. The configuration file conversion request can carry a first path, and the electronic device can obtain the first path carried by the configuration file conversion request. In one embodiment, the configuration file conversion request can further carry a second path, and the server can also obtain the second path carried by the configuration file conversion request. In one embodiment, the configuration file conversion request can further carry a specified processing item, and the server can also obtain the specified processing item carried by the configuration file conversion request.

[0051] In an application scenario, taking the electronic device as a server as an example, the target device can display a configuration file conversion interface. The configuration file conversion interface can include a first input box and a confirmation button. The first input box can be used to input a first path. The user can input the first path in the first input box and click the confirmation button. The target device can respond to the user's click operation on the confirmation button, send a configuration file conversion request to the electronic device, and the electronic device can obtain the first path carried by the configuration file conversion request. In another application scenario, the configuration file conversion interface can further include a second input box. The configuration file conversion request can further carry a second path, and the electronic device can also obtain the second path carried by the configuration file conversion request. In another application scenario, the configuration file conversion interface can further include a processing item selection box. The configuration file conversion request can further carry a specified processing item, and the electronic device can also obtain the specified processing item carried by the configuration file conversion request.

[0052] In one embodiment, the way for the electronic device to read multiple groups of strings from the first configuration file to be converted may be that the electronic device groups multiple strings included in the second configuration file to be converted according to line break symbols, and obtains multiple groups of strings. In one embodiment, in computer languages, it is generally default that one line of string corresponds to one line break symbol, so one line of string can be used as a group of strings. Of course, when multiple lines of strings correspond to one line break symbol, these multiple lines of strings can also be used as a group of strings. It should be noted that, in addition to using line break symbols for grouping, the electronic device can also use other preset symbols, such as #, $, for grouping or other methods for grouping. The embodiments of the present application do not list them one by one here.

[0053] S102. Perform conversion processing on at least one group of strings in the multiple groups of strings, obtain the converted strings corresponding to each group of strings in the at least one group of strings, and generate a second configuration file including the converted strings corresponding to each group of strings.

[0054] Among them, the at least one group is one group or multiple groups. The converted strings meet the format requirements of the second configuration file. For example, the second configuration file can be a configuration file of the second persistence layer or a configuration file of the second persistence layer framework, such as an xml configuration file in mybatis.

[0055] In one application scenario, the first configuration file is an xml configuration file in ibatis, including at least one file header and at least one tag (the tag includes tag attributes and a tag body), and the second configuration file is an xml configuration file in mybatis. The electronic device can read multiple groups of strings from the first configuration file, and during the process of performing conversion processing on at least one group of strings in the multiple groups of strings, perform conversion processing on each file header and each tag included in the first configuration file respectively to obtain a converted file header and a converted tag; the electronic device generates a second configuration file including the converted file header and the converted tag. Among them, the converted file header and the converted tag meet the format specified in the second configuration file. For example, the file constraints of each file header included in the first configuration file can be converted into file constraints that meet the format specified in the second configuration file; the names of each root tag included in the first configuration file can be converted into root tag names that meet the format specified in the second configuration file; for each dynamic assembly tag included in the first configuration file, such as <isnotempty> 、 <isempty> 、 <isnotnull> 、 <isnull> 、 <isequal> 、 <isnotequal>, convert to an if tag; each included in the first configuration file <select>Convert the parameterClass attribute in the tag to the parameterType attribute; convert the property attribute in each tag included in the first configuration file to the test attribute in the if tag; convert the variable reference format of each tag body included in the first configuration file to the variable reference format that conforms to the regulations of the second configuration file.

[0056] In one embodiment, the manner in which the electronic device performs conversion processing on at least one group of strings in the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings may be that the electronic device determines the conversion function corresponding to each to-be-converted keyword in at least one to-be-converted keyword included in each group of strings according to the correspondence between the keyword and the conversion function; the electronic device uses the conversion function corresponding to each to-be-converted keyword in at least one to-be-converted keyword included in each group of strings to perform conversion processing on each group of strings respectively to obtain the converted strings corresponding to each group of strings. Among them, the conversion function can implement the configuration file conversion function. In one embodiment, the conversion function at least includes a to-be-converted keyword, a converted target keyword corresponding to the to-be-converted keyword, and a keyword conversion rule corresponding to the to-be-converted keyword. For example, the keyword conversion rule may include a rule for converting the to-be-converted keyword to the corresponding converted target keyword.

[0057] In one embodiment, the manner in which the electronic device uses the conversion function corresponding to at least one to-be-converted keyword included in each group of strings to perform conversion processing on each group of strings respectively to obtain the converted strings corresponding to each group of strings may be that the electronic device intercepts at least one to-be-converted keyword included in each group of strings; the electronic device performs conversion processing on the to-be-converted keyword according to the conversion function corresponding to each to-be-converted keyword in the at least one to-be-converted keyword to obtain the converted data; the converted data includes the converted target keyword corresponding to the to-be-converted keyword; the electronic device uses the converted data to perform splicing processing on the group of strings to obtain the converted strings corresponding to the group of strings. Among them, the above splicing processing process can be divided into the following two items: one is to directly perform splicing processing on the group of to-be-converted strings, and the other is to perform splicing processing on the group of to-be-converted strings according to the conversion format when the conversion function includes a conversion format. These two methods will be introduced below.

[0058] For the first case, the manner in which the electronic device uses the converted data to perform splicing processing on the group of strings may be that the electronic device replaces the to-be-converted keyword with the converted data in the group of strings. Specifically, the electronic device may replace the to-be-converted keyword with the converted target keyword corresponding to the to-be-converted keyword.

[0059] For the second case, the way for the electronic device to splice the group of strings by using the converted data may be that the electronic device replaces the keyword to be converted with the converted data, and reorganizes the converted data and other data included in the group of strings according to the conversion format included in the conversion function. Specifically, the electronic device may replace the keyword to be converted with the converted target keyword corresponding to the keyword to be converted.

[0060] In one embodiment, the electronic device may obtain a keyword table that records multiple keywords to be converted, and perform keyword matching between the keyword table and the multiple groups of strings to determine at least one group of strings in the multiple groups of strings, where each string in the at least one group of strings includes at least one keyword to be converted among the multiple keywords to be converted. For example, the keyword list includes keyword 1 and keyword 2, and the multiple groups of strings include the first group of strings, the second group of strings, and the third group of strings. The electronic device may determine the first group of strings including keyword 1 and the second group of strings including keyword 2 by matching the keyword table with the multiple groups of strings.

[0061] S103. Read at least one database execution function from the target class file, and determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is the database execution class file corresponding to the first configuration file.

[0062] The electronic device may obtain the target class file (which may be one or more), and read at least one database execution function from the target class file to determine a target database execution function from the at least one database execution function according to the second configuration file. For example, the database execution class file may be a file corresponding to the persistence layer class or a file corresponding to the Data Access Object (DAO) class. Among them, the DAO class refers to the operation class for accessing the database.

[0063] In one embodiment, the electronic device may read at least one database execution function from the target class file by using a file input stream.

[0064] In one embodiment, the electronic device may obtain the target class file according to a third path, where the third path indicates the location where the target class file is located. Among them, the third path may be the same as or different from the foregoing first path.

[0065] In one embodiment, the electronic device may respond to a touch operation on a specified control by the user to obtain the third path input by the user; or obtain the first path and the third path input by the user; or obtain the first path, the second path, and the third path input by the user; or obtain the first path, the second path, the specified processing item, and the third path input by the user.

[0066] In one embodiment, the electronic device may receive the third path sent by other devices. In one embodiment, the configuration file conversion request may also carry the third path, and the server may also obtain the third path carried in the configuration file conversion request.

[0067] In one embodiment, if there are multiple class files under the third path, the electronic device may determine a target class file from the multiple class files according to the obtained class name. In this way, the data reading efficiency of the target class file can be improved.

[0068] In one embodiment, the way for the electronic device to determine the target database execution function from the at least one database execution function according to the second configuration file may be that the electronic device determines, from the at least one database execution function, the target database execution function for which there is a corresponding database execution statement in the second configuration file. In this way, the data reading efficiency of the target class file can be improved.

[0069] In one embodiment, the way for the electronic device to determine, from the at least one database execution function, the target database execution function for which there is a corresponding database execution statement in the second configuration file may be that the electronic device determines, according to the correspondence between the labels of the database execution functions included in the second configuration file and the database execution statements, the database execution function for which there is a corresponding label in the second configuration file from the at least one database execution function; the electronic device determines the database execution function for which there is a corresponding label in the second configuration file as the database execution function for which there is a corresponding database execution statement in the second configuration file. By adopting this way, the data reading efficiency of the target class file can be improved.

[0070] In one embodiment, the electronic device may output the other database execution functions of the at least one database execution function except the target database execution function to a log file. In one embodiment, the electronic device may output the other database execution functions to the log file by means of a file output stream. By outputting to the log file, it is convenient to query the database execution functions with mapping failures subsequently.

[0071] S104. Use the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct a test file corresponding to the second configuration file.

[0072] The electronic device may use the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct a test file corresponding to the second configuration file. Among them, the test file may be used to test whether the second configuration file and the target class file can run normally.

[0073] In one embodiment, the way for the electronic device to use the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct a test file corresponding to the second configuration file may be that the electronic device constructs, according to the input parameters defined in the target database execution function, the input parameters defined in the database execution statement corresponding to the target database execution function in the second configuration file, and the identification information of the target database function, statements including parameter definition, parameter assignment, and calling the target database execution function, and generates a test file including the statements.By adopting this method, test files can be automatically generated, thereby improving development efficiency.

[0074] In one embodiment, the electronic device may, in accordance with the format specified in the test file, use the method of string splicing, and construct a statement including parameter definition, parameter assignment, and a call to the target database execution function based on the input parameters defined in the function of the target database, the input parameters defined in the database execution statement corresponding to the target database execution function in the second configuration file, and the identification information of the target database function. In one embodiment, the electronic device may also compile and execute the test file in any code development tool to verify the correctness of the target database execution function and the corresponding database execution statement. When a large number of database execution functions need to be tested, by the above method, the time for developers to write test files can be reduced, the test efficiency can be improved, and the reliability of the configuration file conversion process can be ensured.

[0075] In one embodiment, the data processing method mentioned in the embodiments of the present application may be executed in a virtual machine environment, such as a Java virtual machine environment.

[0076] It can be seen that in the embodiment shown in FIG. 1, the electronic device may read multiple groups of strings from the first configuration file to be converted, and perform conversion processing on at least one group of strings among the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings, so as to generate a second configuration file including the converted strings corresponding to each group of strings; the electronic device may read at least one database execution function from the target class file, and determine the target database execution function from the at least one database execution function according to the second configuration file, so as to construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file. By adopting this method, the automatic conversion process of the configuration file can be realized, and the generation process of the automatic test file can be realized based on the converted configuration file, thereby improving development efficiency.

[0077] Please refer to FIG. 2, which is a schematic flowchart of another data processing method provided by the embodiments of the present application. This method can be applied to an electronic device, which may be a terminal or a server. The terminal includes, but is not limited to, intelligent terminals such as laptop computers and desktop computers. The server may be a single server or a server cluster. Specifically, this method may include the following steps:

[0078] S201. Read multiple groups of strings from the first configuration file to be converted.

[0079] Among them, step S201 can refer to step S101 in the embodiment of FIG. 1, and the embodiments of the present application will not elaborate here.

[0080] S202. Determine the conversion function corresponding to each to-be-converted keyword among the at least one to-be-converted keyword included in each group of strings according to the correspondence between the keyword and the conversion function.

[0081] S203. Intercept at least one keyword to be converted included in each group of strings and the associated data of each keyword to be converted in the at least one keyword to be converted.

[0082] S204. Perform conversion processing on the keyword to be converted and the associated data of the keyword to be converted according to the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted, to obtain the converted data.

[0083] In steps S202 - S204, the electronic device can determine the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted included in each group of strings according to the correspondence between the keyword and the conversion function. The electronic device can intercept at least one keyword to be converted included in each group of strings and the associated data of each keyword to be converted in the at least one keyword to be converted. The electronic device can perform conversion processing on the keyword to be converted and the associated data of the keyword to be converted according to the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted, to obtain the converted data. Among them, the converted data includes the converted target keyword corresponding to the keyword to be converted and the converted target associated data corresponding to the associated data. The conversion function can implement the configuration file conversion function. In one embodiment, the conversion function at least includes the keyword to be converted, the converted target keyword corresponding to the keyword to be converted, and the keyword conversion rule corresponding to the keyword to be converted. For example, the keyword conversion rule can include the rule for converting the keyword to be converted into the corresponding converted target keyword and the rule for converting the associated data into the corresponding converted target associated data.

[0084] S205. Use the converted data to perform splicing processing on the group of strings, to obtain the converted string corresponding to the group of strings, and generate a second configuration file including the converted strings corresponding to each group of strings.

[0085] In step S205, the electronic device can use the converted data to perform splicing processing on the group of strings, to obtain the converted string corresponding to the group of strings, and generate a second configuration file including the converted strings corresponding to each group of strings, so as to implement the automated conversion process of the configuration file, and further improve the configuration file conversion efficiency. Among them, the above splicing processing process can be divided into the following two items: one is to directly perform splicing processing on the group of strings to be converted, and the other is to perform splicing processing on the group of strings to be converted according to the conversion format when the conversion function includes a conversion format. These two methods will be introduced below.

[0086] For the first case, the way for the electronic device to use the converted data to perform splicing processing on the group of strings can be that the electronic device replaces the keyword to be converted and the associated data of the keyword to be converted with the converted data in the group of strings.Specifically, the electronic device can use the converted target keyword corresponding to the keyword to be converted to replace the keyword to be converted, and use the converted target associated data corresponding to the associated data to replace the associated data.

[0087] For the second case, the way for the electronic device to splice the group of strings using the converted data can be that the electronic device uses the converted data to replace the keyword to be converted and the associated data of the keyword to be converted, and reorganizes the converted data and other data included in the group of strings according to the conversion format included in the conversion function. Specifically, the electronic device can use the converted target keyword corresponding to the keyword to be converted to replace the keyword to be converted, and use the target associated data corresponding to the associated data to replace the associated data.

[0088] S206. Read at least one database execution function from the target class file, and determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is the database execution class file corresponding to the first configuration file.

[0089] S207. Use the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct a test file corresponding to the second configuration file.

[0090] Among them, steps S206-S207 can refer to steps S103-S104 in the embodiment of FIG. 1, and the embodiments of the present application will not be elaborated here.

[0091] It can be seen that in the embodiment shown in FIG. 2, the electronic device can perform conversion processing on the keyword to be converted and the corresponding associated data included in the first configuration file according to the conversion function to obtain the converted data, and can splice the corresponding group of strings through the converted data, so as to obtain the second configuration file, and thus generate a test file for the second configuration file. By using this method, the automatic conversion process of the configuration file can be realized, and the generation process of the automatic test file can be realized based on the converted configuration file, thereby improving the development efficiency.

[0092] Please refer to FIG. 3, which is a schematic structural diagram of a data processing device provided by an embodiment of the present application. This device can be applied to an electronic device, and this device can include:

[0093] A reading module 301, configured to read multiple groups of strings from a first configuration file to be converted.

[0094] A processing module 302, configured to perform conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings, and generate a second configuration file including the converted string corresponding to each group of strings; the converted string meets the format requirements of the second configuration file.

[0095] The reading module 301 is further configured to read at least one database execution function from the target class file.

[0096] The processing module 302 is further configured to determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is the database execution class file corresponding to the first configuration file, and construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file.

[0097] In an optional implementation manner, the processing module 302 is further configured to obtain a keyword table before performing conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings, where the keyword table records multiple keywords to be converted; perform keyword matching between the keyword table and the multiple groups of strings to determine at least one group of strings in the multiple groups of strings, and each group of strings in the at least one group of strings includes at least one keyword to be converted among the multiple keywords to be converted.

[0098] In an optional implementation manner, when the processing module 302 performs conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings, specifically, according to the corresponding relationship between keywords and conversion functions, determine a conversion function corresponding to each keyword to be converted included in each group of strings in the at least one group of strings; use the conversion function corresponding to each keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively to obtain a converted string corresponding to each group of strings.

[0099] In an optional implementation manner, when the processing module 302 uses the conversion function corresponding to at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively to obtain a converted string corresponding to each group of strings, specifically, intercept at least one keyword to be converted included in each group of strings; perform conversion processing on the keyword to be converted according to the conversion function corresponding to each keyword to be converted to obtain converted data; the converted data includes a converted target keyword corresponding to the keyword to be converted; use the converted data to perform splicing processing on this group of strings to obtain a converted string corresponding to this group of strings.

[0100] In an alternative embodiment, the processing module 302 uses the conversion function corresponding to each keyword to be converted in at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively, so as to obtain the converted strings corresponding to each group of strings. Specifically, at least one keyword to be converted included in each group of strings and the associated data of each keyword to be converted in the at least one keyword to be converted are intercepted; according to the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted, conversion processing is performed on the keyword to be converted and the associated data of the keyword to be converted to obtain the converted data; the converted data includes the converted target keyword corresponding to the keyword to be converted and the converted target associated data corresponding to the associated data; the converted data is used to perform splicing processing on this group of strings to obtain the converted strings corresponding to this group of strings.

[0101] In an alternative embodiment, the processing module 302 determines the target database execution function from the at least one database execution function according to the second configuration file. Specifically, according to the correspondence between the label of the database execution function included in the second configuration file and the database execution statement, the database execution function with a corresponding label in the second configuration file is determined from the at least one database execution function; the database execution function with a corresponding label in the second configuration file is determined as the database execution function with a corresponding database execution statement in the second configuration file.

[0102] In an alternative embodiment, the processing module 302 uses the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct the test file corresponding to the second configuration file. Specifically, according to the input parameters defined in the target database execution function, the input parameters defined in the database execution statement corresponding to the target database execution function in the second configuration file, and the identification information of the target database function, a statement including parameter definition, parameter assignment, and calling the target database execution function is constructed; a test file including the statement is generated.

[0103] As can be seen, in the embodiment shown in FIG. 3, the data processing device can read multiple groups of strings from the first configuration file to be converted, and perform conversion processing on at least one group of strings among the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings, so as to generate a second configuration file including the converted strings corresponding to each group of strings; the data processing device can read at least one database execution function from the target class file, and determine the target database execution function from the at least one database execution function according to the second configuration file, so as to construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file. By adopting this method, the automatic conversion process of the configuration file can be realized, and the generation process of the automatic test file can be realized based on the converted configuration file, thereby improving the development efficiency.

[0104] Please refer to FIG. 4, which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Among them, the electronic device described in this embodiment may include: a processor 1000, an input device 2000, an output device 3000, and a memory 4000. The processor 1000, the input device 2000, the output device 3000, and the memory 4000 may be connected through a bus or other means as shown in FIG. 4. In one embodiment, the input device 2000 and the output device 3000 are optional devices. In one embodiment, the input device 2000 includes, but is not limited to, devices such as a touch screen, a recorder, and a sensor. The output device 3000 includes, but is not limited to, devices such as a display screen and a speaker. The touch screen and the display screen can also be replaced with a touch display screen. In one embodiment, the input device 2000 and the output device 3000 may include standard wired or wireless communication interfaces.

[0105] The processor 1000 may be a central processing module (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0106] The memory 4000 may be a high-speed RAM memory or a non-volatile memory, such as a disk memory.The memory 4000 is used to store a set of program codes, and the processor 1000, the input device 2000, and the output device 3000 can call the program codes stored in the memory 4000. Specifically:

[0107] The processor 1000 is configured to read multiple groups of strings from a first configuration file to be converted; perform conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings, and generate a second configuration file including the converted strings corresponding to each group of strings; the converted strings comply with the format requirements of the second configuration file; read at least one database execution function from a target class file, and determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is a database execution class file corresponding to the first configuration file; construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file.

[0108] In one embodiment, the processor 1000 is further configured to obtain a keyword table that records multiple keywords to be converted before performing conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings; perform keyword matching between the keyword table and the multiple groups of strings to determine at least one group of strings in the multiple groups of strings, where each group of strings in the at least one group of strings includes at least one keyword to be converted among the multiple keywords to be converted.

[0109] In one embodiment, when the processor 1000 performs conversion processing on at least one group of strings in the multiple groups of strings to obtain a converted string corresponding to each group of strings in the at least one group of strings, specifically, according to the correspondence between keywords and conversion functions, determine a conversion function corresponding to each keyword to be converted included in each group of strings in the at least one group of strings; use the conversion function corresponding to each keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively to obtain a converted string corresponding to each group of strings.

[0110] In one embodiment, the processor 1000 uses the conversion functions corresponding to at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively, so as to obtain the converted strings corresponding to each group of strings. Specifically, it intercepts at least one keyword to be converted included in each group of strings; performs conversion processing on the keyword to be converted according to the conversion function corresponding to each keyword to be converted among the at least one keyword to be converted, so as to obtain the converted data; the converted data includes the converted target keyword corresponding to the keyword to be converted; uses the converted data to perform splicing processing on this group of strings, so as to obtain the converted string corresponding to this group of strings.

[0111] In one embodiment, the processor 1000 uses the conversion functions corresponding to each keyword to be converted among at least one keyword to be converted included in each group of strings to perform conversion processing on each group of strings respectively, so as to obtain the converted strings corresponding to each group of strings. Specifically, it intercepts at least one keyword to be converted included in each group of strings and the associated data of each keyword to be converted among the at least one keyword to be converted; performs conversion processing on the keyword to be converted and the associated data of the keyword to be converted according to the conversion function corresponding to each keyword to be converted among the at least one keyword to be converted, so as to obtain the converted data; the converted data includes the converted target keyword corresponding to the keyword to be converted and the converted target associated data corresponding to the associated data; uses the converted data to perform splicing processing on this group of strings, so as to obtain the converted string corresponding to this group of strings.

[0112] In one embodiment, the processor 1000 determines the target database execution function from the at least one database execution function according to the second configuration file. Specifically, according to the correspondence between the labels of the database execution functions included in the second configuration file and the database execution statements, it determines the database execution function with a corresponding label in the second configuration file from the at least one database execution function; determines the database execution function with a corresponding database execution statement in the second configuration file as the database execution function with a corresponding label in the second configuration file.

[0113] In one embodiment, the processor 1000 uses the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct the test file corresponding to the second configuration file. Specifically, according to the input parameters defined in the target database execution function, the input parameters defined in the database execution statement corresponding to the target database execution function in the second configuration file, and the identification information of the target database function, it constructs statements including parameter definition, parameter assignment, and calling the target database execution function; generates a test file including the statements.

[0114] In a specific implementation, the processor 1000, input device 2000, and output device 3000 described in the embodiments of the present application may execute the implementation manners described in the embodiments of FIGS. 1 and 2, or may also execute the implementation manners described in the embodiments of the present application, which will not be elaborated herein.

[0115] In each embodiment of the present application, each functional unit may be integrated into one processing unit, may exist physically alone for each unit, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0116] Those of ordinary skill in the art can understand that all or part of the processes of implementing the above embodiments of the method can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it may include the processes of the above embodiments of each method. Among them, the medium is a computer-readable storage medium, and the computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.

[0117] The above-disclosed is only a preferred embodiment of the present application. Of course, the scope of rights of the present application cannot be limited thereby. Those of ordinary skill in the art can understand all or part of the processes of implementing the above embodiments and still fall within the scope covered by the present application according to the equivalent changes made in accordance with the claims of the present application.< / select> < / isnotequal> < / isequal> < / isnull> < / isnotnull> < / isempty> < / isnotempty>

Claims

1. A data processing method, characterized in that, Including: Receiving a configuration file conversion request, where the configuration file conversion request carries a first path and a specified processing matter, the first path indicates the location where the first configuration file is located, and the specified processing matter is testing; In response to the configuration file conversion request, obtaining the first configuration file to be converted based on the first path, and reading multiple groups of strings from the first configuration file to be converted; Performing conversion processing on at least one group of strings among the multiple groups of strings to obtain a converted string corresponding to each string in the at least one group of strings, and generating a second configuration file including the converted strings corresponding to each string; the converted strings conform to the format requirements of the second configuration file; Reading at least one database execution function from a target class file, and determining a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is the database execution class file corresponding to the first configuration file; The determining method of the target database execution function includes: according to the correspondence between the labels of the database execution functions included in the second configuration file and the database execution statements, determining, from the at least one database execution function, the database execution function that has a corresponding label in the second configuration file; and determining the database execution function that has a corresponding label in the second configuration file as the target database execution function that has a corresponding database execution statement in the second configuration file; Using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct a test file corresponding to the second configuration file; the test file is used to test whether the second configuration file and the target class file can run properly; Compiling and executing the test file in a code development tool to verify the correctness of the target database execution function and the corresponding database execution statement.

2. The method according to claim 1, characterized in that, Before performing conversion processing on at least one group of strings among the multiple groups of strings to obtain a converted string corresponding to each string in the at least one group of strings, the method further includes: Obtaining a keyword table, where the keyword table records multiple keywords to be converted; Performing keyword matching between the keyword table and the multiple groups of strings to determine at least one group of strings among the multiple groups of strings, and each string in the at least one group of strings includes at least one keyword to be converted among the multiple keywords to be converted.

3. The method according to claim 1 or 2, characterized in that, Performing conversion processing on at least one group of strings among the multiple groups of strings to obtain a converted string corresponding to each string in the at least one group of strings, including: Determining a conversion function corresponding to each keyword to be converted included in each string in the at least one group of strings according to the correspondence between the keyword and the conversion function; Using the conversion function corresponding to each keyword to be converted included in each string to perform conversion processing on each string respectively to obtain a converted string corresponding to each string.

4. The method according to claim 3, characterized in that, Using the conversion functions corresponding to at least one keyword to be converted included in each group of strings, respectively performing conversion processing on each group of strings to obtain the converted strings corresponding to each group of strings, includes: Intercepting at least one keyword to be converted included in each group of strings; Performing conversion processing on the keyword to be converted according to the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted, to obtain the converted data; the converted data includes the converted target keyword corresponding to the keyword to be converted; Using the converted data to perform splicing processing on this group of strings to obtain the converted strings corresponding to this group of strings.

5. The method according to claim 3, characterized in that, Using the conversion functions corresponding to each keyword to be converted in at least one keyword to be converted included in each group of strings, respectively performing conversion processing on each group of strings to obtain the converted strings corresponding to each group of strings, includes: Intercepting at least one keyword to be converted included in each group of strings and the associated data of each keyword to be converted in the at least one keyword to be converted; Performing conversion processing on the keyword to be converted and the associated data of the keyword to be converted according to the conversion function corresponding to each keyword to be converted in the at least one keyword to be converted, to obtain the converted data; the converted data includes the converted target keyword corresponding to the keyword to be converted and the converted target associated data corresponding to the associated data; Using the converted data to perform splicing processing on this group of strings to obtain the converted strings corresponding to this group of strings.

6. The method according to claim 1, characterized in that, Using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file to construct the test file corresponding to the second configuration file, includes: According to the input parameters defined in the target database execution function, the input parameters defined in the database execution statement corresponding to the target database execution function in the second configuration file, and the identification information of the target database execution function, constructing a statement including parameter definition, parameter assignment, and calling the target database execution function; Generating a test file including the statement.

7. A data processing device, characterized in that, Includes: A reading module, configured to receive a configuration file conversion request, the configuration file conversion request carrying a first path and a specified processing item, the first path indicating the location of the first configuration file, and the specified processing item being testing; in response to the configuration file conversion request, obtaining the first configuration file to be converted based on the first path, and reading multiple groups of strings from the first configuration file to be converted; A processing module, configured to perform conversion processing on at least one group of strings in the multiple groups of strings to obtain the converted strings corresponding to each group of strings in the at least one group of strings, and generate a second configuration file including the converted strings corresponding to each group of strings; the converted strings meet the format requirements of the second configuration file; The reading module is further configured to read at least one database execution function from the target class file; The processing module is further configured to determine a target database execution function from the at least one database execution function according to the second configuration file, where the target class file is the database execution class file corresponding to the first configuration file, and construct a test file corresponding to the second configuration file by using the target database execution function and the database execution statement corresponding to the target database execution function in the second configuration file; The determining method of the target database execution function includes: determining, from at least one database execution function, a database execution function having a corresponding label in the second configuration file according to the correspondence between the label of the database execution function included in the second configuration file and the database execution statement; and determining the database execution function having a corresponding label in the second configuration file as the target database execution function having a corresponding database execution statement in the second configuration file; the test file is used to test whether the second configuration file and the target class file can run normally; The processing module is further configured to compile and execute the test file in a code development tool to verify the correctness of the target database execution function and the corresponding database execution statement.

8. An electronic device, characterized in that, It includes a processor and a memory, the processor and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1-6.