Skip to content

Commit 7979fe0

Browse files
Merge branch 'NH-4000' of https://github.com/fredericDelaporte/nhibernate-core into NH-4000
2 parents ea9ab6c + 3cd1464 commit 7979fe0

File tree

9 files changed

+132
-104
lines changed

9 files changed

+132
-104
lines changed

ShowBuildMenu.bat

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ echo ========================= NHIBERNATE BUILD MENU ==========================
1212
echo --- TESTING ---
1313
echo B. (Step 1) Set up a new test configuration for a particular database.
1414
echo C. (Step 2) Activate a test configuration.
15-
echo D. (Step 3) Run tests using active configuration.
15+
echo D. (Step 3) Run tests using active configuration (Needs built in Visual Studio).
1616
echo.
1717
echo --- BUILD ---
1818
echo E. Build NHibernate (Debug)
@@ -165,7 +165,9 @@ echo Configuration activated.
165165
goto main-menu
166166

167167
:test-run
168-
start "nunit3-console" cmd /K %NUNIT% --x86 --agents=1 --process=separate NHibernate.nunit
168+
SET NUNITPLATFORM=
169+
IF /I "%PLATFORM%" NEQ "x64" set NUNITPLATFORM=--x86
170+
start "nunit3-console" cmd /K %NUNIT% %NUNITPLATFORM% --agents=1 --process=separate NHibernate.nunit
169171
goto main-menu
170172

171173
rem :build-test

default.build

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,19 @@
198198
<!-- Tests -->
199199
<copy file="${bin.dir}/TestEmbeddedConfig.cfg.xml" todir="${bin-pack.tests}"/>
200200
<copy file="${bin.dir}/ABC.hbm.xml" todir="${bin-pack.tests}"/>
201-
<copy todir="${bin-pack.tests}/DbScripts">
202-
<fileset basedir="${root.dir}/src/NHibernate.Test/DbScripts">
203-
<include name="*.sql" />
204-
</fileset>
205-
</copy>
206-
<copy todir="${bin-pack.tests}">
201+
<copy todir="${bin-pack.tests}/DbScripts">
202+
<fileset basedir="${root.dir}/src/NHibernate.Test/DbScripts">
203+
<include name="*.sql" />
204+
</fileset>
205+
</copy>
206+
<copy todir="${bin-pack.tests}">
207207
<fileset basedir="${bin.dir}">
208208
<include name="nunit*" />
209-
<include name="SharpTestsEx*" />
210-
<include name="NHibernate.Domain*" />
209+
<include name="SharpTestsEx*" />
210+
<include name="NHibernate.Domain*" />
211211
<include name="NHibernate.Test*" />
212-
<include name="log4net*" />
213-
</fileset>
212+
<include name="log4net*" />
213+
</fileset>
214214
</copy>
215215
</target>
216216

@@ -241,65 +241,65 @@
241241

242242
</target>
243243

244-
<fileset id="nugetfiles.all" basedir="src">
245-
<include name="NHibernate/NHibernate.build" />
246-
</fileset>
247-
248-
<target name="nuspec" depends="init nuget.set-properties" description="Create nuspec files">
249-
<nant target="nuspec">
250-
<buildfiles refid="nugetfiles.all" />
251-
</nant>
252-
</target>
253-
254-
<target name="nuget" depends="init binaries nuget.set-properties nuspec"
255-
description="Creates files for the release on nuget gallery.">
244+
<fileset id="nugetfiles.all" basedir="src">
245+
<include name="NHibernate/NHibernate.build" />
246+
</fileset>
247+
248+
<target name="nuspec" depends="init nuget.set-properties" description="Create nuspec files">
249+
<nant target="nuspec">
250+
<buildfiles refid="nugetfiles.all" />
251+
</nant>
252+
</target>
253+
254+
<target name="nuget" depends="init binaries nuget.set-properties nuspec"
255+
description="Creates files for the release on nuget gallery.">
256256

