Skip to content

Commit 487a3f1

Browse files
committed
PostgreSQL test support.
SVN: trunk@5409
1 parent 3cc9eec commit 487a3f1

11 files changed

+11205
-2
lines changed

ShowBuildMenu.bat

+9-2
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,17 @@ echo B. NHibernate Trunk - Firebird (32-bit)
181181
echo C. NHibernate Trunk - Firebird (64-bit)
182182
echo D. NHibernate Trunk - SQLite (32-bit)
183183
echo E. NHibernate Trunk - SQLite (64-bit)
184+
echo F. NHibernate Trunk - PostgreSQL
184185
echo.
185186

186187
if exist %SYSTEMROOT%\System32\choice.exe ( goto teamcity-menu-prompt-choice )
187188
goto teamcity-menu-prompt-set
188189

189190
:teamcity-menu-prompt-choice
190-
choice /C:abcde
191+
choice /C:abcdef
191192

192193
if errorlevel 255 goto end
194+
if errorlevel 6 goto teamcity-postgresql
193195
if errorlevel 5 goto teamcity-sqlite64
194196
if errorlevel 4 goto teamcity-sqlite32
195197
if errorlevel 3 goto teamcity-firebird64
@@ -198,13 +200,14 @@ if errorlevel 1 goto teamcity-trunk
198200
if errorlevel 0 goto end
199201

200202
:teamcity-menu-prompt-set
201-
set /p OPT=[A, B, C, D, E]?
203+
set /p OPT=[A, B, C, D, E, F]?
202204

203205
if /I "%OPT%"=="A" goto teamcity-trunk
204206
if /I "%OPT%"=="B" goto teamcity-firebird32
205207
if /I "%OPT%"=="C" goto teamcity-firebird64
206208
if /I "%OPT%"=="D" goto teamcity-sqlite32
207209
if /I "%OPT%"=="E" goto teamcity-sqlite64
210+
if /I "%OPT%"=="F" goto teamcity-postgresql
208211
goto teamcity-menu-prompt-set
209212

210213
:teamcity-trunk
@@ -227,6 +230,10 @@ goto end
227230
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=sqlite64
228231
goto end
229232

233+
:teamcity-postgresql
234+
%NANT% /f:teamcity.build -D:skip.manual=true -D:CCNetLabel=-1 -D:config.teamcity=postgresql
235+
goto end
236+
230237
:end
231238
popd
232239
pause
276 KB
Binary file not shown.

lib/teamcity/postgresql/NHibernate.Test.last-results.xml

+11,142
Large diffs are not rendered by default.

lib/teamcity/postgresql/Npgsql.dll

395 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/NHibernate.Test/NHibernate.Test.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,12 @@
25082508
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
25092509
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
25102510
<EmbeddedResource Include="DriverTest\EntityForMs2008.hbm.xml" />
2511+
<Content Include="DbScripts\PostgreSQL82DialectLinqReadonlyCreateScript.sql">
2512+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2513+
</Content>
2514+
<Content Include="DbScripts\PostgreSQL82DialectLinqReadonlyDropScript.sql">
2515+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2516+
</Content>
25112517
<Content Include="DynamicEntity\package.html" />
25122518
<EmbeddedResource Include="NHSpecificTest\NH2341\Mappings.hbm.xml" />
25132519
<EmbeddedResource Include="NHSpecificTest\NH2228\Mappings.hbm.xml" />

src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
<Reference Include="FirebirdSql.Data.FirebirdClient">
5858
<HintPath>..\..\lib\teamcity\firebird\FirebirdSql.Data.FirebirdClient.dll</HintPath>
5959
</Reference>
60+
<Reference Include="Npgsql">
61+
<HintPath>..\..\lib\teamcity\postgresql\Npgsql.dll</HintPath>
62+
</Reference>
6063
<Reference Include="nunit.framework, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
6164
<SpecificVersion>False</SpecificVersion>
6265
<HintPath>..\..\lib\net\3.5\nunit.framework.dll</HintPath>

src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.build

+2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
<property name="assembly.is-cls-compliant" value="true" />
99
<property name="clover.instrument" value="false" />
1010
<copy file="${root.dir}/lib/teamcity/firebird/FirebirdSql.Data.FirebirdClient.dll" todir="${bin.dir}" />
11+
<copy file="${root.dir}/lib/teamcity/postgresql/Npgsql.dll" todir="${bin.dir}" />
1112
<assemblyfileset id="project.references" basedir="${bin.dir}">
1213
<include name="System.dll" />
1314
<include name="System.Core.dll" />
1415
<include name="System.Data.dll" />
1516
<include name="NHibernate.dll" />
1617
<include name="nunit.framework.dll" />
1718
<include name="FirebirdSql.Data.FirebirdClient.dll" />
19+
<include name="Npgsql.dll" />
1820
</assemblyfileset>
1921
</target>
2022
<target name="generate-assemblyinfo" depends="init common.generate-assemblyinfo" />

src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs

+28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Data.SqlClient;
4+
using Npgsql;
45
using NUnit.Framework;
56
using FirebirdSql.Data.FirebirdClient;
67

@@ -17,6 +18,7 @@ static DatabaseSetup()
1718
SetupMethods.Add("NHibernate.Driver.SqlClientDriver", SetupSqlServer);
1819
SetupMethods.Add("NHibernate.Driver.FirebirdClientDriver", SetupFirebird);
1920
SetupMethods.Add("NHibernate.Driver.SQLite20Driver", SetupNoop);
21+
SetupMethods.Add("NHibernate.Driver.NpgsqlDriver", SetupNpgsql);
2022
}
2123

2224
[Test]
@@ -64,6 +66,32 @@ private static void SetupFirebird(Cfg.Configuration cfg)
6466
FbConnection.CreateDatabase("Database=NHibernate.fdb;ServerType=1");
6567
}
6668

69+
private static void SetupNpgsql(Cfg.Configuration cfg)
70+
{
71+
var connStr = cfg.Properties[Cfg.Environment.ConnectionString];
72+
73+
using (var conn = new NpgsqlConnection(connStr.Replace("Database=nhibernate", "Database=postgres")))
74+
{
75+
conn.Open();
76+
77+
using (var cmd = conn.CreateCommand())
78+
{
79+
cmd.CommandText = "drop database nhibernate";
80+
81+
try
82+
{
83+
cmd.ExecuteNonQuery();
84+
}
85+
catch (Exception)
86+
{
87+
}
88+
89+
cmd.CommandText = "create database nhibernate";
90+
cmd.ExecuteNonQuery();
91+
}
92+
}
93+
}
94+
6795
private static void SetupNoop(Cfg.Configuration cfg)
6896
{
6997
}

teamcity.build

+15
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@
9191
<property name="teamcity.last.result" value="${root.dir}/lib/teamcity/sqlite/NHibernate.Test.last-results.xml" />
9292
</target>
9393

94+
<target name="setup-teamcity-postgresql">
95+
<property name="nunit-console" value="${tools.dir}/NUnit/nunit-console.exe" />
96+
<property name="nunit.found" value="true" />
97+
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.NpgsqlDriver" />
98+
<property name="nhibernate.dialect" value="NHibernate.Dialect.PostgreSQL82Dialect" />
99+
<property name="nhibernate.connection.connection_string" value="Host=localhost;Port=5433;Database=nhibernate;Username=nhibernate;Password=nhdbpass" />
100+
<copy todir="${bin.dir}">
101+
<fileset basedir="${root.dir}/lib/teamcity/postgresql">
102+
<include name="*.dll"/>
103+
</fileset>
104+
</copy>
105+
<property name="NHibernate.Test.IgnoreFail" value="true" />
106+
<property name="teamcity.last.result" value="${root.dir}/lib/teamcity/postgresql/NHibernate.Test.last-results.xml" />
107+
</target>
108+
94109
<script language="C#" prefix="testResult">
95110
<references>
96111
<include name="System.dll" />

0 commit comments

Comments
 (0)