CN117093253A - Configuration comparison method and device, storage medium and electronic equipment - Google Patents

Configuration comparison method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117093253A
CN117093253A CN202310892231.7A CN202310892231A CN117093253A CN 117093253 A CN117093253 A CN 117093253A CN 202310892231 A CN202310892231 A CN 202310892231A CN 117093253 A CN117093253 A CN 117093253A
Authority
CN
China
Prior art keywords
comparison
target
configuration data
configuration
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310892231.7A
Other languages
Chinese (zh)
Inventor
曾淼
方培贻
许小斌
萧永辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310892231.7A priority Critical patent/CN117093253A/en
Publication of CN117093253A publication Critical patent/CN117093253A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a configuration comparison method, a device, a storage medium and electronic equipment. Relates to the technical field of financial science and technology, wherein the method comprises the following steps: obtaining comparison rule information corresponding to target configuration data, wherein the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data; determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data; and carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment. The application solves the technical problem of lower configuration comparison efficiency in the prior art when the configuration data of the application program is configured and compared.

Description

Configuration comparison method and device, storage medium and electronic equipment
Technical Field
The application relates to the technical field of financial science and technology, in particular to a configuration comparison method, a device, a storage medium and electronic equipment.
Background
At present, as the requirements of external devices on the comparison function of the configuration center are increasing, different comparison scenes need to be configured with different configuration data types and different comparison modes.
In the prior art, a comparator is generally newly built for each configuration type and each comparison mode, and then each functional responsible person manually completes the realization of the function according to own reason. However, the method has no unified processing flow and step, so that the code difference between the comparators is large and is difficult to maintain, for example, if the judgment condition in the code needs to be adjusted, each comparator needs to be modified, for example, if a new comparison mode is added or a new configuration type is added, the code of the comparator needs to be redeveloped.
As can be seen from the above, when the configuration data of the application program is configured and compared, the maintenance time of the comparator is long, which results in a problem of low configuration and comparison efficiency.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The application provides a configuration comparison method, a device, a storage medium and electronic equipment, which at least solve the technical problem of low configuration comparison efficiency in the prior art when configuration comparison is carried out on configuration data of an application program.
According to one aspect of the present application, there is provided a configuration contrast method, comprising: obtaining comparison rule information corresponding to target configuration data, wherein the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data; determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data; and carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
Further, determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode comprises: creating a target script according to the configuration type and the comparison mode, and taking the target script as an initial comparator; and inheriting the preset abstract class through the initial comparator to obtain the target comparator.
Further, before the target configuration data is configured and compared by the target comparator to obtain a comparison result, the method further includes: detecting whether the comparison rule information exists in a preset database; allowing to execute configuration comparison operation under the condition that the comparison rule information exists in the preset database, wherein the configuration comparison operation is used for carrying out configuration comparison on the target configuration data through the target comparator to obtain the comparison result; and under the condition that the comparison rule information does not exist in the preset database, prohibiting the execution of the configuration comparison operation.
Further, the target configuration data is configured and compared by the target comparator to obtain a comparison result, which includes: obtaining M first comparison data lists corresponding to the target configuration data through the target comparator, wherein each first comparison data list comprises N pieces of first configuration data to be compared, and M, N is a positive integer; converting the data type of each piece of first configuration data in N pieces of first configuration data in each first comparison data list into a mapping type based on a Java reflection mechanism to obtain M pieces of second comparison data lists, wherein each piece of second comparison data list comprises N pieces of second configuration data to be compared, a main key corresponding to each piece of second configuration data is an attribute name corresponding to the piece of second configuration data, and a key value corresponding to each piece of second configuration data is an attribute value corresponding to the piece of second configuration data; and comparing the second configuration data in the M second comparison data lists through the target comparator to obtain the comparison result.
Further, comparing, by the target comparator, the second configuration data in the M second comparison data lists to obtain the comparison result, including: acquiring a preset metadata table, wherein the preset metadata table at least comprises unique attributes corresponding to the target configuration data and target attribute information corresponding to the target configuration data, and the target attribute information is used for representing configuration data needing configuration comparison in the second configuration data; converting each second comparison data list into a mapping type list according to the unique attribute to obtain M third comparison data lists, wherein each third comparison data list comprises N pieces of third configuration data to be compared, a main key corresponding to each piece of third configuration data is an attribute value corresponding to the unique attribute, and a key value corresponding to each piece of third configuration data is second configuration data corresponding to the third configuration data; and comparing key values corresponding to the primary keys according to the primary keys corresponding to each piece of third configuration data and the target attribute information by the target comparator to obtain a comparison result.
Further, obtaining, by the target comparator, M first comparison data lists corresponding to the target configuration data, including: acquiring a data range of contrast data corresponding to the target configuration data; and acquiring M first comparison data lists corresponding to the target configuration data according to the data range of the comparison data through the target comparator.
Further, after the target configuration data is configured and compared by the target comparator to obtain a comparison result, the method further includes: display information corresponding to the target configuration data is obtained from the preset metadata table, wherein the display information is used for representing field information to be displayed in the comparison result; and generating a target file according to the display information and the comparison result, and displaying the target file in a target page.
According to another aspect of the present application, there is also provided a configuration contrast device, including: the system comprises an acquisition module, a comparison module and a comparison module, wherein the acquisition module is used for acquiring comparison rule information corresponding to target configuration data, the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data; the determining module is used for determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data; the comparison module is used for carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
According to another aspect of the present application, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the above configuration contrast method at run-time.
According to another aspect of the present application, there is also provided an electronic device including one or more processors; and a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running the program, wherein the program is configured to perform the configuration comparison method described above when run.
In the application, firstly, comparison rule information corresponding to target configuration data is obtained, wherein the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data; then determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data; and finally, carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
In the process, the comparison result is obtained by inheriting the preset abstract class object comparator to perform configuration comparison on the object configuration data, and the comparison flow of the object configuration data can be standardized by the preset abstract class, so that the problems of large code difference and difficulty in code maintenance between comparators caused by no unified flow and processing steps are avoided, the maintenance time of the comparators when the configuration data of the application program are subjected to configuration comparison is shortened, the technical effect of improving the configuration comparison efficiency is realized, and the technical problem that the configuration comparison efficiency is lower when the configuration data of the application program is subjected to configuration comparison in the prior art is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of an alternative configuration contrast method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an alternative configuration contrast system according to an embodiment of the present application;
FIG. 3 is a flow chart of an alternative comparison result generation process according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an alternative configuration contrast device according to an embodiment of the present application;
fig. 5 is a schematic diagram of an alternative electronic device according to an embodiment of the application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the configuration comparison method, the device, the storage medium and the electronic device of the present application may be used in the field of financial technology, and may also be used in other fields besides the field of financial technology, and the application fields of the configuration comparison method, the device, the storage medium and the electronic device of the present application are not limited.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.
Example 1
In accordance with an embodiment of the present application, an alternative method embodiment of a configuration contrast method is provided, it being noted that the steps illustrated in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
For convenience in understanding the technical solution of the present application, the following are specific definitions of some key terms in the present application:
PAAS variable: PAAS is Platform as a Service and platform is a service. PAAS variables are variables in the platform, i.e., service.
Configuration contrast: and according to the comparison result of the configuration data of different environments or the same environment, whether the configuration data in the current environment is abnormal or not is found.
FIG. 1 is a flow chart of an alternative configuration contrast method according to an embodiment of the present application, as shown in FIG. 1, comprising the steps of:
step S101, obtaining comparison rule information corresponding to target configuration data.
In an alternative embodiment, a configuration contrast system may be used as the subject of the configuration contrast method in embodiments of the present application. For convenience of description, the configuration comparison system will be simply referred to as a system hereinafter. As shown in fig. 2, the configuration comparison system includes a comparison rule adding module 11, a comparison factory module 12, and a comparison module 15.
The comparison rule adding module 11 is configured to add comparison rule information according to a user requirement. The contrast factory module 12 is used to decouple the use process and creation of the contrasters by factory mode, leaving the caller only to focus on the use rather than the choice of contrasters. The comparator is obtained only by taking the comparator with a factory, and as to which comparator is needed to be used specifically, the comparator is managed by the factory in a unified way, and the factory creates the relevant comparator 13 by comparing the configuration type and the comparison mode in the rule information; for example, the dynamic variables shown in FIG. 2 are time contrasters, PAAS variables are time contrasters, and other contrasters; wherein the comparator 13 includes a configuration data query function, a function of defining a preset metadata table, and a function of checking the comparator; the comparator 13 may inherit the variable comparison flow and the comparison result generation flow in the preset abstract class 14 shown in fig. 2. The comparison module 15 is configured to compare the configuration data with the comparator acquired by the comparison factory module 12.
In step S101, the target configuration data is the configuration data of the target application program, and the comparison rule information at least includes the configuration type of the target configuration data and the comparison mode corresponding to the target configuration data.
Optionally, the configuration type of the target configuration data includes, but is not limited to, a dynamic variable, a static variable, a PAAS variable, wherein the dynamic variable is a variable that does not require application of a restart service and can be directly validated; the static variable is the application's revision variable, and the validation requires a restart. The comparison mode corresponding to the target configuration data includes, but is not limited to, time comparison, version comparison and environment comparison, wherein the time comparison is used for reflecting the change condition of the variable in the range from the start time to the end time under the current environment, such as addition, modification, deletion and the like. And according to the comparison of the environments, whether the configuration data of the current environment accords with the expectations or not is found according to the comparison between different environments, such as a test environment, a formal operation environment, a disaster recovery environment and the like.
Optionally, the comparison rule information corresponding to the target configuration data includes, in addition to the configuration type of the target configuration data and the comparison mode corresponding to the target configuration data, a data range of the comparison data corresponding to the target configuration data, for example, an application parameter range, a deployment environment parameter range, and a version parameter of the application.
Step S102, determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode.
In step S102, the target comparator is a comparator that inherits a preset abstract class, where the preset abstract class is used to normalize a comparison flow of the target configuration data.
For example, the comparison factory module of the system can create a target script through a configuration type and a comparison mode to obtain an initial comparator, and inherit a preset abstract class through the initial comparator to obtain the target comparator.
Step S103, carrying out configuration comparison on the target configuration data through a target comparator to obtain a comparison result.
In step S103, the comparison result is used to characterize the abnormal situation of the target configuration data in the current deployment environment. For example, whether the configuration data in the current deployment environment meets expectations. Alternatively, the current deployment environment includes, but is not limited to, a test environment, a formal operating environment, and a disaster recovery environment.
For example, the comparison module of the system may obtain M first comparison data lists corresponding to the target configuration data through the target comparator, and perform configuration comparison on the target configuration data through the preset metadata table and the M first comparison data lists, so as to obtain a comparison result, where M is a positive integer.
Based on the above-mentioned schemes defined in steps S101 to S103, it can be known that in the present application, first, comparison rule information corresponding to target configuration data is obtained, where the target configuration data is configuration data of a target application program, and the comparison rule information at least includes a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data; then determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data; and finally, carrying out configuration comparison on the target configuration data through a target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
It should be noted that, the comparison result is obtained by inheriting the preset abstract class object comparator to perform configuration comparison on the object configuration data, and because the preset abstract class can standardize the comparison flow of the object configuration data, the problems of large code difference and difficult code maintenance between comparators caused by no unified flow and processing steps are avoided, the maintenance time of the comparators when the configuration data of the application program are configured and compared is reduced, the technical effect of improving the configuration comparison efficiency is achieved, and the technical problem that the configuration comparison efficiency is lower when the configuration data of the application program is configured and compared in the prior art is solved.
Optionally, in the configuration comparison method provided by the embodiment of the present application, determining, based on the configuration type and the comparison mode, a target comparator corresponding to the target configuration data includes: the system can establish a target script according to the configuration type and the comparison mode, and takes the target script as an initial comparator; then the system can inherit the preset abstract class through the initial comparator to obtain the target comparator.
For example, as shown in fig. 2, when the configuration type is a dynamic variable and the comparison mode is time comparison, the comparison factory module of the system may create a target script according to the configuration type and the comparison mode of the target configuration data, take the target script as a time comparator (i.e. an initial comparator) of the dynamic variable, and inherit a preset abstract class through the time comparator of the dynamic variable to obtain the target comparator.
It should be noted that, by creating the target script according to the configuration type and the comparison mode, taking the target script as the initial comparator, and inheriting the preset abstract class through the initial comparator to obtain the target comparator, a new comparator can be quickly expanded and generated, so that the maintenance time of the comparator when the configuration data of the application program is configured and compared is reduced, and the configuration comparison efficiency is improved. The initial comparator inherits the preset abstract class to obtain the target comparator, and the comparison flow of the comparator is normalized by using the preset abstract class.
Optionally, in the configuration comparison method provided by the embodiment of the present application, before performing configuration comparison on the target configuration data by the target comparator, before obtaining a comparison result, the configuration comparison method further includes: the system can detect whether the comparison rule information exists in a preset database; under the condition that comparison rule information exists in a preset database, the system allows configuration comparison operation to be executed, wherein the configuration comparison operation is used for carrying out configuration comparison on target configuration data through a target comparator, and a comparison result is obtained; and under the condition that the comparison rule information does not exist in the preset database, the system prohibits the execution of the configuration comparison operation.
In order to avoid the problem of configuration comparison failure caused by the definition error of the comparison rule information, in this embodiment, the system may check the comparison rule information by detecting whether the comparison rule information exists in the preset database. Specifically, under the condition that comparison rule information exists in a preset database, allowing configuration comparison of target configuration data through a target comparator to obtain a comparison result; under the condition that comparison rule information does not exist in the preset database, the configuration comparison of the target configuration data through the target comparator is forbidden, and a comparison result is obtained. The detection of whether the comparison rule information exists in the preset database can be performed by detecting whether the information such as an application program, a deployment environment and the like in the comparison rule information exists in the database.
Optionally, in the configuration comparison method provided by the embodiment of the present application, obtaining, by the target comparator, M first comparison data lists corresponding to the target configuration data includes: the system can acquire the data range of the contrast data corresponding to the target configuration data; and then obtaining M first comparison data lists corresponding to the target configuration data according to the data range of the comparison data through the target comparator.
Optionally, in the configuration comparison method provided by the embodiment of the present application, the configuration comparison is performed on the target configuration data by the target comparator, so as to obtain a comparison result, including: the system can obtain M first comparison data lists corresponding to target configuration data through a target comparator, wherein each first comparison data list comprises N pieces of first configuration data to be compared, and M, N is a positive integer; then the system can convert the data type of each piece of first configuration data in N pieces of first configuration data in each first comparison data list into a mapping type based on a Java reflection mechanism to obtain M pieces of second comparison data lists, wherein each piece of second comparison data list comprises N pieces of second configuration data to be compared, a main key corresponding to each piece of second configuration data is an attribute name corresponding to the piece of second configuration data, and a key value corresponding to each piece of second configuration data is an attribute value corresponding to the piece of second configuration data; and finally, the system can compare the second configuration data in the M second comparison data lists through the target comparator to obtain a comparison result.
Optionally, in the configuration comparison method provided by the embodiment of the present application, comparing, by the target comparator, second configuration data in the M second comparison data lists to obtain a comparison result, including: the system can acquire a preset metadata table, wherein the preset metadata table at least comprises unique attributes corresponding to target configuration data and target attribute information corresponding to the target configuration data, and the target attribute information is used for representing configuration data needing configuration comparison in second configuration data; then, converting each second comparison data list into a mapping type list according to the unique attribute to obtain M third comparison data lists, wherein each third comparison data list comprises N pieces of third configuration data to be compared, a main key corresponding to each piece of third configuration data is an attribute value corresponding to the unique attribute, and a key value corresponding to each piece of third configuration data is second configuration data corresponding to the third configuration data; and finally, the system can compare the key value corresponding to the primary key according to the primary key corresponding to each piece of third configuration data and the target attribute information through the target comparator, and a comparison result is obtained.
In this embodiment, the system may obtain, by comparing rule information, a data range of comparison data corresponding to the target configuration data, and then obtain, by a configuration data query function in the target comparator, M first comparison data lists (List (data source 1) and List (data source 2) shown in fig. 3) corresponding to the target configuration data according to the data range of the comparison data, where each first comparison data List includes N pieces of first configuration data to be compared, for example, user (name: three, age 20), user (name: four, age 21), user (name: five, age 22) in List (data source 2) shown in fig. 3, and User (name: four, age 21), user (name: zhao Liu, age 22) in List (data source 1) shown in fig. 3.
Further, the system may convert the data type of each of the N pieces of first configuration data in each of the first comparison data lists into a mapping type (i.e., map type) through a Java reflection mechanism, resulting in M pieces of second comparison data lists, for example, list2 (data source 1), list2 (data source 2) as shown in fig. 3. Wherein, the primary key corresponding to each piece of second configuration data is an attribute name corresponding to the piece of second configuration data, and the key value corresponding to each piece of second configuration data is an attribute value corresponding to the piece of second configuration data, for example, as shown in fig. 3, in Map (key: name, value: zhang three; key: age, value: 20), map (key: name, value: li four; key: age, value: 21), map (key: name, value: wang five; key: age, value: 22) in List2 (data source 1); map (key: name, value: zhang three; key: age, value: 21), map (key: name, value: lifour; key: age, value: 21), map (key: name, value: zhao Liu; key: age, value: 22) in List2 (data source 2) shown in fig. 3.
Further, the system may further include a preset metadata table shown in fig. 3, where the preset metadata table includes a unique attribute (for example, name in fig. 3) corresponding to the target configuration data and target attribute information (for example, a required comparison attribute, age, shown in fig. 3) corresponding to the target configuration data. The system may translate each second comparison data list into a list of mapping types based on unique attributes, resulting in M third comparison data lists, e.g., map < String, object > > (data source 1) and Map < String, object > > (data source 2) as shown in FIG. 3. Wherein, the primary key corresponding to each third configuration data is an attribute value corresponding to a unique attribute, and the key value corresponding to each third configuration data is second configuration data corresponding to the third configuration data, for example, keys in Map < String, object > > (data source 1) shown in fig. 3: zhang three, value: map (key: name, value: zhang san; key: age, value: 20), etc.; key in Map < String, object > > (data source 2): zhao Liu, value: map (key: name, value: zhao Liu; key: age, value: 22), and the like.
Further, the system may compare the key value corresponding to the primary key according to the primary key and the target attribute information corresponding to each piece of the third configuration data by using the target comparator, so as to obtain a comparison result (for example, in the comparison result shown in fig. 3, the configuration information of Zhang three is modified, the configuration information of Lisi four is not different, the configuration information of Wang five is deleted, and the configuration information of Zhao Liu is newly added).
It should be noted that, the target comparator is used for carrying out configuration comparison on the target configuration data according to the Java reflection mechanism and the custom preset metadata table to obtain a comparison result, so that the configuration comparison on the target configuration data through a unified comparison flow in a preset abstract class in the target comparator is realized, the maintainability and expandability of the comparator are improved, the maintenance time of the comparator when the configuration data of an application program is configured and compared is reduced, the technical effect of improving the configuration comparison efficiency is realized, and the technical problem that the configuration comparison efficiency is lower when the configuration data of the application program is configured and compared in the prior art is solved.
Optionally, in the configuration comparison method provided by the embodiment of the present application, after performing configuration comparison on target configuration data by using a target comparator, the method further includes: the system can acquire display information corresponding to the target configuration data from a preset metadata table, wherein the display information is used for representing field information to be displayed in the comparison result; and then generating a target file according to the display information and the comparison result, and displaying the target file in the target page.
In this embodiment, the comparison module of the system may obtain display information corresponding to the target configuration data from a preset metadata table, for example, a field header required to be displayed for a comparison result in the preset metadata table shown in fig. 3: user name, age, and fields to be displayed: name, age. The system may then generate a target file as shown in fig. 3 according to the display information and the comparison result, and display the target file in the target page for the user to view.
Optionally, the display information in the preset metadata table may also be information such as a cell format, a cell color, and the like of the target file.
It should be noted that, by generating the target file according to the display information and the comparison result and displaying the target file in the target page, the user can intuitively see the abnormal condition of the target configuration data in the current deployment environment through the target file displayed in the target page, thereby improving the experience of the user.
Therefore, the configuration comparison method provided by the application standardizes the comparison flow by utilizing the abstract class. Variable comparison and result generation can be uniformly realized by using java reflection and metadata definition, so that the code maintainability and expandability are improved, and meanwhile, a new comparator can be quickly expanded and generated by inheriting and comparing abstract classes. The factory mode decoupling service is utilized, namely, when a comparison process is initiated, a comparison method of a specific comparator (namely, an abstract class) is not concerned with, only the specific comparator is needed to be used, the selection of the specific comparator is determined by a factory, complex comparison implementation details are shielded, service coupling is reduced, the original initiation comparison process is not needed to be modified because of a new comparator, the maintenance time of the comparator when configuration comparison is carried out on configuration data of an application program is reduced, the technical effect of improving the configuration comparison efficiency is achieved, the technical problem that the configuration comparison efficiency is low when the configuration comparison is carried out on the configuration data of the application program in the prior art is solved, and the production risk is reduced.
Example 2
According to an embodiment of the present application, there is provided an embodiment of a configuration contrast device, wherein fig. 4 is a schematic diagram of an alternative configuration contrast device according to an embodiment of the present application, as shown in fig. 4, and the device includes:
the obtaining module 401 is configured to obtain comparison rule information corresponding to target configuration data, where the target configuration data is configuration data of a target application program, and the comparison rule information at least includes a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data;
a determining module 402, configured to determine, based on the configuration type and the comparison mode, a target comparator corresponding to the target configuration data, where the target comparator is a comparator that inherits a preset abstract class, and the preset abstract class is used to normalize a comparison flow of the target configuration data;
the comparison module 403 is configured to perform configuration comparison on the target configuration data through the target comparator, so as to obtain a comparison result, where the comparison result is used to characterize an abnormal situation of the target configuration data in the current deployment environment.
It should be noted that the above-mentioned obtaining module 401, determining module 402, and comparing module 403 correspond to steps S101 to S103 in the above-mentioned embodiment 1, and the three modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in the above-mentioned embodiment 1.
Optionally, the determining module includes: the creating unit is used for creating a target script according to the configuration type and the comparison mode, and taking the target script as an initial comparator; and the inheritance unit is used for inheriting the preset abstract class through the initial comparator to obtain the target comparator.
Optionally, the configuration contrast device further comprises: the detection module is used for detecting whether the comparison rule information exists in a preset database or not before the comparison result is obtained by carrying out configuration comparison on the target configuration data through the target comparator; the permission execution module is used for permitting execution of configuration comparison operation under the condition that comparison rule information exists in a preset database, wherein the configuration comparison operation is used for carrying out configuration comparison on target configuration data through a target comparator to obtain a comparison result; and the execution prohibition module is used for prohibiting the execution of configuration comparison operation under the condition that the comparison rule information does not exist in the preset database.
Optionally, the comparison module includes: the first acquisition unit is used for acquiring M first comparison data lists corresponding to the target configuration data through the target comparator, wherein each first comparison data list comprises N pieces of first configuration data to be compared, and M, N is a positive integer; the first conversion unit is used for converting the data type of each piece of first configuration data in N pieces of first configuration data in each first comparison data list into a mapping type based on a Java reflection mechanism to obtain M pieces of second comparison data lists, wherein each piece of second comparison data list comprises N pieces of second configuration data to be compared, a main key corresponding to each piece of second configuration data is an attribute name corresponding to the piece of second configuration data, and a key value corresponding to each piece of second configuration data is an attribute value corresponding to the piece of second configuration data; the first comparison unit is used for comparing the second configuration data in the M second comparison data lists through the target comparator to obtain comparison results.
Optionally, the first contrast unit includes: the second acquisition unit is used for acquiring a preset metadata table, wherein the preset metadata table at least comprises unique attributes corresponding to target configuration data and target attribute information corresponding to the target configuration data, and the target attribute information is used for representing configuration data needing configuration comparison in the second configuration data; the second conversion unit is used for converting each second comparison data list into a mapping type list according to the unique attribute to obtain M third comparison data lists, wherein each third comparison data list comprises N pieces of third configuration data to be compared, a main key corresponding to each piece of third configuration data is an attribute value corresponding to the unique attribute, and a key value corresponding to each piece of third configuration data is second configuration data corresponding to the third configuration data; and the second comparison unit is used for comparing the key value corresponding to the main key according to the main key corresponding to each piece of third configuration data and the target attribute information through the target comparator to obtain a comparison result.
Optionally, the first acquisition unit includes: the third acquisition unit is used for acquiring the data range of the contrast data corresponding to the target configuration data; and the fourth acquisition unit is used for acquiring M first comparison data lists corresponding to the target configuration data according to the data range of the comparison data through the target comparator.
Optionally, the configuration contrast device further comprises: the first acquisition module is used for carrying out configuration comparison on the target configuration data through the target comparator, acquiring display information corresponding to the target configuration data from a preset metadata table after a comparison result is obtained, wherein the display information is used for representing field information to be displayed in the comparison result; and the generating module is used for generating a target file according to the display information and the comparison result and displaying the target file in the target page.
Example 3
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the configuration comparison method in embodiment 1 described above at runtime.
Example 4
According to another aspect of the embodiments of the present application, there is also provided an electronic device, wherein fig. 5 is a schematic diagram of an alternative electronic device according to an embodiment of the present application, as shown in fig. 5, the electronic device including one or more processors; and a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running the programs, wherein the programs are configured to perform the configuration comparison method in embodiment 1 described above when run.
As shown in fig. 5, an embodiment of the present application provides an electronic device, where the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, the following steps are implemented:
obtaining comparison rule information corresponding to target configuration data, wherein the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data; determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data; and carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
Optionally, the processor when executing the program further implements the following steps: creating a target script according to the configuration type and the comparison mode, and taking the target script as an initial comparator; and inheriting a preset abstract class through the initial comparator to obtain the target comparator.
Optionally, the processor when executing the program further implements the following steps: before configuring and comparing the target configuration data through the target comparator to obtain a comparison result, detecting whether comparison rule information exists in a preset database; under the condition that comparison rule information exists in a preset database, allowing to execute configuration comparison operation, wherein the configuration comparison operation is used for carrying out configuration comparison on target configuration data through a target comparator to obtain a comparison result; and under the condition that the comparison rule information does not exist in the preset database, prohibiting the execution of configuration comparison operation.
Optionally, the processor when executing the program further implements the following steps: obtaining M first comparison data lists corresponding to target configuration data through a target comparator, wherein each first comparison data list comprises N pieces of first configuration data to be compared, and M, N is a positive integer; converting the data type of each piece of first configuration data in N pieces of first configuration data in each first comparison data list into a mapping type based on a Java reflection mechanism to obtain M pieces of second comparison data lists, wherein each piece of second comparison data list comprises N pieces of second configuration data to be compared, a main key corresponding to each piece of second configuration data is an attribute name corresponding to the piece of second configuration data, and a key value corresponding to each piece of second configuration data is an attribute value corresponding to the piece of second configuration data; and comparing the second configuration data in the M second comparison data lists through the target comparator to obtain a comparison result.
Optionally, the processor when executing the program further implements the following steps: acquiring a preset metadata table, wherein the preset metadata table at least comprises unique attributes corresponding to target configuration data and target attribute information corresponding to the target configuration data, and the target attribute information is used for representing configuration data needing configuration comparison in second configuration data; converting each second comparison data list into a mapping type list according to the unique attribute to obtain M third comparison data lists, wherein each third comparison data list comprises N pieces of third configuration data to be compared, a main key corresponding to each piece of third configuration data is an attribute value corresponding to the unique attribute, and a key value corresponding to each piece of third configuration data is second configuration data corresponding to the third configuration data; and comparing key values corresponding to the primary keys according to the primary keys corresponding to each piece of third configuration data and the target attribute information by the target comparator to obtain a comparison result.
Optionally, the processor when executing the program further implements the following steps: acquiring a data range of contrast data corresponding to the target configuration data; and obtaining M first comparison data lists corresponding to the target configuration data according to the data range of the comparison data through the target comparator.
Optionally, the processor when executing the program further implements the following steps: after the target configuration data is configured and compared through the target comparator, obtaining a comparison result, display information corresponding to the target configuration data is obtained from a preset metadata table, wherein the display information is used for representing field information to be displayed in the comparison result; and generating a target file according to the display information and the comparison result, and displaying the target file in the target page.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of units may be a logic function division, and there may be another division manner in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.

Claims (10)

1. A configuration contrast method, comprising:
obtaining comparison rule information corresponding to target configuration data, wherein the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data;
determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data;
and carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
2. The method of claim 1, wherein determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode comprises:
Creating a target script according to the configuration type and the comparison mode, and taking the target script as an initial comparator;
and inheriting the preset abstract class through the initial comparator to obtain the target comparator.
3. The method of claim 1, wherein prior to performing configuration comparison on the target configuration data by the target comparator, the method further comprises:
detecting whether the comparison rule information exists in a preset database;
allowing to execute configuration comparison operation under the condition that the comparison rule information exists in the preset database, wherein the configuration comparison operation is used for carrying out configuration comparison on the target configuration data through the target comparator to obtain the comparison result;
and under the condition that the comparison rule information does not exist in the preset database, prohibiting the execution of the configuration comparison operation.
4. The method of claim 1, wherein performing configuration comparison on the target configuration data by the target comparator to obtain a comparison result comprises:
obtaining M first comparison data lists corresponding to the target configuration data through the target comparator, wherein each first comparison data list comprises N pieces of first configuration data to be compared, and M, N is a positive integer;
Converting the data type of each piece of first configuration data in N pieces of first configuration data in each first comparison data list into a mapping type based on a Java reflection mechanism to obtain M pieces of second comparison data lists, wherein each piece of second comparison data list comprises N pieces of second configuration data to be compared, a main key corresponding to each piece of second configuration data is an attribute name corresponding to the piece of second configuration data, and a key value corresponding to each piece of second configuration data is an attribute value corresponding to the piece of second configuration data;
and comparing the second configuration data in the M second comparison data lists through the target comparator to obtain the comparison result.
5. The method of claim 4, wherein comparing, by the target comparator, the second configuration data in the M second comparison data lists to obtain the comparison result, comprising:
acquiring a preset metadata table, wherein the preset metadata table at least comprises unique attributes corresponding to the target configuration data and target attribute information corresponding to the target configuration data, and the target attribute information is used for representing configuration data needing configuration comparison in the second configuration data;
Converting each second comparison data list into a mapping type list according to the unique attribute to obtain M third comparison data lists, wherein each third comparison data list comprises N pieces of third configuration data to be compared, a main key corresponding to each piece of third configuration data is an attribute value corresponding to the unique attribute, and a key value corresponding to each piece of third configuration data is second configuration data corresponding to the third configuration data;
and comparing key values corresponding to the primary keys according to the primary keys corresponding to each piece of third configuration data and the target attribute information by the target comparator to obtain a comparison result.
6. The method of claim 4, wherein obtaining, by the target comparator, M first comparison data lists corresponding to the target configuration data, comprises:
acquiring a data range of contrast data corresponding to the target configuration data;
and acquiring M first comparison data lists corresponding to the target configuration data according to the data range of the comparison data through the target comparator.
7. The method of claim 5, wherein after performing configuration comparison on the target configuration data by the target comparator to obtain a comparison result, the method further comprises:
Display information corresponding to the target configuration data is obtained from the preset metadata table, wherein the display information is used for representing field information to be displayed in the comparison result;
and generating a target file according to the display information and the comparison result, and displaying the target file in a target page.
8. A configuration contrast device, comprising:
the system comprises an acquisition module, a comparison module and a comparison module, wherein the acquisition module is used for acquiring comparison rule information corresponding to target configuration data, the target configuration data is configuration data of a target application program, and the comparison rule information at least comprises a configuration type of the target configuration data and a comparison mode corresponding to the target configuration data;
the determining module is used for determining a target comparator corresponding to the target configuration data based on the configuration type and the comparison mode, wherein the target comparator is a comparator inheriting a preset abstract class, and the preset abstract class is used for standardizing the comparison flow of the target configuration data;
the comparison module is used for carrying out configuration comparison on the target configuration data through the target comparator to obtain a comparison result, wherein the comparison result is used for representing the abnormal condition of the target configuration data in the current deployment environment.
9. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program is arranged to execute the configuration comparison method according to any of the claims 1 to 7 when run.
10. An electronic device comprising one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the configuration contrast method of any of claims 1-7.
CN202310892231.7A 2023-07-19 2023-07-19 Configuration comparison method and device, storage medium and electronic equipment Pending CN117093253A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310892231.7A CN117093253A (en) 2023-07-19 2023-07-19 Configuration comparison method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310892231.7A CN117093253A (en) 2023-07-19 2023-07-19 Configuration comparison method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117093253A true CN117093253A (en) 2023-11-21

Family

ID=88774217

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310892231.7A Pending CN117093253A (en) 2023-07-19 2023-07-19 Configuration comparison method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117093253A (en)

Similar Documents

Publication Publication Date Title
US10657264B2 (en) Techniques for correlating vulnerabilities across an evolving codebase
US10324909B2 (en) Omega names: name generation and derivation utilizing nested three or more attributes
Nandi et al. Automatic trigger generation for rule-based smart homes
US9483508B1 (en) Omega names: name generation and derivation
US20160162539A1 (en) Computer executable method of generating analysis data and apparatus performing the same and storage medium for the same
CN112579461A (en) Assertion processing method, system and storage medium
US9367307B2 (en) Staged points-to analysis for large code bases
CN113535141A (en) Database operation code generation method and device
CN114048227A (en) SQL statement anomaly detection method, device, equipment and storage medium
CN117093253A (en) Configuration comparison method and device, storage medium and electronic equipment
CN113055410B (en) Cloud resource management method, device, equipment, system and readable storage medium
CN113672233B (en) Server out-of-band management method, device and equipment based on Redfish
CN111142852B (en) Interface conversion function generation method and device
CN114153435A (en) EB2S system for intelligent contract code design and generation and use method
CN114527993A (en) Application deployment method, device, equipment and medium
Kummita et al. Integration of the Static Analysis Results Interchange Format in CogniCrypt
CN113448584B (en) APP version management method, device, medium and computer equipment
CN117056213A (en) Software testing method and device, electronic equipment and storage medium
CN116719823A (en) Service system development method and device
CN118210482A (en) Code generation method, device, computer equipment and storage medium
CN118734369A (en) Data detection method and device, computer equipment, medium and product
CN117609275A (en) Interface calling method, device, storage medium and computer equipment
CN116484333A (en) Authority control method and device for modifying source code variable and electronic equipment
CN118972276A (en) Method and device for detecting overtime of network signal
Ranković et al. Misconfiguration prevention and error cause detection for distributed-cloud applications

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