Test environment migration method, device, storage medium and program product

By refining the test environment migration process, it is divided into database migration, application migration and configuration modification, and using automated scripts and configuration rules for automated processing, it solves the problem of long-term and error-prone migration in the existing technology, and realizes the problem of migration being long-term and error-prone. Efficient and accurate migration process.

CN115964357BActive Publication Date: 2025-02-18PEOPLE'S INSURANCE COMPANY OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211447484.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2025-02-18
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

When the application system test environment of large companies is replaced, it is necessary to migrate the test environment from the original equipment to the new equipment. The existing technology methods are time-consuming, error-prone and poor efficiency.

Method used

The migration of the test environment is refined into three parts: database migration, application migration and configuration modification, and the application configuration is automatically extracted and modified through automated scripts and configuration rules to achieve migration automation.

Benefits of technology

Reduces workload and time-consuming, improves migration efficiency and accuracy, and reduces the possibility of manual errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964357B_ABST
    Figure CN115964357B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a test environment migration method, device, storage medium and program product, the method includes migrating a database in a test environment to be migrated, obtaining a migrated database, migrating an application in the test environment to be migrated, obtaining a migrated application, for each application in the migrated application, based on the configuration rule corresponding to the application, extracting the application configuration to be modified from the configuration data of the application, and modifying the application configuration to be modified based on the address correspondence, obtaining new configuration data, and realizing the migration of the test environment to be migrated, the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration. The embodiment of the present application can improve the migration efficiency and accuracy of the test environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of software testing technology, and in particular to a test environment migration method, device, storage medium and program product. Background Art

[0002] The application system test environment is used to test the application system. When equipment is replaced, the test environment needs to be migrated from the original equipment to the new equipment.

[0003] In the related art, the application system is usually rebuilt on the new device manually.

[0004] However, in the process of implementing this application, the inventors found that there are at least the following problems in the prior art: the application system testing environment of a large company usually involves multiple application systems, the number of application systems is large, the coupling is high, and there are many dependent basic components, the workload is huge, the time is long, it is easy to make mistakes, and the efficiency is low. Summary of the invention

[0005] Embodiments of the present application provide a test environment migration method, device, storage medium, and program product to improve the migration efficiency and accuracy of the test environment.

[0006] In a first aspect, an embodiment of the present application provides a test environment migration method, comprising:

[0007] Migrate the database in the test environment to be migrated to obtain the migrated database;

[0008] Migrating the application program in the test environment to be migrated to obtain a migrated application program;

[0009] For each application in the migrated application, based on the configuration rules corresponding to the application, the application configuration to be modified is extracted from the configuration data of the application, and based on the address correspondence, the application configuration to be modified is modified to obtain new configuration data, thereby realizing the migration of the test environment to be migrated; the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration.

[0010] In a possible design, migrating the database in the to-be-migrated test environment to obtain the migrated database includes:

[0011] Obtain the source address, destination address, and database instance name of the database in the test environment to be migrated;

[0012] According to the database instance name, a database corresponding to the database instance name is migrated from the corresponding source end address to the destination end address to obtain a migrated database.

[0013] In a possible design, migrating the database corresponding to the database instance name from the corresponding source end address to the destination end address to obtain the migrated database includes:

[0014] Determine the database type to which the database corresponding to the database instance name belongs;

[0015] Determine the backup and recovery execution command corresponding to the database type according to the first corresponding relationship; the first corresponding relationship includes a corresponding relationship between at least one database instance name and at least one backup and recovery execution command;

[0016] According to the backup and restore execution command, the database at the source end address is backed up to obtain database backup data, and the database backup data is restored at the destination end address to obtain the migrated database.

[0017] In a possible design, migrating the application in the to-be-migrated test environment to obtain the migrated application includes:

[0018] Obtain the type of the virtual machine at the migration destination of the application in the test environment to be migrated;

[0019] Determine, according to a second correspondence, a virtualization execution command corresponding to the virtual machine type; the second correspondence includes a correspondence between at least one virtual machine type and at least one virtualization execution command;

[0020] According to the virtualization execution command, the application is migrated to the virtual machine at the destination end to obtain the migrated application.

