Skip to content

Commit

Permalink
Merge branch 'master' into NH3864-Cacheable-Multicriteria
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzik authored Jun 13, 2018
2 parents a1b6a56 + 06ad6ac commit 85a4cef
Show file tree
Hide file tree
Showing 91 changed files with 2,911 additions and 374 deletions.
2 changes: 1 addition & 1 deletion Tools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net461" />
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net461" />
<package id="NUnit.Extension.VSProjectLoader" version="3.6.0" targetFramework="net461" />
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2.6" targetFramework="net461" />
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2.7" targetFramework="net461" />
<package id="vswhere" version="2.1.4" targetFramework="net461" />
<package id="gitreleasemanager" version="0.7.0" targetFramework="net461" />
</packages>
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 5.1.2.{build}
version: 5.1.3.{build}
image: Visual Studio 2017
environment:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion build-common/NHibernate.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<VersionMajor Condition="'$(VersionMajor)' == ''">5</VersionMajor>
<VersionMinor Condition="'$(VersionMinor)' == ''">1</VersionMinor>
<VersionPatch Condition="'$(VersionPatch)' == ''">2</VersionPatch>
<VersionPatch Condition="'$(VersionPatch)' == ''">3</VersionPatch>
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>

<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
Expand Down
4 changes: 2 additions & 2 deletions build-common/common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<!-- This is used only for build folder -->
<!-- TODO: Either remove or refactor to use NHibernate.props -->
<property name="project.version" value="5.1.2" overwrite="false" />
<property name="project.version.numeric" value="5.1.2" overwrite="false" />
<property name="project.version" value="5.1.3" overwrite="false" />
<property name="project.version.numeric" value="5.1.3" overwrite="false" />

<!-- properties used to connect to database for testing -->
<include buildfile="nhibernate-properties.xml" />
Expand Down
3 changes: 2 additions & 1 deletion doc/reference/modules/basic_mapping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,8 @@

<para>
The <literal>&lt;dynamic-component&gt;</literal> element allows an <literal>IDictionary</literal>
to be mapped as a component, where the property names refer to keys of the dictionary.
or <literal>IDictionary&lt;string, object&gt;</literal>to be mapped as a component, where the property
names refer to keys of the dictionary.
</para>

</sect2>
Expand Down
12 changes: 6 additions & 6 deletions doc/reference/modules/toolset_guide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<para>
You <emphasis>must</emphasis> specify a SQL <literal>Dialect</literal> via the
<literal>hibernate.dialect</literal> property when using this tool.
<literal>dialect</literal> configuration property when using this tool.
</para>

<sect2 id="toolsetguide-s1-2" revision="1">
Expand Down Expand Up @@ -262,23 +262,23 @@ new SchemaExport(cfg).Create(false, true);]]></programlisting>
</thead>
<tbody>
<row>
<entry><literal>hibernate.connection.driver_class</literal></entry>
<entry><literal>connection.driver_class</literal></entry>
<entry>jdbc driver class</entry>
</row>
<row>
<entry><literal>hibernate.connection.url</literal></entry>
<entry><literal>connection.url</literal></entry>
<entry>jdbc url</entry>
</row>
<row>
<entry><literal>hibernate.connection.username</literal></entry>
<entry><literal>connection.username</literal></entry>
<entry>database user</entry>
</row>
<row>
<entry><literal>hibernate.connection.password</literal></entry>
<entry><literal>connection.password</literal></entry>
<entry>user password</entry>
</row>
<row>
<entry><literal>hibernate.dialect</literal></entry>
<entry><literal>dialect</literal></entry>
<entry>dialect</entry>
</row>
</tbody>
Expand Down
17 changes: 17 additions & 0 deletions releasenotes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
Build 5.1.3
=============================

Release notes - NHibernate - Version 5.1.3

** Bug

* #1741 Fix DbType.Binary registration in DB2Dialect
* #1732 Dictionary failure in Loader
* #1730 Query cache always missed in session having altered the entities
* #1711 Fix static proxy serialization

** Task

* #1716 Release 5.1.3


Build 5.1.2
=============================

Expand Down
2 changes: 2 additions & 0 deletions src/AsyncGenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
applyChanges: true
analyzation:
methodConversion:
- conversion: Copy
name: AfterTransactionCompletionProcess_EvictsFromCache
- conversion: Copy
hasAttributeName: OneTimeSetUpAttribute
- conversion: Copy
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using NHibernate.Cache;
using NHibernate.Cfg;
using NSubstitute;
using NUnit.Framework;
using Environment = NHibernate.Cfg.Environment;

