Unhandled Exceptions

30 Jan

NDbUnit v1.6 (and Proteus Unit Test libraries) with Oracle Support Released!

Thanks to a code contribution from an adopter of NDbUnit, I’m happy to announce that NDbUnit v1.6 is now released and available for download from the Google Code downloads page with support for Oracle 8i and later.

Oracle support has been on the project’s roadmap for some time now and its great to be able to introduce this support at long-last (and even more enjoyable to be able to jump-start this functionality with a contribution from an adopter of the project).

I’m happy to say that this now brings the complete list of supported DB targets under NDbUnit to six:

  • Microsoft SQL Server (including Express Editions and on up to Enterprise)
  • Microsoft OleDb-supported databases*
  • Microsoft SqlServerCe/Mobile Edition/whatever its called this month
  • MySql
  • Oracle (including XE and on up to Enterprise)
  • SqlLite (including both on-disk and in-memory variants)

*there is currently a known issue with OleDb support that is under review

FWIW, I’d still love to get support for PostGreSql in there too at some point (hint –hint, community!)

Proteus Unit Test Libraries update Released as well!

Now that NDbUnit properly supports Oracle, its possible to extend the Proteus Project’s Unit testing libraries to do the same and so I’m also happy to announce that the 1.2.6 release of the Proteus.UnitTest.dll library is also now available for download from its own Google Code downloads page.  The Proteus utility classes that wrap NDbUnit with a series of convenience methods now also support Oracle as a database target.

Happy coding~!