[0021] In a possible design, extracting the application configuration to be modified from the configuration data of the application based on the configuration rule corresponding to the application includes:

[0022] Determine the configuration rule corresponding to the application according to the third corresponding relationship; the third corresponding relationship includes a corresponding relationship between at least one application and at least one configuration rule; the configuration rule includes a start character string and an end character string of the application configuration;

[0023] According to the start character string and the end character string corresponding to the application program, the application configuration to be modified having the start character string and the end character string is extracted from the configuration data of the application program.

[0024] In a possible design, extracting the application configuration to be modified having the start string and the end string from the configuration data of the application according to the start string and the end string corresponding to the application includes:

[0025] For each partition in the configuration data,

[0026] If the partition includes the starting character string and the flag bit is the first value, the flag bit is changed to the second value, and the character string after the starting character string is added to the first storage space;

[0027] If the starting character string and the ending character string do not exist in the partition, and the flag bit is a second value, adding the character string in the partition to the first storage space;

[0028] If the partition includes the end character string and the flag bit is a second value, the character string before the end character string is added to the first storage space, and the character string in the first storage space is added to the second storage space.

[0029] In a possible design, extracting the application configuration to be modified having the start string and the end string from the configuration data of the application according to the start string and the end string corresponding to the application further includes:

[0030] If the partition includes the starting string and the flag is a second value, the string before the starting string is added to the first storage space, and the string in the first storage space is added to the second storage space, the first storage space is cleared, and the string after the starting string is added to the first storage space.

[0031] In a second aspect, an embodiment of the present application provides a test environment migration device, including:

[0032] The migration module is used to migrate the database in the test environment to be migrated and obtain the migrated database;

[0033] The migration module is further used to migrate the application program in the test environment to be migrated to obtain the migrated application program;

[0034] A modification module is used to extract the application configuration to be modified from the configuration data of each application in the migrated application based on the configuration rules corresponding to the application, and to modify the application configuration to be modified based on the address correspondence relationship to obtain new configuration data, so as to realize the migration of the test environment to be migrated; the address correspondence relationship includes the address correspondence relationship before and after the database migration, and the address correspondence relationship before and after the application migration.

[0035] In a third aspect, an embodiment of the present application provides a test environment migration device, including: at least one processor and a memory;

[0036] The memory stores computer-executable instructions;

[0037] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method described in the first aspect and various possible designs of the first aspect.

[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described in the first aspect and various possible designs of the first aspect are implemented.

[0039] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect and various possible designs of the first aspect.

[0040] The test environment migration method, device, storage medium and program product provided in this embodiment include migrating the database in the test environment to be migrated to obtain the migrated database, migrating the application in the test environment to be migrated to obtain the migrated application, and for each application in the migrated application, extracting the application configuration to be modified from the configuration data of the application based on the configuration rules corresponding to the application, and modifying the application configuration to be modified based on the address correspondence to obtain new configuration data to achieve the migration of the test environment to be migrated, wherein the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration. The method of this embodiment can realize migration automation, reduce workload and time consumption, and greatly improve migration efficiency and accuracy by refining the migration work into three parts: database migration, application migration and configuration modification, and automatically extracting the application configuration from the configuration data based on the configuration rules for automatic modification. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1a Schematic diagram 1 of an application scenario of a test environment migration method provided in an embodiment of the present application;

[0043] Figure 1bA schematic diagram of an application scenario of a test environment migration method provided in an embodiment of the present application Figure 2 ;

[0044] Figure 2 A flow chart of a test environment migration method provided in an embodiment of the present application;

[0045] Figure 3 A system architecture diagram of a test environment migration system provided in an embodiment of the present application;

[0046] Figure 4 A schematic diagram of the structure of the test environment migration device provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of the hardware structure of the test environment migration device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0049] The application system test environment of a large company usually involves multiple application systems. For example, in an insurance company, the application system test environment may involve multiple application systems such as auto insurance underwriting, non-auto insurance underwriting, auto insurance claims, non-auto claims, and financial systems. The entire test environment may even be associated with hundreds of application systems. When equipment is replaced, the test environment needs to be migrated from the original equipment to the new equipment.