257-
<nant target="nuget">
258-
<buildfiles refid="nugetfiles.all" />
259-
</nant>
260-
261-
<mkdir dir="${nuget.nupackages.dir}" />
262-
<move todir="${nuget.nupackages.dir}">
263-
<fileset basedir="${nuget.workingdir}">
264-
<include name="*.nupkg" />
265-
</fileset>
266-
</move>
267-
</target>
268-
269-
<target name="nugetpushbat" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
270-
description="Creates files for the release on nuget gallery.">
271-
272-
<copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/>
273-
274-
<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
275-
<foreach item="File" property="filename">
276-
<in>
277-
<items>
278-
<include name="${nuget.nupackages.dir}/*.nupkg"/>
279-
</items>
280-
</in>
281-
<do>
282-
<echo message="nuget push ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
283-
</do>
284-
</foreach>
285-
</target>
286-
287-
<target name="nugetpush" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
288-
description="Push packages on nuget gallery.">
289-
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
290-
<foreach item="File" property="filename">
291-
<in>
292-
<items>
293-
<include name="${nuget.nupackages.dir}/*.nupkg"/>
294-
</items>
295-
</in>
296-
<do>
297-
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe">
298-
<arg value="push" />
299-
<arg value="${filename}" />
300-
</exec>
301-
</do>
302-
</foreach>
303-
</target>
257+
<nant target="nuget">
258+
<buildfiles refid="nugetfiles.all" />
259+
</nant>
260+
261+
<mkdir dir="${nuget.nupackages.dir}" />
262+
<move todir="${nuget.nupackages.dir}">
263+
<fileset basedir="${nuget.workingdir}">
264+
<include name="*.nupkg" />
265+
</fileset>
266+
</move>
267+
</target>
268+
269+
<target name="nugetpushbat" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
270+
description="Creates files for the release on nuget gallery.">
271+
272+
<copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/>
273+
274+
<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
275+
<foreach item="File" property="filename">
276+
<in>
277+
<items>
278+
<include name="${nuget.nupackages.dir}/*.nupkg"/>
279+
</items>
280+
</in>
281+
<do>
282+
<echo message="nuget push ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
283+
</do>
284+
</foreach>
285+
</target>
286+
287+
<target name="nugetpush" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
288+
description="Push packages on nuget gallery.">
289+
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
290+
<foreach item="File" property="filename">
291+
<in>
292+
<items>
293+
<include name="${nuget.nupackages.dir}/*.nupkg"/>
294+
</items>
295+
</in>
296+
<do>
297+
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe">
298+
<arg value="push" />
299+
<arg value="${filename}" />
300+
</exec>
301+
</do>
302+
</foreach>
303+
</target>
304304

305305
</project>

src/NHibernate.Everything.sln

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26730.3
4+
VisualStudioVersion = 15.0.26730.12
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Support", "Support", "{9BDB5C84-14EC-4384-B423-9E319675B3CA}"
77
ProjectSection(SolutionItems) = preProject
@@ -73,6 +73,8 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "NHibernate.Test.VisualBasic
7373
EndProject
7474
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.Example.Web", "NHibernate.Example.Web\NHibernate.Example.Web.csproj", "{B291C1C1-599B-418E-8591-8A8CF1CAA188}"
7575
EndProject
76+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.TestDatabaseSetup", "NHibernate.TestDatabaseSetup\NHibernate.TestDatabaseSetup.csproj", "{783DB85E-2EED-4377-8EF4-8D6EFE042007}"
77+
EndProject
7678
Global
7779
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7880
Debug|.NET = Debug|.NET
@@ -144,6 +146,18 @@ Global
144146
{B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Any CPU.Build.0 = Release|Any CPU
145147
{B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
146148
{B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Mixed Platforms.Build.0 = Release|Any CPU
149+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|.NET.ActiveCfg = Debug|Any CPU
150+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|.NET.Build.0 = Debug|Any CPU
151+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
152+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Any CPU.Build.0 = Debug|Any CPU
153+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
154+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
155+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|.NET.ActiveCfg = Release|Any CPU
156+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|.NET.Build.0 = Release|Any CPU
157+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Any CPU.ActiveCfg = Release|Any CPU
158+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Any CPU.Build.0 = Release|Any CPU
159+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
160+
{783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Mixed Platforms.Build.0 = Release|Any CPU
147161
EndGlobalSection
148162
GlobalSection(SolutionProperties) = preSolution
149163
HideSolutionNode = FALSE
@@ -159,6 +173,7 @@ Global
159173
{7AEE5B37-C552-4E59-9B6F-88755BCB5070} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
160174
{446E148D-A9D5-4D7D-A706-BEDD45B2BC7D} = {92509065-DAEA-4457-8300-C7B64CD0E9F4}
161175
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
176+
{783DB85E-2EED-4377-8EF4-8D6EFE042007} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
162177
EndGlobalSection
163178
GlobalSection(ExtensibilityGlobals) = postSolution
164179
SolutionGuid = {A41913C2-EDEB-440A-BBDE-0AEB56C1CBA6}

src/NHibernate.Example.Web/Pages/Error.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66
using Microsoft.AspNetCore.Mvc.RazorPages;
77

8-
namespace AspNetCoreFxWebApplication.Pages
8+
namespace NHibernate.Example.Web.Pages
99
{
1010
public class ErrorModel : PageModel
1111
{

src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public PeVerifier(string assemblyFileName)
2323

2424
var dir = Path.GetDirectoryName(_assemlyLocation);
2525

26-
while (!Directory.Exists(Path.Combine(dir, "Tools/PEVerify")))
26+
while (!Directory.Exists(Path.Combine(dir, "Tools", "PEVerify")))
2727
{
2828
if (Directory.GetParent(dir) == null)
2929
throw new Exception(string.Format("Could not find Tools/PEVerify directory in ancestor of {0}", _assemlyLocation));
@@ -35,7 +35,7 @@ public PeVerifier(string assemblyFileName)
3535
if (Environment.Version.Major == 2)
3636
versionFolder = "3.5";
3737

38-
_peVerifyPath = Path.Combine(dir, "Tools/PEVerify/" + versionFolder + "/PEVerify.exe");
38+
_peVerifyPath = Path.Combine(dir, "Tools", "PEVerify", versionFolder, "PEVerify.exe");
3939

4040
if (!File.Exists(_peVerifyPath))
4141
throw new Exception(string.Format("Could not find PEVerify.exe at {0}", _peVerifyPath));

src/NHibernate.Test/NHSpecificTest/Logs/LogsFixture.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void WillGetSessionIdFromSessionLogs()
4040

4141
s.Get<Person>(1);//will execute some sql
4242

43-
var loggingEvent = spy.Events[0];
43+
var loggingEvent = spy.GetWholeLog();
4444
Assert.That(loggingEvent.Contains(sessionId.ToString()), Is.True);
4545
}
4646
}
@@ -78,12 +78,9 @@ public TextLogSpy(string loggerName, string pattern)
7878
loggerImpl.Level = Level.All;
7979
}
8080

81-
public string[] Events
81+
public string GetWholeLog()
8282
{
83-
get
84-
{
85-
return stringBuilder.ToString().Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);
86-
}
83+
return stringBuilder.ToString();
8784
}
8885

8986
public void Dispose()

src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections;
3-
using System.IO;
4-
using System.Runtime.Serialization.Formatters.Binary;
3+
using System.Runtime.CompilerServices;
54

65
using NHibernate.Util;
76
using NUnit.Framework;
@@ -11,11 +10,30 @@ namespace NHibernate.Test.UtilityTest
1110
[TestFixture]
1211
public class WeakHashtableFixture
1312
{
14-
protected WeakHashtable Create()
13+
private static WeakHashtable Create()
1514
{
1615
return new WeakHashtable();
1716
}
1817

18+
// NoInlining to keep temporary variables' lifetime from being extended.
19+
[MethodImpl(MethodImplOptions.NoInlining)]
20+
private static WeakHashtable CreateWithTwoObjects()
21+
{
22+
var table = Create();
23+
24+
table[new object()] = new object();
25+
table[new object()] = new object();
26+
27+
return table;
28+
}
29+
30+
[MethodImpl(MethodImplOptions.NoInlining)]
31+
private static WeakRefWrapper CreateWeakRefWrapper()
32+
{
33+
object obj = new object();
34+
return new WeakRefWrapper(obj);
35+
}
36+
1937
[Test]
2038
public void Basic()
2139
{
@@ -33,10 +51,8 @@ public void Basic()
3351
[Test]
3452
public void WeakReferenceGetsFreedButHashCodeRemainsConstant()
3553
{
36-
object obj = new object();
37-
WeakRefWrapper wr = new WeakRefWrapper(obj);
54+
WeakRefWrapper wr = CreateWeakRefWrapper();
3855
int hashCode = wr.GetHashCode();
39-
obj = null;
4056

4157
GC.Collect();
4258

@@ -48,10 +64,7 @@ public void WeakReferenceGetsFreedButHashCodeRemainsConstant()
4864
[Test]
4965
public void Scavenging()
5066
{
51-
WeakHashtable table = Create();
52-
53-
table[new object()] = new object();
54-
table[new object()] = new object();
67+
WeakHashtable table = CreateWithTwoObjects();
5568

5669
GC.Collect();
5770
table.Scavenge();
@@ -62,10 +75,7 @@ public void Scavenging()
6275
[Test]
6376
public void IterationAfterGC()
6477
{
65-
WeakHashtable table = Create();
66-
67-
table[new object()] = new object();
68-
table[new object()] = new object();
78+
WeakHashtable table = CreateWithTwoObjects();
6979

7080
GC.Collect();
7181

src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,21 @@ private static void SetupFirebird(Cfg.Configuration cfg)
116116

117117
private static void SetupSqlServerCe(Cfg.Configuration cfg)
118118
{
119+
var connStr = cfg.Properties[Cfg.Environment.ConnectionString];
120+
119121
try
120122
{
121-
if (File.Exists("NHibernate.sdf"))
122-
File.Delete("NHibernate.sdf");
123+
var connStrBuilder = new SqlCeConnectionStringBuilder(connStr);
124+
var dataSource = connStrBuilder.DataSource;
125+
if (File.Exists(dataSource))
126+
File.Delete(dataSource);
123127
}
124128
catch (Exception e)
125129
{
126130
Console.WriteLine(e);
127131
}
128132

129-
using (var en = new SqlCeEngine("DataSource=\"NHibernate.sdf\""))
133+
using (var en = new SqlCeEngine(connStr))
130134
{
131135
en.CreateDatabase();
132136
}

0 commit comments

Comments
 (0)