This invention relates to a technique to register data used in a test for an application program using a database into the database.
Conventionally, following two methods for preparing a database when a test for an application program using the database is carried out exist.
In a method for directly registering data into the database by using a Structured Query Language (SQL) or the like, an appropriate value must be set into each column based on a schema. In addition, in order to maintain a data association on the business, it is necessary to separately register associated data into other databases, appropriately. Because a lot of jobs are required to set appropriate values into each column, it is very difficult to carry out settings of data by human hands while maintaining consistency on the business.
For that purpose, for example, JP-A2000-20529 discloses a technique to automatically generate test data by providing a data generation rule and coupling information for schema information held in a database. Specifically, a data warehouse test data generation apparatus has a database; database access means of the database; data generation information storage means for holding data generation information, which is generated by inputting the data generation rule and the coupling information into the schema information of the database; data generation information registration means for inputting association information of the data generation rule and the coupling information; data generation means for generating test data by the schema information and the association information; data generation activation means for inputting instructions and parameters; and a data memory of a work area for the test data generation. However, this publication does not presuppose a case where a registration application for registering data into the database is used.
In addition, JP-A-2001-256076 discloses a test data generation technique for easily and appropriately generating test data suitable for an actual environment. Specifically, when a user sets parameters for the test data generation, a test data generation apparatus connects with an existing database, and obtains data storage information in the existing database. Next, while referring to the data storage information, it reads out records stored in a table of the existing database, and calculates characteristic of column data, and after disconnecting with the existing database, it generates the test data by using the characteristic of the existing database. When the test data is generated, it connects with a database to be developed, and stores records of the generated test data into the database to be developed. Therefore, by using data stored in the existing database, which is actually operating, it is possible to generate dummy test data much according to the actual state, and appropriately carry out tuning of the database. However, when data matching with the purpose of the test for the application program to be tested is not registered in the database, the test for the application program is not appropriately carried out. Such a point is not considered in this publication.
For the database used by the application program to be test, there is a case where a registration application program is prepared to carry out data registration into the database so as to maintain the consistency on the business. When such a registration application program exists, there is no need for the user to mention a point of maintaining the consistency on the business. However, it cannot be easily understood that what data should be inputted into the registration application in order to carry out an appropriate test of the application program to be tested.
Thus, in the conventional arts, it is impossible to automatically register the test data suitable for the purpose of the test in such an environment that data is registered into the database by using the registration application program.
Therefore, an object of this invention is to provide a technique to automatically register the test data suitable for the purpose of the test into the database in such an environment that data is registered into the database by the registration application program.
In addition, another object of this invention is to provide a technique to generate data to carry out the test of the application program to be tested, without lack of the test items.
A test data registration method according to this invention is a method for registering data used for a test of an application using a database into the database by using a data registration application, including: obtaining data concerning a test condition, and storing the data concerning the test condition into a test condition data storage; generating an input candidate value for the data registration application based on the data concerning the test condition, which is stored in the test condition data storage, and reverse specification data, which defines a reverse processing of the data registration application and is identified from specification data of the data registration application, and storing the input candidate value into a storage device, and inputting the input candidate value (e.g. as an input message) stored in the storage device into the data registration application to carry out a registration processing to the database.
By carrying out such a processing, data suitable for the purpose of the test is registered into the database through the data registration application while maintaining the consistency on the business. That is, data suitable for the test of the application to be tested is stored into the database.
Incidentally, the aforementioned generating may include: generating an initial input candidate value (e.g. an initial candidate value in an embodiment) for the data registration application according to the data concerning the test condition, which is stored in the test condition data storage, and generating the input candidate value from the initial input candidate value by using the reverse specification data defining the reverse processing of the data registration application. Thus, data suitable for the purpose of the test is properly registered into the database.
Furthermore, the generating the initial input candidate value and the generating the input candidate value may be carried out for each data item for which the data concerning the test condition is defined.
Moreover, the aforementioned generating the initial input candidate value may include, when the initial input candidate value cannot be directly identified from the data concerning the test condition, identifying an input representative value stored in an input representative value data storage as the initial input candidate value. For example, when the data concerning the test condition defines a test condition that “A” is not included, a value other than “A” is obtained from the input representative values.
Furthermore, the aforementioned generating may include identifying an input representative value stored in an input representative value data storage, as the initial candidate value, for a data item for which data concerning the test condition is not defined. This is because, for the data item for which the data concerning the test condition is not defined, an arbitrary value can be set.
In addition, this invention may further include generating the reverse specification data defining a reverse processing of the data registration application from the specification data of the data registration application.
Incidentally, the aforementioned generating the reverse specification data may include: changing an operation in a data input or data check within the specification data of the data registration application to a reverse operation; and interchanging an input item and an output item in the data input or data check within the specification data of the data registration application. Thus, the appropriate reverse specification data defining a reverse processing is generated.
Moreover, the aforementioned generating may further include: generating a second initial input candidate value for the data registration application from a processing logic included in the specification data of the data registration application, which is stored in a data registration application specification data storage, for a data item for which the initial input candidate value cannot be identified from the data concerning the test condition; and generating the input candidate value from the second initial input candidate value by using the reverse specification data defining the reverse processing of the data registration application. Thus, variations of the input candidate values can be increased and the leakage of the test items can be prevented.
Moreover, the aforementioned inputting may include generating a plurality of messages by combining the input candidate values of each data item. Thus, plural test records can be appropriately registered into the database.
Furthermore, the aforementioned generating may further include: generating a third initial input candidate value for the data registration application from a processing logic included in the specification data of the application using the database, which is stored in the specification data storage, for an data item for which the initial input candidate value cannot be identified from the data concerning the test condition; and generating the input candidate value from the third initial input candidate value by using second reverse specification data defining a reverse processing of the application using the database and the reverse specification data defining the reverse processing of the data registration application. Thus, variations of the input candidate values can be further increased, and the leakage of the test items can be prevented.
In addition, this invention may further include extracting the input candidate value from data, which has been already registered into the database. It is possible to further increase the variations of the input candidate values.
Furthermore, this invention may further include generating new data concerning the test condition from the data concerning the test data and records registered in the database by the inputting. Thus, it is possible to cause the test executor to carry out the test without leakage of the test items.
Incidentally, it is possible to create a program for causing a computer to execute this method. The program is stored into a storage medium or a storage device such as, for example, a flexible disk, a CD-ROM, a magneto-optical disk, a semiconductor memory, or a hard disk. In addition, the program may be distributed as digital signals over a network in some cases. Data under processing is temporarily stored in the storage device such as a computer memory.
First, a system outline that is a premise in a first embodiment of this invention will be explained by using
Under such a premise, in order to store data according to the test cases 104, it is necessary to appropriately generate an input message 101. A test data registration apparatus to appropriately generate the input message 101 will be explained by using
The test data registration apparatus according to this embodiment has a test case input unit 1 to input data concerning the test case; a test case data storage 3 storing data concerning the test case, which was inputted by the test case input unit 1; an input representative value input unit 11 to input the input representative value; an input representative value storage 13 storing the input representative values inputted by the input representative value input unit 11; a registration application specification data storage 5 storing specification data of the registration application 102; a specification reverse unit 7 that carries out a processing to generate reverse specification data for carrying out a reverse processing of the registration application 102 by using data stored in the registration application specification data storage 5 and the input representative value storage 13; a reverse specification data storage 9 storing the reverse specification data that is a processing result of the specification reverse unit 7; an input message generator 15 that carries out a processing to generate an input message for the registration application 102 by using data stored in the test case data storage 3, the reverse specification data storage 9 and the input representative value storage 13; an input message storage 17 storing the input messages generated by the input message generator 15; and an input execution unit 19 that carries out a processing to input the input messages stored in the input message storage 17 into the registration application 102.
Next, an example of data stored in the registration application specification data storage 5 will be shown in
The specification reverse unit 7 carries out a processing, which will be explained in detail later, to generate the reverse specification data to carry out the reverse processing of the registration application 102, and stores the reverse specification data into the reverse specification data storage 9. An example of the reverse specification data corresponding to the specification data shown in
Specific contents of
(a) inputMsg.product=testDB.product
(b) if inputMsg.unit is “none”, inputMsg.qunatity=testDB.quantity
(c) if inputMsg.unit is “dozen”, inputMsg.quantity=testDB.quantity/12
More specifically, the product of the input message is the product of the testDB. When the unit of the input message is “dozen”, a value calculated by “testDB.quantity”/12 becomes the quantity of the input message. When the unit is “none”, the testDB.quantity is the quantity of the input message.
Although an example that the reverse specification data is automatically generated by the specification reverse unit 7 is shown in the embodiment, the user may prepare the reverse specification data.
Incidentally, it is assumed that the test target application 106 is a program that carries out a following processing.
(a) An input message for the test target application 106 has data items including a product name and a quantity.
(b) If the product in the input message does not exist in the DB 103, an error is outputted.
(c) If the quantity corresponding to the product in the input message is greater than the quantity of the same product in the DB 103, an error is outputted.
The specifications of such a program can be described as shown in
Next, a processing flow of the test data registration apparatus shown in
In addition, in an example of
The user inputs the test input values and the test conditions by the test case input unit 1.
Next, the input representative value input unit 11 prompts the user to input the input representative values, accepts the inputs of the input representative values from the user, and stores the input representative values into the input representative value storage 13 (step S3). For example, data as shown in
Then, the specification reverse unit 7 carries out a generation processing of the reverse specification data by using data stored in the registration application specification data storage 5 and the input representative value storage 13 (step S4). This processing will be explained in detail later. As a result, data as shown in
Then, the input message generator 15 refers to the test case data storage 3 to obtain data of an unprocessed test case (step S7). In addition, the input message generator 15 refers to the input representative value storage 13, for example, to identify an unprocessed DB item (step S9). As for the unprocessed DB item, a DB item defined as a condition in the reverse specification data stored in the reverse specification data storage 9, for example, is preferentially identified. In the example of
After that, the input message generator 15 judges, based on data of the test case obtained at the step S7, whether or not a condition is set to the DB item identified at the step S9 (step S11). For example, in a case of the test number “1”, because a condition is set only to testDB.product, the input message generator 15 can judge that a condition is set to the product and any condition is not set to the other DB items. In addition, in a case of the test number “2”, because a condition is attached to testDB.product and testDB.quantity, the input message generator 15 judges that a condition is set to these, and any condition is not set to the DB item “unit”.
Here, when it is judged that any condition is not set to the DB item identified at the step S9, the input message generator 15 obtains an input representative value of that DB item as an input candidate value from the input representative value storage 13, and stores the input candidate value into a storage device such as a main memory (step S13). Then, the processing shifts to a processing of
For example, in the test number “1” or “2”, when the DB item “unit” is processed, “dozen”, which is an input representative value of that DB item, is identified as the input candidate value.
For example, in a case of the test number “1”, when the DB item “quantity” is processed, because any test condition is not set, “100”, which is an input representative value of that DB item is identified as the input candidate value.
On the other hand, when it is judged that a condition is set to the DB item identified at the step S9, the input message generator 15 judges whether or not the DB item identified at the step S9 is a character string (step S15). When it is judged that the DB item identified at the step S9 is a character string, the input message generator 15 identifies an initial candidate value according to the test condition of the test case identified at the step S7 or an input representative value of that DB item when the initial candidate value cannot be identified by the test condition (step S21).
Then, the input message generator 15 interprets the initial candidate value by the reverse specification data stored in the reverse specification data storage 9 to identify the input candidate value (step S23). After that, the processing shifts to a processing of
For example, in a case of the test number “1”, as shown in
In addition, in a case of the test number “2”, because a condition that “E”, which is a test condition, is included is set to the DB item “product”, as shown in
Furthermore, when it is judged that the DB item is not a character string, the input message generator 15 identifies an initial candidate value according to the test condition of the test case obtained at the step S7 (step S17). Then, the input message generator 15 interprets the initial candidate value by the reverse specification data stored in the reverse specification data storage 9 to identify the input candidate value (step S19). After that, the processing shifts to the processing of
For example, in a case of the test number “2”, because a condition of an integer less than “25”, which is a test condition, as shown in
Shifting to the explanation of the processing of
On the other hand, when all DB items have been processed, the input message generator 15 generates input messages by combining the input candidate values, and stores the input messages into the input message storage 17 (step S27). For example, data as shown in
Then, the input execution unit 19 outputs the input messages stored in the input message storage 17 to the registration application 102 (step S29). Then, the registration application 102 carries out a processing according to the specification data stored in the registration application specification data storage 5 to register data into the DB 103. When the input messages as shown in
After that, the input message generator 15 judges whether or not all of the test cases have been processed (step S31). When there is an unprocessed test case, the processing returns to the step S8 in
By carrying out the processing as described above, data is registered through the registration application 102 into the DB 103 in such a form that the data conforms to each test case. Incidentally, because the registration application 102 is used, the data consistency in the DB 103 does not have any problems. Therefore, the test environment preparation for the test target application 106 becomes efficient.
Incidentally, data of the test cases may be registered in the input message storage 17 in association with the data of the input messages. Then, it is possible to hold data concerning what input message should be outputted to the registration application 102 in what case, and in a case where the same test is carried out again, the input message stored in the input message storage 17 can be reused.
Incidentally, the system outline, which is a premise of this embodiment and shown in
Next, the reverse specification generation processing will be explained by using
Then, the specification reverse unit 7 starts searching from an eSpec tag, searches the specification for a Specification tag, which defines a unit of the specification description, and judges whether or not an unprocessed Specification tag exists (step S41). When the unprocessed Specification tag exits, the specification reverse unit 7 identifies one unprocessed Specification tag (step S43). On the other hand, when the unprocessed Specification tag does not exist, the processing returns to an original processing.
When the specification reverse unit 7 identifies the unprocessed Specification tag, the specification reverse unit 7 searches the specification for a Control tag under that Specification tag, and judges whether or not an unprocessed Control tag exists (step S45). When there is no unprocessed Control tag, the processing returns to the step S41. On the other hand, when there is an unprocessed Control tag, the specification reverse unit 7 identifies one unprocessed Control tag (step S47). Then, the specification reverse unit 7 obtains an attribute value of a section attribute in an unprocessed Validate tag under that Control tag (step S49). In the example of
In addition, the specification reverse unit 7 searches the specification for a Section tag whose name is the same as the attribute value of the Section attribute, to identify the Section tag (step S51). In the example of
When the intra-Section processing ends, the specification reverse unit 7 judges whether or not all of the Section tags identified at the step S51 have been processed (step S55). When there is an unprocessed Section tag, the processing returns to the step S51. On the other hand, when all of the Section tags identified at the step S51 have been processed, the specification reverse unit 7 judges whether or not an unprocessed Validate tag exists (step S57). When the unprocessed Validate tag exists, the processing returns to the step S49. On the other hand, the specification reverse unit judges whether or not all of the Control tags have been processed (step S59). When all of the Control tags have been processed, the processing returns to the step S41. When there is an unprocessed control tag, the processing returns to the step S47.
By carrying out such a processing, it is possible to carry out a processing for necessary portions in the XML specification of the registration application 102 without any leakage.
Next, the intra-Section processing will be explained by using
On the other hand, when there is an unprocessed term tag, the specification reverse unit 7 identifies the unprocessed term tag (step S69), and judges whether or not a target attribute exists (step S71). When the target attribute does not exist, the processing returns to the step S36, because it is a check processing. On the other hand, when there is a target attribute, the specification reverse unit 7 judges whether or not an attribute value of the target attribute is concerned with the DB item (step S73). In the example of the ninth and tenth lines in
On the other hand, when the op attribute does not represent the logical operation, the specification reverse unit 7 changes the value of the op attribute as follows (step S77). That is, “ADD” is changed to “SUB”, “SUB” is changed to “ADD”, “MUL” is changed to “DIV”, and “DIV” is changed to “MUL”. In a case of “EQ”, there is no change. In the case of the ninth and tenth lines in
Shifting to the processing of
On the other hand, when the method of the function is included in the predetermined methods, the specification reverse unit 7 converts the function attribute into a type of an item pertinent in the input message (step S87). Specifically, the function attribute is converted to a type of a pertinent item of the input representative value stored in the input representative value storage 13. In the case of the ninth and tenth lines in
Then, the specification reverse unit 7 exchanges the value of the target attribute with the value of a property attribute (step S89). After that, the specification reverse unit 7 stores the data after the change into the reverse specification data storage 9 (step S91). Then, the processing returns to the step S67 through the terminal E.
By carrying out the aforementioned processing, the specification as shown in
According to the aforementioned processing, the ninth and tenth lines of
Although the first embodiment of this invention was described above, this invention is not limited to this embodiment. For example, the functional block diagram of
In addition, when the same result can be obtained, it is possible to exchange an order of the steps or execute the steps in parallel in the processing flow. For example, an order of the steps S3 and S1 can be exchanged.
In addition, as for the steps S65 and S73 in
According to the first embodiment, although it becomes possible to automatically register data according to the test cases into the database, sufficient variations are not always registered into the database.
For example, by using a system (shown in
A failure occurred in the application is mainly based on gaps in the specification interpretation between developers. In the example of
A functional block diagram of a test data registration apparatus in this embodiment will be shown in
For example, data as shown in
In addition,
Next, an operation of the apparatus shown in
Next, the input representative value input unit 207 prompts the user to input the input representative values, accepts the inputs of the input representative values from the user, and stores the input representative values into the input representative value storage 208 (step S103). For example, data as shown in
Then, the specification reverse unit 205 carries out a generation processing of the reverse specification data by using data stored in the registration application specification data storage 203 and the input representative value storage 208 (step S105). Because this processing is the same as that in the first embodiment, the explanation is omitted. As a result, data as shown in
After that, the input message generator 209 carries out a first input candidate value extraction processing by using data stored in the test case data storage 202 and the reverse specification data storage 206 (step S107). The first input candidate value extraction processing will be explained by using
In the first input candidate value extraction processing, first, the input message generator 209 reads out one unprocessed test case from the test case data storage 202 (step S121). In addition, the input message generator 209 identifies one unprocessed data item to which an input candidate value should be set (step S123). Data items (i.e. data items in the order table) that correspond to data items (i.e. data items in the input message), which are outputs, and are starting points are identified among the reverse specification data stored in the reverse specification data storage 206, for example. In the example of
Next, the input message generator 209 judges whether or not a condition is defined for the data items identified at the step S123 in the test cases stored in the test case data storage 202 (step S125). In the example of
On the other hand, when an initial candidate value can be identified according to the condition of the test case, the input message generator 209 identifies an initial candidate value according to the condition of the test case (step S129). According to the rules of
Then, the input message generator 209 judges whether or not all of the data items have been processed (step S133). When the unprocessed data item exists, the processing returns to the step S123. On the other hand, when the processing is completed for all of the data items, the input message generator 209 judges whether or not all of the test cases have been processed (step S135). In the example of
Returning to the explanation of the processing in
The input message generator 209 refers to the area storing the input candidate values in, for example, the main memory to obtain condition data for the data items for which the input candidate values have not been identified, from the processing logic (
Next, the input message generator 209 identifies one unprocessed condition among the conditions extracted at the step S141 (step S143). Then, the input message generator 209 identifies an initial candidate value satisfying the identified condition (step S145). In this processing, the specific rules shown in
Here, the input message generator 209 judges whether or not the initial candidate value could be identified (step S147). When the initial candidate value cannot be identified, the processing shifts to the step S151. On the other hand, when the initial candidate value could be identified, the input message generator 209 interprets the initial candidate value by the reverse specification data, identifies an input candidate value, and stores the input candidate value into, for example, an area to store the input candidate value in the main memory (step S149).
When it is judged at the step S147 that the initial candidate value cannot be identified or after the step S149, the input message generator 209 identifies initial candidate values, which do not satisfies the identified condition (step S151). In this processing, the specific rules as shown in
Here, the input message generator 209 judges whether or not the initial candidate value could be identified at the step S151 (step S153). When the initial candidate value cannot be identified, the processing shifts to step S157. On the other hand, when the initial candidate value could be identified, the input message generator 209 interprets the initial candidate value by the reverse specification data to identify the input candidate value, and stores the initial candidate value into the area to store the initial candidate value in, for example, the main memory (step S155). In a case of the condition “productID” in the first line of
Then, the input message generator 209 judges whether or not all of the conditions have been processed (step S157). When the unprocessed condition remains, the processing returns to the step S143. When all of the conditions have been processed, the processing returns to the original processing.
In a case of the condition “customerID” in the second line of
Returning to the explanation of the processing of
Then, the input message generator 209 combines the input candidate values of the respective data items by using a well-known method such as the orthogonal table or AllPair method to generate input messages, and stores the generated input messages into the input message storage 210 (step S113). For example, six input messages as shown in
Then, the input execution unit 211 reads out an input message from the input message storage 210, and causes the data registration application 151 to output the input message to carry out a processing to register data into the DB 152 (step S115). For example, because the processing logic as shown in
After that, for the user who carries out the test, the test case generator 213 generates data of the test case based on the data registered in the DB 152, and stores the generated data into the test case data storage 202 (step S117). If necessary, the test case stored in the test case data storage 202 may be outputted to an output device such as a display device or printer. In the aforementioned example of
By carrying out the aforementioned processing, because variations of the input messages increase and it becomes possible to carry out tests for various cases, it is possible to reduce the development costs and enhance the test efficiency by preventing the leakage of the test items and reducing the return back in the development.
In the second embodiment, by using the specification data of the data registration application 151, the variations of the input candidate values are increased. However, in this embodiment, by using the specification data of the test target application 153, the variations of the input candidate values are increased. The basic processing flow is the same as that in
That is, the input message generator 209 refers to the area to store the input candidate values in, for example, the main memory to obtain condition data for the data items for which the input candidate value cannot be identified in the first input candidate value extraction processing from the processing logic in the specification data of the test target application 153, which is stored in the test target application specification data storage 204 (step S161). For example, here, as shown in
Next, the input message generator 209 identifies one unprocessed condition among the conditions extracted at the step S161 (step S163). Then, the input message generator 209 identifies the initial candidate value satisfying the identified condition (step S165). This processing follows the specific rules shown in
Here, the input message generator 209 judges whether or not the initial candidate value could be identified (step S167). When the initial candidate value could not identified, the processing shifts to step S171. On the other hand, when the initial candidate value could be identified, the input message generator 209 interprets the initial candidate value by the reverse specification data of the test target application 153 and the reverse specification data of the data registration application 151 to identify the input candidate value, and stores the input candidate value into the area to store the input candidate value in, for example, the main memory (step S169).
When it is judged at the step S167 that the initial candidate value cannot be identified, or after the step S169, the input message generator 209 identifies the initial candidate value, which does not satisfy the identified condition (step S171). This processing follows the specific rules shown in
Here, the input message generator 209 judges whether or not the initial candidate value could be identified at the step S171 (step S173). When the initial candidate value could not identified, the processing shifts to the step S177. On the other hand, when the initial candidate value can be identified, the input message generator 209 interprets the initial candidate value by the reverse specific data of the test target application 153 and the reverse specific data of the data registration application 151 to identify the input candidate value, and stores the input candidate value into the area to store the input candidate value in, for example, main memory (step S175). This processing is a processing as explained in
Then, the input message generator 209 judges whether or not all of the conditions have been processed (step S177). When there is an unprocessed condition, the processing returns to the step S163. When all of the conditions have been processed, the origin processing returns to the original processing.
By carrying out such a processing, as shown in
In the third embodiment, an example that the input candidate value is generated from the input representative value after the second input candidate value extraction processing was shown. In this fourth embodiment, the copy information included in the specification data of the data registration application 151 is used. Specifically, when the copy information schematically shown in
Thus, by using data used in other table, that is, data having the consistency, it becomes possible to enrich the input candidate values and increase the variation of the input messages.
Although the second to fourth embodiments of this invention were described above, this invention is not limited to this invention. For example, the functional block diagram shown in
Incidentally, the test data registration apparatuses as shown in
There is a case where a processing such as a range check, data copy and conversion is executed for the data item such as data Bean, HashMap (java.util.HashMap), and XML data Bean (com.fujitsu.uji.xml.XMLDataBean) on a Web server. The XML data specification description is a function to describe, in the XML format, the copy processing and the check processing of the data items whose specification change, which depends on the business, is frequent, into an external file, and to execute such a processing. By describing the specification into the external file, it becomes possible to cope with the specification change without changing the program, and it is expected that the maintenance capability is improved.
A system outline, which utilizes the XML data specification description, is indicated in
The user describes the specification such as a data range, matching of the character string pattern and the like in the XML format, for each data item. The usable data items are data items of the data Bean, Hash Map and XML data Bean. In the execution time, it is possible to execute the XML file as it is by using the interpreter function, or compile and execute the XML file by using the compiler function. By executing the XML file as it is, it is possible to cope with the changes of the data check specification or the like without changing the program.
It is possible to compile the created XML data specification description to classes of the Java (registered trademark) and use the generated classes. The XML data specification description compiler generates and outputs the Java source file from the XML data specification description. Because there is no need to analyze the XML in the application execution, the execution capability is enhanced compared with a case where the XML file is used as it is.
The created XML data specification description is executed. As inputs, data Bean, HashMap and XML data Bean can be used. It is possible to refer to or update the data items of the objects, which are designated as the inputs, and to update the data item of the output destination object.
The outline of the XML data specification description is shown in
a) Config Element
This element designates information of XML data specification description.
b) Specification Element
This element indicates a unit of the processing. In the execution time of the XML specification description, by using a name designated in the name attribute of this element, the processing is called.
c) Control Element
This element designates an order of the check and a check target object. The processing is executed in an order of the validate elements described in this element.
d) Validate Element
Section element to be executed is designated in the section attribute of this element.
e) Section Element
This element indicates an execution unit of a series of processing.
f) Block Element
This element designates a judgment range of the condition.
g) Term Element
This element designates the condition and operation in a case where the condition is true.
h) Verify Element
This element designates the condition and operation to be executed in a case where the condition is false.
i) Decision Element
This element designates an operation to be executed in a case where a set of conditions, which are stored in the value element, is true.
j) Status Element
This element indicates a judgment condition of the decision element.
Next, an example of the description of the XML data specification definition is shown in
a) a case where the tag of specification name=“checkValue” is called
1. execute validate tags designated in the control tag in sequence. In the example, the pertinent section tags are called in the order of check 1 and then check 2.
2. check, by the tag of section name=“check1”, which was firstly called from the control tag, whether or not the value of the value item is data from 0 to 100.
5. check, by the tag of section name=“check2”, whether or not the value of the data item “text” is null or empty character string.
b) a case where the tag of specification name=“copyValue” is called
1. execute the validate tag designated in the control tag. In the example, the copy section is executed for the array element of arrayData and the array element of t_arrayData by the number of elements.
2. copy to “t_value” by the tag of section name=“copy” called from the control tag, when the data item “value” is not 0.
3. after the execution of copy section by the number of elements, the processing normally ends.
Next, usable object expressions and operators will be explained. In the following XML description, the object expression can be described for the property attribute and the operand attribute in the term element. <term property=“value” op=“LE” operand=“100” exception=“#value should be from 0 to 100.”/>
A list of the object expressions, which can be described, will be shown in
In addition, a logical operator or calculation operator can be designated in the op attribute. The operators, which can be designated, will be shown in
Furthermore, a method, which is applied to property, can be described in the function attribute of the value element in the following XML description. <value seq=“2” property=“text” function=“stringLength” op=“EQ” operand=“0”/>
The methods, which can be described, will be shown in
In addition, the description method shown in
Furthermore, the definition method of the user method is as follows:
In the XML data specification description, a static method and a method of a class, which inherits ESpecValidator class, can be used as the user method. The definition method of the user method will be explained in the following.
a) The static method is used.
In the XML data specification description, the static method can be invoked. As the invocation method, it is designated in a format “package name.class name.method name” in the function attribute or valueFunction attribute. An example is shown below.
<term property=“abc” function=“some_package.some_class.some_function”/>
package some_package; class some_class {static void some function(String arg1) { . . . }}
b) A method of a class, which inherits ESpecValidator class, is used.
An example that ESpecValidator class is inherited and a method of the class is invoked is shown below.
<term property=“abc” function=“some_function”/>
class SomeClass extends EspecValidator {void some_function (String arg1){ . . . }}
The parameters are defined in the following format.
a) arbitrary type some_function(arbitrary type, . . . )
The type matching to an arbitrary type is automatically carried out. However, when the type matching cannot be carried out, an exception occurs.
b) arbitrary type some_function(Object [ ]args);
The parameter is outputted in an array of the Object type.
An example that the plural parameters are outputted to the user-defined method is shown below. When plural objects are described in the property attribute in such a manner that the plural objects are separated by the comma, they are invoked in sequence in association with the parameters of the user-defined method. In the following example, a numeral value “1” is outputted to param1 of some_function, a character string “abc” is outputted to param2 of some_function, and a numeral value “2” is outputted to param3 of some_function.
<term property=“1, #abc, 2” function=“some_function”/>
void some_function(int param1, String param2, int param3){ . . . }
Although the present invention has been described with respect to a specific preferred embodiment thereof, various change and modifications may be suggested to one skilled in the art, and it is intended that the present invention encompass such changes and modifications as fall within the scope of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2006-340927 | Dec 2006 | JP | national |
2007-161665 | Jun 2007 | JP | national |