[0050] In the related art, the application system is usually rebuilt on the new device manually, which specifically involves re-creating the database of the application system, redeploying the basic components that the application system depends on, re-adjusting the database and application configuration files of the application system according to the new environment, and redeploying the application package. However, the number of application systems is large, the coupling is high, and the basic components they depend on are many, the workload is huge, time-consuming, error-prone, and inefficient.

[0051] To solve the above technical problems, the inventors of the present application have found that the migration work of the entire application system test environment can be refined, and based on the configuration rules of the application, the application configuration that meets the configuration rules in the configuration data of the application is extracted, and then automatically modified uniformly, so as to realize the automation of migration, reduce the workload, reduce the time consumption, and improve the efficiency of migration. Specifically, combined with the characteristics of the application system of a large company (integrated architecture, coexistence of stand-alone application system and distributed application system, etc.), the application system itself is decomposed into a database host, an application system program running host, a basic component architecture host and a corresponding application system configuration, etc., and then based on the application host virtualization technology, the database instance level migration and automation scripts including shell and python script development can be carried out, and each stage can be orderly arranged (for example, the migration of the database host and the application system program running host can be carried out simultaneously), so as to realize the solution of automatic and rapid migration of the application system test environment in a large company. Based on this, the embodiment of the present application provides a test environment migration method.

[0052] Figure 1a A schematic diagram of an application scenario of a test environment migration method provided in an embodiment of the present application is shown in FIG. Figure 1a As shown, the execution end is in communication connection with the migration source end and the migration destination end. The migration source end includes a test environment to be migrated (including a database and an application, etc.), and the execution end is used to migrate the test environment to be migrated to the migration destination end. The execution end may include multiple migration hosts, and the number of migration hosts may be set according to actual needs, which is not limited in this embodiment, and the migration host may be a terminal device or a server.

[0053] In the specific implementation process, the execution end controls the migration of the database in the test environment to be migrated from the migration source end to the migration destination end to obtain the migrated database; migrates the application in the test environment to be migrated from the migration source end to the migration destination end to obtain the migrated application; for each application in the migrated application, based on the configuration rules corresponding to the application, extracts the application configuration to be modified from the configuration data of the application, and based on the address correspondence, modifies the application configuration to be modified to obtain new configuration data, and realizes the migration of the test environment to be migrated; the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration. Among them, database migration and application migration can be carried out in parallel. The test environment migration method provided in the embodiment of the present application can realize migration automation, reduce workload and time consumption, and greatly improve migration efficiency and accuracy by refining the migration work into three parts: database migration, application migration and configuration modification, and automatically extracting application configuration from configuration data based on configuration rules for automatic modification.

[0054] For example, take the insurance application system as an example. Figure 1b As shown, the migration source resource pool includes multiple databases, such as a motor vehicle insurance underwriting database, a new payment database, a motor vehicle insurance claims database, etc. Correspondingly, the application host includes a host corresponding to the motor vehicle insurance underwriting application, a host corresponding to the new payment application, a host corresponding to the motor vehicle insurance claims application, etc., and the configuration host includes a redis host corresponding to the motor vehicle insurance underwriting application, a redis host corresponding to the new payment application, and a redis host corresponding to the motor vehicle insurance claims application. In the specific implementation process, the migration work can be divided into database migration, application virtual machine migration, and application configuration modification. The migration host can move each database in the migration source resource pool to the migration destination resource pool to obtain the migrated database; move each application in the migration source resource pool to the migration destination resource pool to obtain the migrated application; for each application in the migrated application, based on the configuration rules corresponding to the application, extract the application configuration to be modified from the configuration data of the application, and modify the application configuration to be modified based on the address correspondence to obtain new configuration data, and realize the migration of the test environment to be migrated; the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration. Among them, database migration and application migration can be carried out in parallel.

[0055] It should be noted that the scenario diagram shown in Figure 1 is only an example. The test environment migration method and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0056] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0057] Figure 2 The following is a flow chart of the test environment migration method provided in the embodiment of the present application. Figure 2 As shown, the method includes:

[0058] 201. Migrate the database in the test environment to be migrated to obtain the migrated database.

