|
From: Ashwin K. <AKu...@pd...> - 2011-01-19 16:26:41
|
Roberto: I have added the following extensions to DBUnit 2.4.8 in-house as we are using JUNIT3 and JDK 1.5 (Annotations). I understand that DBUnit 3+ will support JDK 1.5 and annotation. I checked out https://svn.codehaus.org/dbunit/ but I would need further support in understand how to go about adding my code here as I don't see all the classes from 2.4.8 here. Here is the summary of my extensions that I would like to contribute. EnhancedDBUnitTestCase (extends DBTestCase) (Supports newer annotations around test methods) Base class for the unit tests that need to test stored procedures. For Junit4, will have to add these to custom test runner. IDBUnitDatabaseProperties Constants defined that provide schema connectivity parameters. DBUnitConnectionManager (uses DBCP) This class provides connection pooling so tests can share the expensive connection object(s). DbUnitOperationListener DBUnit closes connection after setup, and thus requires connections to be opened/closed for test and again for tear down. This class ensures the same connection instance is used for setUp(), execution of test..() and tearDown() as well. SQLDatabaseOperation Helps extend functionality to use SQL scripts for input/clean up data sets. Useful for deleting when there is seed data in the table, circular references. PropertyReplacerInputStream This class is used by DBUnit to evaluate property place holders when reading the file containing the input dataset. Useful when your input dataset has to refer seed data that is already part of the schema, or you need to substitute dynamically calculated values in the data set (like dates) This is much faster as it extends BufferedInputStream DBUnitPropertyEnum (Will need to reconsider this) This class helps evaluate a given property value. Developers will add newer enums as and when necessary in the input data sets. PropertyEvaluator Interface that will be implemented by the custom property evaluator. DBUnitPropertyEvaluator Custom property evaluator ${TOMORROW_DATE_IN_MM_DD_YYYY} or ${SQL:select ID from EMPLOYEE where degree_type='MS'} DBUnitCustomDataSet Custom dataset that aggregates multiple datasets for a given unit test so we can set up circular referential data if so needed. DBUnitOrderedTableNameMap Uses MultiValueMap to handle multiple datasets having input data for the same table. DBUnitSetUpDatabaseOperation, DBUnitTearDownDatabaseOperation Database operations to be used in order to set up/clean up data for a test. getDataSet() gets invoked for both setup and teardown. Using the above, we can differentiate and retrieve the appropriate data set from set up and clean up. DBUnitTestConfiguration Annotation to specify set up, clean up data set(s) and methods to do the same. Example: @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = DBUnitTearDownDatabaseOperation.USE_SQL) The above REFRESH will help create circular reference as it will update and not insert if the record is already present. Besides this, I have tried to address an issue that developers have in extracting data sets from RDBMS. Most developers can exercise the application and create test data however, extracting that seems challenging in order to create a test data set. So, I have created a DataExporter utility class that can allow developer to establish connection to a schema and specify which record in a table they want to extract. From there on, the utility will go over all the tables this record references (foreign key) to query if the developer is interested in extracting that. If so, this will go recursively. Set up connection properties Connection jdbcConnection; jdbcConnection = DriverManager.getConnection( "jdbc:oracle:thin:@machine-ip:1525:db", "user", "password"); connection = new DatabaseConnection(jdbcConnection, "company"); // for Oracle 10 DatabaseConfig config = connection.getConfig(); config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory()); // try to extract desired data set extractDesiredDataSet(0, "EMPLOYEE", new Long(1233422)); Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : y Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : y Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : y Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : y Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : y Once we opt out or walk through recursively, we have a neat data set that we can now import and massage to create test data sets. If someone has already contributed similar stuff, please let me know. If you think this can potentially add value to DBUnit, I would like to contribute to DBUnit3. It will be really helpful if you can mail or help me understand how to go about contributing this source to the DBUnit 3 on codehaus. Sincerely, ______________________________________________________________ Ashwini Kuntamukkala | PDX, Inc. EPS Architecture Team |
|
From: Roberto Lo G. <rlo...@gm...> - 2011-01-24 23:21:01
|
Hi Ashwin, first of all please excuse my late response, but I've just relocated to Ireland and my free time is really busy these days. Anyway, we are actually trying to start dbUnit 3 from scratch, design it as we would it to be and then see how far we are from dbUnit 2 (not much I guess) then we'll try to move in dbUnit 3 all the dbUnit 2 code but sticking to the new design. What we want to achieve is having a clean design (as dbUnit 2 has, but we want to have the option to use any available Java 5 feature) without having to re-code everything: I hope you can get the picture. This means your code can't be just contributed straight into the dbUnit 3 repo, but if you wish we would be happy to welcome you on the redesign task. I think your contribution could be really interesting for us all as you seem have already faced most of the features we wish to add, plus some feature we didn't think of yet. Let us know if you wish to be part of the redesign task, this can be a great chance to improve an already great extension. Take care, Roberto On Wed, Jan 19, 2011 at 16:14, Ashwin Kuntamukkala <AKu...@pd... > wrote: > Roberto: > > > > > > I have added the following extensions to DBUnit 2.4.8 in-house as we are > using JUNIT3 and JDK 1.5 (Annotations). > > > > I understand that DBUnit 3+ will support JDK 1.5 and annotation. > > > > I checked out https://svn.codehaus.org/dbunit/ but I would need further > support in understand how to go about adding my code here as I don’t see all > the classes from 2.4.8 here. > > > > > > > > Here is the summary of my extensions that I would like to contribute. > > > > > > > > *EnhancedDBUnitTestCase (extends DBTestCase)* (Supports newer annotations > around test methods) > > Base class for the unit tests that need to test stored procedures. > > For Junit4, will have to add these to custom test runner. > > > > *IDBUnitDatabaseProperties* > > Constants defined that provide schema connectivity parameters. > > > > *DBUnitConnectionManager (uses DBCP)* > > This class provides connection pooling so tests can share the expensive > connection object(s). > > > > *DbUnitOperationListener* > > DBUnit closes connection after setup, and thus requires connections to be > opened/closed for test and again for tear down. This class ensures the same > connection instance is used for setUp(), execution of test..() and > tearDown() as well. > > > > *SQLDatabaseOperation* > > Helps extend functionality to use SQL scripts for input/clean up data sets. > Useful for deleting when there is seed data in the table, circular > references. > > > > *PropertyReplacerInputStream* > > This class is used by DBUnit to evaluate property place holders when > reading the file containing the input dataset. Useful when your input > dataset has to refer seed data that is already part of the schema, or you > need to substitute dynamically calculated values in the data set (like > dates) > > This is much faster as it extends *BufferedInputStream** * > > > > *DBUnitPropertyEnum* (Will need to reconsider this) > > This class helps evaluate a given property value. > > Developers will add newer enums as and when necessary in the input data > sets. > > > > *PropertyEvaluator* > > Interface that will be implemented by the custom property evaluator. > > > > *DBUnitPropertyEvaluator* > > Custom property evaluator > > ${TOMORROW_DATE_IN_MM_DD_YYYY} or > > ${SQL:select ID from EMPLOYEE where degree_type=‘MS’} > > > > > > *DBUnitCustomDataSet* > > Custom dataset that aggregates multiple datasets for a given unit test so > we can set up circular referential data if so needed. > > > > *DBUnitOrderedTableNameMap* > > Uses MultiValueMap to handle multiple datasets having input data for the > same table. > > > > *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* > > Database operations to be used in order to set up/clean up data for a test. > > > > getDataSet() gets invoked for both setup and teardown. Using the above, we > can differentiate and retrieve the appropriate data set from set up and > clean up. > > > > > > *DBUnitTestConfiguration * > > Annotation to specify set up, clean up data set(s) and methods to do the > same. > > Example: > > @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, > setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, > > tearDownScripts = {"delele_emp_dept.sql"}, > tearDownScriptsOperation = DBUnitTearDownDatabaseOperation.USE_SQL) > > > > The above REFRESH will help create circular reference as it will update and > not insert if the record is already present. > > > > > > > > Besides this, I have tried to address an issue that developers have in > extracting data sets from RDBMS. Most developers can exercise the > application and create test data however, extracting that seems challenging > in order to create a test data set. > > > > So, I have created a *DataExporter* utility class that can allow developer > to establish connection to a schema and specify which record in a table they > want to extract. From there on, the utility will go over all the tables this > record references (foreign key) to query if the developer is interested in > extracting that. If so, this will go recursively. > > > > > > Set up connection properties > > > > Connection jdbcConnection; > > jdbcConnection = DriverManager.*getConnection*( > > "jdbc:oracle:thin:@machine-ip:1525:db", > > "user", "password"); > > *connection* = *new* DatabaseConnection(jdbcConnection, "company"); > > // for Oracle 10 > > DatabaseConfig config = *connection*.getConfig(); > > config.setProperty(DatabaseConfig.*PROPERTY_DATATYPE_FACTORY*, *new*Oracle10DataTypeFactory()); > > > > > > // try to extract desired data set > > > > *extractDesiredDataSet*(0, "EMPLOYEE", *new* Long(1233422)); > > > > > > Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : > > y > > Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : > > y > > Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : > > y > > > > Once we opt out or walk through recursively, we have a neat data set that > we can now import and massage to create test data sets. > > > > > > If someone has already contributed similar stuff, please let me know. > > > > If you think this can potentially add value to DBUnit, I would like to > contribute to DBUnit3. > > It will be really helpful if you can mail or help me understand how to go > about contributing this source to the DBUnit 3 on codehaus. > > > > > > Sincerely, > > > > ______________________________________________________________ > > Ashwini Kuntamukkala | *PDX, Inc.* > > *EPS Architecture Team* > > > |
|
From: Ashwin K. <AKu...@pd...> - 2011-01-25 14:53:43
|
Thanks Roberto for getting back to me! I'd be glad to be on the team doing the redesign task. ______________________________________________________ Ashwini Kuntamukkala | 817.246.6760 | ext. 4010 EPS Architecture Team PDX, Inc. From: Roberto Lo Giacco [mailto:rlo...@gm...] Sent: Monday, January 24, 2011 5:20 PM To: Ashwin Kuntamukkala Cc: dbu...@li...; jef...@us...; fel...@us... Subject: Re: potential contribution to DBUnit 3 Hi Ashwin, first of all please excuse my late response, but I've just relocated to Ireland and my free time is really busy these days. Anyway, we are actually trying to start dbUnit 3 from scratch, design it as we would it to be and then see how far we are from dbUnit 2 (not much I guess) then we'll try to move in dbUnit 3 all the dbUnit 2 code but sticking to the new design. What we want to achieve is having a clean design (as dbUnit 2 has, but we want to have the option to use any available Java 5 feature) without having to re-code everything: I hope you can get the picture. This means your code can't be just contributed straight into the dbUnit 3 repo, but if you wish we would be happy to welcome you on the redesign task. I think your contribution could be really interesting for us all as you seem have already faced most of the features we wish to add, plus some feature we didn't think of yet. Let us know if you wish to be part of the redesign task, this can be a great chance to improve an already great extension. Take care, Roberto On Wed, Jan 19, 2011 at 16:14, Ashwin Kuntamukkala <AKu...@pd...<mailto:AKu...@pd...>> wrote: Roberto: I have added the following extensions to DBUnit 2.4.8 in-house as we are using JUNIT3 and JDK 1.5 (Annotations). I understand that DBUnit 3+ will support JDK 1.5 and annotation. I checked out https://svn.codehaus.org/dbunit/ but I would need further support in understand how to go about adding my code here as I don't see all the classes from 2.4.8 here. Here is the summary of my extensions that I would like to contribute. EnhancedDBUnitTestCase (extends DBTestCase) (Supports newer annotations around test methods) Base class for the unit tests that need to test stored procedures. For Junit4, will have to add these to custom test runner. IDBUnitDatabaseProperties Constants defined that provide schema connectivity parameters. DBUnitConnectionManager (uses DBCP) This class provides connection pooling so tests can share the expensive connection object(s). DbUnitOperationListener DBUnit closes connection after setup, and thus requires connections to be opened/closed for test and again for tear down. This class ensures the same connection instance is used for setUp(), execution of test..() and tearDown() as well. SQLDatabaseOperation Helps extend functionality to use SQL scripts for input/clean up data sets. Useful for deleting when there is seed data in the table, circular references. PropertyReplacerInputStream This class is used by DBUnit to evaluate property place holders when reading the file containing the input dataset. Useful when your input dataset has to refer seed data that is already part of the schema, or you need to substitute dynamically calculated values in the data set (like dates) This is much faster as it extends BufferedInputStream DBUnitPropertyEnum (Will need to reconsider this) This class helps evaluate a given property value. Developers will add newer enums as and when necessary in the input data sets. PropertyEvaluator Interface that will be implemented by the custom property evaluator. DBUnitPropertyEvaluator Custom property evaluator ${TOMORROW_DATE_IN_MM_DD_YYYY} or ${SQL:select ID from EMPLOYEE where degree_type='MS'} DBUnitCustomDataSet Custom dataset that aggregates multiple datasets for a given unit test so we can set up circular referential data if so needed. DBUnitOrderedTableNameMap Uses MultiValueMap to handle multiple datasets having input data for the same table. DBUnitSetUpDatabaseOperation, DBUnitTearDownDatabaseOperation Database operations to be used in order to set up/clean up data for a test. getDataSet() gets invoked for both setup and teardown. Using the above, we can differentiate and retrieve the appropriate data set from set up and clean up. DBUnitTestConfiguration Annotation to specify set up, clean up data set(s) and methods to do the same. Example: @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = DBUnitTearDownDatabaseOperation.USE_SQL) The above REFRESH will help create circular reference as it will update and not insert if the record is already present. Besides this, I have tried to address an issue that developers have in extracting data sets from RDBMS. Most developers can exercise the application and create test data however, extracting that seems challenging in order to create a test data set. So, I have created a DataExporter utility class that can allow developer to establish connection to a schema and specify which record in a table they want to extract. From there on, the utility will go over all the tables this record references (foreign key) to query if the developer is interested in extracting that. If so, this will go recursively. Set up connection properties Connection jdbcConnection; jdbcConnection = DriverManager.getConnection( "jdbc:oracle:thin:@machine-ip:1525:db", "user", "password"); connection = new DatabaseConnection(jdbcConnection, "company"); // for Oracle 10 DatabaseConfig config = connection.getConfig(); config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory()); // try to extract desired data set extractDesiredDataSet(0, "EMPLOYEE", new Long(1233422)); Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : y Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : y Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : y Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : y Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : y Once we opt out or walk through recursively, we have a neat data set that we can now import and massage to create test data sets. If someone has already contributed similar stuff, please let me know. If you think this can potentially add value to DBUnit, I would like to contribute to DBUnit3. It will be really helpful if you can mail or help me understand how to go about contributing this source to the DBUnit 3 on codehaus. Sincerely, ______________________________________________________________ Ashwini Kuntamukkala | PDX, Inc. EPS Architecture Team |
|
From: Roberto Lo G. <rlo...@gm...> - 2011-01-26 12:29:58
|
Nice! We will have a face to face meeting this evening with Sebastien discussing the redesign here in Dublin (IE) around 18.00 GMT. Do you wish to get involved? We can start an IRC channel or a Skype communication, whatever you prefer. I hope others will join too, I'm going to post a message on the developers list. On Tue, Jan 25, 2011 at 14:53, Ashwin Kuntamukkala <AKu...@pd... > wrote: > Thanks Roberto for getting back to me! > > I’d be glad to be on the team doing the redesign task. > > > > ______________________________________________________ > > Ashwini Kuntamukkala | 817.246.6760 | ext. 4010 > *EPS Architecture Team *** > > *PDX, Inc.* > > > > *From:* Roberto Lo Giacco [mailto:rlo...@gm...] > *Sent:* Monday, January 24, 2011 5:20 PM > *To:* Ashwin Kuntamukkala > *Cc:* dbu...@li...; > jef...@us...; fel...@us... > *Subject:* Re: potential contribution to DBUnit 3 > > > > Hi Ashwin, > > > > first of all please excuse my late response, but I've just relocated to > Ireland and my free time is really busy these days. Anyway, we are actually > trying to start dbUnit 3 from scratch, design it as we would it to be and > then see how far we are from dbUnit 2 (not much I guess) then we'll try to > move in dbUnit 3 all the dbUnit 2 code but sticking to the new design. > > > > What we want to achieve is having a clean design (as dbUnit 2 has, but we > want to have the option to use any available Java 5 feature) without having > to re-code everything: I hope you can get the picture. > > > > This means your code can't be just contributed straight into the dbUnit 3 > repo, but if you wish we would be happy to welcome you on the redesign task. > I think your contribution could be really interesting for us all as you seem > have already faced most of the features we wish to add, plus some feature we > didn't think of yet. > > > > Let us know if you wish to be part of the redesign task, this can be a > great chance to improve an already great extension. > > > > Take care, > > Roberto > > > > On Wed, Jan 19, 2011 at 16:14, Ashwin Kuntamukkala < > AKu...@pd...> wrote: > > Roberto: > > > > > > I have added the following extensions to DBUnit 2.4.8 in-house as we are > using JUNIT3 and JDK 1.5 (Annotations). > > > > I understand that DBUnit 3+ will support JDK 1.5 and annotation. > > > > I checked out https://svn.codehaus.org/dbunit/ but I would need further > support in understand how to go about adding my code here as I don’t see all > the classes from 2.4.8 here. > > > > > > > > Here is the summary of my extensions that I would like to contribute. > > > > > > > > *EnhancedDBUnitTestCase (extends DBTestCase)* (Supports newer annotations > around test methods) > > Base class for the unit tests that need to test stored procedures. > > For Junit4, will have to add these to custom test runner. > > > > *IDBUnitDatabaseProperties* > > Constants defined that provide schema connectivity parameters. > > > > *DBUnitConnectionManager (uses DBCP)* > > This class provides connection pooling so tests can share the expensive > connection object(s). > > > > *DbUnitOperationListener* > > DBUnit closes connection after setup, and thus requires connections to be > opened/closed for test and again for tear down. This class ensures the same > connection instance is used for setUp(), execution of test..() and > tearDown() as well. > > > > *SQLDatabaseOperation* > > Helps extend functionality to use SQL scripts for input/clean up data sets. > Useful for deleting when there is seed data in the table, circular > references. > > > > *PropertyReplacerInputStream* > > This class is used by DBUnit to evaluate property place holders when > reading the file containing the input dataset. Useful when your input > dataset has to refer seed data that is already part of the schema, or you > need to substitute dynamically calculated values in the data set (like > dates) > > This is much faster as it extends *BufferedInputStream** * > > > > *DBUnitPropertyEnum* (Will need to reconsider this) > > This class helps evaluate a given property value. > > Developers will add newer enums as and when necessary in the input data > sets. > > > > *PropertyEvaluator* > > Interface that will be implemented by the custom property evaluator. > > > > *DBUnitPropertyEvaluator* > > Custom property evaluator > > ${TOMORROW_DATE_IN_MM_DD_YYYY} or > > ${SQL:select ID from EMPLOYEE where degree_type=‘MS’} > > > > > > *DBUnitCustomDataSet* > > Custom dataset that aggregates multiple datasets for a given unit test so > we can set up circular referential data if so needed. > > > > *DBUnitOrderedTableNameMap* > > Uses MultiValueMap to handle multiple datasets having input data for the > same table. > > > > *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* > > Database operations to be used in order to set up/clean up data for a test. > > > > getDataSet() gets invoked for both setup and teardown. Using the above, we > can differentiate and retrieve the appropriate data set from set up and > clean up. > > > > > > *DBUnitTestConfiguration * > > Annotation to specify set up, clean up data set(s) and methods to do the > same. > > Example: > > @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, > setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, > > tearDownScripts = {"delele_emp_dept.sql"}, > tearDownScriptsOperation = DBUnitTearDownDatabaseOperation.USE_SQL) > > > > The above REFRESH will help create circular reference as it will update and > not insert if the record is already present. > > > > > > > > Besides this, I have tried to address an issue that developers have in > extracting data sets from RDBMS. Most developers can exercise the > application and create test data however, extracting that seems challenging > in order to create a test data set. > > > > So, I have created a *DataExporter* utility class that can allow developer > to establish connection to a schema and specify which record in a table they > want to extract. From there on, the utility will go over all the tables this > record references (foreign key) to query if the developer is interested in > extracting that. If so, this will go recursively. > > > > > > Set up connection properties > > > > Connection jdbcConnection; > > jdbcConnection = DriverManager.*getConnection*( > > "jdbc:oracle:thin:@machine-ip:1525:db", > > "user", "password"); > > *connection* = *new* DatabaseConnection(jdbcConnection, "company"); > > // for Oracle 10 > > DatabaseConfig config = *connection*.getConfig(); > > config.setProperty(DatabaseConfig.*PROPERTY_DATATYPE_FACTORY*, *new*Oracle10DataTypeFactory()); > > > > > > // try to extract desired data set > > > > *extractDesiredDataSet*(0, "EMPLOYEE", *new* Long(1233422)); > > > > > > Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : > > y > > Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : > > y > > Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : > > y > > > > Once we opt out or walk through recursively, we have a neat data set that > we can now import and massage to create test data sets. > > > > > > If someone has already contributed similar stuff, please let me know. > > > > If you think this can potentially add value to DBUnit, I would like to > contribute to DBUnit3. > > It will be really helpful if you can mail or help me understand how to go > about contributing this source to the DBUnit 3 on codehaus. > > > > > > Sincerely, > > > > ______________________________________________________________ > > Ashwini Kuntamukkala | *PDX, Inc.* > > *EPS Architecture Team* > > > > > |
|
From: Sébastien Le C. <sl...@ya...> - 2011-01-29 23:18:46
|
Hi Ashwini, Could you please submit your contribution as a patch to the current DbUnit svn trunk at sourceforge, either by sending it to the list or using the SF tracker (https://sourceforge.net/tracker/?group_id=47439&atid=449493)? It looks like what you guys have done could be a good starting point to the DbUnit 3.x devs. Regards, Sébastien. On 19/01/2011 16:14, Ashwin Kuntamukkala wrote: > Roberto: > > I have added the following extensions to DBUnit 2.4.8 in-house as we are > using JUNIT3 and JDK 1.5 (Annotations). > > I understand that DBUnit 3+ will support JDK 1.5 and annotation. > > I checked out https://svn.codehaus.org/dbunit/ but I would need further > support in understand how to go about adding my code here as I don’t see > all the classes from 2.4.8 here. > > Here is the summary of my extensions that I would like to contribute. > > *EnhancedDBUnitTestCase(extends DBTestCase)*(Supports newer annotations > around test methods) > > Base class for the unit tests that need to test stored procedures. > > For Junit4, will have to add these to custom test runner. > > *IDBUnitDatabaseProperties* > > Constants defined that provide schema connectivity parameters. > > *DBUnitConnectionManager (uses DBCP)* > > This class provides connection pooling so tests can share the expensive > connection object(s). > > *DbUnitOperationListener* > > DBUnit closes connection after setup, and thus requires connections to > be opened/closed for test and again for tear down. This class ensures > the same connection instance is used for setUp(), execution of test..() > and tearDown() as well. > > *SQLDatabaseOperation* > > Helps extend functionality to use SQL scripts for input/clean up data > sets. Useful for deleting when there is seed data in the table, circular > references. > > *PropertyReplacerInputStream* > > This class is used by DBUnit to evaluate property place holders when > reading the file containing the input dataset. Useful when your input > dataset has to refer seed data that is already part of the schema, or > you need to substitute dynamically calculated values in the data set > (like dates) > > This is much faster as it extends _BufferedInputStream___ > > *DBUnitPropertyEnum* (Will need to reconsider this) > > This class helps evaluate a given property value. > > Developers will add newer enums as and when necessary in the input data > sets. > > *PropertyEvaluator* > > Interface that will be implemented by the custom property evaluator. > > *DBUnitPropertyEvaluator* > > Custom property evaluator > > ${TOMORROW_DATE_IN_MM_DD_YYYY} or > > ${SQL:select ID from EMPLOYEE where degree_type=‘MS’} > > *DBUnitCustomDataSet* > > Custom dataset that aggregates multiple datasets for a given unit test > so we can set up circular referential data if so needed. > > *DBUnitOrderedTableNameMap* > > Uses MultiValueMap to handle multiple datasets having input data for the > same table. > > *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* > > Database operations to be used in order to set up/clean up data for a test. > > getDataSet() gets invoked for both setup and teardown. Using the above, > we can differentiate and retrieve the appropriate data set from set up > and clean up. > > *DBUnitTestConfiguration * > > Annotation to specify set up, clean up data set(s) and methods to do the > same. > > Example: > > @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, > setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, > > tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = > DBUnitTearDownDatabaseOperation.USE_SQL) > > The above REFRESH will help create circular reference as it will update > and not insert if the record is already present. > > Besides this, I have tried to address an issue that developers have in > extracting data sets from RDBMS. Most developers can exercise the > application and create test data however, extracting that seems > challenging in order to create a test data set. > > So, I have created a *DataExporter* utility class that can allow > developer to establish connection to a schema and specify which record > in a table they want to extract. From there on, the utility will go over > all the tables this record references (foreign key) to query if the > developer is interested in extracting that. If so, this will go recursively. > > Set up connection properties > > Connection jdbcConnection; > > jdbcConnection = DriverManager./getConnection/( > > "jdbc:oracle:thin:@machine-ip:1525:db", > > "user", "password"); > > /connection/= *new*DatabaseConnection(jdbcConnection, "company"); > > // for Oracle 10 > > DatabaseConfig config = /connection/.getConfig(); > > config.setProperty(DatabaseConfig./PROPERTY_DATATYPE_FACTORY/, > *new*Oracle10DataTypeFactory()); > > // try to extract desired data set > > /extractDesiredDataSet/(0, "EMPLOYEE", *new*Long(1233422)); > > Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : > > y > > Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : > > y > > Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : > > y > > Once we opt out or walk through recursively, we have a neat data set > that we can now import and massage to create test data sets. > > If someone has already contributed similar stuff, please let me know. > > If you think this can potentially add value to DBUnit, I would like to > contribute to DBUnit3. > > It will be really helpful if you can mail or help me understand how to > go about contributing this source to the DBUnit 3 on codehaus. > > Sincerely, > > ______________________________________________________________ > > Ashwini Kuntamukkala |*PDX, Inc.* > > /EPS Architecture Team/ > > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > > > > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer |
|
From: Ashwin K. <AKu...@pd...> - 2011-02-02 16:03:44
|
Sebastien: I am unable to check the URL you sent. ------ There was an error processing your request ... Permission Denied Access to this page is restricted (either to project members or to project administrators) and you do not meet the requirements to access this page. Please contact the administrator of this project for further assistance. ----- I get the above exception on the sourceforge website. Thanks Ashwin -----Original Message----- From: Sébastien Le Callonnec [mailto:sl...@ya...] Sent: Saturday, January 29, 2011 5:19 PM To: dbu...@li... Subject: Re: [dbunit-developer] potential contribution to DBUnit 3 - [SPAM E3 : Header] - Email found in subject Hi Ashwini, Could you please submit your contribution as a patch to the current DbUnit svn trunk at sourceforge, either by sending it to the list or using the SF tracker (https://sourceforge.net/tracker/?group_id=47439&atid=449493)? It looks like what you guys have done could be a good starting point to the DbUnit 3.x devs. Regards, Sébastien. On 19/01/2011 16:14, Ashwin Kuntamukkala wrote: > Roberto: > > I have added the following extensions to DBUnit 2.4.8 in-house as we are > using JUNIT3 and JDK 1.5 (Annotations). > > I understand that DBUnit 3+ will support JDK 1.5 and annotation. > > I checked out https://svn.codehaus.org/dbunit/ but I would need further > support in understand how to go about adding my code here as I don't see > all the classes from 2.4.8 here. > > Here is the summary of my extensions that I would like to contribute. > > *EnhancedDBUnitTestCase(extends DBTestCase)*(Supports newer annotations > around test methods) > > Base class for the unit tests that need to test stored procedures. > > For Junit4, will have to add these to custom test runner. > > *IDBUnitDatabaseProperties* > > Constants defined that provide schema connectivity parameters. > > *DBUnitConnectionManager (uses DBCP)* > > This class provides connection pooling so tests can share the expensive > connection object(s). > > *DbUnitOperationListener* > > DBUnit closes connection after setup, and thus requires connections to > be opened/closed for test and again for tear down. This class ensures > the same connection instance is used for setUp(), execution of test..() > and tearDown() as well. > > *SQLDatabaseOperation* > > Helps extend functionality to use SQL scripts for input/clean up data > sets. Useful for deleting when there is seed data in the table, circular > references. > > *PropertyReplacerInputStream* > > This class is used by DBUnit to evaluate property place holders when > reading the file containing the input dataset. Useful when your input > dataset has to refer seed data that is already part of the schema, or > you need to substitute dynamically calculated values in the data set > (like dates) > > This is much faster as it extends _BufferedInputStream___ > > *DBUnitPropertyEnum* (Will need to reconsider this) > > This class helps evaluate a given property value. > > Developers will add newer enums as and when necessary in the input data > sets. > > *PropertyEvaluator* > > Interface that will be implemented by the custom property evaluator. > > *DBUnitPropertyEvaluator* > > Custom property evaluator > > ${TOMORROW_DATE_IN_MM_DD_YYYY} or > > ${SQL:select ID from EMPLOYEE where degree_type='MS'} > > *DBUnitCustomDataSet* > > Custom dataset that aggregates multiple datasets for a given unit test > so we can set up circular referential data if so needed. > > *DBUnitOrderedTableNameMap* > > Uses MultiValueMap to handle multiple datasets having input data for the > same table. > > *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* > > Database operations to be used in order to set up/clean up data for a test. > > getDataSet() gets invoked for both setup and teardown. Using the above, > we can differentiate and retrieve the appropriate data set from set up > and clean up. > > *DBUnitTestConfiguration * > > Annotation to specify set up, clean up data set(s) and methods to do the > same. > > Example: > > @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, > setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, > > tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = > DBUnitTearDownDatabaseOperation.USE_SQL) > > The above REFRESH will help create circular reference as it will update > and not insert if the record is already present. > > Besides this, I have tried to address an issue that developers have in > extracting data sets from RDBMS. Most developers can exercise the > application and create test data however, extracting that seems > challenging in order to create a test data set. > > So, I have created a *DataExporter* utility class that can allow > developer to establish connection to a schema and specify which record > in a table they want to extract. From there on, the utility will go over > all the tables this record references (foreign key) to query if the > developer is interested in extracting that. If so, this will go recursively. > > Set up connection properties > > Connection jdbcConnection; > > jdbcConnection = DriverManager./getConnection/( > > "jdbc:oracle:thin:@machine-ip:1525:db", > > "user", "password"); > > /connection/= *new*DatabaseConnection(jdbcConnection, "company"); > > // for Oracle 10 > > DatabaseConfig config = /connection/.getConfig(); > > config.setProperty(DatabaseConfig./PROPERTY_DATATYPE_FACTORY/, > *new*Oracle10DataTypeFactory()); > > // try to extract desired data set > > /extractDesiredDataSet/(0, "EMPLOYEE", *new*Long(1233422)); > > Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : > > y > > Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : > > y > > Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : > > y > > Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : > > y > > Once we opt out or walk through recursively, we have a neat data set > that we can now import and massage to create test data sets. > > If someone has already contributed similar stuff, please let me know. > > If you think this can potentially add value to DBUnit, I would like to > contribute to DBUnit3. > > It will be really helpful if you can mail or help me understand how to > go about contributing this source to the DBUnit 3 on codehaus. > > Sincerely, > > ______________________________________________________________ > > Ashwini Kuntamukkala |*PDX, Inc.* > > /EPS Architecture Team/ > > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > > > > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ dbunit-developer mailing list dbu...@li... https://lists.sourceforge.net/lists/listinfo/dbunit-developer |
|
From: Sébastien Le C. <sl...@ya...> - 2011-02-02 18:34:52
|
Hi Ashwin, That’s fine, just send the patch to the list then. Thanks a lot! Seb On 02/02/2011 16:03, Ashwin Kuntamukkala wrote: > Sebastien: > I am unable to check the URL you sent. > > ------ > > There was an error processing your request ... > > Permission Denied > Access to this page is restricted (either to project members or to project administrators) and you do not meet the requirements to access this page. Please contact the administrator of this project for further assistance. > > ----- > > I get the above exception on the sourceforge website. > > Thanks > Ashwin > > > -----Original Message----- > From: Sébastien Le Callonnec [mailto:sl...@ya...] > Sent: Saturday, January 29, 2011 5:19 PM > To: dbu...@li... > Subject: Re: [dbunit-developer] potential contribution to DBUnit 3 - [SPAM E3 : Header] - Email found in subject > > Hi Ashwini, > > > Could you please submit your contribution as a patch to the current > DbUnit svn trunk at sourceforge, either by sending it to the list or > using the SF tracker > (https://sourceforge.net/tracker/?group_id=47439&atid=449493)? It looks > like what you guys have done could be a good starting point to the > DbUnit 3.x devs. > > > Regards, > Sébastien. > > > On 19/01/2011 16:14, Ashwin Kuntamukkala wrote: >> Roberto: >> >> I have added the following extensions to DBUnit 2.4.8 in-house as we are >> using JUNIT3 and JDK 1.5 (Annotations). >> >> I understand that DBUnit 3+ will support JDK 1.5 and annotation. >> >> I checked out https://svn.codehaus.org/dbunit/ but I would need further >> support in understand how to go about adding my code here as I don't see >> all the classes from 2.4.8 here. >> >> Here is the summary of my extensions that I would like to contribute. >> >> *EnhancedDBUnitTestCase(extends DBTestCase)*(Supports newer annotations >> around test methods) >> >> Base class for the unit tests that need to test stored procedures. >> >> For Junit4, will have to add these to custom test runner. >> >> *IDBUnitDatabaseProperties* >> >> Constants defined that provide schema connectivity parameters. >> >> *DBUnitConnectionManager (uses DBCP)* >> >> This class provides connection pooling so tests can share the expensive >> connection object(s). >> >> *DbUnitOperationListener* >> >> DBUnit closes connection after setup, and thus requires connections to >> be opened/closed for test and again for tear down. This class ensures >> the same connection instance is used for setUp(), execution of test..() >> and tearDown() as well. >> >> *SQLDatabaseOperation* >> >> Helps extend functionality to use SQL scripts for input/clean up data >> sets. Useful for deleting when there is seed data in the table, circular >> references. >> >> *PropertyReplacerInputStream* >> >> This class is used by DBUnit to evaluate property place holders when >> reading the file containing the input dataset. Useful when your input >> dataset has to refer seed data that is already part of the schema, or >> you need to substitute dynamically calculated values in the data set >> (like dates) >> >> This is much faster as it extends _BufferedInputStream___ >> >> *DBUnitPropertyEnum* (Will need to reconsider this) >> >> This class helps evaluate a given property value. >> >> Developers will add newer enums as and when necessary in the input data >> sets. >> >> *PropertyEvaluator* >> >> Interface that will be implemented by the custom property evaluator. >> >> *DBUnitPropertyEvaluator* >> >> Custom property evaluator >> >> ${TOMORROW_DATE_IN_MM_DD_YYYY} or >> >> ${SQL:select ID from EMPLOYEE where degree_type='MS'} >> >> *DBUnitCustomDataSet* >> >> Custom dataset that aggregates multiple datasets for a given unit test >> so we can set up circular referential data if so needed. >> >> *DBUnitOrderedTableNameMap* >> >> Uses MultiValueMap to handle multiple datasets having input data for the >> same table. >> >> *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* >> >> Database operations to be used in order to set up/clean up data for a test. >> >> getDataSet() gets invoked for both setup and teardown. Using the above, >> we can differentiate and retrieve the appropriate data set from set up >> and clean up. >> >> *DBUnitTestConfiguration * >> >> Annotation to specify set up, clean up data set(s) and methods to do the >> same. >> >> Example: >> >> @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, >> setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, >> >> tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = >> DBUnitTearDownDatabaseOperation.USE_SQL) >> >> The above REFRESH will help create circular reference as it will update >> and not insert if the record is already present. >> >> Besides this, I have tried to address an issue that developers have in >> extracting data sets from RDBMS. Most developers can exercise the >> application and create test data however, extracting that seems >> challenging in order to create a test data set. >> >> So, I have created a *DataExporter* utility class that can allow >> developer to establish connection to a schema and specify which record >> in a table they want to extract. From there on, the utility will go over >> all the tables this record references (foreign key) to query if the >> developer is interested in extracting that. If so, this will go recursively. >> >> Set up connection properties >> >> Connection jdbcConnection; >> >> jdbcConnection = DriverManager./getConnection/( >> >> "jdbc:oracle:thin:@machine-ip:1525:db", >> >> "user", "password"); >> >> /connection/= *new*DatabaseConnection(jdbcConnection, "company"); >> >> // for Oracle 10 >> >> DatabaseConfig config = /connection/.getConfig(); >> >> config.setProperty(DatabaseConfig./PROPERTY_DATATYPE_FACTORY/, >> *new*Oracle10DataTypeFactory()); >> >> // try to extract desired data set >> >> /extractDesiredDataSet/(0, "EMPLOYEE", *new*Long(1233422)); >> >> Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : >> >> y >> >> Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : >> >> y >> >> Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : >> >> y >> >> Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : >> >> y >> >> Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : >> >> y >> >> Once we opt out or walk through recursively, we have a neat data set >> that we can now import and massage to create test data sets. >> >> If someone has already contributed similar stuff, please let me know. >> >> If you think this can potentially add value to DBUnit, I would like to >> contribute to DBUnit3. >> >> It will be really helpful if you can mail or help me understand how to >> go about contributing this source to the DBUnit 3 on codehaus. >> >> Sincerely, >> >> ______________________________________________________________ >> >> Ashwini Kuntamukkala |*PDX, Inc.* >> >> /EPS Architecture Team/ >> >> >> >> ------------------------------------------------------------------------------ >> Protect Your Site and Customers from Malware Attacks >> Learn about various malware tactics and how to avoid them. Understand >> malware threats, the impact they can have on your business, and how you >> can protect your company and customers by using code signing. >> http://p.sf.net/sfu/oracle-sfdevnl >> >> >> >> _______________________________________________ >> dbunit-developer mailing list >> dbu...@li... >> https://lists.sourceforge.net/lists/listinfo/dbunit-developer > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer > |
|
From: Ashwin K. <AKu...@pd...> - 2011-02-05 00:03:30
|
Sebastian/Roberto: I am attaching the patch file built of my additions to 2.4.8 version of DBUnit. I have written a word document containing instructions regarding how to run the tests written using the extension code. It does not use embedded derby but instead connects to a remote derby instance containing the schema/seed data. The instructions are provided in the word document. I have tried to add extensive comments and explanations given the nature of subject. I am sure there are more things need to be done to make the code better but hopefully we can address them as we move to 3.0 release. I have modified the pom.xml to download the necessary jars for connection pooling. * There was an issue I ran into with ojdbc driver jar version 10.2.0.4.0 I haven't used the "DatabaseEnvironment" class hierarchy although I have called out as future work for myself. Please let me know if you have any issues or questions/comments regarding this work. DBUnit Rocks! ______________________________________________________ Ashwini Kuntamukkala -----Original Message----- From: Sébastien Le Callonnec [mailto:sl...@ya...] Sent: Wednesday, February 02, 2011 12:35 PM To: dbu...@li... Subject: Re: [dbunit-developer] potential contribution to DBUnit 3 - [SPAM E3 : Header] - Email found in subject - [SPAM E3 : Header] - Email found in subject Hi Ashwin, That's fine, just send the patch to the list then. Thanks a lot! Seb On 02/02/2011 16:03, Ashwin Kuntamukkala wrote: > Sebastien: > I am unable to check the URL you sent. > > ------ > > There was an error processing your request ... > > Permission Denied > Access to this page is restricted (either to project members or to project administrators) and you do not meet the requirements to access this page. Please contact the administrator of this project for further assistance. > > ----- > > I get the above exception on the sourceforge website. > > Thanks > Ashwin > > > -----Original Message----- > From: Sébastien Le Callonnec [mailto:sl...@ya...] > Sent: Saturday, January 29, 2011 5:19 PM > To: dbu...@li... > Subject: Re: [dbunit-developer] potential contribution to DBUnit 3 - [SPAM E3 : Header] - Email found in subject > > Hi Ashwini, > > > Could you please submit your contribution as a patch to the current > DbUnit svn trunk at sourceforge, either by sending it to the list or > using the SF tracker > (https://sourceforge.net/tracker/?group_id=47439&atid=449493)? It looks > like what you guys have done could be a good starting point to the > DbUnit 3.x devs. > > > Regards, > Sébastien. > > > On 19/01/2011 16:14, Ashwin Kuntamukkala wrote: >> Roberto: >> >> I have added the following extensions to DBUnit 2.4.8 in-house as we are >> using JUNIT3 and JDK 1.5 (Annotations). >> >> I understand that DBUnit 3+ will support JDK 1.5 and annotation. >> >> I checked out https://svn.codehaus.org/dbunit/ but I would need further >> support in understand how to go about adding my code here as I don't see >> all the classes from 2.4.8 here. >> >> Here is the summary of my extensions that I would like to contribute. >> >> *EnhancedDBUnitTestCase(extends DBTestCase)*(Supports newer annotations >> around test methods) >> >> Base class for the unit tests that need to test stored procedures. >> >> For Junit4, will have to add these to custom test runner. >> >> *IDBUnitDatabaseProperties* >> >> Constants defined that provide schema connectivity parameters. >> >> *DBUnitConnectionManager (uses DBCP)* >> >> This class provides connection pooling so tests can share the expensive >> connection object(s). >> >> *DbUnitOperationListener* >> >> DBUnit closes connection after setup, and thus requires connections to >> be opened/closed for test and again for tear down. This class ensures >> the same connection instance is used for setUp(), execution of test..() >> and tearDown() as well. >> >> *SQLDatabaseOperation* >> >> Helps extend functionality to use SQL scripts for input/clean up data >> sets. Useful for deleting when there is seed data in the table, circular >> references. >> >> *PropertyReplacerInputStream* >> >> This class is used by DBUnit to evaluate property place holders when >> reading the file containing the input dataset. Useful when your input >> dataset has to refer seed data that is already part of the schema, or >> you need to substitute dynamically calculated values in the data set >> (like dates) >> >> This is much faster as it extends _BufferedInputStream___ >> >> *DBUnitPropertyEnum* (Will need to reconsider this) >> >> This class helps evaluate a given property value. >> >> Developers will add newer enums as and when necessary in the input data >> sets. >> >> *PropertyEvaluator* >> >> Interface that will be implemented by the custom property evaluator. >> >> *DBUnitPropertyEvaluator* >> >> Custom property evaluator >> >> ${TOMORROW_DATE_IN_MM_DD_YYYY} or >> >> ${SQL:select ID from EMPLOYEE where degree_type='MS'} >> >> *DBUnitCustomDataSet* >> >> Custom dataset that aggregates multiple datasets for a given unit test >> so we can set up circular referential data if so needed. >> >> *DBUnitOrderedTableNameMap* >> >> Uses MultiValueMap to handle multiple datasets having input data for the >> same table. >> >> *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* >> >> Database operations to be used in order to set up/clean up data for a test. >> >> getDataSet() gets invoked for both setup and teardown. Using the above, >> we can differentiate and retrieve the appropriate data set from set up >> and clean up. >> >> *DBUnitTestConfiguration * >> >> Annotation to specify set up, clean up data set(s) and methods to do the >> same. >> >> Example: >> >> @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, >> setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, >> >> tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = >> DBUnitTearDownDatabaseOperation.USE_SQL) >> >> The above REFRESH will help create circular reference as it will update >> and not insert if the record is already present. >> >> Besides this, I have tried to address an issue that developers have in >> extracting data sets from RDBMS. Most developers can exercise the >> application and create test data however, extracting that seems >> challenging in order to create a test data set. >> >> So, I have created a *DataExporter* utility class that can allow >> developer to establish connection to a schema and specify which record >> in a table they want to extract. From there on, the utility will go over >> all the tables this record references (foreign key) to query if the >> developer is interested in extracting that. If so, this will go recursively. >> >> Set up connection properties >> >> Connection jdbcConnection; >> >> jdbcConnection = DriverManager./getConnection/( >> >> "jdbc:oracle:thin:@machine-ip:1525:db", >> >> "user", "password"); >> >> /connection/= *new*DatabaseConnection(jdbcConnection, "company"); >> >> // for Oracle 10 >> >> DatabaseConfig config = /connection/.getConfig(); >> >> config.setProperty(DatabaseConfig./PROPERTY_DATATYPE_FACTORY/, >> *new*Oracle10DataTypeFactory()); >> >> // try to extract desired data set >> >> /extractDesiredDataSet/(0, "EMPLOYEE", *new*Long(1233422)); >> >> Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : >> >> y >> >> Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : >> >> y >> >> Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : >> >> y >> >> Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : >> >> y >> >> Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : >> >> y >> >> Once we opt out or walk through recursively, we have a neat data set >> that we can now import and massage to create test data sets. >> >> If someone has already contributed similar stuff, please let me know. >> >> If you think this can potentially add value to DBUnit, I would like to >> contribute to DBUnit3. >> >> It will be really helpful if you can mail or help me understand how to >> go about contributing this source to the DBUnit 3 on codehaus. >> >> Sincerely, >> >> ______________________________________________________________ >> >> Ashwini Kuntamukkala |*PDX, Inc.* >> >> /EPS Architecture Team/ >> >> >> >> ------------------------------------------------------------------------------ >> Protect Your Site and Customers from Malware Attacks >> Learn about various malware tactics and how to avoid them. Understand >> malware threats, the impact they can have on your business, and how you >> can protect your company and customers by using code signing. >> http://p.sf.net/sfu/oracle-sfdevnl >> >> >> >> _______________________________________________ >> dbunit-developer mailing list >> dbu...@li... >> https://lists.sourceforge.net/lists/listinfo/dbunit-developer > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer > ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ dbunit-developer mailing list dbu...@li... https://lists.sourceforge.net/lists/listinfo/dbunit-developer |
|
From: Sébastien Le C. <sl...@ya...> - 2011-02-05 13:01:35
|
Hi Ashwin, Thanks a lot for your patch. I think it will take us some time to go through it! ;) I haven’t looked at it in much details yet, but I have some initial comments: - The patch fails on pom.xml, I had to change the file manually to add the dependencies. Line numbers seem to be off, did you make the patch against the 2.4.8 tag rather than trunk? - It also creates some files at the root of the project which, at first glance, belong in src/test/resources. - After applying the patch, and switching source code level to 1.5, one test is failing: Results : Tests in error: testEmployeeDepartmentCircularDependency(org.dbunit.test.SampleDBUnitTest) Tests run: 1027, Failures: 0, Errors: 1, Skipped: 0 - On the unit test front, you definitely need to add some!! ;) Thanks a mil again, it looks like great stuff! I’ll make more comments as soon as I’ve had time to look at it a bit more. Regards, Seb On 05/02/2011 00:03, Ashwin Kuntamukkala wrote: > Sebastian/Roberto: > > I am attaching the patch file built of my additions to 2.4.8 version of DBUnit. I have written a word document containing instructions regarding how to run the tests written using the extension code. > > It does not use embedded derby but instead connects to a remote derby instance containing the schema/seed data. The instructions are provided in the word document. > > I have tried to add extensive comments and explanations given the nature of subject. > > I am sure there are more things need to be done to make the code better but hopefully we can address them as we move to 3.0 release. > > > I have modified the pom.xml to download the necessary jars for connection pooling. > > * There was an issue I ran into with ojdbc driver jar version 10.2.0.4.0 > > I haven't used the "DatabaseEnvironment" class hierarchy although I have called out as future work for myself. > > > Please let me know if you have any issues or questions/comments regarding this work. > > DBUnit Rocks! > > ______________________________________________________ > Ashwini Kuntamukkala > > > -----Original Message----- > From: Sébastien Le Callonnec [mailto:sl...@ya...] > Sent: Wednesday, February 02, 2011 12:35 PM > To: dbu...@li... > Subject: Re: [dbunit-developer] potential contribution to DBUnit 3 - [SPAM E3 : Header] - Email found in subject - [SPAM E3 : Header] - Email found in subject > > Hi Ashwin, > > That's fine, just send the patch to the list then. > > Thanks a lot! > Seb > > On 02/02/2011 16:03, Ashwin Kuntamukkala wrote: >> Sebastien: >> I am unable to check the URL you sent. >> >> ------ >> >> There was an error processing your request ... >> >> Permission Denied >> Access to this page is restricted (either to project members or to project administrators) and you do not meet the requirements to access this page. Please contact the administrator of this project for further assistance. >> >> ----- >> >> I get the above exception on the sourceforge website. >> >> Thanks >> Ashwin >> >> >> -----Original Message----- >> From: Sébastien Le Callonnec [mailto:sl...@ya...] >> Sent: Saturday, January 29, 2011 5:19 PM >> To: dbu...@li... >> Subject: Re: [dbunit-developer] potential contribution to DBUnit 3 - [SPAM E3 : Header] - Email found in subject >> >> Hi Ashwini, >> >> >> Could you please submit your contribution as a patch to the current >> DbUnit svn trunk at sourceforge, either by sending it to the list or >> using the SF tracker >> (https://sourceforge.net/tracker/?group_id=47439&atid=449493)? It looks >> like what you guys have done could be a good starting point to the >> DbUnit 3.x devs. >> >> >> Regards, >> Sébastien. >> >> >> On 19/01/2011 16:14, Ashwin Kuntamukkala wrote: >>> Roberto: >>> >>> I have added the following extensions to DBUnit 2.4.8 in-house as we are >>> using JUNIT3 and JDK 1.5 (Annotations). >>> >>> I understand that DBUnit 3+ will support JDK 1.5 and annotation. >>> >>> I checked out https://svn.codehaus.org/dbunit/ but I would need further >>> support in understand how to go about adding my code here as I don't see >>> all the classes from 2.4.8 here. >>> >>> Here is the summary of my extensions that I would like to contribute. >>> >>> *EnhancedDBUnitTestCase(extends DBTestCase)*(Supports newer annotations >>> around test methods) >>> >>> Base class for the unit tests that need to test stored procedures. >>> >>> For Junit4, will have to add these to custom test runner. >>> >>> *IDBUnitDatabaseProperties* >>> >>> Constants defined that provide schema connectivity parameters. >>> >>> *DBUnitConnectionManager (uses DBCP)* >>> >>> This class provides connection pooling so tests can share the expensive >>> connection object(s). >>> >>> *DbUnitOperationListener* >>> >>> DBUnit closes connection after setup, and thus requires connections to >>> be opened/closed for test and again for tear down. This class ensures >>> the same connection instance is used for setUp(), execution of test..() >>> and tearDown() as well. >>> >>> *SQLDatabaseOperation* >>> >>> Helps extend functionality to use SQL scripts for input/clean up data >>> sets. Useful for deleting when there is seed data in the table, circular >>> references. >>> >>> *PropertyReplacerInputStream* >>> >>> This class is used by DBUnit to evaluate property place holders when >>> reading the file containing the input dataset. Useful when your input >>> dataset has to refer seed data that is already part of the schema, or >>> you need to substitute dynamically calculated values in the data set >>> (like dates) >>> >>> This is much faster as it extends _BufferedInputStream___ >>> >>> *DBUnitPropertyEnum* (Will need to reconsider this) >>> >>> This class helps evaluate a given property value. >>> >>> Developers will add newer enums as and when necessary in the input data >>> sets. >>> >>> *PropertyEvaluator* >>> >>> Interface that will be implemented by the custom property evaluator. >>> >>> *DBUnitPropertyEvaluator* >>> >>> Custom property evaluator >>> >>> ${TOMORROW_DATE_IN_MM_DD_YYYY} or >>> >>> ${SQL:select ID from EMPLOYEE where degree_type='MS'} >>> >>> *DBUnitCustomDataSet* >>> >>> Custom dataset that aggregates multiple datasets for a given unit test >>> so we can set up circular referential data if so needed. >>> >>> *DBUnitOrderedTableNameMap* >>> >>> Uses MultiValueMap to handle multiple datasets having input data for the >>> same table. >>> >>> *DBUnitSetUpDatabaseOperation*, *DBUnitTearDownDatabaseOperation* >>> >>> Database operations to be used in order to set up/clean up data for a test. >>> >>> getDataSet() gets invoked for both setup and teardown. Using the above, >>> we can differentiate and retrieve the appropriate data set from set up >>> and clean up. >>> >>> *DBUnitTestConfiguration * >>> >>> Annotation to specify set up, clean up data set(s) and methods to do the >>> same. >>> >>> Example: >>> >>> @DBUnitTestConfiguration(setUpScripts={"employee_dept.xml","supervisor.xml"}, >>> setUpScriptsOperation= DBUnitSetUpDatabaseOperation.REFRESH, >>> >>> tearDownScripts = {"delele_emp_dept.sql"}, tearDownScriptsOperation = >>> DBUnitTearDownDatabaseOperation.USE_SQL) >>> >>> The above REFRESH will help create circular reference as it will update >>> and not insert if the record is already present. >>> >>> Besides this, I have tried to address an issue that developers have in >>> extracting data sets from RDBMS. Most developers can exercise the >>> application and create test data however, extracting that seems >>> challenging in order to create a test data set. >>> >>> So, I have created a *DataExporter* utility class that can allow >>> developer to establish connection to a schema and specify which record >>> in a table they want to extract. From there on, the utility will go over >>> all the tables this record references (foreign key) to query if the >>> developer is interested in extracting that. If so, this will go recursively. >>> >>> Set up connection properties >>> >>> Connection jdbcConnection; >>> >>> jdbcConnection = DriverManager./getConnection/( >>> >>> "jdbc:oracle:thin:@machine-ip:1525:db", >>> >>> "user", "password"); >>> >>> /connection/= *new*DatabaseConnection(jdbcConnection, "company"); >>> >>> // for Oracle 10 >>> >>> DatabaseConfig config = /connection/.getConfig(); >>> >>> config.setProperty(DatabaseConfig./PROPERTY_DATATYPE_FACTORY/, >>> *new*Oracle10DataTypeFactory()); >>> >>> // try to extract desired data set >>> >>> /extractDesiredDataSet/(0, "EMPLOYEE", *new*Long(1233422)); >>> >>> Do you want to fetch : EMPLOYEE[ADDRESS_ID]->ADDRESS? (y/n) : >>> >>> y >>> >>> Do you want to fetch : ADDRESS[HOME_PHONE_ID]->PHONE? (y/n) : >>> >>> y >>> >>> Do you want to fetch : ADDRESS[MOBILE_PHONE_ID]->PHONE? (y/n) : >>> >>> y >>> >>> Do you want to fetch : EMPLOYEE[DEPARTMENT_ID]->DEPARTMENT? (y/n) : >>> >>> y >>> >>> Do you want to fetch : DEPARTMENT[SUPERVISOR_ID]->EMPLOYEE? (y/n) : >>> >>> y >>> >>> Once we opt out or walk through recursively, we have a neat data set >>> that we can now import and massage to create test data sets. >>> >>> If someone has already contributed similar stuff, please let me know. >>> >>> If you think this can potentially add value to DBUnit, I would like to >>> contribute to DBUnit3. >>> >>> It will be really helpful if you can mail or help me understand how to >>> go about contributing this source to the DBUnit 3 on codehaus. >>> >>> Sincerely, >>> >>> ______________________________________________________________ >>> >>> Ashwini Kuntamukkala |*PDX, Inc.* >>> >>> /EPS Architecture Team/ >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Protect Your Site and Customers from Malware Attacks >>> Learn about various malware tactics and how to avoid them. Understand >>> malware threats, the impact they can have on your business, and how you >>> can protect your company and customers by using code signing. >>> http://p.sf.net/sfu/oracle-sfdevnl >>> >>> >>> >>> _______________________________________________ >>> dbunit-developer mailing list >>> dbu...@li... >>> https://lists.sourceforge.net/lists/listinfo/dbunit-developer >> >> ------------------------------------------------------------------------------ >> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> Finally, a world-class log management solution at an even better price-free! >> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >> February 28th, so secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsight-sfd2d >> _______________________________________________ >> dbunit-developer mailing list >> dbu...@li... >> https://lists.sourceforge.net/lists/listinfo/dbunit-developer >> >> ------------------------------------------------------------------------------ >> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> Finally, a world-class log management solution at an even better price-free! >> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >> February 28th, so secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsight-sfd2d >> _______________________________________________ >> dbunit-developer mailing list >> dbu...@li... >> https://lists.sourceforge.net/lists/listinfo/dbunit-developer >> > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer > > > > ------------------------------------------------------------------------------ > The modern datacenter depends on network connectivity to access resources > and provide services. The best practices for maximizing a physical server's > connectivity to a physical network are well understood - see how these > rules translate into the virtual world? > http://p.sf.net/sfu/oracle-sfdevnlfb > > > > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer |