CN105512276B - Method and device for constructing junk file and electronic equipment - Google Patents
Method and device for constructing junk file and electronic equipment Download PDFInfo
- Publication number
- CN105512276B CN105512276B CN201510886262.7A CN201510886262A CN105512276B CN 105512276 B CN105512276 B CN 105512276B CN 201510886262 A CN201510886262 A CN 201510886262A CN 105512276 B CN105512276 B CN 105512276B
- Authority
- CN
- China
- Prior art keywords
- junk
- file
- garbage
- data
- folder
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 238000012360 testing method Methods 0.000 claims abstract description 47
- 238000004140 cleaning Methods 0.000 claims abstract description 44
- 230000006870 function Effects 0.000 claims description 29
- 238000011084 recovery Methods 0.000 claims description 19
- 238000012545 processing Methods 0.000 claims description 5
- 230000008569 process Effects 0.000 description 14
- 230000009467 reduction Effects 0.000 description 12
- 238000011161 development Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 238000009434 installation Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/1737—Details of further file system functions for reducing power consumption or coping with limited storage space, e.g. in mobile devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
- G06F16/162—Delete operations
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a method and a device for constructing a junk file and electronic equipment. The method comprises the following steps: receiving a junk file restoration request, and acquiring junk data matched with junk feature information contained in the junk file restoration request from a preset junk file database; if the acquired junk data is a junk folder, acquiring storage path information corresponding to the junk data, and creating a junk folder mapped by the storage path information in each electronic device to be tested; and if the acquired junk data are junk files, establishing the acquired junk files. By applying the method and the device, the time required by the junk file cleaning test can be shortened, and the junk file cleaning efficiency is improved.
Description
Technical Field
The present invention relates to computer file management technologies, and in particular, to a method and an apparatus for constructing a junk file, and an electronic device.
Background
With computer communication and internet technologies, electronic devices are more and more commonly used, for example, smart mobile phones, personal digital assistants, palm computers and desktop computers are more and more widely used, and various applications stored in the electronic devices are more and more, and application programs generate a large amount of junk files in daily operation and use processes, so that more and more storage spaces of the electronic devices are occupied, and therefore, the junk files in the electronic devices need to be regularly cleaned. Wherein, the junk file includes: and in the daily operation and use process, the reserved temporary file or junk information file exits due to the abnormality of the file reading program.
Currently, generally, garbage cleaning software is installed in an electronic device, and a regular or manual mode of a user is set to perform full-disk scanning on the electronic device so as to clean garbage files generated during the operation of each application program. In order to improve the garbage cleaning efficiency of the garbage cleaning software, a garbage cleaning software developer or an operator needs to test the garbage cleaning function of the garbage cleaning software before releasing new garbage cleaning software, and improve and perfect the program code of the garbage cleaning software according to the test result, so that the garbage cleaning software to be released can meet the pre-designed requirement.
When testing the garbage cleaning function of the garbage cleaning software, a garbage file construction method is generally adopted to simulate each actual environment of a user, namely, a large number of garbage files generated by various application programs are injected into electronic equipment to be tested in advance, the garbage cleaning software is utilized to perform garbage cleaning on the electronic equipment to be tested, whether the garbage cleaning software can clean all the injected garbage files is determined, and if not, the garbage cleaning software is improved and perfected. The injected junk files need to be extracted by an operator by inquiring the junk files generated by each application program, for example, the operator extracts the junk files and the junk storage path information which need to be injected into the electronic equipment to be tested by collecting the junk files such as cache files, log files or temporary files generated in the application program using process reported by each electronic equipment, and finally, the junk files with the same storage path information as the junk files are created in the electronic equipment to be tested in a manual mode according to the obtained junk file storage path information. However, the method for constructing the junk files has the advantages that the time required by a junk file cleaning test is long, the junk file cleaning efficiency is low, and further the development period of junk cleaning software is long.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for constructing a garbage file, and an electronic device, so as to shorten the time required by a garbage file cleaning test and improve the garbage file cleaning efficiency.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a method for constructing a junk file, including:
receiving a junk file restoration request, and acquiring junk data matched with junk feature information contained in the junk file restoration request from a preset junk file database;
if the acquired junk data is a junk folder, acquiring storage path information corresponding to the junk data, and creating a junk folder mapped by the storage path information in each electronic device to be tested;
and if the acquired junk data are junk files, establishing the acquired junk files.
Optionally, the receiving a junk file restoration request, and acquiring junk data matched with junk feature information included in the junk file restoration request from a preset junk file database includes:
editing a variable in a preset junk file application script, wherein the variable is used for representing junk feature information of a junk file test;
running the edited junk file application script and triggering and connecting a preset junk file database;
reading the junk data matched with the edited junk feature information from the junk file database;
and after reading all junk data matched with the edited junk feature information, disconnecting the junk file database.
Optionally, the junk file database is asynchronously connected by using a Java junk file database connection mode.
Optionally, reading the junk data matched with the edited junk feature information from the junk file database includes:
and calling an execution query method connected with a Java junk file database, traversing the junk file database, querying junk data matched with the edited junk feature information, and storing the queried junk data to a preset result setting object.
Optionally, the method further includes:
and recording the result setting object into a preset data configuration file.
Optionally, if the acquired spam data is a spam folder, acquiring storage path information corresponding to the spam data, and creating a spam folder mapped by the storage path information in each electronic device to be tested includes:
and using a circular traversal result setting object, obtaining a field value corresponding to each column record in an object table for recording garbage data in the result setting object, if the field value is identified as a folder, obtaining storage path information corresponding to the garbage data, calling a recovery function, and using an mkdir p command to create the folder mapped by the storage path information.
Optionally, if the acquired junk data is a junk file, creating the acquired junk file includes:
and using a circular traversal result setting object to obtain a field value corresponding to each column record in an object table for recording junk data in the result setting object, if the field value is identified as a file, obtaining storage path information of a previous directory of the junk data, calling a recovery function, using an mkdir p command to create a junk folder mapped by the storage path information of the previous directory, calling the recovery function under the created junk folder, and using a dd command to copy the obtained junk data under the created junk folder.
Optionally, the method further includes:
and performing garbage cleaning on each electronic device to be tested by using preset garbage cleaning software, and evaluating the garbage cleaning software according to the acquired garbage cleaning result.
Optionally, the method further includes:
and deleting the junk folders and the junk files created in the electronic devices to be tested after the completion of the junk cleaning of the electronic devices to be tested is monitored.
Optionally, the spam feature information includes: the test area field, the test electronic equipment operating system version field, the test electronic equipment model field, the junk file keyword field and the like, or any combination thereof.
In a second aspect, an embodiment of the present invention provides an apparatus for constructing a junk file, including: a junk data matching module, a junk folder creation module, and a junk file creation module, wherein,
the junk data matching module is used for receiving a junk file restoration request and acquiring junk data matched with junk feature information contained in the junk file restoration request from a preset junk file database;
a junk folder creating module, configured to, if the obtained junk data is a junk folder, obtain storage path information corresponding to the junk data, and create a junk folder mapped by the storage path information in each electronic device to be tested;
and the junk file creating module is used for creating the acquired junk file if the acquired junk data is the junk file.
Optionally, the junk data matching module includes: an editing unit, a connection unit, a matching unit and a connection disconnection unit, wherein,
the editing unit is used for editing a variable in a preset junk file application script, wherein the variable is used for representing junk feature information of a junk file test;
the connecting unit is used for running the edited junk file application script and triggering and connecting a preset junk file database;
the matching unit is used for reading the junk data matched with the edited junk feature information from the junk file database;
and the connection disconnection unit is used for disconnecting the connection with the junk file database after reading all junk data matched with the edited junk feature information.
Optionally, the junk file database is asynchronously connected by using a Java junk file database connection mode.
Optionally, the matching unit includes: a call subunit, a traverse subunit, a query subunit, and a store subunit, wherein,
the calling subunit is used for calling an execution query method connected with the Java junk file database;
the traversal subunit is used for traversing the junk file database;
the query subunit is used for querying the junk data matched with the edited junk feature information;
and the storage subunit stores the inquired junk data to a preset result setting object.
Optionally, the matching unit further includes:
and the data configuration subunit is used for recording the result setting object into a preset data configuration file.
Optionally, the junk folder creating module includes: a field value acquiring unit, a folder judging unit, and a folder creating unit, wherein,
the field value acquisition unit is used for setting objects by using a circular traversal result and acquiring a field value corresponding to each column of records in an object table for recording junk data in the result setting objects;
the folder judgment unit is used for acquiring the storage path information corresponding to the junk data if the field value is identified as a folder;
and the folder creating unit is used for calling a recovery function and creating the folder mapped by the storage path information by using an mkdir command.
Optionally, the junk file creating module includes: a field value acquiring unit, a file judging unit, and a file creating unit, wherein,
the field value acquisition unit is used for setting objects by using a circular traversal result and acquiring a field value corresponding to each column of records in an object table for recording junk data in the result setting objects;
the file judging unit is used for acquiring the storage path information of a directory on the junk data if the field value is identified as a file;
and the file creating unit is used for calling a recovery function, creating a garbage folder mapped by the storage path information of the previous directory by using an mkdir command, calling the recovery function under the created garbage folder, and copying the acquired garbage data under the created garbage folder by using a dd command.
Optionally, the apparatus further comprises:
and the garbage cleaning testing module is used for performing garbage cleaning on each electronic device to be tested by utilizing preset garbage cleaning software and evaluating the garbage cleaning software according to the acquired garbage cleaning result.
Optionally, the apparatus further comprises:
and the garbage data processing module is used for deleting the garbage folders and the garbage files created in the electronic equipment to be tested after the garbage cleaning of the electronic equipment to be tested is monitored to be finished.
Optionally, the spam feature information includes: the test area field, the test electronic equipment operating system version field, the test electronic equipment model field, the junk file keyword field and the like, or any combination thereof.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, and is used for executing any one of the methods for constructing the garbage file.
According to the method, the device and the electronic equipment for constructing the junk files, provided by the embodiment of the invention, the junk data matched with the junk feature information contained in the junk file restoration request are acquired from a preset junk file database by receiving the junk file restoration request; if the acquired junk data is a junk folder, acquiring storage path information corresponding to the junk data, and creating a junk folder mapped by the storage path information in each electronic device to be tested; and if the acquired junk data are junk files, establishing the acquired junk files. Therefore, the junk files or the junk folders can be inquired and automatically created according to the input junk feature information, the time required by the junk file cleaning test is effectively shortened, and the junk file cleaning efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a method for constructing junk files according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating an embodiment of the present invention that receives a garbage file reduction request and obtains garbage data matched with garbage feature information included in the garbage file reduction request from a preset garbage file database;
FIG. 3 is another flowchart illustrating a method for constructing a junk file according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for constructing junk files according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a method for constructing a junk file according to an embodiment of the present invention. Referring to fig. 1, the method includes:
step 11, receiving a junk file restoration request, and acquiring junk data matched with junk feature information contained in the junk file restoration request from a preset junk file database;
in this step, as an optional embodiment, fig. 2 is a schematic flow diagram illustrating a process of receiving a garbage file reduction request and obtaining garbage data matched with garbage feature information included in the garbage file reduction request from a preset garbage file database according to an embodiment of the present invention. Referring to fig. 2, the process includes:
step 21, editing a preset variable in a junk file Application (APP) script, wherein the variable is used for representing junk feature information of a junk file test;
in this step, as an optional embodiment, the garbage file application script may be developed by using an Android (Android) technology, and in the embodiment of the present invention, the garbage feature information is represented by a variable, so that corresponding garbage data can be dynamically updated when garbage file cleaning tests of different times or different garbage cleaning purposes are performed.
In the embodiment of the present invention, as an optional embodiment, the junk data includes a junk file and a junk folder, where the junk file may include a cache file, a log file, a temporary file, a dll file of an old version application program, an exe file of the old version application program, a bak file of the old version application program, and the like, and the junk folder is a folder corresponding to the storage path information of the junk folder.
The spam characteristics information includes but is not limited to: the field of the test area field, the field of the test electronic device operating system version, the field of the test electronic device model, the field of the junk file keyword, and the like, or any combination thereof, which is not limited in the embodiment of the present invention. Wherein,
since junk data such as a cache file or a log file generated during the operation of each application may be different in the electronic devices in different areas, the test area field is used to indicate a region or a country, such as china, the united states, japan, and the like, to which the junk file cleaning test is directed. Similarly, the test electronic device operating systems are different, and the spam data such as a cache file or a log file generated by each application program in the running process may be different, so that the test electronic device operating system field is used for indicating the operating system targeted by the spam file cleaning test.
In the embodiment of the invention, the variables in the application script of the junk file are edited, namely the variables are replaced by specific junk characteristic information, for example, the variables are replaced by Chinese, Windows 10 and advertisements (junk file key words). And after the variables in the junk file application script are edited, generating a junk file restoration request.
Step 22, running the edited junk file application script, and triggering and connecting a preset junk file database;
in this step, as an optional embodiment, the junk file DataBase is connected by using a Java junk file DataBase connection (JDBC) mode, where the JDBC is a Java Application Programming Interface (API) for executing Structured Query Language (SQL) statements, may provide uniform access to multiple relational junk file databases, and is composed of a group of classes and interfaces written in Java Language.
In the embodiment of the present invention, as another optional embodiment, a Java spam database connection manner is utilized, and an asynchronous connection is adopted for the spam database, where the spam database is a relational database (MySQL) database and stores spam files generated by each application program and corresponding storage path information.
In the embodiment of the present invention, as an optional embodiment, the junk file database may be set in an intranet or an extranet, which is not limited in the embodiment of the present invention. The junk data format stored in the junk file database is the same as the junk data format imported into the junk file database, that is, the junk data format generated by the application program in each corresponding electronic device, and may be updated by an operator at regular time or at irregular time, for example, the operator may obtain the installation directory of each application program from the registry of the electronic device, and search for the junk file in the predetermined format in the installation directory of the corresponding application program. The registry is a core database in the Windows operating system, various parameters are stored in the registry, the startup of Windows, the loading of hardware drivers and the running of some Windows application programs are controlled, the registry comprises related configuration and state information of SOFTWARE and hardware, for example, an installation directory of the application programs in the electronic equipment can be obtained through HKEY _ LOCAL _ MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Unin st all of the registry. In the junk file database, a junk file, a junk folder, and corresponding attribute information and content information of the junk file and the junk folder may be recorded in an object table, where the attribute information includes a name of the junk folder, storage path information, and the like. The operation personnel obtains the junk data corresponding to the new junk feature information and updates the junk data into the junk file database, which is a known technology, and the detailed description is omitted here.
Step 23, reading the junk data matched with the edited junk feature information from the junk file database;
in this step, as an optional embodiment, the reading the junk data matched with the edited junk feature information from the junk file database includes:
and calling an execution query method connected with a Java junk file database, traversing the junk file database, querying junk data matched with the edited junk feature information, and storing the queried junk data to a preset result setting object.
In this step, after the connection of the asynchronous Java garbage file database is successful, an execution query (execute query) method for Java garbage file database connection in the garbage file application script is called, data, that is, garbage data matched with the edited garbage feature information, is queried from the garbage file database, and is returned to a result set (ResultSet) object in the garbage file application script for storage. The result setting object stores therein the garbage data in the form of an object table, each column record of the object table corresponds to a garbage data, and details regarding the result setting object are omitted herein.
In the embodiment of the present invention, since the garbage data stored in the ResultSet object is temporarily stored, in order to avoid querying the garbage file database again when the same garbage data is needed in the subsequent test, the method may further include:
and recording the result setting object into a preset data configuration file.
In this step, as an optional embodiment, the data configuration file exists in the form of an entity class, and is responsible for recording all data (junk files or junk folders) required to be used in the running (testing) process of the electronic device to be tested, so that the relevant coupling of the junk files or the junk folders (data) can be reduced conveniently in the development process of the garbage cleaning software.
And 24, after reading all the junk data matched with the edited junk feature information, disconnecting the connection with the junk file database.
In this step, after the garbage file restoration request is responded, the connection with the garbage file database is closed.
Step 12, if the acquired junk data is a junk folder, acquiring storage path information corresponding to the junk data, and creating a junk folder mapped by the storage path information in each electronic device to be tested;
in this step, as an optional embodiment, if the obtained garbage data is a garbage folder, obtaining storage path information corresponding to the garbage data, and creating a garbage folder mapped by the storage path information in each electronic device to be tested includes:
and using a circular traversal result setting object to obtain a field value corresponding to each column record in an object table for recording garbage data in the result setting object, if the field value is identified as a folder, obtaining storage path information corresponding to the garbage data, calling a recovery function, and using an mkdir p command to create a folder (directory) mapped by the storage path information.
In this step, a junk folder having the same path as the storage path information is created in each electronic device, and the name of the junk folder created in the electronic device is the same as the name of the junk folder stored in the result setting object.
In the embodiment of the invention, a linux mkdir command can be used for creating the specified directory name, and the specified directory name is not the same as the existing directory name in the current directory. With the mkdir p command, if a directory in the path does not exist, the system will automatically create the non-existing directory. In the embodiment of the invention, a plurality of directories can be created at one time through an mkdir command, namely, a garbage folder mapped by each storage path information can be created in a multi-process or multi-thread mode.
And step 13, if the acquired junk data are junk files, establishing the acquired junk files.
In this step, as an optional embodiment, if the obtained junk data is a junk file, creating the obtained junk file includes:
and using a circular traversal result setting object to obtain a field value corresponding to each column record in an object table for recording junk data in the result setting object, if the field value is identified as a file, obtaining storage path information of a previous directory of the junk data, calling a recovery function, using an mkdir p command to create a junk folder mapped by the storage path information of the previous directory, calling the recovery function under the created junk folder, using a dd command to create the junk data with corresponding size, format and suffix name, and copying the obtained junk data to the created junk folder.
In the embodiment of the invention, the ResultSet object is traversed by using a cycle, the field value corresponding to each column of record in the object table is obtained, then the recovery function is called, whether the record corresponding to the field value to be recovered is a file or a folder is judged, if the record is the folder, a directory corresponding to the same name is created in the electronic equipment by using an mkdir command, and if the record is the file, a junk file with the same size, suffix name and size as those of the record in the object table is created under the corresponding directory by using a dd command, so that the functions of automatic creation of the junk directory and automatic generation of the junk file are achieved, the time required by a junk file cleaning test is effectively shortened, the junk file cleaning efficiency is improved, and the development period of junk cleaning software is further reduced. Compared with the prior art, the method has the advantages that operators need to be manually found to search the garbage characteristic information, then the garbage folders or garbage files are manually created under the corresponding characteristic directories of the electronic equipment, the method is changed into the method that when the garbage characteristic information is increased or decreased, the operators only need to maintain the garbage file database, the garbage files can be manufactured at one time by using the method provided by the embodiment of the invention, and the garbage files can be repeatedly manufactured for any electronic equipment provided with the method provided by the embodiment of the invention, so that the time required by garbage cleaning test is short, the garbage test efficiency is high, and the development period of garbage cleaning software is effectively shortened.
As an alternative embodiment, the method may further include:
and performing garbage cleaning on each electronic device to be tested by using preset garbage cleaning software, and evaluating the garbage cleaning software according to the acquired garbage cleaning result.
In the step, in the development process of the garbage cleaning software, the garbage cleaning function in the garbage cleaning software can be tested at any time, and as garbage files or garbage folders generated in the operation process of various application programs can be introduced into the electronic equipment to be tested, the real use environment of a user can be simulated, so that whether the developed garbage cleaning software meets the preset function or not is determined according to the garbage cleaning result, and the garbage cleaning software is improved when the preset function is not met.
As another alternative embodiment, the method may further include:
and deleting the junk folders and the junk files created in the electronic devices to be tested after the completion of the junk cleaning of the electronic devices to be tested is monitored.
In this step, after the garbage cleaning software is operated each time to perform garbage cleaning on each electronic device to be tested, the garbage folder and the garbage file created in each electronic device to be tested are deleted. Therefore, the electronic equipment can be tested again conveniently, the junk folders and the junk files can be constructed according to the preset requirements, and the constructed junk folders and the constructed junk files can be compared and analyzed with the junk cleaning result conveniently to evaluate the junk cleaning software.
The present invention will be described in further detail with reference to a specific example.
Fig. 3 is another schematic flow chart of a method for constructing a junk file according to an embodiment of the present invention. Referring to fig. 3, the method includes:
step 31, asynchronously connecting the junk file database according to the junk file restoration request;
in this step, as an optional embodiment, a junk file database on the asynchronous network side of the electronic device to be tested is triggered by clicking a junk file starting control button on the electronic device to be tested.
In the embodiment of the invention, the junk file database is a MySQL database.
Step 32, starting a method for inquiring a junk file database, and inquiring junk data matched with junk feature information contained in the junk file restoration request to obtain junk file restoration data;
in this step, the method for querying the junk file database is an executeQuery method of JDBC.
Step 33, storing the garbage file reduction data into a result setting object;
in this step, the data stored in the result setting object is temporary storage data.
Step 34, storing the result setting object into a data configuration file;
in this step, the data stored in the data configuration file is long-term storage data.
Step 35, reading the stored garbage file reduction data;
in this step, the garbage file reduction data may be read from the result setting object, or may be read from the data configuration file.
Step 36, judging whether the read garbage file reduction data is a file or a folder, if the read garbage file reduction data is a file, executing step 37, and if the read garbage file reduction data is a folder, executing step 38;
step 37, calling dd commands to create junk file reduction data with the same size and format under the directories corresponding to the electronic devices to be tested;
and step 38, calling an mkdir p command to create junk file reduction data with the same path in each electronic device to be tested.
Fig. 4 is a schematic structural diagram of an apparatus for constructing a junk file according to an embodiment of the present invention. Referring to fig. 4, the apparatus includes: a junk data matching module 41, a junk folder creation module 42, and a junk file creation module 43, wherein,
a junk data matching module 41, configured to receive a junk file restoration request, and acquire junk data matched with junk feature information included in the junk file restoration request from a preset junk file database;
in the embodiment of the present invention, as an optional embodiment, the junk data includes a junk file and a junk folder, where the junk file may include one or any combination of a cache file, a log file, a temporary file, a dll file of an old version application program, an exe file of the old version application program, a bak file of the old version application program, and the like; the garbage characteristic information comprises: the test area field, the test electronic equipment operating system version field, the test electronic equipment model field, the junk file keyword field and the like, or any combination thereof.
A junk folder creating module 42, configured to, if the obtained junk data is a junk folder, obtain storage path information corresponding to the junk data, and create a junk folder mapped by the storage path information in each electronic device to be tested;
the junk file creating module 43 creates the acquired junk file if the acquired junk data is a junk file.
In this embodiment of the present invention, as an optional embodiment, the garbage data matching module 41 includes: an editing unit, a connection unit, a matching unit, and a connection disconnection unit (not shown in the figure), wherein,
the editing unit is used for editing a variable in a preset junk file application script, wherein the variable is used for representing junk feature information of a junk file test;
the connecting unit is used for running the edited junk file application script and triggering and connecting a preset junk file database;
in the embodiment of the invention, as an optional embodiment, the Java junk file database is asynchronously connected in a Java junk file database connection mode.
The matching unit is used for reading the junk data matched with the edited junk feature information from the junk file database;
in this embodiment of the present invention, as an optional embodiment, the matching unit includes: a call subunit, a traverse subunit, a query subunit, and a store subunit, wherein,
the calling subunit is used for calling an execution query method connected with the Java junk file database;
the traversal subunit is used for traversing the junk file database;
the query subunit is used for querying the junk data matched with the edited junk feature information;
and the storage subunit stores the inquired junk data to a preset result setting object.
As another alternative embodiment, the matching unit further includes:
and the data configuration subunit is used for recording the result setting object into a preset data configuration file.
And the connection disconnection unit is used for disconnecting the connection with the junk file database after reading all junk data matched with the edited junk feature information.
As an alternative embodiment, the junk folder creation module 42 includes: a field value acquiring unit, a folder judging unit, and a folder creating unit (not shown in the figure), wherein,
the field value acquisition unit is used for setting objects by using a circular traversal result and acquiring a field value corresponding to each column of records in an object table for recording junk data in the result setting objects;
the folder judgment unit is used for acquiring the storage path information corresponding to the junk data if the field value is identified as a folder;
and the folder creating unit is used for calling a recovery function and creating the folder mapped by the storage path information by using an mkdir command.
As an alternative embodiment, the garbage file creating module 43 includes: a field value acquiring unit, a file judging unit, and a file creating unit (not shown in the figure), wherein,
the field value acquisition unit is used for setting objects by using a circular traversal result and acquiring a field value corresponding to each column of records in an object table for recording junk data in the result setting objects;
the file judging unit is used for acquiring the storage path information of a directory on the junk data if the field value is identified as a file;
and the file creating unit is used for calling a recovery function, creating a garbage folder mapped by the storage path information of the previous directory by using an mkdir command, calling the recovery function under the created garbage folder, and copying the acquired garbage data under the created garbage folder by using a dd command.
In this embodiment of the present invention, as an optional embodiment, the apparatus may further include:
and the garbage cleaning test module 44 is configured to perform garbage cleaning on each electronic device to be tested by using preset garbage cleaning software, and evaluate the garbage cleaning software according to the acquired garbage cleaning result.
As another alternative embodiment, the apparatus may further include:
and the garbage data processing module 45 is configured to delete the garbage folders and the garbage files created in the electronic devices to be tested after it is monitored that the garbage cleaning of the electronic devices to be tested is completed.
The embodiment of the invention also provides electronic equipment, and the electronic equipment comprises the device in any one of the embodiments.
Fig. 5 is a schematic structural diagram of an embodiment of an electronic device of the present invention, which can implement the processes of the embodiments shown in fig. 1 to 4 of the present invention, and as shown in fig. 5, the electronic device may include: the device comprises a shell 51, a processor 52, a memory 53, a circuit board 54 and a power circuit 55, wherein the circuit board 54 is arranged inside a space enclosed by the shell 51, and the processor 52 and the memory 53 are arranged on the circuit board 54; a power supply circuit 55 for supplying power to each circuit or device of the electronic apparatus; the memory 53 is used to store executable program code; the processor 52 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 53, and is used for executing the method for constructing the garbage file according to any of the foregoing embodiments.
The specific execution process of the above steps by the processor 52 and the steps further executed by the processor 52 by running the executable program code may refer to the description of the embodiment shown in fig. 1 to 4 of the present invention, and are not described herein again.
The electronic device exists in a variety of forms, including but not limited to:
(1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) Ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This type of device comprises: audio, video players (e.g., ipods), handheld game consoles, electronic books, and smart toys and portable car navigation devices.
(4) A server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because of the need of providing high-reliability service.
(5) And other electronic equipment with data interaction function.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (19)
1. A method for constructing garbage files is applied to garbage cleaning software function testing, and comprises the following steps:
receiving a junk file restoration request, and acquiring junk data matched with junk feature information contained in the junk file restoration request from a preset junk file database; the garbage characteristic information comprises: the test area field, the test electronic equipment operating system version field, the test electronic equipment model field, the junk file keyword field and the like or any combination thereof;
if the acquired junk data is a junk folder, acquiring storage path information corresponding to the junk data, and creating a junk folder mapped by the storage path information in each electronic device to be tested;
and if the acquired junk data are junk files, establishing the acquired junk files.
2. The method according to claim 1, wherein the receiving a garbage file restoration request, and acquiring garbage data matching with the garbage feature information included in the garbage file restoration request from a preset garbage file database comprises:
editing a variable in a preset junk file application script, wherein the variable is used for representing junk feature information of a junk file test;
running the edited junk file application script and triggering and connecting a preset junk file database;
reading the junk data matched with the edited junk feature information from the junk file database;
and after reading all junk data matched with the edited junk feature information, disconnecting the junk file database.
3. The method of claim 2, wherein the junk database is asynchronously connected using a Java junk database connection.
4. The method of claim 2, wherein reading the spam data matching the edited spam characteristics information from the spam file database comprises:
and calling an execution query method connected with a Java junk file database, traversing the junk file database, querying junk data matched with the edited junk feature information, and storing the queried junk data to a preset result setting object.
5. The method of claim 4, further comprising:
and recording the result setting object into a preset data configuration file.
6. The method according to any one of claims 1 to 5, wherein if the acquired garbage data is a garbage folder, acquiring storage path information corresponding to the garbage data, and creating a garbage folder mapped with the storage path information in each electronic device to be tested comprises:
and using a circular traversal result setting object, obtaining a field value corresponding to each column record in an object table for recording garbage data in the result setting object, if the field value is identified as a folder, obtaining storage path information corresponding to the garbage data, calling a recovery function, and using an mkdir p command to create the folder mapped by the storage path information.
7. The method according to any one of claims 1 to 5, wherein if the acquired junk data is a junk file, creating the acquired junk file comprises:
and using a circular traversal result setting object to obtain a field value corresponding to each column record in an object table for recording junk data in the result setting object, if the field value is identified as a file, obtaining storage path information of a previous directory of the junk data, calling a recovery function, using an mkdir p command to create a junk folder mapped by the storage path information of the previous directory, calling the recovery function under the created junk folder, and using a dd command to copy the obtained junk data under the created junk folder.
8. The method according to any one of claims 1 to 5, further comprising:
and performing garbage cleaning on each electronic device to be tested by using preset garbage cleaning software, and evaluating the garbage cleaning software according to the acquired garbage cleaning result.
9. The method of claim 8, further comprising:
and deleting the junk folders and the junk files created in the electronic devices to be tested after the completion of the junk cleaning of the electronic devices to be tested is monitored.
10. The device for constructing the garbage files is applied to garbage cleaning software function testing, and comprises the following components: a junk data matching module, a junk folder creation module, and a junk file creation module, wherein,
the junk data matching module is used for receiving a junk file restoration request and acquiring junk data matched with junk feature information contained in the junk file restoration request from a preset junk file database; the garbage characteristic information comprises: the test area field, the test electronic equipment operating system version field, the test electronic equipment model field, the junk file keyword field and the like or any combination thereof;
a junk folder creating module, configured to, if the obtained junk data is a junk folder, obtain storage path information corresponding to the junk data, and create a junk folder mapped by the storage path information in each electronic device to be tested;
and the junk file creating module is used for creating the acquired junk file if the acquired junk data is the junk file.
11. The apparatus of claim 10, wherein the spam data matching module comprises: an editing unit, a connection unit, a matching unit and a connection disconnection unit, wherein,
the editing unit is used for editing a variable in a preset junk file application script, wherein the variable is used for representing junk feature information of a junk file test;
the connecting unit is used for running the edited junk file application script and triggering and connecting a preset junk file database;
the matching unit is used for reading the junk data matched with the edited junk feature information from the junk file database;
and the connection disconnection unit is used for disconnecting the connection with the junk file database after reading all junk data matched with the edited junk feature information.
12. The apparatus of claim 11, wherein the garbage database is asynchronously connected using a Java garbage database connection.
13. The apparatus of claim 11, wherein the matching unit comprises: a call subunit, a traverse subunit, a query subunit, and a store subunit, wherein,
the calling subunit is used for calling an execution query method connected with the Java junk file database;
the traversal subunit is used for traversing the junk file database;
the query subunit is used for querying the junk data matched with the edited junk feature information;
and the storage subunit stores the inquired junk data to a preset result setting object.
14. The apparatus of claim 13, wherein the matching unit further comprises:
and the data configuration subunit is used for recording the result setting object into a preset data configuration file.
15. The apparatus of any of claims 10 to 14, wherein the junk folder creation module comprises: a field value acquiring unit, a folder judging unit, and a folder creating unit, wherein,
the field value acquisition unit is used for setting objects by using a circular traversal result and acquiring a field value corresponding to each column of records in an object table for recording junk data in the result setting objects;
the folder judgment unit is used for acquiring the storage path information corresponding to the junk data if the field value is identified as a folder;
and the folder creating unit is used for calling a recovery function and creating the folder mapped by the storage path information by using an mkdir command.
16. The apparatus of any of claims 10 to 14, wherein the junk file creation module comprises: a field value acquiring unit, a file judging unit, and a file creating unit, wherein,
the field value acquisition unit is used for setting objects by using a circular traversal result and acquiring a field value corresponding to each column of records in an object table for recording junk data in the result setting objects;
the file judging unit is used for acquiring the storage path information of a directory on the junk data if the field value is identified as a file;
and the file creating unit is used for calling a recovery function, creating a garbage folder mapped by the storage path information of the previous directory by using an mkdir command, calling the recovery function under the created garbage folder, and copying the acquired garbage data under the created garbage folder by using a dd command.
17. The apparatus of any one of claims 10 to 14, further comprising:
and the garbage cleaning testing module is used for performing garbage cleaning on each electronic device to be tested by utilizing preset garbage cleaning software and evaluating the garbage cleaning software according to the acquired garbage cleaning result.
18. The apparatus of claim 17, further comprising:
and the garbage data processing module is used for deleting the garbage folders and the garbage files created in the electronic equipment to be tested after the garbage cleaning of the electronic equipment to be tested is monitored to be finished.
19. An electronic device, characterized in that the electronic device comprises: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the method of constructing a garbage file as claimed in any one of the preceding claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510886262.7A CN105512276B (en) | 2015-12-04 | 2015-12-04 | Method and device for constructing junk file and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510886262.7A CN105512276B (en) | 2015-12-04 | 2015-12-04 | Method and device for constructing junk file and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105512276A CN105512276A (en) | 2016-04-20 |
CN105512276B true CN105512276B (en) | 2018-12-14 |
Family
ID=55720258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510886262.7A Expired - Fee Related CN105512276B (en) | 2015-12-04 | 2015-12-04 | Method and device for constructing junk file and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105512276B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107766351B (en) * | 2016-08-16 | 2020-12-25 | 腾讯科技(深圳)有限公司 | File directory identification method and device |
CN106844464B (en) * | 2016-12-21 | 2020-01-07 | 北京安云世纪科技有限公司 | Mobile terminal and file forbidding method and device thereof |
CN107704369B (en) * | 2017-08-31 | 2021-05-04 | 云宏信息科技股份有限公司 | Operation log recording method, electronic device, storage medium and system |
CN112698791A (en) * | 2020-12-31 | 2021-04-23 | 珠海豹趣科技有限公司 | System disk cleaning method and device, electronic equipment and storage medium |
CN112860643B (en) * | 2021-03-05 | 2022-07-08 | 中富通集团股份有限公司 | Method for improving cache cleaning speed of 5G mobile terminal and storage device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102902601A (en) * | 2011-09-12 | 2013-01-30 | 微软公司 | Efficient data recovery |
CN102999420A (en) * | 2011-09-13 | 2013-03-27 | 阿里巴巴集团控股有限公司 | XSS (Cross Site Scripting) testing method and XSS testing system based on DOM (Document Object Model) |
CN103679390A (en) * | 2013-12-26 | 2014-03-26 | 北京奇虎科技有限公司 | Background testing method and device of configuration system |
EP2717174A1 (en) * | 2012-10-04 | 2014-04-09 | Ricoh Company Ltd. | A method and system for retrieving and providing requested data from hierarchical data structures |
CN104754002A (en) * | 2013-12-30 | 2015-07-01 | 北京金山网络科技有限公司 | File cleaning method and device, mobile terminal and cloud-side server |
-
2015
- 2015-12-04 CN CN201510886262.7A patent/CN105512276B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102902601A (en) * | 2011-09-12 | 2013-01-30 | 微软公司 | Efficient data recovery |
CN102999420A (en) * | 2011-09-13 | 2013-03-27 | 阿里巴巴集团控股有限公司 | XSS (Cross Site Scripting) testing method and XSS testing system based on DOM (Document Object Model) |
EP2717174A1 (en) * | 2012-10-04 | 2014-04-09 | Ricoh Company Ltd. | A method and system for retrieving and providing requested data from hierarchical data structures |
CN103679390A (en) * | 2013-12-26 | 2014-03-26 | 北京奇虎科技有限公司 | Background testing method and device of configuration system |
CN104754002A (en) * | 2013-12-30 | 2015-07-01 | 北京金山网络科技有限公司 | File cleaning method and device, mobile terminal and cloud-side server |
Also Published As
Publication number | Publication date |
---|---|
CN105512276A (en) | 2016-04-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105512276B (en) | Method and device for constructing junk file and electronic equipment | |
EP3435235B1 (en) | Method and device for executing data recovery operation | |
CN109471851B (en) | Data processing method, device, server and storage medium | |
CN108205560B (en) | Data synchronization method and device | |
CN110737594B (en) | Database standard conformance testing method and device for automatically generating test cases | |
CN104809056A (en) | Interface testing code generating method and device | |
CN111241111B (en) | Data query method and device, data comparison method and device, medium and equipment | |
CN104699408A (en) | Operation method and device of touch screen and touch device | |
CN110597704B (en) | Pressure test method, device, server and medium for application program | |
CN104808982A (en) | Application function simulation development method and device | |
CN115576600A (en) | Code change-based difference processing method and device, terminal and storage medium | |
CN110555185A (en) | Page customization method and system based on PC client | |
CN105574026A (en) | Method and device for service supporting by using non-relational database | |
CN108279905B (en) | Method and device for introducing library file into assembly | |
CN112000321B (en) | Method and device for realizing undo and/or redo of three-dimensional detection software | |
CN111176887A (en) | MySQL misoperation rollback method, equipment and system | |
CN109032940B (en) | Test scene input method, device, equipment and storage medium | |
CN111880896B (en) | Method and device for rapidly restoring container and running state data | |
CN109522187B (en) | Method and device for quickly extracting state information | |
CN113326046A (en) | Method and device for acquiring compiling time length | |
JP2010152707A (en) | Backup method of database and database system | |
CN107450910B (en) | Method and system for providing design resources and method, system and device for software development | |
CN111414335B (en) | Data file searching method and device | |
CN111258503A (en) | Management method and device of CIROS file system | |
CN112685431B (en) | Asynchronous caching method, device, system, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20181214 |