namespace NHibernate.Test.BulkManipulation
{
using System.Threading.Tasks;
[TestFixture]
public class NativeSQLBulkOperationsWithCacheAsync : TestCase
{
protected override string MappingsAssembly => "NHibernate.Test";

protected override IList Mappings => new[] { "BulkManipulation.Vehicle.hbm.xml" };

protected override void Configure(Configuration configuration)
{
cfg.SetProperty(Environment.UseQueryCache, "true");
cfg.SetProperty(Environment.UseSecondLevelCache, "true");
cfg.SetProperty(Environment.CacheProvider, typeof(SubstituteCacheProvider).AssemblyQualifiedName);
}

[Test]
public async Task SimpleNativeSQLInsert_DoesNotEvictEntireCacheWhenQuerySpacesAreAddedAsync()
{
List<string> clearCalls = new List<string>();
(Sfi.Settings.CacheProvider as SubstituteCacheProvider).OnClear(x =>
{
clearCalls.Add(x);
});
using (var s = OpenSession())
{
string ssql = "UPDATE Vehicle SET Vin='123' WHERE Vin='123c'";

using (var t = s.BeginTransaction())
{

await (s.CreateSQLQuery(ssql).ExecuteUpdateAsync());
await (t.CommitAsync());

Assert.AreEqual(1, clearCalls.Count);
}

clearCalls.Clear();

using (var t = s.BeginTransaction())
{
await (s.CreateSQLQuery(ssql).AddSynchronizedQuerySpace("Unknown").ExecuteUpdateAsync());
await (t.CommitAsync());

Assert.AreEqual(0, clearCalls.Count);
}
}
}
}
}
78 changes: 78 additions & 0 deletions src/NHibernate.Test/Async/NHSpecificTest/GH1730/Fixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using NHibernate.Cfg;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.GH1730
{
using System.Threading.Tasks;
[TestFixture]
public class FixtureAsync : BugTestCase
{
protected override void Configure(Configuration configuration)
{
cfg.SetProperty(Environment.GenerateStatistics, "true");
}

protected override void OnTearDown()
{
using (var session = OpenSession())
using (var transaction = session.BeginTransaction())
{
session.CreateQuery("delete from Entity").ExecuteUpdate();

transaction.Commit();
}
}

[Test]
public async Task HitCacheInSameSessionAsync()
{
await (Sfi.EvictQueriesAsync());
Sfi.Statistics.Clear();
var entities = new System.Collections.Generic.List<Entity>();

using (var session = OpenSession())
{
using (var transaction = session.BeginTransaction())
{
for (int i = 0; i < 3; i++)
{
var e = new Entity { Name = "Name" + i };
entities.Add(e);
await (session.SaveAsync(e));
}
await (transaction.CommitAsync());
}

var queryString = "from Entity";

using (var tx = session.BeginTransaction())
{
// this query will hit the database and create the cache
await (session.CreateQuery(queryString).SetCacheable(true).ListAsync());
await (tx.CommitAsync());
}

using (var transaction = session.BeginTransaction())
{
//and this one SHOULD served by the cache
await (session.CreateQuery(queryString).SetCacheable(true).ListAsync());
await (transaction.CommitAsync());
}

var qs = Sfi.Statistics.GetQueryStatistics(queryString);
Assert.AreEqual(1, qs.CacheHitCount);
Assert.AreEqual(1, qs.CachePutCount);
}
}
}
}
68 changes: 68 additions & 0 deletions src/NHibernate.Test/Async/NHSpecificTest/NH1039Generic/Fixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System;
using System.Collections.Generic;
using NUnit.Framework;


namespace NHibernate.Test.NHSpecificTest.NH1039Generic
{
using System.Threading.Tasks;
[TestFixture]
public class FixtureAsync : BugTestCase
{
public override string BugNumber
{
get { return "NH1039Generic"; }
}

protected override void OnTearDown()
{
base.OnTearDown();
using (ISession s = OpenSession())
using (ITransaction tx = s.BeginTransaction())
{
s.Delete("from Person");
tx.Commit();
}
}

[Test]
public async Task testAsync()
{
using (ISession s = OpenSession())
using (ITransaction tx = s.BeginTransaction())
{
Person person = new Person("1");
person.Name = "John Doe";
var set = new HashSet<object>();
set.Add("555-1234");
set.Add("555-4321");
person.Properties.Add("Phones", set);

await (s.SaveAsync(person));
await (tx.CommitAsync());
}
using (ISession s = OpenSession())
using (ITransaction tx = s.BeginTransaction())
{
Person person = (Person)await (s.CreateCriteria(typeof(Person)).UniqueResultAsync());

Assert.AreEqual("1", person.ID);
Assert.AreEqual("John Doe", person.Name);
Assert.AreEqual(1, person.Properties.Count);
Assert.That(person.Properties["Phones"], Is.InstanceOf<ISet<object>>());
Assert.IsTrue(((ISet<object>) person.Properties["Phones"]).Contains("555-1234"));
Assert.IsTrue(((ISet<object>) person.Properties["Phones"]).Contains("555-4321"));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using NHibernate.Dialect;


namespace NHibernate.Test.NHSpecificTest.NH2204
namespace NHibernate.Test.NHSpecificTest.NH1316
{
using System.Threading.Tasks;
[TestFixture]
Expand Down Expand Up @@ -66,7 +66,7 @@ protected override void OnTearDown()


[Test]
public async Task KnownFailure_Correct_Id_Returned_When_Using_TriggerAsync()
public async Task Correct_Id_Returned_When_Using_TriggerAsync()
{
//We expected this test to fail - if the problem has been fixed, clean-up the test.
var entity1 = new Parent {Name = "Parent1_0"}; // when saved this entity should have the id of 1
Expand Down Expand Up @@ -100,13 +100,10 @@ public async Task KnownFailure_Correct_Id_Returned_When_Using_TriggerAsync()
await (s.SaveAsync(entity3));
await (s.FlushAsync());

Warn.Unless(
Assert.That(
entity3.Id,
Is.EqualTo(3),
"oh uh - it would appear that lastval() is not our friend when a trigger updates other sequences.");

// now would be a good time to look at the data in the tables and see that they have the IDs as expected
// which are not the same as those returned by nhibernate
}
}
}
Expand Down
Loading

0 comments on commit 85a4cef

Please sign in to comment.