Yes.  That’s basically what I have now with an abstract NUnit.SqlMapTests.StatementTest and an NUnit.SqlMapTests.Oracle.StatementTest that inherits from it with a different Init() (as you have there).

 

For stuff that has sequence numbers or Oracle-specific DDL statements, there would be a couple more sql scripts than MSSQL for a CREATE table with an IDENTITY column to drop and add the sequence (and place a trigger on the column).

 

I do like the ScriptRunner change as you mentioned to make it switch on the DataSource to parse and tokenize the given script for Oracle since it would have less impact on the current test structure.

 

Roberto

 

 

-----Original Message-----
From: Gilles Bayon [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 23, 2004 1:35 PM
To: ibatis-user-cs@incubator.apache.org
Subject: RE: Update NUnit tests for different databases?

 

Can the solution to replace the call to a

InitScript( sqlMap.DataSource, ScriptDirectory + "account-insert.sql" );

By

InitScript( sqlMap.DataSource, ScriptDirectory + "account-drop.sql" );

InitScript( sqlMap.DataSource, ScriptDirectory + "account-create.sql" );

InitScript( sqlMap.DataSource, ScriptDirectory + "account-insert.sql" );

Can be Ok ?

 


De : roberto [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 23 décembre 2004 19:01
À : ibatis-user-cs@incubator.apache.org
Objet : RE: Update NUnit tests for different databases?

 

For the Init() methods in the tests, it is the various InitScript( sqlMap.DataSource, ScriptDirectory + "account-init.sql" ); calls that need to be changed for Oracle. 

 

At this time, account-init.sql, like the other similar –init.sql scripts, contains a DROP table, CREATE table, and multiple INSERTs.  The ScriptRunner is taking that file’s text for the one command, but the two Oracle providers (ODP and OracleClient) that I’m using don’t like multiple/mixed DDL or DML/batch SQL statements in one command text unlike MSSQL. 

 

Therefore, I’ve split the DROP and CREATE into their own files and wrapped the INSERTs in a PL/SQL BEGIN END block to get the INSERTs to run in one command.  The InitSqlMap() is fine.

 

Aside from the SqlMapTests, I see that TransactionTest and the 5 DaoTests also call the –init.sql scripts.

 

To change the ScriptRunner to get the basic account-init.sql script to run for Oracle would mean parsing the file’s text to break it up into multiple commands to be executed (probably looking for the “;” in Oracle’s case to get the statements and removing any comments in the scripts).  That’s the main reason for me bringing up changing or separating out the Inits/SetUps for the tests. 

 

Either method would work I guess (ScriptRunner change vs Init change in the tests).

 

Roberto

 

 

-----Original Message-----
From: Gilles Bayon [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 23, 2004 12:25 PM
To: ibatis-user-cs@incubator.apache.org
Subject: RE: Update NUnit tests for different databases?

 

A you have seen, I think of testing for multiple database, in the IBatisNet.Test.dll.config, you can find some keys to set the database testing

<appSettings>

            <!-- To test MySql set value="MySql"  (to do)-->

            <!-- To test Oracle set value="Oracle"  (to do)-->            

            <!-- To test MS Sql Server set value="MSSQL"  -->                    

            <add key="database" value="MSSQL"/>

            <!-- To test MS SqlServer via SqlClient value="SqlClient"  -->

            <!-- To test MS SqlServer via OleDb value="OleDb"  -->

            <!-- To test MS SqlServer via Odbc value="Odbc"  -->

            <add key="providerType" value="SqlClient"/>

</appSettings>

As it is for now, you can test for one database/provider.

In directory statementTest, you have a directory MSSQL but it only test procedure or SQL specific to MSSQL that must be marked by Category(“MSSQL”)]as you noted (you can go it for that, +1).

The directory IBatisNet.Test\Scripts already contains directory for MSSQL, Oracle, MySQL. Oracle and MySQL directories are empty and ready to be filled J

 

You can create a package Oracle (+1) to test specific sql to Oracle but the base test of SqlMapTests/*.cs must be passed by the couple database/provider Oracle/OracleClient or Oracle/Oledb…

 

For the Init() structure I don’t see what you want to change as in general it call InitSqlMap() which already depend of the the couple database/provider being tested and it is internal to a test file.

You can go to reworking ScriptRunner with a switch case on datasource if it can help you run an oracle DDL script.

 

-Gilles

 


De : roberto [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 23 décembre 2004 05:16
À : ibatis-user-cs@incubator.apache.org
Objet : Update NUnit tests for different databases?

 

Could we change the Init() structure to accommodate running different SQL scripts depending on the database being tested? 

 

I’ve resorted to separating out the various Oracle statements into their own SQL files and modifying the Init() methods of the current tests.  I briefly toyed with the idea of using EXECUTE IMMEDIATE and reworking the ScriptRunner to use an Oracle package with ref cursors to run the DDL statements in one script/command text but quickly got over it!

 

Anyway, I think the project may already have been headed in this direction given the MSSQL tests in their own namespace.

 

For example:

 

Make NUnit.SqlMapTests.StatementTest abstract.  Create an NUnit.SqlMapTests.Oracle namespace (like the existing MSSQL namespace).  And create an NUnit.SqlMapTests.Oracle.StatementTest with a different Init().

 

Additionally, we can tag the specific db tests by NUnit Category such as [Category(“MSSQL”)], [Category(“MySQL”)], and [Category(“Oracle”)] or use some other convention.

 

Roberto

 


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004

Reply via email to