16 Responses to “NDbUnit v1.6 (and Proteus Unit Test libraries) with Oracle Support Released!”

  1. 1
    Mocte Says:

    Any chance for Firebird database support ???

    Regards,

  2. 2
    sbohlen Says:

    @Mocte:

    Not really, but that’s a great idea. Would you be interested in submitting a patch for this as was just done for Oracle?

    Else we would be glad to put it on the roadmap, but cannot predict when we’ll get to it (competing priorities, and all that).

    -Steve B.

  3. 3
    Mocte Says:

    Steve,

    I’m relatively new to .NET and altough I have done some apps with C#, actually I’m not doing .NET programming for my everyday work, just for the sake of learning, but I’m moving onto .NET and I would be very interested on collaborating with a FB patch for NDbunit because it is my database of choice, but first I would like to finish your summer of NH sessions and after it I’ll be glad to help.

    Best regards,
    Mocte

  4. 4
    sbohlen Says:

    @Mocte:

    That would be great — let me know if there’s anything I can do to assist you when you’re ready. Would be great to get firebird support added to NDbUnit!

    -Steve B.

  5. 5
    Lee M Says:

    I have a SQL Server database and I am able to get Proteus to save the test database in my TestFixture setup but I can’t get it to work with SQLite. I am able to hit the SQLite database in my unit test but I can’t get Proteus to save the SQLite test database.

    I have found connection strings for SQLite on the net that all contain “Version=3;New=boolean:” but I get an error when I add this to the connection string.
    Any help would be greatly appreciated!

    I get the following error.

    System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.SqlClient.SqlConnection.Open()
    at NDbUnit.Core.DbCommandBuilder.GetSchemaTable(IDbCommand sqlSelectCommand)
    at NDbUnit.Core.DbCommandBuilder.CreateSelectCommand(DataSet ds, String tableName)
    NDbUnit.Core.NDbUnitException: DbCommandBuilder.CreateSelectCommand(DataSet, string) failed for tableName = ‘Customer’
    at NDbUnit.Core.DbCommandBuilder.CreateSelectCommand(DataSet ds, String tableName)
    at NDbUnit.Core.DbCommandBuilder.BuildCommands(Stream xmlSchema)
    at NDbUnit.Core.NDbUnitTest.ReadXmlSchema(Stream xmlSchema)
    at NDbUnit.Core.NDbUnitTest.ReadXmlSchema(String xmlSchemaFile)
    at Proteus.Utility.UnitTest.DatabaseUnitTestBase.SaveDatabase(String connectionString, String schemaFilePathName, String datasetFilePathName, DatabaseClientType clientType)
    at Proteus.Utility.UnitTest.DatabaseUnitTestBase.SaveTestDatabase()
    at DataAccessLayerTestSqlite.NHibernateDataProviderTestSQLite.TestFixtureSetup() in Sqlite.cs: line 24

    Here is the TestFixture
    [TestFixture]
    public class NHibernateDataProviderTestSQLite : Proteus.Utility.UnitTest.DatabaseUnitTestBase
    {
    [TestFixtureSetUp]
    public void TestFixtureSetup()
    {

    SaveTestDatabase(); *****Line 24
    DatabaseFixtureSetUp();
    }

    This is my APP.CONFIG

    Here is my HIBERNATE.CFG.XML

    NHibernate.Connection.DriverConnectionProvider
    NHibernate.Driver.SQLite20Driver
    data source=C:\WIP\DineAndDiscussNHibernate\TestDatabase\DineDiscuss.db3
    NHibernate.Dialect.SQLiteDialect
    true=1;false=0
    true

  6. 6
    Lee M Says:

    oops
    Here is my APP.CONFIG

  7. 7
    sbohlen Says:

    @Lee M:

    Your first clue is in the ‘meat’ of your exception message here:

    System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Note that the error is coming from “System.Data.SqlClient” which indicates that the Proteus classes are thinking they should be using the SQLServer ADO.NET infrastructure instead of the SQLite ADO.NET infrastructure.

    In addition to changing the connection strings, et. al. you also must tell the Proteus.Utility.UnitTest.DatabaseUnitTestBase class to use the Sqlite-specific infrastructure to talk to the database.

    If you look at line 122 of the source code here… http://code.google.com/p/proteusproject/source/browse/trunk/src/Proteus.Utility.UnitTest/DatabaseUnitTestBase.cs#122 …you can see that the _databaseClientType field in the base class is set by default to the enum DatabaseClientType.SqlClient. To use Proteus with other database targets supported by NDbUnit, you also need to change this enum value in your derived class (probably in the [TestFixtureSetUp] method is safest as in …

    [TestFixtureSetUp]
    public void TestFixtureSetUp()
    {
    _databaseClientType = DatabaseClientType.SqliteClient;
    DatabaseFixtureSetUp();

    //rest of your code here as needed
    }

    After that, I believe it should work for you. Let me know how you make out with it.

    -Steve B.

  8. 8
    Lee M Says:

    Thanks for the quick reply. I then had an error that the version of System.Data.SQLite was not 1.0.60. I had downloaded the 1.0.65 version, so I got the correct version and that got me farther. I then got this error
    System.InvalidOperationException: Unsupported Database client type: SqliteClient
    at Proteus.Utility.UnitTest.DatabaseUnitTestBase.ValidateSchemaAgainstDatabase(String schemaFilename)
    at Proteus.Utility.UnitTest.DatabaseUnitTestBase.DatabaseFixtureSetUp(Boolean ignoreSchemaDifferences)
    at Proteus.Utility.UnitTest.DatabaseUnitTestBase.DatabaseFixtureSetUp()
    at DataAccessLayerTestSqlite.NHibernateDataProviderTestSQLite.TestFixtureSetup() in

    I then passed “true” to the DatabaseFixtureSetUp, and it worked beautifully

    [TestFixtureSetUp]
    public void TestFixtureSetup()
    {
    _databaseClientType = DatabaseClientType.SqliteClient;
    SaveTestDatabase();
    DatabaseFixtureSetUp(true);
    }

    Thank you for the help and the videos, I am working my way through Summer on NHibernate and then it will be on to Autumn of Agile. These videos are very well done and chock full of valuable information. Thanks again!!

  9. 9
    sbohlen Says:

    @Lee M:

    Interesting — I had forgotten that part (the boolean flag to skip DB + XSD comparison for targets that don’t support it!). That’s the result of a recent refactoring to support different validator logic for different DB targets and — indeed — SQLite isn’t supported for runtime DB < --> XSD validation as of yet.

    Glad you got it working — and thx for the comments re: the screencasts~!

    -Steve B.

  10. 10
    TracyLaws Says:

    I am very happy to read this article..thanks for giving us this useful information. Fantastic walk-through. I appreciate this post.

  11. 11
    Simon Says:

    Hi Steve

    Just wanted to thank you for this , it has saved us a lot of time already

    As quick background we have layered a simple set of datatable comparisons on top of your libary ( all based on XML so we have a schema file and then a series of xml files that highlight the outputs of the tests via nunit TestCases and linq.

    In your opinion, how easy would it be to change the xml seed to be an array of seed files vs. a single file. we are looking at how we can best reuse our seed data sets for aggregates so we can compose them together to better exercise our domain, vs. having a custom seed for every set of tests ( typically the aggregates are the same and we compose them for each test case ). We tried but as some of the code in the LoadDatabase is private so we would have to basically implement the whole library vs. just overloading explictly what we need.

    We also are looking at being able to disable the creation the backups.

    The last thing we have to do is to be able to create a data table of the output parameters / rc from the ado command object so we can compare those as well if necessary.

    Excellent work, look forward to your thoughts.

  12. 12
    mulberry sale Says:

    This was an amazing site that I had never seen it before. Thanks a lot for the information because I had liked it very much!

  13. 13
    nike outlet online Says:

    nike factory outlet online has produced all kinds of shoes to choose for customers,nike factory outlet,These shoes are well known all over the world,about their design and quality When it comes to Nike, nike outlet online the “free” inspired design gives the shoe the ability to allow your feet to move in a wide variety of motions or directions.

  14. 14
    kmoutlet Says:

    Lv isn’t just high end model ready to accept all of us. There are a great many some other famous brands that are delivering spectacular products and therefore tackle several gear once in a while really need. Nevertheless the exact query gets nearer get something that has high quality louis vuitton outlet online italia, Lv is regarded as the persons names which might be as part of the set of suppliers preparing top quality programs. Louis Vuitton works with required to along with average things. On usual attributes, now there are provided some of those homes which individuals try to look for. Lv items won’t be examined by offerings in any further items because they get their particular designs and styles plus their purchase exclusive styles which have been incredible louis vuitton borse.

    Louis Vuitton is a really well-known product in lots of states around the globe and therefore the explanation for this is definitely thus clear. Required to and also the specialness in its bristling products turn this name favorite among most people. Items on this comfort manufacturer Louis Vuitton are created just perfectly. None are equipped with tech and also apparent problems at the development combined with conceptualizing process. You will find many legendary in addition to professional class people enjoy possessing Louis Vuitton solutions and products as the offerings bring charm borsa louis vuitton, originality is a valuable and magnificence inside of their celebrities. For typically the toughness of Louis Vuitton systems is anxious, ones own excellence is definitely used more costly and are usually made from rugged materials making tolerant and difficult. You can keep any kind elements with them which fits in borse louis vuitton outlet italia.

    The type of garmets, extras and merchandise you choose allows the picture of charm you will have. The software is all about final decision plus your essence. Equivalent can be the case at this website, when you find yourself showing off some Louis Vuitton merchandise, individuals might probably experience being grand person that will be vibrant and it has a captivating disposition. People may believe that you simply are members of a real noble family group. Function people calculate a person when you are a thorough complete stranger for many years.

  15. 15
    Coach Outlet Store Online Says:

    I happy to find many good point here in the post, writing is

    simply great, thank you for the post!

  16. 16
    Beats By Dre Discount Says:

    This is a good post. This post give truly quality information.

Leave a Reply

© 2013 Unhandled Exceptions | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo