CN114330278A - Method and equipment for judging consistency of returned data - Google Patents
Method and equipment for judging consistency of returned data Download PDFInfo
- Publication number
- CN114330278A CN114330278A CN202111592668.6A CN202111592668A CN114330278A CN 114330278 A CN114330278 A CN 114330278A CN 202111592668 A CN202111592668 A CN 202111592668A CN 114330278 A CN114330278 A CN 114330278A
- Authority
- CN
- China
- Prior art keywords
- data
- configuration file
- fields
- values
- json objects
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 36
- 230000015654 memory Effects 0.000 claims abstract description 43
- 230000005540 biological transmission Effects 0.000 claims description 11
- 238000007493 shaping process Methods 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 claims description 3
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 238000004590 computer program Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000005291 magnetic effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 230000003936 working memory Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The method comprises the steps of reading configuration files corresponding to returned data of different data platforms; dividing each read configuration file to obtain configuration files of a plurality of fields, and storing the configuration files of the plurality of fields in an internal memory; acquiring configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and converting the configuration file objects of each field into JSON objects; and comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result. Therefore, whether the data returned by different platforms are completely consistent or not can be uniformly processed, and the form of the configuration file is provided to support extension.
Description
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for determining consistency of returned data.
Background
Generally, an ES (elastic search) needs to be upgraded completely, so as to facilitate maintenance and unified management, when the versions are not unified, the ES is upgraded to a fixed version uniformly, and meanwhile, an authority control is also added to the ES, so that data needs to be checked when the ES is migrated, and a problem of data inconsistency caused by a change in a transmission data type between different versions (especially under the condition of a large version span) is prevented, and a tool for judging whether data returned by two data platforms (such as ES databases of different versions) are completely consistent is not provided at present.
Disclosure of Invention
An object of the present application is to provide a method and an apparatus for determining consistency of returned data, which can perform uniform processing on whether data returned by different platforms are completely consistent, and provide a form of configuration file to support extension.
According to one aspect of the application, a method for judging consistency of returned data is provided, and the method comprises the following steps:
reading configuration files corresponding to returned data of different data platforms;
dividing each read configuration file to obtain configuration files of a plurality of fields, and storing the configuration files of the plurality of fields in an internal memory;
acquiring configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and converting the configuration file objects of each field into JSON objects;
and comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result.
Optionally, reading configuration files corresponding to return data of different data platforms includes:
judging whether the returned data of different data platforms transmit program parameters or not to obtain a judgment result;
and determining the path of the corresponding configuration file according to the judgment result, and reading the configuration file according to the path of the corresponding configuration file.
Optionally, determining a path of a corresponding configuration file according to the determination result, and reading the configuration file according to the path of the corresponding configuration file includes:
when the judgment result is that the program parameters are transmitted, reading the set parameters as the path of the configuration file, and reading the configuration file according to the set parameters;
and when the judgment result is that the program parameters are not transmitted, taking the directory where the return data is located as a path of the configuration file, and reading the configuration file from the directory.
Optionally, comparing current fields of JSON objects corresponding to every two data platforms by using a preset judgment logic to obtain a consistency result, where the consistency result includes:
and taking the current fields of the JSON objects corresponding to every two data platforms as transmission parameters to be transmitted to a tool class containing preset judgment logic, and comparing the transmitted transmission parameters in the tool class by using the preset judgment logic to obtain a consistency result.
Optionally, comparing the transmitted transmission parameters with the preset judgment logic in the tool class to obtain a consistency result, where the consistency result includes:
judging whether the transmission parameters of the current fields of the JSON objects corresponding to every two data platforms are empty in the tool class, if so, the returned data of the data platforms corresponding to the two JSON objects are consistent, and if one of the returned data is not empty, the returned data of the data platforms corresponding to the two JSON objects are inconsistent;
and if neither of the two JSON objects is empty, adding keys of the current fields of the two JSON objects into an unordered set, traversing the unordered set, acquiring values of the current fields of the two JSON objects from the unordered set, comparing the values, and obtaining a consistency result according to the comparison of the values.
Optionally, obtaining values of current fields of the two JSON objects from the unordered set, and performing value comparison, and obtaining a consistency result according to the value comparison, including:
traversing all fields of the two JSON objects in the unordered set, obtaining values of the two current fields and comparing the values of the two current fields;
if only one of the values of the two current fields is null, the returned data of the data platforms corresponding to the two JSON objects are inconsistent;
if the values of the two current fields are not null, comparing whether the values of the two current fields are consistent, if not, continuously judging the types of the values of the two current fields, and obtaining a consistency result according to the types.
Optionally, continuously judging the types of the values of the two current fields, and obtaining a consistency result according to the types, including:
if one of the two current field values is a long shaping type and the other is a character string type, analyzing the value of the character type according to a formatting format in the configuration file;
and if the value obtained by analysis is equal to the value of the long shaping type, continuously traversing the next field, and if the values corresponding to all the fields are equal, enabling the returned data of the data platforms corresponding to the two JSON objects to be consistent.
Optionally, the configuration file includes a format that configures a plurality of date formatting.
According to another aspect of the present application, there is also provided an apparatus for determining consistency of returned data, the apparatus including:
the reading device is used for reading configuration files corresponding to the returned data of different data platforms;
the segmenting device is used for segmenting each read configuration file to obtain a plurality of fields of configuration files, and storing the plurality of fields of configuration files into the memory;
the conversion device is used for acquiring the configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform and converting the configuration file objects of each field into JSON objects;
and the comparison device is used for comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result.
According to another aspect of the present application, there is also provided an apparatus for determining consistency of returned data, the apparatus including:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method as previously described.
According to yet another aspect of the present application, there is also provided a computer readable medium having computer readable instructions stored thereon, the computer readable instructions being executable by a processor to implement the method as described above.
Compared with the prior art, the configuration files corresponding to the returned data of different data platforms are read; dividing each read configuration file to obtain configuration files of a plurality of fields, and storing the configuration files of the plurality of fields in an internal memory; acquiring configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and converting the configuration file objects of each field into JSON objects; and comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result. Therefore, whether the data returned by different platforms are completely consistent or not can be uniformly processed, and the form of the configuration file is provided to support extension.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 illustrates a flow diagram of a method for determining returned data consistency, provided in accordance with an aspect of the subject application;
FIG. 2 is a flow diagram illustrating tool class initialization according to an embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating a process of reading a configuration file according to an embodiment of the present application;
fig. 4 is a schematic structural diagram illustrating an apparatus for determining consistency of returned data according to another aspect of the present application.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (e.g., Central Processing Units (CPUs)), input/output interfaces, network interfaces, and memory.
The Memory may include volatile Memory in a computer readable medium, Random Access Memory (RAM), and/or nonvolatile Memory such as Read Only Memory (ROM) or flash Memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, Phase-Change RAM (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash Memory or other Memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassette tape, magnetic tape storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
Fig. 1 is a schematic flow chart illustrating a method for determining consistency of returned data according to an aspect of the present application, where the method includes: S11-S14, wherein in the S11, configuration files corresponding to the return data of different data platforms are read; step S12, each read configuration file is divided to obtain configuration files of a plurality of fields, and the configuration files of the plurality of fields are stored in an internal memory; step S13, acquiring configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and converting the configuration file objects of each field into JSON objects; and step S14, comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result. Therefore, whether the data returned by different platforms are completely consistent or not is uniformly processed, a consistency result can be obtained, and the extension can be supported through the provided configuration file.
Specifically, in step S11, configuration files corresponding to the return data of different data platforms are read; the data objects returned by different data platforms may not be consistent, a tool class may be used for verification, the returned data of the different platforms are firstly transmitted into the tool class, and the returned data of the different data platforms are configured with a configuration file, wherein the configuration file comprises a data format of data, and the tool class firstly reads a configuration file corresponding to the returned data of the different data platforms which need to be judged for consistency, so that the configuration file is used for judging the data consistency. Wherein the configuration file comprises a format configured for multiple date formatting. The configuration file is configured with a plurality of common date formatting formats, and if different regions or time zones are inconsistent, the configuration file can be supplemented with the configuration file, and the configuration file can also be customized to carry out assignment in a command or other places.
Specifically, in step S12, each read configuration file is divided to obtain configuration files with a plurality of fields, and the configuration files with the plurality of fields are stored in the memory; here, the read configuration file is divided, for example, by rows, into fields to obtain configuration files of a plurality of fields, and the configuration files of the fields are stored in a memory (for example, a JVM memory) for subsequent use.
Specifically, in step S13, the configuration file object of the plurality of fields corresponding to each data platform is obtained from the memory based on the return data of each data platform, and the configuration file object of each field is converted into a JSON object; here, the configuration file objects of the multiple fields corresponding to the return data are obtained from the memory according to the return data to be compared, for example, the return data to be compared may be from multiple different data platforms, the configuration files of the multiple fields obtained by cutting the configuration file of the return data of each platform need to be taken out from the memory, and the read configuration file of each field is used as the configuration file object, so that the configuration file object of each field is converted into a JSON object, and the fields are compared one by one.
Specifically, in step S14, the current fields of the JSON objects corresponding to each two data platforms are compared by using a preset judgment logic, so as to obtain a consistency result. Here, the JSON objects of every two different data platform sources are compared according to a preset judgment logic set inside the tool class, for example, when there are two data platforms, the JSON objects of the two data platforms are compared, and the JSON objects are compared one by one according to the fields to obtain a consistency result.
In some embodiments of the present application, in step S11, it is determined whether the returned data of the different data platforms pass the program parameters, so as to obtain a determination result; and determining the path of the corresponding configuration file according to the judgment result, and reading the configuration file according to the path of the corresponding configuration file. In the method, whether the received return data of different data platforms transmit program parameters is judged in the tool class, so that corresponding configuration files are read according to the program parameters. Specifically, when the judgment result is that the program parameters are transmitted, reading the set parameters as the path of the configuration file, and reading the configuration file according to the set parameters; and when the judgment result is that the program parameters are not transmitted, taking the directory where the return data is located as a path of the configuration file, and reading the configuration file from the directory. Here, when the returned data transmits the program parameters, it indicates that the configuration file of the returned data can be called, and the set parameters read by the program parameters are taken as the path of the configuration file, so that the corresponding configuration file is read according to the path of the configuration file; when the returned data has no program parameters, the configuration file (data _ format. conf) in the same directory is directly read by default.
In a specific embodiment of the present application, as shown in fig. 2, a tool class is used to determine data consistency, the tool class automatically performs initialization work along with program startup, and when initialization is started, a configuration file (data _ format.conf) under a source directory (resources directory) under a current engineering directory of the tool class is obtained by default, multiple formats for date formatting are configured in the file, and each line is a configuration, for example: [ 'yyyyy-MM-dd HH: MM: ss' ], and 'yyyyy-MM-dd HH: MM: ss.SSS' ]. Acquiescently obtaining a data _ format.conf file under a resources directory under a current engineering directory using a tool class, reading the file content of the data _ format.conf and putting the file content into a memory so as to perform data analysis by using the tool class; subsequently, step S100 is executed, the specific content of step S100 includes steps S10, S101 to S105 and S201, as shown in fig. 3, S10, determining whether reading the date _ format. conf file is successful; when the reading is successful, S101, storing the file content in a memory in a character string array form; s102, marking the identifier (initialized) in the tool class as TRUE, and then S103, converting the data with the same id acquired from different platforms into JSON objects, so as to compare whether the fields and the values with the same number are the same or not; s104, starting to call an [ isSame ] method of the tool class, wherein the two parameters are JSON objects converted from the data with the same id acquired in the previous step (S103); and S105, judging whether the tool class is successfully initialized, if so, continuing to compare the data by using a preset judgment logic, and if not, throwing out 'initialization failure abnormity' to prompt a user that the comparison cannot be carried out. Conf file fails to be read, S201 is executed, the file fails to be read, and the user is prompted to throw an "initialization failure exception", which may be the absence of a profile or the absence of content of a profile, so that the profile under the default directory is used, and then S103 to S105 are executed.
In some embodiments of the present application, in step S14, the current field of the JSON object corresponding to every two data platforms is transferred to a tool class containing a preset judgment logic as a transfer parameter, and the transferred transfer parameters are compared in the tool class by using the preset judgment logic, so as to obtain a consistency result. When the number of the data platforms to be compared is at least two, taking every two data platforms as comparison objects, taking the JSON objects corresponding to every two data platforms as parameters and transmitting the JSON objects to a tool class, wherein the tool class comprises preset judgment logic, the transmitted JSON objects comprise a plurality of fields, comparing according to each field during comparison, traversing the fields of the JSON objects according to the preset judgment logic, and comparing current fields corresponding to different data platforms.
Then, judging whether the transmission parameters of the current fields of the JSON objects corresponding to every two data platforms are both null or not in the tool class, if so, the returned data of the data platforms corresponding to the two JSON objects are consistent, and if one of the returned data is not null, the returned data of the data platforms corresponding to the two JSON objects are inconsistent; and if neither of the two JSON objects is empty, adding keys of the current fields of the two JSON objects into an unordered set, traversing the unordered set, acquiring values of the current fields of the two JSON objects from the unordered set, comparing the values, and obtaining a consistency result according to the comparison of the values. Checking whether the transmission parameters are all null, if both are null, returning a TURE, indicating that the data are the same, if one is null and the other is not null, returning a FALSE, and if both are not null, adding keys (keys) of the current fields of the two objects into the unordered set, then traversing the unordered set, acquiring the values of the current fields of the two JSON objects, and comparing to obtain a consistency result.
Specifically, traversing all fields of two JSON objects in the unordered set, obtaining values of two current fields, and comparing the values of the two current fields; if only one of the values of the two current fields is null, the returned data of the data platforms corresponding to the two JSON objects are inconsistent; if the values of the two current fields are not null, comparing whether the values of the two current fields are consistent, if not, continuously judging the types of the values of the two current fields, and obtaining a consistency result according to the types. Traversing all fields of JSON objects in the unordered set, acquiring the values of the current fields of the two JSON objects, comparing the values of the current fields, if the two values are both null, indicating that the current fields are equal, and continuously traversing the next field; if only one of the two fields is null, the current fields and the values of the two JSONs are not equal, the jump-out traversal directly returns FALSE, if the current fields of the two JSONs are not null, the two current fields are compared to determine whether the values of the two current fields are consistent, and if the values of the two current fields are consistent, the traversal is continued until the traversal is completed or the jump-out traversal is performed under the condition of inconsistency.
If one of the two current field values is a long shaping type and the other is a character string type, analyzing the character type value according to the formatting format in the configuration file; and if the value obtained by analysis is equal to the value of the long shaping type, continuously traversing the next field, and if the values corresponding to all the fields are equal, enabling the returned data of the data platforms corresponding to the two JSON objects to be consistent. If the values of one current field are successfully analyzed and the values of the Long type are equal to the values of the Long type, the values of the current field are equal, the traversal is continued, and if the values of the Long type are not successful or the values of the Long type are not equal, the traversal is directly returned to FALSE. Through the conciseness of the JSON structure, whether the returned data of different data platforms are completely consistent or not is judged, other tool classes do not need to be additionally quoted, the tool can be applied to the upgrading of new tools or platforms in the service development process, so that the performance and the safety are improved, and the consistency of the upgraded data can be ensured.
In addition, the embodiment of the present application further provides a computer readable medium, on which computer readable instructions are stored, where the computer readable instructions are executable by a processor to implement the foregoing method for determining consistency of returned data.
Corresponding to the method described above, the present application also provides a terminal, which includes modules or units capable of executing the method steps described in fig. 1, fig. 2, fig. 3, or various embodiments, and these modules or units may be implemented by hardware, software, or a combination of hardware and software, and this application is not limited thereto. For example, in an embodiment of the present application, there is further provided an apparatus for determining consistency of returned data, where the apparatus includes:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method as previously described.
For example, the computer readable instructions, when executed, cause the one or more processors to:
reading configuration files corresponding to returned data of different data platforms;
dividing each read configuration file to obtain configuration files of a plurality of fields, and storing the configuration files of the plurality of fields in an internal memory;
acquiring configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and converting the configuration file objects of each field into JSON objects;
and comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result.
Fig. 4 is a schematic structural diagram illustrating an apparatus for determining consistency of returned data according to another aspect of the present application, where the apparatus includes: the device comprises a reading device 11, a dividing device 12, a converting device 13 and a comparing device 14, wherein the reading device 11 is used for reading configuration files corresponding to return data of different data platforms; the segmenting device 12 is configured to segment each read configuration file to obtain configuration files of a plurality of fields, and store the configuration files of the plurality of fields in the memory; the conversion device 13 is configured to obtain configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and convert the configuration file objects of each field into JSON objects; the comparison device 14 is configured to compare the current fields of the JSON objects corresponding to every two data platforms by using a preset judgment logic, so as to obtain a consistency result.
It should be noted that the content executed by the reading device 11, the dividing device 12, the converting device 13 and the comparing device 14 is the same as or corresponding to the content executed in the above steps S11, S12, S13 and S14, respectively, and for the sake of brevity, the description thereof is omitted.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Claims (11)
1. A method for judging consistency of returned data, which is characterized in that the method comprises the following steps:
reading configuration files corresponding to returned data of different data platforms;
dividing each read configuration file to obtain configuration files of a plurality of fields, and storing the configuration files of the plurality of fields in an internal memory;
acquiring configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform, and converting the configuration file objects of each field into JSON objects;
and comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result.
2. The method of claim 1, wherein reading configuration files corresponding to returned data of different data platforms comprises:
judging whether the returned data of different data platforms transmit program parameters or not to obtain a judgment result;
and determining the path of the corresponding configuration file according to the judgment result, and reading the configuration file according to the path of the corresponding configuration file.
3. The method according to claim 2, wherein determining a path of a corresponding configuration file according to the determination result, and reading a configuration file according to the path of the corresponding configuration file comprises:
when the judgment result is that the program parameters are transmitted, reading the set parameters as the path of the configuration file, and reading the configuration file according to the set parameters;
and when the judgment result is that the program parameters are not transmitted, taking the directory where the return data is located as a path of the configuration file, and reading the configuration file from the directory.
4. The method of claim 1, wherein comparing the current fields of the JSON objects corresponding to each two data platforms using a preset judgment logic to obtain a consistency result comprises:
and taking the current fields of the JSON objects corresponding to every two data platforms as transmission parameters to be transmitted to a tool class containing preset judgment logic, and comparing the transmitted transmission parameters in the tool class by using the preset judgment logic to obtain a consistency result.
5. The method of claim 4, wherein comparing the delivered delivery parameters in the tool class using the predetermined decision logic to obtain a consistency result comprises:
judging whether the transmission parameters of the current fields of the JSON objects corresponding to every two data platforms are empty in the tool class, if so, the returned data of the data platforms corresponding to the two JSON objects are consistent, and if one of the returned data is not empty, the returned data of the data platforms corresponding to the two JSON objects are inconsistent;
and if neither of the two JSON objects is empty, adding keys of the current fields of the two JSON objects into an unordered set, traversing the unordered set, acquiring values of the current fields of the two JSON objects from the unordered set, comparing the values, and obtaining a consistency result according to the comparison of the values.
6. The method of claim 5, wherein obtaining values of current fields of the two JSON objects from the unordered set and performing a comparison of the values, and wherein obtaining a consistency result from the comparison of the values comprises:
traversing all fields of the two JSON objects in the unordered set, obtaining values of the two current fields and comparing the values of the two current fields;
if only one of the values of the two current fields is null, the returned data of the data platforms corresponding to the two JSON objects are inconsistent;
if the values of the two current fields are not null, comparing whether the values of the two current fields are consistent, if not, continuously judging the types of the values of the two current fields, and obtaining a consistency result according to the types.
7. The method of claim 6, wherein continuing to determine the types of the values of the two current fields and obtaining a consistency result according to the types comprises:
if one of the two current field values is a long shaping type and the other is a character string type, analyzing the value of the character type according to a formatting format in the configuration file;
and if the value obtained by analysis is equal to the value of the long shaping type, continuously traversing the next field, and if the values corresponding to all the fields are equal, enabling the returned data of the data platforms corresponding to the two JSON objects to be consistent.
8. The method of any of claims 1 to 7, wherein the configuration file comprises a format that configures a plurality of date formatting.
9. An apparatus for determining consistency of returned data, the apparatus comprising:
the reading device is used for reading configuration files corresponding to the returned data of different data platforms;
the segmenting device is used for segmenting each read configuration file to obtain a plurality of fields of configuration files, and storing the plurality of fields of configuration files into the memory;
the conversion device is used for acquiring the configuration file objects of a plurality of fields corresponding to each data platform from the memory based on the return data of each data platform and converting the configuration file objects of each field into JSON objects;
and the comparison device is used for comparing the current fields of the JSON objects corresponding to every two data platforms by using preset judgment logic to obtain a consistency result.
10. An apparatus for determining consistency of returned data, the apparatus comprising:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method of any of claims 1 to 8.
11. A computer readable medium having computer readable instructions stored thereon which are executable by a processor to implement the method of any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111592668.6A CN114330278B (en) | 2021-12-23 | 2021-12-23 | Method and equipment for judging consistency of returned data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111592668.6A CN114330278B (en) | 2021-12-23 | 2021-12-23 | Method and equipment for judging consistency of returned data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114330278A true CN114330278A (en) | 2022-04-12 |
CN114330278B CN114330278B (en) | 2024-08-30 |
Family
ID=81055322
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111592668.6A Active CN114330278B (en) | 2021-12-23 | 2021-12-23 | Method and equipment for judging consistency of returned data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114330278B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117370398A (en) * | 2023-11-15 | 2024-01-09 | 航天信息(广东)有限公司 | Comparison method and device for changing data |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106021119A (en) * | 2016-08-03 | 2016-10-12 | 网易(杭州)网络有限公司 | Configuration file calibration method and device |
CN107346320A (en) * | 2016-05-06 | 2017-11-14 | 北京神州泰岳软件股份有限公司 | A kind of data calling method and device |
CN110727691A (en) * | 2019-10-22 | 2020-01-24 | 北京明略软件系统有限公司 | Data analysis and verification method and device |
CN111124479A (en) * | 2019-12-18 | 2020-05-08 | 北京像素软件科技股份有限公司 | Configuration file analysis method and system and electronic equipment |
-
2021
- 2021-12-23 CN CN202111592668.6A patent/CN114330278B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107346320A (en) * | 2016-05-06 | 2017-11-14 | 北京神州泰岳软件股份有限公司 | A kind of data calling method and device |
CN106021119A (en) * | 2016-08-03 | 2016-10-12 | 网易(杭州)网络有限公司 | Configuration file calibration method and device |
CN110727691A (en) * | 2019-10-22 | 2020-01-24 | 北京明略软件系统有限公司 | Data analysis and verification method and device |
CN111124479A (en) * | 2019-12-18 | 2020-05-08 | 北京像素软件科技股份有限公司 | Configuration file analysis method and system and electronic equipment |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117370398A (en) * | 2023-11-15 | 2024-01-09 | 航天信息(广东)有限公司 | Comparison method and device for changing data |
CN117370398B (en) * | 2023-11-15 | 2024-05-28 | 航天信息(广东)有限公司 | Comparison method and device for changing data |
Also Published As
Publication number | Publication date |
---|---|
CN114330278B (en) | 2024-08-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110069572B (en) | HIVE task scheduling method, device, equipment and storage medium based on big data platform | |
US20160283357A1 (en) | Call stack relationship acquiring method and apparatus | |
US11422917B2 (en) | Deriving software application dependency trees for white-box testing | |
CN108573019B (en) | Data migration method and device, electronic equipment and readable storage medium | |
CN110134583B (en) | Software testing and data processing method and device | |
CN113448862B (en) | Software version testing method and device and computer equipment | |
CN112363937A (en) | Method and device for testing differential coverage rate, computer equipment and storage medium | |
CN115794220A (en) | Software source migration method, device and system, computing device and readable storage medium | |
CN107168866B (en) | Parameter analysis method and device for configuration file | |
CN114816816A (en) | Collapse stack information processing method, device, equipment and storage medium | |
CN114330278B (en) | Method and equipment for judging consistency of returned data | |
CN110928941B (en) | Data fragment extraction method and device | |
CN112860507B (en) | Control method and device for sampling rate of distributed link tracking system | |
CN111767213B (en) | Database check point testing method and device, electronic equipment and storage medium | |
CN109446077A (en) | A kind of data library test method and device | |
CN110727565B (en) | Network equipment platform information collection method and system | |
CN111400245B (en) | Art resource migration method and device | |
CN107092671B (en) | Method and equipment for managing meta information | |
CN111736848B (en) | Packet conflict positioning method, device, electronic equipment and readable storage medium | |
CN113282504A (en) | Incremental code coverage rate detection method and service development method and device | |
CN112363944A (en) | Method and equipment for comparing return values of multiple environment interfaces | |
CN112988457A (en) | Data backup method, device and system and computer equipment | |
CN113051329B (en) | Data acquisition method, device, equipment and storage medium based on interface | |
CN112506736B (en) | Method and device for monitoring open state of office file | |
CN111857802A (en) | Method, system and equipment for merging request group integration |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |