A new configuration key identification method, a deployed application system, an electronic device, and a storage medium

CN121614199BActive Publication Date: 2026-10-16GUANGZHOU PINWEI SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511908702.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-10-16
Estimated Expiration
2045-12-17

AI Technical Summary

Technical Problem

[0009]本发明提供了一种新增配置键识别方法、部署应用系统、电子设备及存储介质,用于解决现有的新增配置键检测方法依赖人工核验,容易产生人为失误的技术问题

Benefits of technology

[0082] As can be seen from the above technical solution, the present invention has the following advantages: When a user successfully deploys an application to the application deployment system, the application deployment system sends a deployment success message to the testing tool platform; receives the scanning algorithm toolkit and shell script returned by the testing tool platform in response to the deployment success message; obtains the configuration key call relationship from the testing tool platform based on the scanning algorithm toolkit; executes the shell script to download the application's source code; obtains the configuration key based on the configuration key call relationship and the source code, and sends the configuration key to the testing tool platform; receives the newly added configuration key returned by the testing tool platform after recognizing the configuration key, and returns the newly added configuration key to the user. No manual verification is required; the recognition of newly added configuration keys can be automatically completed, thereby improving the efficiency and accuracy of newly added configuration key recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121614199B_ABST
    Figure CN121614199B_ABST
Patent Text Reader

Abstract

The application discloses a kind of newly added configuration key identification method, deployment application system, electronic equipment and storage medium, to solve the technical problem that existing newly added configuration key detection method relies on artificial verification, and is prone to human error.The present application comprises: when user successfully deploys application to deployment application system, deployment application system sends deployment success message to test tool platform;Receive the scanning algorithm toolkit and shell script returned in response to the deployment success message by test tool platform;According to the scanning algorithm toolkit, the pre-stored configuration key call relationship is obtained from the test tool platform;Execute shell script, download the source code of application;According to the configuration key call relationship and source code, obtain configuration key, and send configuration key to test tool platform;Receive the newly added configuration key returned by test tool platform to identify configuration key, and return the newly added configuration key to user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of configuration key recognition technology, and in particular to a method for recognizing new configuration keys, a deployment application system, an electronic device, and a storage medium. Background Technology

[0002] During product release, inadequate development practices or overlooked configuration dependencies can lead to release failures or anomalies during acceptance testing. This can range from minor rollbacks to serious malfunctions. To avoid such issues, it is crucial to strengthen the focus on and management of configuration dependencies.

[0003] The traditional testing and repair process is as follows:

[0004] 1. The developers developed the system based on the product requirements document and added a configuration key, but forgot to record it in the wiki document submitted for testing.

[0005] 2. When testers review the code, they identify the configuration keys based on the calling relationship of the configuration keys. Newly added configuration keys are identified manually.

[0006] 3. If it is discovered manually that a newly added configuration key is missing, and after the application is released to the production environment, the developers find that the configuration key is not effective or generates error logs, and the application does not meet the expected function, then the application will be rolled back.

[0007] 4. The testers notify the developers to fix the problem. After the developers have fixed the problem, they notify the testers to test the relevant functions of the configuration key. Once there are no problems, the system is released online.

[0008] However, the above steps rely on manual verification, which is prone to human error. Summary of the Invention

[0009] This invention provides a method for identifying newly added configuration keys, an application deployment system, an electronic device, and a storage medium, which solves the technical problem that existing methods for detecting newly added configuration keys rely on manual verification and are prone to human error.

[0010] This invention provides a method for identifying newly added configuration keys, applied to an application deployment system. The method includes:

[0011] When a user successfully deploys an application to the application deployment system, the application deployment system sends a deployment success message to the testing tool platform.

[0012] Receive the scanning algorithm toolkit and shell script returned by the testing tool platform in response to the deployment success message;

[0013] The configuration key call relationship is obtained from the test tool platform according to the scanning algorithm toolkit;

[0014] Execute the shell script to download the application's source code;

[0015] The configuration key is obtained based on the configuration key call relationship and the source code, and the configuration key is sent to the test tool platform;

[0016] The test tool platform receives the newly added configuration key returned by the configuration key and returns the newly added configuration key to the user.

[0017] Optionally, the step of calling the configuration key according to the configuration key call relationship and parsing the configuration key from the source code, and sending the configuration key to the testing tool platform, includes:

[0018] Traverse all Java files in the source code to collect class information and declaration information;

[0019] Based on the class information and the declaration information, analyze the method calls in various preset code structures to generate a method call object;

[0020] The invocation relationship and mapping relationship of all the method invocations are determined based on the method invocation object;

[0021] All configuration keys are obtained by matching the call relationship and the mapping relationship in the configuration key call relationship, and the configuration keys are sent to the test tool platform.

[0022] Optionally, the code structure includes a method structure; the declaration information includes method declarations; the step of analyzing method calls in various preset code structures based on the class information and generating a method call object includes:

[0023] Retrieve the method signature corresponding to the method declaration from the method signature cache;

[0024] Search for all first method call expressions in the method body corresponding to the method declaration;

[0025] Collect the first internal variables declared by the method;

[0026] Obtain all expression statements in the first method call expression, and identify the first variable declaration expression in the expression statements;

[0027] Extract the first initialization expression of the first internal variable based on the first variable declaration expression;

[0028] Establish a first internal variable mapping based on the first internal variable and the first initialization expression;

[0029] Parse the first method call expression to determine the called method, and obtain the called method signature, called method class name, and called method name of the called method;

[0030] A first initial method call object is generated using the called method signature, the called method class name, the called method name, and the method signature;

[0031] The call parameters are determined based on the first internal variable mapping and the first method call expression, as well as the first actual parameter value and the first type information of the call parameters;

[0032] The actual parameter values ​​and the type information are added to the first initial method call object to obtain the first method call object.

[0033] Optionally, the code structure includes static code blocks; the declaration information includes initialization block declarations; the step of analyzing method calls in various preset code structures based on the class information and generating method call objects includes:

[0034] Iterate through the initialization block declarations to obtain the static initialization block;

[0035] Find the second method call expression of the static initialization block;

[0036] Collect the second internal variable and the second variable declaration expression within the static initialization block;

[0037] Based on the second variable declaration expression, extract the second variable name and the second initialization expression of the variable with an initial value from the second internal variable;

[0038] Establish a mapping relationship between the second variable name and the second initialization expression to obtain the second internal variable mapping;

[0039] Search the method call cache for the first parsing result of the second method call expression;

[0040] A second initial method call object is created based on the first parsing result;

[0041] Based on the second method call expression and the second internal variable mapping, the second actual parameter value and second type information of each second internal variable are obtained;

[0042] The second actual parameter value and the second type information are added to the second initial method call object to obtain the second method call object.

[0043] Optionally, the code structure includes a field structure; the declaration information includes field declarations; the step of analyzing method calls in various preset code structures based on the class information and generating a method call object includes:

[0044] Obtain the third method call expression declared for the field;

[0045] Retrieve the second parsing result of the third method call expression from the method call cache;

[0046] A third initial method call object is created based on the second parsing result;

[0047] Obtain the third initialization expression for each variable in the field declaration;

[0048] Obtain the object creation expression from the third initialization expression;

[0049] Search the preset check type cache for the third parsing result of the object creation expression;

[0050] Obtain the complete description and type information of the construction type corresponding to the third parsing result;

[0051] Based on the complete description and the type information, match the constructor method in the preset third initial method call object;

[0052] The parameter expression is obtained according to the parameter index in the constructor, the target parameter is obtained from the parameter expression, and the target parameter is saved to the corresponding constant mapping set.

[0053] A third method call object is generated based on the set of constant mappings.

[0054] Optionally, the code structure includes a constructor; the declaration information includes class or interface declarations; the step of analyzing method calls in various preset code structures based on the class information and generating a method call object includes:

[0055] Retrieve the member declarations of each of the aforementioned classes or interfaces;

[0056] Obtain the constructor declaration from the member declarations;

[0057] Iterate through all statements in the constructor declaration to obtain the statement containing the fourth method call expression;

[0058] Collect local variable information from the statement;

[0059] Find the fourth variable declaration expression that contains the local variable information;

[0060] Extract the fourth variable name and the corresponding fourth initialization expression from the fourth variable declaration expression to obtain the local variable information with initial values;

[0061] Establish a mapping relationship between the fourth variable name and the fourth initialization expression to obtain the local variable mapping;

[0062] Parse the fourth method call expression to obtain the fourth parsing result;

[0063] A fourth initial method call object is generated based on the fourth parsing result;

[0064] Based on the fourth method call expression and the local variable mapping, the fourth actual parameter value and the fourth type information of the local variable information are obtained;

[0065] The fourth actual parameter value and the fourth type information are added to the fourth initial method call object to obtain the fourth method call object.

[0066] Optionally, the step of determining the call relationship and mapping relationship of all the method calls based on the method call object includes:

[0067] The method calls the object to generate a call relationship, and the call chain is established based on the call relationship.

[0068] Generate an enumeration map, a constant map, and an internal enumeration map based on the call chain;

[0069] The enumeration mapping, the constant mapping, and the internal enumeration mapping are respectively matched with the preset import declaration;

[0070] The successfully matched enumeration mapping, the constant mapping, and the internal enumeration mapping are used as mapping relationships.

[0071] The present invention also provides an application deployment system, comprising:

[0072] The deployment success message sending module is used to send a deployment success message to the testing tool platform when a user successfully deploys an application to the deployment application system.

[0073] The toolkit and script receiving module is used to receive the scanning algorithm toolkit and shell script returned by the test tool platform in response to the deployment success message;

[0074] The configuration key call relationship acquisition module is used to acquire the configuration key call relationship from the test tool platform based on the scanning algorithm toolkit.

[0075] The source code download module is used to execute the shell script and download the source code of the application;

[0076] The configuration key acquisition module is used to acquire the configuration key according to the configuration key call relationship and the source code, and send the configuration key to the test tool platform;

[0077] The module for returning a new configuration key is used to receive the new configuration key returned by the test tool platform after recognizing the configuration key, and to return the new configuration key to the user.

[0078] The present invention also provides an electronic device, the device comprising a processor and a memory:

[0079] The memory is used to store program code and transmit the program code to the processor;

[0080] The processor is configured to execute the new configuration key recognition method as described above, according to the instructions in the program code.

[0081] The present invention also provides a computer-readable storage medium for storing program code for executing the new configuration key recognition method as described in any of the preceding claims.

[0082] As can be seen from the above technical solution, the present invention has the following advantages: When a user successfully deploys an application to the application deployment system, the application deployment system sends a deployment success message to the testing tool platform; receives the scanning algorithm toolkit and shell script returned by the testing tool platform in response to the deployment success message; obtains the configuration key call relationship from the testing tool platform based on the scanning algorithm toolkit; executes the shell script to download the application's source code; obtains the configuration key based on the configuration key call relationship and the source code, and sends the configuration key to the testing tool platform; receives the newly added configuration key returned by the testing tool platform after recognizing the configuration key, and returns the newly added configuration key to the user. No manual verification is required; the recognition of newly added configuration keys can be automatically completed, thereby improving the efficiency and accuracy of newly added configuration key recognition. Attached Figure Description

[0083] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0084] Figure 1 A flowchart illustrating the steps of a newly added configuration key recognition method provided in an embodiment of the present invention;

[0085] Figure 2 A timing flowchart of a newly added configuration key recognition method provided in an embodiment of the present invention;

[0086] Figure 3 This is a timing flowchart of an application deployment system provided in an embodiment of the present invention. Detailed Implementation

[0087] This invention provides a method for identifying newly added configuration keys, an application deployment system, an electronic device, and a storage medium to solve the technical problem that existing methods for detecting newly added configuration keys rely on manual verification and are prone to human error.

[0088] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0089] Please see Figure 1 , Figure 1 A flowchart illustrating the steps of a newly added configuration key recognition method provided in an embodiment of the present invention.

[0090] This invention provides a method for recognizing newly added configuration keys, applied to an application deployment system. The method may specifically include the following steps:

[0091] Step 101: When the user successfully deploys the application to the application deployment system, the application deployment system sends a deployment success message to the testing tool platform.

[0092] In this embodiment of the invention, when a user deploys an application to the application deployment system, the testing tool platform can listen for the deployment success message sent by the application deployment system.

[0093] Step 102: Receive the scanning algorithm toolkit and shell script returned by the test tool platform in response to the successful deployment message;

[0094] When the testing tool platform receives a deployment success message, it can return the corresponding scanning algorithm toolkit and shell script to the deployment success message.

[0095] Step 103: Obtain the configuration key call relationship from the test tool platform based on the scanning algorithm toolkit;

[0096] After obtaining the scanning algorithm toolkit, you can use it to retrieve the configuration key call relationship from the testing tool platform.

[0097] Step 104: Execute the shell script to download the application's source code;

[0098] A shell script is a text file containing a series of commands. It is used to perform tasks in batches and automatically in the command-line interface (shell) of Unix / Linux systems.

[0099] Source code, also known as source code, is a human-readable text file written by a programmer in a programming language. It is the most primitive form of software and the starting point for creating computer programs.

[0100] After obtaining the shell script, you can execute it to download the application's source code.

[0101] Step 105: Obtain the configuration key based on the configuration key call relationship and source code, and send the configuration key to the test tool platform;

[0102] After obtaining the application's source code and configuration key call relationships, JavaParser technology can be used to parse out all configuration keys based on all configuration key call relationships and source code. The configuration keys can then be sent to the testing tool platform to analyze whether the configuration keys have changed.

[0103] In one example, the code structure includes the method structure; the declaration information includes the method declarations, and step 105 may include the following sub-steps:

[0104] S51, traverses all Java files in the source code, collecting class information and declaration information;

[0105] S52, analyzes method calls in various preset code structures based on class information and declaration information, and generates a method call object;

[0106] In one example, S52 may include the following sub-steps:

[0107] A1. Retrieve the method signature corresponding to the method declaration from the method signature cache;

[0108] A2, search for all first method call expressions in the method body corresponding to the method declaration;

[0109] A3 is the first internal variable declared in the collection method;

[0110] A4, retrieve all expression statements in the first method call expression, and identify the first variable declaration expression in the expression statements;

[0111] A5, extract the first initialization expression of the first internal variable based on the first variable declaration expression;

[0112] A6, Establish the mapping of the first internal variable based on the first internal variable and the first initialization expression;

[0113] A7, parse the first method call expression, determine the called method, and obtain the called method signature, the called method class name, and the called method name;

[0114] A8 generates the first initial method call object using the called method signature, the called method class name, the called method name, and the method signature;

[0115] A9, determine the call parameters, the first actual parameter value and the first type information of the call parameters based on the first internal variable mapping and the first method call expression;

[0116] A10 adds the actual parameter values ​​and type information to the first initial method call object to obtain the first method call object.

[0117] In the specific implementation, the process of identifying the calling procedure in the method structure is as follows:

[0118] 1. Initialization phase:

[0119] First, a shared method call analysis class is created to store information such as method parameters. This analyzer will be used for analyzing all subsequent methods. Two caches are also established:

[0120] Method signature cache: Stores the method signatures of processed methods to avoid duplicate calculations;

[0121] Parsing result caching: Stores parsed node information to improve parsing efficiency.

[0122] 2. Traverse the list of methods and process each method declaration as follows:

[0123] 2.1 Obtaining the method signature:

[0124] First, check if the method signature of the method already exists in the method signature cache; if it does not exist, calculate the method signature and store it in the cache; if obtaining the signature fails, skip the subsequent processing of the method.

[0125] 2.2 Collection method call:

[0126] Search for all first method call expressions in the current method body. If no method call is found, skip the subsequent processing of that method.

[0127] 2.3 Collection method internal variables:

[0128] The first variable inside the collection method:

[0129] Iterate through all statements in the method body, identify the first variable declaration expression in the expression statement; extract the variable name of the first internal variable and the corresponding first initialization expression, and establish a mapping from the first variable name to the first initialization expression of the first internal variable.

[0130] 3. Processing method call:

[0131] 3.1 Method call resolution:

[0132] For each first method call expression, attempt to directly parse the method call to obtain detailed information about the called method. If parsing fails, record the number of failures but continue processing other calls.

[0133] 3.2 Constructing the first initial method call object:

[0134] A successfully resolved method call will create a first initial method call object (such as a MethodCallObj object), which contains: the full signature of the called method, the class name of the called method (package name + class name), the method name of the called method, and the method signature of the current method.

[0135] 3.3 Analyze the calling parameters:

[0136] Analyze the parameters of the method call: pass in the method call expression and the first internal variable mapping collected, parse the first actual value and first type information of the parameter, and return a list of parameter analysis results.

[0137] 4. Result storage:

[0138] If the parameter analysis result is not empty:

[0139] Set the parameter list into the first initial method call object to obtain the first method call object, and add the first method call object to the final result list.

[0140] In one example, the code structure includes a static code block; step S52 may include the following sub-steps:

[0141] B1. Traverse the initialization block declarations to obtain the static initialization block;

[0142] B2. Find the second method call expression for the static initialization block;

[0143] B3. Collect the second internal variable and the second variable declaration expression inside the static initialization block;

[0144] B4. Extract the second variable name and the second initialization expression of the variable with an initial value from the second internal variable based on the second variable declaration expression;

[0145] B5. Establish the mapping relationship between the second variable name and the second initialization expression to obtain the second internal variable mapping;

[0146] B6. Search the method call cache for the first parsed result of the second method call expression;

[0147] B7. Create a second initial method call object based on the first parsing result;

[0148] B8. Based on the second method call expression and the second internal variable mapping, obtain the second actual parameter value and second type information of each second internal variable;

[0149] B9. Add the second actual parameter value and the second type information to the second initial method call object to obtain the second method call object.

[0150] In the specific implementation, the process of obtaining and analyzing the call to the "static code block" is as follows:

[0151] 1. Initialization phase:

[0152] First, create a shared method call analysis class and pass in an empty parameter list. Simultaneously, establish a method call cache.

[0153] Method call cache: Stores parsed method call expressions and their parsing results to avoid repeatedly parsing the same method call.

[0154] 2. Filter static initialization blocks:

[0155] Iterate through the initialization block declarations in the Java file, processing only static initialization blocks and skipping non-static initialization blocks.

[0156] 3. Collection method call:

[0157] For each static initialization block:

[0158] First, search for all second method call expressions in the initialization block. If no method call is found, skip the subsequent processing of the initialization block.

[0159] 4. Collect variables inside the static block:

[0160] Collect the second internal variables inside the static initialization block:

[0161] Use the Stream API to find all second variable declaration expressions in the static code block, expand the nested second variable declaration expressions into a flat stream for processing, extract the second variable name and the corresponding second initialization expression for each second inner variable, collect only the second inner variables with initial values, and establish a mapping from the second variable name to the second initialization expression for the second inner variable.

[0162] 5. Processing method call:

[0163] For each method call expression:

[0164] 5.1 Cache parsing method call:

[0165] First, check if the first parsed result of the second method call expression already exists in the method call cache. If it does not exist, attempt to parse the method call:

[0166] Successful parsing: Store the result in the cache;

[0167] Parsing failure: Output debugging information; otherwise, handle silently.

[0168] If the parsed result is already in the cache, use the cached value directly.

[0169] 5.2 Creating a method call object:

[0170] For a successfully resolved method call, create a second initial method call object:

[0171] Set the full signature of the method being called;

[0172] Set the class name (package name + class name) of the method being called.

[0173] Set the name of the method to be called.

[0174] 5.3 Analyze the calling parameters:

[0175] Parameters for the analysis method call:

[0176] The method call expression and the collected second internal variable mapping are passed in, the second actual parameter value and the second type information of the parameter are parsed, and a list of parameter analysis results is returned.

[0177] 6. Result storage:

[0178] If the parameter analysis result is not empty: set the parameter list into the second initial method call object to obtain the second method call object, and add the second method call object to the final result list.

[0179] In one example, the code structure includes the field structure; the declaration information includes the field declarations; step S52 may include the following sub-steps:

[0180] C1. Get the third method call expression of the field declaration;

[0181] C2. Retrieve the second parsing result of the third method call expression from the method call cache;

[0182] C3. Create a third initial method call object based on the second parsing result;

[0183] C4. Retrieve the third initialization expression for each variable in the field declaration;

[0184] C5. Obtain the object creation expression from the third initialization expression;

[0185] C6. Search for the third parsing result of the object creation expression in the preset check type cache;

[0186] C7. Obtain the complete description and type information of the constructed type corresponding to the third parsing result;

[0187] C8. Match the constructor in the preset third initialization method call object based on the complete description and type information;

[0188] C9. Obtain the parameter expression based on the parameter index in the constructor, retrieve the target parameter from the parameter expression, and save the target parameter to the corresponding constant mapping set;

[0189] A third method call object is generated based on the set of constant mappings.

[0190] In the specific implementation, the analysis call process for retrieving "fields" is as follows:

[0191] 1. Initialization phase:

[0192] Create shared analytics classes and caching mechanisms:

[0193] Method call analysis class: used to analyze method call parameters;

[0194] The second method call cache stores the parsed method call expressions and their parsing results.

[0195] Type cache: Stores the type resolution result of the object creation expression.

[0196] 2. Handling field declarations:

[0197] Iterate through all field declarations in the Java file and perform two types of analysis on each field:

[0198] 2.1 Processing method call:

[0199] For the method call expression in the field:

[0200] Cache resolution process: Check if the method call cache already contains a resolution result;

[0201] If it does not exist, attempt to resolve the method call: if resolution is successful, store the result in the cache;

[0202] Parsing failed: Output debugging information; other parsing errors are handled silently.

[0203] Create a third initialization method call object:

[0204] For successfully resolved method calls:

[0205] Set the full signature of the method being called;

[0206] Set the class name (package name + class name) of the method being called.

[0207] Set the name of the method to be called;

[0208] The method call parameters are resolved (no variable mapping is passed in, an empty mapping is used). If the parameter list is not empty, the result object is added to the final list.

[0209] 2.2 Handling object creation expressions:

[0210] Handling object creation in fields:

[0211] Variable initialization check: Iterate through all variables of the field;

[0212] Check each variable for an initialization expression, and only process object creation expressions.

[0213] Type resolution and caching: Check if the type cache already contains the resolution result of the object creation expression. If it does not exist, try to resolve the type. If the resolution is successful, store the result in the cache. If the resolution fails, handle it silently and skip the expression.

[0214] Target matching and value extraction:

[0215] For successfully resolved types: obtain a complete description of the constructed type and type information of the constructed parameters;

[0216] Find the matching constructor in the target list: compare the constructor signature information to see if they match, and find the first matching target;

[0217] For the target being matched:

[0218] Obtain the corresponding parameter expression based on the key value (parameter index) in the target, extract the target parameter from the expression, and set the extracted target parameter into the relevant constant mapping set.

[0219] After obtaining the target parameters, different processing strategies can be adopted according to the different types of the target parameter values, thereby obtaining a third-party method call object containing the call relationship:

[0220] Scenario 1: Direct string value:

[0221] If the parameter is a direct string like "jdbc:mysql: / / localhost / db", the code will collect this string value, which may be used for subsequent configuration analysis.

[0222] Scenario 2: Referencing an external class constant:

[0223] If the parameter references a constant from another class, such as AppConstants.DB_URL, the code will:

[0224] Analyze which class this constant comes from;

[0225] Establish a mapping relationship: constant name → class that defines the constant, so that you know that this configuration value comes from an external definition.

[0226] Scenario 3: Referencing local constants:

[0227] If the parameter references a constant defined in the current class, such as `private static finalString URL = "..."` defined inside the class, the code will:

[0228] Upon attempting to parse, it was found that the outer class declaration could not be found, indicating that this was an internally defined constant. This internal definition relationship was recorded.

[0229] Case 4: Complex Expressions

[0230] If the parameter is a concatenated expression, such as "http: / / " + host + " / api", the code will temporarily record it and mark it as a complex case that requires further processing.

[0231] In one example, the code structure includes a constructor; the declaration information includes class or interface declarations; step S52 may include the following sub-steps:

[0232] D1. Obtain the member declarations of each class or interface;

[0233] D2. Obtain the constructor declaration from the member declarations;

[0234] D3. Traverse all statements in the constructor declaration and obtain the statement containing the fourth method call expression;

[0235] D4. Collect information about local variables in the statements;

[0236] D5. The fourth variable declaration expression for finding local variable information;

[0237] D6. Extract the name of the fourth variable and the corresponding fourth initialization expression that have local variable information with initial values ​​from the fourth variable declaration expression;

[0238] D7. Establish the mapping relationship between the fourth variable name and the fourth initialization expression to obtain the local variable mapping;

[0239] D8. Parse the fourth method call expression to obtain the fourth parsing result;

[0240] D9. Generate the fourth initial method call object based on the fourth parsing result;

[0241] D10. Based on the fourth method call expression and local variable mapping, obtain the fourth actual parameter value and fourth type information of local variable information;

[0242] D11. Add the fourth actual parameter value and the fourth type information to the fourth initial method call object to obtain the fourth method call object.

[0243] In the specific implementation, the analysis and call process of the "constructor" is as follows:

[0244] 1. Initialization phase:

[0245] Create a shared method call analysis class that will be used to analyze the parameters of method calls throughout the process. The analyzer is initialized with an empty parameter list.

[0246] 2. Traversing class and interface declarations:

[0247] Iterate through all passed-in class or interface declarations in the Java file and perform in-depth analysis on each class or interface.

[0248] 3. Filter constructor:

[0249] For each class or interface, iterate through all its member declarations, process only the constructor declarations, and skip other types of members (such as fields, methods, etc.).

[0250] 4. Process the constructor body:

[0251] For each constructor, iterate through all statements in its body:

[0252] 4.1. Pre-emptive checks and optimizations:

[0253] Before processing each statement in detail, a quick check is performed to see if the current statement contains any method call expressions. If no method call is found, the subsequent processing of that statement is immediately skipped.

[0254] 4.2 Collect local variables:

[0255] For statements containing method calls, the getConstructInnerVar function is called to collect local variable information in the statement. The Stream API is used to find all fourth variable declaration expressions in the statement. Nested variable declarations are expanded into a flat stream for processing. For each local variable information, the fourth variable name and the corresponding fourth initialization expression are extracted. Only local variable information with initial values ​​is collected. A mapping relationship between the fourth variable name and the fourth initialization expression is established. The returned local variable mapping will be used for subsequent method parameter analysis.

[0256] 5. Processing method call:

[0257] For each method call expression in the statement:

[0258] 5.1 Method Analysis and Attempt:

[0259] Attempt to parse the method call and obtain detailed information about the called method:

[0260] If the parsing is successful, continue with subsequent processing;

[0261] If parsing fails: Output debugging information;

[0262] For other parsing exceptions, handle them silently.

[0263] 5.2 Creating a method call object:

[0264] For successfully resolved method calls, a new initial method call object is created, including:

[0265] Set the full signature of the method being called;

[0266] Set the class name (package name + class name) of the method being called;

[0267] Set the name of the method to be called.

[0268] 5.3 Parameter Analysis:

[0269] Use a analyzer to analyze the parameters of a method call:

[0270] By passing in the method call expression and the collected local variable mappings, the analyzer will parse the actual values ​​and type information of the parameters and return a list of parameter analysis results.

[0271] 6. Result Validation and Storage:

[0272] Verify the analysis results: Check if the parameter analysis results are empty; if the parameter list is empty, skip storing the method; if the parameter list is not empty, set the parameter list into the method call object and add the object to the final result list.

[0273] In one example, the code structure also includes annotations; the analysis call process for retrieving "annotations" is as follows:

[0274] 1. Iterating over field declarations:

[0275] Iterate through all field declarations in the Java file and perform annotation analysis on each field.

[0276] 2. Annotation type identification and processing:

[0277] For each annotation on a field, two main types of processing are performed:

[0278] 2.1. @Value annotation processing:

[0279] Annotation recognition: Checks if it is a Spring @Value annotation, and matches and identifies it through a predefined value mapping.

[0280] Value extraction process:

[0281] Extract annotation values ​​and process two annotation formats:

[0282] The standard annotation format is: @Value(value = "..."), which extracts a string literal from the value key-value pair;

[0283] Single member annotation format: @Value("..."), directly extracts the member value;

[0284] Special binary expressions: Process expressions that begin with "${" and end with "}", and extract the configuration name from them;

[0285] SpEL expression parsing: For the extracted annotation values, check whether they conform to the SpEL expression format (starting with "${" and ending with "}");

[0286] Extracting configuration keys from SpEL expressions:

[0287] Remove the "${" and "}" wrappers, separate by colons, and take the first part as the configuration key (default value syntax is supported);

[0288] Remove leading and trailing spaces, and add the extracted configuration key to the constant value set;

[0289] If the SpEL expression format is invalid, an error message will be output.

[0290] 2.2 Other configuration annotation processing:

[0291] Annotation recognition:

[0292] Check if it matches the annotation type in the passed-in annotation map, which are usually project-defined configuration annotations.

[0293] Annotation Analysis:

[0294] Handling two annotation formats:

[0295] Standard annotation format: Extracts the value from the specified annotation field (annName);

[0296] Single member annotation format: directly extracts the member value; if the corresponding value field cannot be found, outputs a prompt message.

[0297] 3. Expression value processing:

[0298] Handling different types of expression values:

[0299] 3.1 String literal processing:

[0300] If it is of type StringLiteralExpr, directly extract the string value and add it to the constant value collection.

[0301] 3.2 Field access expression processing:

[0302] If it is of type FieldAccessExpr, it indicates that you are accessing a constant field of another class. It attempts to parse the field declaration and obtain the fully qualified name of the declared type.

[0303] The constant mapping is constructed based on different contexts: in the context of member value pairs, the expression string is used as the key; otherwise, the field name is used as the key to establish a mapping relationship between the field name and the declared class name.

[0304] 3.3 Name Expression Processing:

[0305] If it is of type NameExpr, it means that it is referencing a constant name. It attempts to parse the value declaration, obtain complete information about the declared type, and construct a complete mapping between the constant name (class name.field name) and the classpath. If the parsing fails, it means that it is an internally defined constant, and a mapping of its own constant is established.

[0306] 3.4 Binary Expression Processing:

[0307] If it is of type BinaryExpr, it represents a complex expression. The entire expression string is stored in the connection map for subsequent processing, and the output debugging information identifies the complex expression scenario.

[0308] 3.5 Handling Unknown Types:

[0309] For expression types that are not recognized, output type information for debugging purposes.

[0310] S53, determine the calling relationship and mapping relationship of all method calls based on the method calling object;

[0311] In this embodiment of the invention, parameter passing and calling relationships can be analyzed using a recursive method to determine the calling relationships and mapping relationships of all method calls.

[0312] In one example, step S53 may include the following sub-steps:

[0313] S531, generate a call relationship based on the method call object, and establish a call chain based on the call relationship;

[0314] S532, generate enumeration mapping, constant mapping and internal enumeration mapping according to the call chain;

[0315] S533, matching the enumeration mapping, constant mapping and internal enumeration mapping with the preset import declaration respectively;

[0316] S534 uses the successfully matched enumeration mapping, constant mapping, and internal enumeration mapping as mapping relationships.

[0317] In the specific implementation, the analysis process of the call relationship and mapping relationship is implemented through a recursive method as follows:

[0318] 1. Recursive control and initialization:

[0319] 1.1 Recursion Depth Control:

[0320] Set a callback counter that increments each time the function is entered. The function will automatically terminate when the recursion depth exceeds 5 levels to prevent infinite recursion.

[0321] 1.2 Data container initialization:

[0322] Create a temporary intermediate storage container:

[0323] enumMapSed: Stores a mapping of enumeration type parameters;

[0324] enumInnerMapSed: Stores a mapping of internal enumeration parameters;

[0325] constantMapSed: Stores a mapping of constant parameters;

[0326] methodCallTmp: Stores method calls that require further processing.

[0327] 2. Method call chain matching analysis:

[0328] 2.1 Double-loop matching:

[0329] Traverse all method calls in all project classes and establish parent-child call relationships:

[0330] Outer loop: Iterate through the list of project classes;

[0331] Inner loop: Matches method calls in each class with the passed-in method call definitions.

[0332] 2.2 Method signature matching:

[0333] Compare the sub-method's own signature with the parent method's call signature. If the signatures match, it means that the connection point of the method call chain has been found.

[0334] 3. Parameter type analysis and classification:

[0335] Refined processing is performed based on the different types of parameters:

[0336] 3.1 Handling of Enumeration Types:

[0337] Scenario 1: Standard enumeration call:

[0338] When the parameter type is (enum) and the path is java.lang.Enum, construct the key-value format of enum name.subname, and store it in the enum map or the inner enum map according to the scope.

[0339] Scenario 2: Custom enumeration call:

[0340] When the parameter path contains ".enum", it is recognized as a custom enumeration, and an enumeration name mapping relationship is established.

[0341] 3.2 String constant handling:

[0342] When the parameter type description contains java.lang.String, the name containing the dot is processed, class name matching is performed, and a constant mapping relationship is established based on the matching result.

[0343] 3.3 Enumeration of constants:

[0344] Basic type enumeration constants, the scope determines whether they are internal or external enumerations.

[0345] 3.4 Handling complex enumeration method calls:

[0346] Handle parameter replacement and name reconstruction, use regular expressions to avoid character conflicts, and construct the final method call key name.

[0347] 3.5 Handling recursive method calls:

[0348] When the parameter type is the value of the method input parameter, it indicates that the method call needs to be further recursively processed, copies the method call object properties, sets the parameter name and target parameter, and adds it to the temporary method call list for subsequent recursive processing.

[0349] 3.6 Simple Constant Processing:

[0350] When the parameter type is a string constant, simple constant values ​​are processed. For complex expressions containing plus signs, parameter analysis is performed. For simple names, they are directly added to the constant value set.

[0351] 4. Import declaration resolution and final mapping:

[0352] 4.1 Import declaration matching:

[0353] Iterate through the project's list of import declarations and match the temporarily stored mappings with the import declarations:

[0354] Enumeration mapping: Matches import declarations based on scope;

[0355] Constant mapping: Matches import declarations based on the classpath;

[0356] Inner enumeration mapping: handles enumeration declarations of inner classes.

[0357] 4.2 Final Storage:

[0358] Store the successfully matched mappings into the final output container:

[0359] enumMap: Stores enumeration type mappings;

[0360] constantMap: Stores a constant mapping;

[0361] enumInnerMap: Stores internal enumeration maps.

[0362] 5. Handling recursive calls:

[0363] 5.1 Recursion condition check:

[0364] Check if the temporary method call list is empty. If it is not empty, perform recursive calls to continue the analysis.

[0365] 5.2 Recursive transit:

[0366] The newly discovered method calls are used as input for the next round of analysis, passing all accumulated mappings to continue the in-depth analysis of the method call chain.

[0367] S54, match the call relationship and mapping relationship in the configuration key call relationship, obtain all configuration keys, and send the configuration keys to the test tool platform.

[0368] After obtaining all the call relationships and mapping relationships, you can match the call relationships and mapping relationships in the configuration key call relationships to obtain all the configuration keys.

[0369] Furthermore, in the matching process with the configuration key call relationship, it is also necessary to match whether the configuration value of each configuration key is consistent with the data recorded in the configuration key call relationship. If the call relationship, mapping relationship, and configuration value are all consistent, then the key in the call relationship is the configuration key to be obtained in this embodiment of the invention. The extraction process of the configuration value of each configuration key is as follows:

[0370] The process of extracting a single enumeration value:

[0371] 1. Core business implementation process:

[0372] 1.1 Input parameter processing:

[0373] Java source file path;

[0374] The set of enumeration names to be extracted;

[0375] Assume that each Java class contains only one enumeration definition.

[0376] 1.2 Extraction of Enumeration Class Names:

[0377] Get the first enumeration name from the set of enumeration names, separate it by a dot, and extract the actual enumeration class name (remove the package name prefix).

[0378] 1.3 File parsing and access:

[0379] Use try-with-resources to ensure that file streams are closed correctly;

[0380] Create a visitor instance for a specific enumeration class name;

[0381] Traverse the compilation unit and apply the visitor pattern.

[0382] 1.4 Enumerated Value Matching and Extraction:

[0383] For each enumeration name, the full enumeration name is split by a dot, with the expected format: package name.enumeration class name.enumeration constant name. The third part is extracted as the specific enumeration constant name. The matching constant is searched in the parsed enumeration key-value pairs. If found, the full enumeration name and constant value are stored in the result mapping. If not found, a warning message is output.

[0384] 1.5. Exception Handling:

[0385] It captures exceptions such as files not found and outputs corresponding error messages.

[0386] 2. Enumerate the visitor inner class:

[0387] 23.1 Initialization Configuration:

[0388] Receives the target enumeration name as a constructor parameter and initializes a mapping container that stores enumeration key-value pairs.

[0389] 2.2 Enumeration declaration access logic:

[0390] Override the visit method to handle enumeration declarations specifically, check if the enumeration name matches the target name, process only the enumeration with the specified name, and ignore other enumerations.

[0391] 2.3 Enumeration of constant extraction:

[0392] For the matching enumeration declaration:

[0393] Iterate through all entries of the enumeration, extract the name of each enumeration constant as the key, and use the enumeration constant name itself as the value to establish a name-to-name mapping relationship.

[0394] The process of extracting dynamic enumeration values:

[0395] 1. Implementation process of core business methods:

[0396] 1.1 Input parameter processing:

[0397] Java source file path;

[0398] The set of enumeration names to be extracted, supporting multiple formats.

[0399] 1.2 Enumeration Name Resolution and Classification:

[0400] Based on dot delimiters and bracket recognition, four different enumeration name formats are processed:

[0401] Format 1: Fully qualified name (parts.length >= 3):

[0402] Example: com.example.ConfigName.VIP_POS_PUMA_APPSECRET.name();

[0403] Extract: scope, enumerated constant name, method name.

[0404] Format 2: Includes the simple name of the method (parts.length == 2 && includes parentheses):

[0405] Example: ConfigName.VIP_POS_PUMA_APPSECRET.name();

[0406] Extract the class name from the file path as the scope.

[0407] Format 3: Simple name excluding method names (parts.length == 2 && excluding parentheses):

[0408] Example: ConfigName.VIP_POS_PUMA_APPSECRET;

[0409] Extract the enumeration constant names; the method name is empty.

[0410] Format 4: Minimal Format (Other Cases):

[0411] Use the enumeration name directly; the method name is empty.

[0412] 1.3 Data Structure Construction:

[0413] enumMap: Establishes a mapping from enumeration constant names to a set of method names;

[0414] keyMap: Establishes a reverse mapping for subsequent result assembly.

[0415] 1.4 Enumeration Class Lookup and Field Parsing:

[0416] The compiler searches for matching enumeration declarations within the compilation unit and performs in-depth parsing of the enumeration structure. It then iterates through the target enumeration constants and extracts the corresponding field values.

[0417] 1.5 Result Assembly and Transformation:

[0418] Retrieve the corresponding field value based on the method name;

[0419] Handling empty method names: Use the value of the first field;

[0420] Supports case conversion requirements and constructs the final mapping from the full name of the enumeration to the field value.

[0421] 2. Core logic for parsing enumerated fields:

[0422] 2.1 Analysis of constructor parameters:

[0423] Explicit constructor case:

[0424] Retrieve the parameter list of the constructor and identify the first String parameter as the primary key field.

[0425] Implicit constructor case:

[0426] The parameter name is inferred by enumerating the fields, and the first field name is used as the primary key field.

[0427] Default fallback: If all of the above fail, use "name" as the default field name.

[0428] 2.2 Parameter parsing for enumeration instances:

[0429] For each enumerated constant:

[0430] Get the name of the enumeration instance;

[0431] Iterate through the constructor's parameters and their corresponding arguments;

[0432] Handling two types of parameter expressions;

[0433] String literals: directly extract the string value;

[0434] Method call expression: recursively resolves method call values;

[0435] If no parameter is provided, the enumeration instance name is used as the default value.

[0436] 3. Accessibility methods:

[0437] 3.1 Class Name Extraction:

[0438] Extract Java class names from file paths, based on directory separators and file extensions.

[0439] 3.2 Method name to field name conversion:

[0440] Handle getter methods: getXxx() → xxx, keeping other method names unchanged.

[0441] 3.3 Set Mapping Management:

[0442] Provide a unified Map <String, Set <string>Insertion logic supports the cumulative addition of values.

[0443] 3.4 Method call value resolution:

[0444] The process is simplified, directly returning a string representation of the method call. In practical applications, this can be extended to deep parsing.

[0445] The process of extracting constant values ​​from a constant class:

[0446] 1. Initialization and file parsing:

[0447] 1.1 File reading:

[0448] Use try-with-resources to ensure that file streams are closed correctly;

[0449] Read Java source files from the specified path;

[0450] StaticJavaParser is used to parse compilation units and generate abstract syntax trees.

[0451] 1.2 Class Name Extraction:

[0452] Extract the Java filename from the file path;

[0453] Remove the ".java" extension to get the base class name.

[0454] 2. Main constant extraction stage:

[0455] Iterate through all type declarations in the compilation unit and perform three types of processing:

[0456] 2.1 Handling of ordinary classes and interfaces:

[0457] Top-level field handling: Iterate through all field declarations in the class;

[0458] For the variables in each field:

[0459] Construct a fully qualified name: class_name.variable_name;

[0460] If the key set contains fully qualified names, extract the initial values ​​for the variables;

[0461] If the key set contains only variable names (without class name prefixes), also extract the initial values;

[0462] The comments indicate that the original plan was to process only static fields, but all fields were actually processed.

[0463] Inner class handling:

[0464] Filter out all inner class declarations. For each inner class:

[0465] Construct a fully qualified name: outer class name.inner class name.variable name;

[0466] If the key set contains the fully qualified name, extract the initial value of the variable.

[0467] 2.2 Handling of enumeration classes:

[0468] Iterate through all entries of the enumeration (enumeration constant):

[0469] Constructing a complete enumeration constant name: ClassName.EnumerationConstantName;

[0470] If the key set contains the enumeration constant name, retrieve the first parameter of the enumeration constant as the value, and store the enumeration constant name and parameter value in the result map.

[0471] 3. Backup matching stage:

[0472] 3.1 Handling unmatched keys:

[0473] Calculate the set of keys that have been successfully matched, remove the matched keys from the original set of keys, and obtain the unmatched keys.

[0474] 3.2 Loose matching rules:

[0475] For unmatched keys, a more lenient matching strategy is adopted:

[0476] Iterate through the inner classes again, matching only the variable names (ignoring class name prefixes). If a variable name is in the set of unmatched keys, extract its initial value.

[0477] 4. Exception handling:

[0478] It captures exceptions such as files not found and outputs corresponding error messages.

[0479] 5. Summary of matching strategies:

[0480] This method employs a multi-level matching strategy:

[0481] 5.1 Exact Matching (Main Stage):

[0482] Fully qualified name matching: class name.variable name;

[0483] Inner class complete match: outer class name.inner class name.variable name;

[0484] Enumeration constant matching: ClassName.EnumerationConstantName.

[0485] 5.2, Loose Matching (Backstop Phase):

[0486] Simple name matching: only variable names (for inner class fields).

[0487] The process of extracting constant values ​​from a Java class:

[0488] 1. File reading and parsing:

[0489] 1.1 Safe File Operations:

[0490] Using the try-with-resources statement ensures that the file input stream is properly closed, guaranteeing resource release even if an exception occurs during processing.

[0491] 1.2 Syntax Analysis:

[0492] StaticJavaParser is used to parse Java source files into compilation units, generating abstract syntax trees (ASTs) for structured analysis.

[0493] 2. Field declaration, traversal, and filtering:

[0494] 2.1 Find all field declarations:

[0495] Use the findAll method to locate all field declarations in the compilation unit, including all fields at the class level, regardless of their access modifiers.

[0496] 2.2 Variable-level processing:

[0497] For each field declaration:

[0498] Iterate through all variable declarators contained in the field, with each variable declarator corresponding to a specific field variable.

[0499] 3. Target constant matching and extraction:

[0500] 3.1 Key-value matching:

[0501] Check if the current variable name exists in the passed-in key set (keys), and only process variables that exactly match the target key name.

[0502] 3.2 Initial value extraction:

[0503] For the matched variables:

[0504] Check if the variable has an initializer. If it does, convert it to a string and store the variable name and the corresponding initial value in the result map.

[0505] 4. Exception handling:

[0506] Capture and handle file not found or other parsing exceptions, output clear error messages indicating which file cannot be accessed, and ensure that the method can still return the collected results in abnormal situations.

[0507] Step 106: Receive the new configuration key returned by the test tool platform for recognizing the configuration key, and return the new configuration key to the user.

[0508] After obtaining all the configuration keys, the application deployment system can send the configuration keys to the testing tool platform. The testing tool platform can obtain all the configuration keys from the last release of the application, compare the changes between the two configuration keys, and obtain the newly added configuration keys.

[0509] For ease of understanding, the embodiments of the present invention will be described below through specific examples:

[0510] Please see Figure 2 , Figure 2 The following is a timing flowchart of a newly added configuration key recognition method provided in an embodiment of the present invention.

[0511] When a user deploys an application to the application deployment system, the testing tool platform listens for a deployment success message sent by the application deployment system. At this point, the testing tool platform can send a scanning algorithm toolkit and a shell script to the application deployment system. After obtaining the scanning algorithm toolkit and the shell script, the application deployment system can retrieve the pre-stored configuration key call relationships and execute the shell script to download the application source code. It can then retrieve all configuration keys based on the configuration key call relationships and the source code. The retrieved configuration keys are sent to the testing tool platform for matching. When the testing tool platform finds that the collected configuration keys have changed compared to all the configuration keys when the application was last released, it can notify the user of the newly added configuration keys through a message.

[0512] This invention, upon successful application deployment by a user, involves the following steps: the application deployment system sends a deployment success message to a testing tool platform; it receives a scanning algorithm toolkit and shell script from the testing tool platform in response to the deployment success message; it retrieves configuration key call relationships from the testing tool platform based on the scanning algorithm toolkit; it executes the shell script to download the application's source code; it uses JavaParser technology to parse all configuration keys based on the configuration key call relationships and the source code, and sends these configuration keys to the testing tool platform; finally, it receives newly added configuration keys from the testing tool platform and returns these newly added configuration keys to the user. This automatic identification of newly added configuration keys eliminates the need for manual verification, thus improving the efficiency and accuracy of new configuration key identification.

[0513] Please see Figure 3 , Figure 3 This is a structural block diagram of an application deployment system provided in an embodiment of the present invention.

[0514] This invention provides an application deployment system, comprising:

[0515] The deployment success message sending module 301 is used to send a deployment success message from the deployment application system to the test tool platform when the user successfully deploys the application to the deployment application system.

[0516] The toolkit and script receiving module 302 is used to receive the scanning algorithm toolkit and shell script returned by the test tool platform in response to the successful deployment message.

[0517] The configuration key call relationship acquisition module 303 is used to obtain the pre-stored configuration key call relationship from the test tool platform according to the scanning algorithm toolkit;

[0518] The source code download module returned a 304 error, which is used to execute a shell script to download the application's source code.

[0519] The configuration key acquisition module 305 is used to obtain the configuration key according to the configuration key call relationship and source code, and send the configuration key to the test tool platform;

[0520] The new configuration key return module 306 is used to receive the new configuration key returned by the test tool platform for recognizing the configuration key, and return the new configuration key to the user.

[0521] This invention also provides an electronic device, which includes a processor and a memory:

[0522] The memory is used to store program code and transfer the program code to the processor;

[0523] The processor is used to execute the newly added configuration key recognition method of this embodiment of the invention according to the instructions in the program code.

[0524] This invention also provides a computer-readable storage medium for storing program code, which is used to execute the newly added configuration key recognition method of this invention.

[0525] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0526] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0527] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0528] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0529] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0530] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0531] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0532] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0533] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the element.

[0534] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.< / string>

Claims

1. A method for recognizing newly added configuration keys, characterized in that, The method, applied to the deployment of application systems, includes: When a user successfully deploys an application to the application deployment system, the application deployment system sends a deployment success message to the testing tool platform. Receive the scanning algorithm toolkit and shell script returned by the testing tool platform in response to the deployment success message; The pre-stored configuration key call relationship is obtained from the test tool platform according to the scanning algorithm toolkit; Execute the shell script to download the application's source code; The configuration key is obtained based on the configuration key call relationship and the source code, and the configuration key is sent to the testing tool platform; this includes: traversing all Java files in the source code to collect class information and declaration information; Based on the class information and the declaration information, analyze the method calls in various preset code structures to generate a method call object; Determining the call relationships and mapping relationships of all method calls based on the method call object includes: generating call relationships based on the method call object, and establishing a call chain based on the call relationships; generating enumeration mappings, constant mappings, and internal enumeration mappings based on the call chain; matching the enumeration mappings, constant mappings, and internal enumeration mappings with preset import declarations respectively; and using the successfully matched enumeration mappings, constant mappings, and internal enumeration mappings as mapping relationships. Match the call relationship and the mapping relationship in the configuration key call relationship to obtain all configuration keys, and send the configuration keys to the test tool platform; The test tool platform receives the newly added configuration key returned by the configuration key and returns the newly added configuration key to the user.

2. The method according to claim 1, characterized in that, The code structure includes a method structure; the declaration information includes method declarations; the step of analyzing method calls in various preset code structures based on the class information and the declaration information to generate a method call object includes: Retrieve the method signature corresponding to the method declaration from the method signature cache; Search for all first method call expressions in the method body corresponding to the method declaration; Collect the first internal variables declared by the method; Obtain all expression statements in the first method call expression, and identify the first variable declaration expression in the expression statements; Extract the first initialization expression of the first internal variable based on the first variable declaration expression; Establish a first internal variable mapping based on the first internal variable and the first initialization expression; Parse the first method call expression to determine the called method, and obtain the called method signature, called method class name, and called method name of the called method; A first initial method call object is generated using the called method signature, the called method class name, the called method name, and the method signature; The call parameters are determined based on the first internal variable mapping and the first method call expression, as well as the first actual parameter value and the first type information of the call parameters; The first actual parameter value and the first type information are added to the first initial method call object to obtain the first method call object.

3. The method according to claim 1, characterized in that, The code structure includes static code blocks; the declaration information includes initialization block declarations; the step of analyzing method calls in various preset code structures based on the class information and the declaration information to generate method call objects includes: Iterate through the initialization block declarations to obtain the static initialization block; Find the second method call expression of the static initialization block; Collect the second internal variable and the second variable declaration expression within the static initialization block; Based on the second variable declaration expression, extract the second variable name and the second initialization expression of the variable with an initial value from the second internal variable; Establish a mapping relationship between the second variable name and the second initialization expression to obtain the second internal variable mapping; Search the method call cache for the first parsing result of the second method call expression; A second initial method call object is created based on the first parsing result; Based on the second method call expression and the second internal variable mapping, the second actual parameter value and second type information of each second internal variable are obtained; The second actual parameter value and the second type information are added to the second initial method call object to obtain the second method call object.

4. The method according to claim 1, characterized in that, The code structure includes a field structure; the declaration information includes field declarations; the step of analyzing method calls in various preset code structures based on the class information and the declaration information to generate a method call object includes: Obtain the third method call expression declared for the field; Retrieve the second parsing result of the third method call expression from the method call cache; A third initial method call object is created based on the second parsing result; Obtain the third initialization expression for each variable in the field declaration; Obtain the object creation expression from the third initialization expression; Search the preset check type cache for the third parsing result of the object creation expression; Obtain the complete description and type information of the construction type corresponding to the third parsing result; Based on the complete description and the type information, match the constructor method in the preset third initial method call object; The parameter expression is obtained according to the parameter index in the constructor, the target parameter is obtained from the parameter expression, and the target parameter is saved to the corresponding constant mapping set; A third method call object is generated based on the set of constant mappings.

5. The method according to claim 1, characterized in that, The code structure includes a constructor; the declaration information includes class or interface declarations; the step of analyzing method calls in various preset code structures based on the class information and the declaration information, and generating a method call object, includes: Retrieve the member declarations of each of the aforementioned classes or interfaces; Obtain the constructor declaration from the member declarations; Iterate through all statements in the constructor declaration to obtain the statement containing the fourth method call expression; Collect local variable information from the statement; Find the fourth variable declaration expression that contains the local variable information; Extract the fourth variable name and the corresponding fourth initialization expression from the fourth variable declaration expression to obtain the local variable information with initial values; Establish a mapping relationship between the fourth variable name and the fourth initialization expression to obtain the local variable mapping; Parse the fourth method call expression to obtain the fourth parsing result; A fourth initial method call object is generated based on the fourth parsing result; Based on the fourth method call expression and the local variable mapping, the fourth actual parameter value and the fourth type information of the local variable information are obtained; The fourth actual parameter value and the fourth type information are added to the fourth initial method call object to obtain the fourth method call object.

6. An application deployment system, characterized in that, include: The deployment success message sending module is used to send a deployment success message to the testing tool platform when a user successfully deploys an application to the deployment application system. The toolkit and script receiving module is used to receive the scanning algorithm toolkit and shell script returned by the test tool platform in response to the deployment success message; The configuration key call relationship acquisition module is used to acquire the configuration key call relationship from the test tool platform based on the scanning algorithm toolkit. The source code download module is used to execute the shell script and download the source code of the application; The configuration key acquisition module is used to acquire the configuration key according to the configuration key call relationship and the source code, and send the configuration key to the test tool platform; including: traversing all Java files in the source code and collecting class information and declaration information; Based on the class information and the declaration information, analyze the method calls in various preset code structures to generate a method call object; Determining the call relationships and mapping relationships of all method calls based on the method call object includes: generating call relationships based on the method call object, and establishing a call chain based on the call relationships; generating enumeration mappings, constant mappings, and internal enumeration mappings based on the call chain; matching the enumeration mappings, constant mappings, and internal enumeration mappings with preset import declarations respectively; and using the successfully matched enumeration mappings, constant mappings, and internal enumeration mappings as mapping relationships. Match the call relationship and the mapping relationship in the configuration key call relationship to obtain all configuration keys, and send the configuration keys to the test tool platform; The module for returning a new configuration key is used to receive the new configuration key returned by the test tool platform after recognizing the configuration key, and to return the new configuration key to the user.

7. An electronic device, characterized in that, The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the new configuration key recognition method according to any one of claims 1-5 according to the instructions in the program code.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program code for executing the new configuration key recognition method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Application program testing method and device, equipment, storage medium and program product

    CN118193382A

  • Component version upgrading method and device, equipment and medium

    CN118567699A