22using System . Collections ;
33using System . Data ;
44using NHibernate . Dialect ;
5+ using NHibernate . Driver ;
6+ using NHibernate . Engine ;
57using NHibernate . Exceptions ;
68using NHibernate . Util ;
79using NUnit . Framework ;
@@ -21,36 +23,51 @@ protected override IList Mappings
2123 get { return new [ ] { "ExceptionsTest.User.hbm.xml" , "ExceptionsTest.Group.hbm.xml" } ; }
2224 }
2325
26+ protected override bool AppliesTo ( Dialect . Dialect dialect )
27+ {
28+ return dialect is MsSql2000Dialect || dialect is PostgreSQLDialect || dialect is FirebirdDialect || dialect is Oracle8iDialect ;
29+ }
30+
31+ protected override bool AppliesTo ( ISessionFactoryImplementor factory )
32+ {
33+ var driver = factory . ConnectionProvider . Driver ;
34+ return ! ( driver is OracleDataClientDriver ) && ! ( driver is OracleManagedDataClientDriver ) && ! ( driver is OracleLiteDataClientDriver ) && ! ( driver is OdbcDriver ) && ! ( driver is OleDbDriver ) ;
35+ }
36+
2437 protected override void Configure ( Cfg . Configuration configuration )
2538 {
2639 if ( Dialect is MsSql2000Dialect )
2740 {
28- configuration . SetProperty ( Cfg . Environment . SqlExceptionConverter ,
29- typeof ( MSSQLExceptionConverterExample ) . AssemblyQualifiedName ) ;
41+ configuration . SetProperty (
42+ Cfg . Environment . SqlExceptionConverter ,
43+ typeof ( MSSQLExceptionConverterExample ) . AssemblyQualifiedName ) ;
3044 }
45+
3146 if ( Dialect is Oracle8iDialect )
3247 {
33- configuration . SetProperty ( Cfg . Environment . SqlExceptionConverter ,
34- typeof ( OracleClientExceptionConverterExample ) . AssemblyQualifiedName ) ;
48+ configuration . SetProperty (
49+ Cfg . Environment . SqlExceptionConverter ,
50+ typeof ( OracleClientExceptionConverterExample ) . AssemblyQualifiedName ) ;
3551 }
3652
3753 if ( Dialect is PostgreSQLDialect )
3854 {
39- configuration . SetProperty ( Cfg . Environment . SqlExceptionConverter ,
40- typeof ( PostgresExceptionConverterExample ) . AssemblyQualifiedName ) ;
55+ configuration . SetProperty (
56+ Cfg . Environment . SqlExceptionConverter ,
57+ typeof ( PostgresExceptionConverterExample ) . AssemblyQualifiedName ) ;
4158 }
4259
4360 if ( Dialect is FirebirdDialect )
4461 {
45- configuration . SetProperty ( Cfg . Environment . SqlExceptionConverter , typeof ( FbExceptionConverterExample ) . AssemblyQualifiedName ) ;
62+ configuration . SetProperty (
63+ Cfg . Environment . SqlExceptionConverter ,
64+ typeof ( FbExceptionConverterExample ) . AssemblyQualifiedName ) ;
4665 }
4766 }
4867
4968 [ Test ]
5069 public void IntegrityViolation ( )
5170 {
52- if ( Dialect is SQLiteDialect )
53- Assert . Ignore ( "Example exception converter not implemented." ) ;
5471
5572 //ISQLExceptionConverter converter = Dialect.BuildSQLExceptionConverter();
5673 ISQLExceptionConverter converter = sessions . Settings . SqlExceptionConverter ;
@@ -115,9 +132,6 @@ public void IntegrityViolation()
115132 [ Test ]
116133 public void BadGrammar ( )
117134 {
118- if ( Dialect is SQLiteDialect )
119- Assert . Ignore ( "Example exception converter not implemented." ) ;
120-
121135 //ISQLExceptionConverter converter = Dialect.BuildSQLExceptionConverter();
122136 ISQLExceptionConverter converter = sessions . Settings . SqlExceptionConverter ;
123137
0 commit comments