[0059] The execution subject of this embodiment may be a terminal device or a server, for example, Figure 1a The execution end 103 shown, and Figure 1b Migrate hosts as shown.

[0060] Specifically, the application system test environment is composed of many application systems. For example, insurance companies have underwriting systems (auto insurance underwriting system, non-auto insurance underwriting system), public systems (user system, data dictionary system), claims systems (auto insurance claims system, non-auto claims system), financial systems (new payment and collection systems), etc. Each application system is roughly divided into database host, program running host and basic component host, such as redis cache host. First, according to the characteristics of the insurance application system test environment (integrated architecture, coexistence of stand-alone application system and distributed application system, etc.), the migration work can be layered and refined. For example, it can be decomposed into three parts: database migration, application migration and configuration modification.

[0061] Regarding database migration: Considering that all application systems involved in the test environment can reuse the same set of databases, databases of similar applications can be centrally deployed on the same database instance. For example, underwriting systems are all deployed on the same database instance. Therefore, instance-level migration can be adopted. Compared with the method of importing and exporting by database in related technologies, the method of this embodiment can greatly reduce the number of objects to be migrated, and realize batch migration of databases of all application systems on a database instance from the source end to the destination end.

[0062] In some embodiments, migrating the database in the test environment to be migrated to obtain the migrated database may include: obtaining the source address, destination address and database instance name of the database in the test environment to be migrated; according to the database instance name, migrating the database corresponding to the database instance name from the corresponding source address to the destination address to obtain the migrated database.

[0063] In some embodiments, migrating the database corresponding to the database instance name from the corresponding source address to the destination address to obtain the migrated database may include: determining the database type to which the database corresponding to the database instance name belongs; determining the backup and recovery execution command corresponding to the database type based on a first corresponding relationship; the first corresponding relationship includes a corresponding relationship between at least one database instance name and at least one backup and recovery execution command; based on the backup and recovery execution command, backing up the database under the source address to obtain database backup data, and restoring the database backup data under the destination address to obtain the migrated database.

[0064] Specifically, Figure 3 This is a system architecture diagram of the test environment migration system provided in the embodiment of the present application. Figure 3As shown, the system includes a database migration module 301 , an application and basic component migration module 302 , and a configuration adaptation module 303 .

[0065] The database instance of the application system of the entire test environment is migrated from the source end to the destination end through the database migration module 301. Before the migration is executed, a database host with the same operating system and database configuration as the source end can be prepared in advance at the migration destination end.

[0066] Specifically, the database migration module 301 includes a migration source and destination database proxy module, a database backup and recovery data dictionary module, and a database migration scheduling execution module. The migration source and destination database proxy modules are used to automatically identify the database type. For example, the database type can be identified based on operating system environment variables and application package names. After the database type is identified, the database backup and recovery command corresponding to the database type can be selected (for example, the informix database can use the ontape command) according to a predetermined correspondence (the correspondence between different database types and different backup and recovery commands), and the command is deployed on the migration source and destination database hosts.

[0067] The database backup and restore data dictionary module is used to maintain the correspondence between different database types and different backup and restore commands, so that the database migration module 301 can perform retrieval query.

[0068] The database migration scheduling execution module is used to maintain the data dictionary of the correspondence between the source IP and the destination IP of the database, so as to traverse each database with the source IP of the database as the loop step, and concurrently schedule the database proxy module to perform the database backup on the source side, and restore the backup by executing the backup command corresponding to the database type on the destination side.

[0069] 202. Migrate the application in the test environment to be migrated to obtain a migrated application.

[0070] Specifically, for the migration of the hosts running all application system programs (applications) in the test environment, virtualization technology can be used to migrate the application system programs of all application hosts from the virtual machine level. For example, a virtual machine with the same specifications as the migration source can be allocated at the migration destination of the application system program, and then the snapshot technology can be used to migrate the operating system of the migration source, the basic components that the application system depends on, and the application system application package itself to the migration destination.

[0071] In some embodiments, migrating the application in the test environment to be migrated to obtain the migrated application may include: obtaining the type of virtual machine at the migration destination of the application in the test environment to be migrated; determining the virtualization execution command corresponding to the virtual machine type based on a second correspondence; the second correspondence includes a correspondence between at least one virtual machine type and at least one virtualization execution command; and migrating the application to the virtual machine at the destination based on the virtualization execution command to obtain the migrated application.

[0072] For example, Figure 3 As shown, the application and basic component migration module 302 is used to migrate the application system program packages on the application system program running host and the basic component host in the entire test environment, the dependent basic software and the operating system as a whole from the source end to the destination end. The application and basic component migration module 302 includes an application host source and destination data dictionary module, a virtualization management module, and an application system host migration scheduling execution module.

[0073] Among them, the application host source and destination data dictionary module is used to maintain the source IP, destination IP, type of virtualization software of the application program, and the corresponding relationship A between the three; the virtualization management module is used to maintain the IP of each virtualization software management host, the type of virtualization software, the corresponding snapshot generation and recovery commands, and the corresponding relationship B between the three.

[0074] The application system host migration scheduling execution module is used to realize the generation and recovery of the host snapshot of the application system program based on the corresponding relationships (corresponding relationship A and corresponding relationship B) maintained by the application host source and destination data dictionary modules and the virtualization management module respectively. Specifically, the type of virtualization software can be used as the loop step length, and the IP of the application host can be used as the loop step length to start threads in parallel to execute the migration of the application system programs of each application system host. For example, based on the corresponding relationship A and the corresponding relationship B, the corresponding snapshot generation and recovery commands can be determined, and the command line interface of the virtualization management software can be remotely called to execute the generation of the snapshot. After the snapshot is generated, the snapshot can be restored.

[0075] 203. For each application in the migrated application, based on the configuration rules corresponding to the application, extract the application configuration to be modified from the configuration data of the application, and based on the address correspondence, modify the application configuration to be modified to obtain new configuration data, so as to realize the migration of the test environment to be migrated; the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration.

[0076] Specifically, the adaptation of the application system after migration mainly involves the modification of database and application configuration, such as the modification of data sources, basic components and peripheral dependent system addresses. The entire migration process can be orderly arranged by developing an automated migration program (for example, using shell and / or Python) and deployed in Figure 1b On the multiple migration hosts shown (the number of migration hosts can be determined according to actual needs, and this embodiment does not limit this), the migration of the entire application system test environment is realized by cross-host calls. This can reduce the difficulty of the configuration modification work that is most dependent on manual work, and is also the most tedious and error-prone in the related technology, and greatly improve the migration efficiency.

[0077] In some embodiments, extracting the application configuration to be modified from the configuration data of the application based on the configuration rules corresponding to the application may include: determining the configuration rules corresponding to the application according to a third correspondence; the third correspondence includes a correspondence between at least one application and at least one configuration rule; the configuration rule includes a start string and an end string of the application configuration; and extracting the application configuration to be modified having the start string and the end string from the configuration data of the application according to the start string and the end string corresponding to the application.

[0078] In some embodiments, the extracting the application configuration to be modified having the start string and the end string from the configuration data of the application according to the start string and the end string corresponding to the application may include: for each partition in the configuration data, if the partition includes the start string and the flag is a first value, changing the flag to a second value, and adding the string after the start string to the first storage space; if the partition does not contain the start string and the end string, and the flag is a second value, adding the string in the partition to the first storage space; if the partition includes the end string and the flag is a second value, adding the string before the end string to the first storage space, and adding the string in the first storage space to the second storage space. Optionally, it may also include: if the partition includes the start string and the flag is a second value, adding the string before the start string to the first storage space, adding the string in the first storage space to the second storage space, clearing the first storage space, and adding the string after the start string to the first storage space.

[0079] Specifically, Figure 3As shown, the configuration adaptation module 303 is used to adapt the migrated application system program according to the new test environment to ensure that the application system can be started and used normally. The configuration adaptation module 303 presets the application configuration rule module, analyzes the application configuration module and executes the application configuration module.

[0080] Among them, the preset application configuration configuration rule module is used to maintain the correspondence between different application architectures and different configuration rules, so as to retrieve and query the corresponding configuration rules according to the application architecture to which different application system programs belong. Based on the queried configuration rules, the configuration of a single system for peripheral system calls can be modified. For example, for the application architectures Weblogic_jdbc, Spring_boot_jdbc, and Tomcat_jdbc, the associated file name file_name, the starting string jdbc_conn_match_start, and the ending string jdbc_conn_match_end can all correspond, and the application architecture system can correspond to the associated file name file_name, the starting string system_config_match_start, and the ending string system_config_match_end.

[0081] The application configuration analysis module is used to traverse the application packages of the migrated application system programs and extract the database configurations that meet the configuration rules (for example, matching the file name, starting string and ending string in the above correspondence). In addition, in order to improve accuracy, the extracted configurations can be organized into an execution list and the execution list can be stored in the database for display through a web page, so that the migration implementation personnel can also modify and confirm the configuration items through the web page. In this way, the entire configuration process is traceable, further ensuring the accuracy of the execution list, thereby improving the accuracy of the configuration modification.

[0082] The configuration adaptation module 303 is used to extract the configuration that needs to be modified in the application configuration file C of the application system program, modify it according to the new migration environment, and generate an execution list for subsequent modification and execution. In this implementation process, the first storage space (such as temporary text T) can be used to record the extracted application configuration to be modified, and the final result is output to the second storage space (such as output file C_after). The specific implementation method can be as follows:

[0083] First, each application system program may correspond to multiple configuration files. The configuration file is used as the loop step length, and the current configuration file is traversed once in a single loop. Since a single traversal cannot be backtracked, the flag FLAG can be used to record the current processing status of the application configuration (for example, when FALG is 1, it indicates that an application configuration has started; when FLAG is 0, it indicates that the reading of the current application configuration has been completed).

[0084] Secondly, the configuration rule of the current application system program can be retrieved from the corresponding relationship maintained by the preset application configuration rule module, that is, the starting string and the ending string can be determined, and then the configuration file extraction work can be completed based on this.

[0085] Again, in the specific process, the initial value of the flag FLAG can be set to 0, and the configuration file of the schedule can be traversed. The preset partition (for example, a line) text R is read from C in turn for analysis. The processing can be divided into the following four cases:

[0086] In the first case, R contains the starting string in the configuration rule, and FLAG is 0, which indicates the start of a new application configuration. FLAG is set to 1, and the characters after the starting string are added to the temporary file T (which can be cleared each time a new application configuration record is started), and the next line is read.

[0087] In the second case, R contains the starting string in the configuration rule, and FLAG is 1, so it can be considered that the current application configuration has ended. Use the paste-copy operation to process the temporary text T as a single line and write it to the output file C_after. Clear T and continue reading the next line. Since this line of text not only marks the end of the current application configuration statement, but also the beginning of the next application configuration statement, FLAG is not set to 0 here. It should be noted that in this case, that is, the situation where two starting strings appear consecutively, considering that it may be a misrecognition, the record content corresponding to the previous starting string can also be discarded. This embodiment does not limit this and can be set according to actual needs.

[0088] In the third case, R contains the configuration rule end string, and FLAG is 1. This is another case where the application configuration ends. The copy and paste method is also used to process the temporary text T in a single line and write it to the output file C_after. T is cleared, the next line is read, and FLAG is set to 0.

[0089] In the fourth case, except for the statements above, when FLAG is 1, it means that the current text is in an application configuration and the current text is output to T.

[0090] Finally, after the row-by-row traversal is completed, the result set C_after of the application configuration can be obtained, and each application configuration in C_after is represented by a single row.

[0091] The application configuration execution module is used to adapt the original application configuration content to the configuration of the new environment according to the application configuration execution list, with the migration destination application host IP as the loop step.

[0092] The test environment migration method provided in this embodiment can realize migration automation, reduce workload and time consumption, and greatly improve migration efficiency and accuracy by breaking down the migration work into three parts: database migration, application program migration, and configuration modification, and automatically extracting application configuration from configuration data based on configuration rules for automatic modification.

[0093] Figure 4 This is a schematic diagram of the structure of the test environment migration device provided in the embodiment of the present application. Figure 4 As shown, the test environment migration device 40 includes: a migration module 401 and a modification module 402 .

[0094] Migration module 401, used to migrate the database in the test environment to be migrated to obtain the migrated database;

[0095] The migration module 401 is further used to migrate the application in the test environment to be migrated to obtain the migrated application;

[0096] The modification module 402 is used to extract the application configuration to be modified from the configuration data of each application in the migrated application based on the configuration rules corresponding to the application, and modify the application configuration to be modified based on the address correspondence relationship to obtain new configuration data, so as to realize the migration of the test environment to be migrated; the address correspondence relationship includes the address correspondence relationship before and after the database migration, and the address correspondence relationship before and after the application migration.

[0097] The test environment migration device provided in the embodiment of the present application can realize migration automation, reduce workload and time consumption, and greatly improve migration efficiency and accuracy by breaking down the migration work into three parts: database migration, application program migration, and configuration modification, and automatically extracting application configuration from configuration data based on configuration rules for automatic modification.

[0098] The test environment migration device provided in the embodiment of the present application can be used to execute the above-mentioned method embodiment, and its implementation principle and technical effect are similar, which will not be repeated in this embodiment.

[0099] Figure 5This is a schematic diagram of the hardware structure of the test environment migration device provided in the embodiment of the present application, and the device may be a terminal device or a server, such as a computer, a messaging device, a tablet device, a medical device, etc.

[0100] The device 50 may include one or more of the following components: a processing component 501 , a memory 502 , a power component 503 , a multimedia component 504 , an audio component 505 , an input / output (I / O) interface 506 , a sensor component 507 , and a communication component 508 .

[0101] The processing component 501 generally controls the overall operation of the device 50, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 501 may include one or more processors 509 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 501 may include one or more modules to facilitate the interaction between the processing component 501 and other components. For example, the processing component 501 may include a multimedia module to facilitate the interaction between the multimedia component 504 and the processing component 501.

[0102] The memory 502 is configured to store various types of data to support operations on the device 50. Examples of such data include instructions for any application or method operating on the device 50, contact data, phone book data, messages, pictures, videos, etc. The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0103] The power supply component 503 provides power to the various components of the device 50. The power supply component 503 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 50.

[0104] The multimedia component 504 includes a screen that provides an output interface between the device 50 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 504 includes a front camera and / or a rear camera. When the device 50 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0105] The audio component 505 is configured to output and / or input audio signals. For example, the audio component 505 includes a microphone (MIC), and when the device 50 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 502 or sent via the communication component 508. In some embodiments, the audio component 505 also includes a speaker for outputting audio signals.

[0106] I / O interface 506 provides an interface between processing component 501 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0107] The sensor assembly 507 includes one or more sensors for providing various aspects of status assessment for the device 50. For example, the sensor assembly 507 can detect the open / closed state of the device 50, the relative positioning of components, such as the display and keypad of the device 50, and the sensor assembly 507 can also detect the position change of the device 50 or a component of the device 50, the presence or absence of user contact with the device 50, the orientation or acceleration / deceleration of the device 50, and the temperature change of the device 50. The sensor assembly 507 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 507 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 507 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0108] The communication component 508 is configured to facilitate wired or wireless communication between the device 50 and other devices. The device 50 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 508 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 508 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0109] In an exemplary embodiment, the device 50 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned methods.

[0110] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 502 including instructions, and the instructions can be executed by a processor 509 of the device 50 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0111] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0112] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0113] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0114] An embodiment of the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the test environment migration method performed by the test environment migration device as described above is implemented.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A test environment migration method, characterized in that: include: Migrate the database in the test environment to be migrated to obtain the migrated database; Migrating the application program in the test environment to be migrated to obtain a migrated application program; For each application in the migrated application, based on the configuration rules corresponding to the application, the application configuration to be modified is extracted from the configuration data of the application, and based on the address correspondence, the application configuration to be modified is modified to obtain new configuration data, so as to realize the migration of the test environment to be migrated; the address correspondence includes the address correspondence before and after the database migration, and the address correspondence before and after the application migration; The step of migrating the application program in the test environment to be migrated to obtain the migrated application program includes: Obtain the type of the virtual machine at the migration destination of the application in the test environment to be migrated; Determine, according to a second correspondence, a virtualization execution command corresponding to the virtual machine type; the second correspondence includes a correspondence between at least one virtual machine type and at least one virtualization execution command; Migrating the application to a virtual machine at a destination end according to the virtualization execution command to obtain a migrated application; The extracting the application configuration to be modified from the configuration data of the application based on the configuration rule corresponding to the application includes: Determine the configuration rule corresponding to the application according to the third corresponding relationship; the third corresponding relationship includes a corresponding relationship between at least one application and at least one configuration rule; the configuration rule includes a start character string and an end character string of the application configuration; According to the start character string and the end character string corresponding to the application program, the application configuration to be modified having the start character string and the end character string is extracted from the configuration data of the application program.

2. The method according to claim 1, characterized in that The step of migrating the database in the test environment to be migrated to obtain the migrated database includes: Obtain the source address, destination address, and database instance name of the database in the test environment to be migrated; According to the database instance name, a database corresponding to the database instance name is migrated from the corresponding source end address to the destination end address to obtain a migrated database.

3. The method according to claim 2, characterized in that The step of migrating the database corresponding to the database instance name from the corresponding source end address to the destination end address to obtain the migrated database includes: Determine the database type to which the database corresponding to the database instance name belongs; Determine the backup and recovery execution command corresponding to the database type according to the first corresponding relationship; the first corresponding relationship includes a corresponding relationship between at least one database instance name and at least one backup and recovery execution command; According to the backup and restore execution command, the database at the source end address is backed up to obtain database backup data, and the database backup data is restored at the destination end address to obtain the migrated database.

4. The method according to claim 1, characterized in that The extracting the application configuration to be modified having the start string and the end string from the configuration data of the application according to the start string and the end string corresponding to the application includes: For each partition in the configuration data, If the partition includes the starting character string and the flag bit is the first value, the flag bit is changed to the second value, and the character string after the starting character string is added to the first storage space; If the starting character string and the ending character string do not exist in the partition, and the flag bit is a second value, adding the character string in the partition to the first storage space; If the partition includes the end character string and the flag bit is a second value, the character string before the end character string is added to the first storage space, and the character string in the first storage space is added to the second storage space.

5. The method according to claim 4, characterized in that The step of extracting the application configuration to be modified having the start string and the end string from the configuration data of the application according to the start string and the end string corresponding to the application further includes: If the partition includes the starting string and the flag is a second value, the string before the starting string is added to the first storage space, and the string in the first storage space is added to the second storage space, the first storage space is cleared, and the string after the starting string is added to the first storage space.

6. A test environment migration device, characterized in that: include: The migration module is used to migrate the database in the test environment to be migrated and obtain the migrated database; The migration module is further used to migrate the application program in the test environment to be migrated to obtain the migrated application program; A modification module, for extracting the application configuration to be modified from the configuration data of the application for each application in the migrated application based on the configuration rules corresponding to the application, and modifying the application configuration to be modified based on the address correspondence relationship to obtain new configuration data, so as to realize the migration of the test environment to be migrated; the address correspondence relationship includes the address correspondence relationship before and after the database migration, and the address correspondence relationship before and after the application migration; The migration module is further used for: Obtain the type of the virtual machine at the migration destination of the application in the test environment to be migrated; Determine, according to a second correspondence, a virtualization execution command corresponding to the virtual machine type; the second correspondence includes a correspondence between at least one virtual machine type and at least one virtualization execution command; Migrating the application to a virtual machine at a destination end according to the virtualization execution command to obtain a migrated application; The modification module is further used for: Determine the configuration rule corresponding to the application according to the third corresponding relationship; the third corresponding relationship includes a corresponding relationship between at least one application and at least one configuration rule; the configuration rule includes a start character string and an end character string of the application configuration; According to the start character string and the end character string corresponding to the application program, the application configuration to be modified having the start character string and the end character string is extracted from the configuration data of the application program.

7. A test environment migration device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the test environment migration method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the test environment migration method according to any one of claims 1 to 5 is implemented.

9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the test environment migration method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Technique for migrating a host environment to a new system platform

    CN101218565A

  • Application migration method, device and system, storage medium, and cloud tool on application

    CN110134489A