Skip to content

Upgrade AsyncGenerator to 0.14.0 #2126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.13.3" targetFramework="net461" />
<package id="CSharpAsyncGenerator.CommandLine" version="0.14.0" targetFramework="net461" />
<package id="vswhere" version="2.1.4" targetFramework="net461" />
<package id="gitreleasemanager" version="0.7.0" targetFramework="net461" />
</packages>
41 changes: 5 additions & 36 deletions src/AsyncGenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,30 +181,10 @@
methodConversion:
- conversion: Copy
name: AfterTransactionCompletionProcess_EvictsFromCache
- conversion: Copy
hasAttributeName: OneTimeSetUpAttribute
- conversion: Copy
hasAttributeName: OneTimeTearDownAttribute
- conversion: Copy
hasAttributeName: SetUpAttribute
- conversion: Copy
hasAttributeName: TearDownAttribute
- conversion: Smart
hasAttributeName: TestAttribute
- conversion: Smart
hasAttributeName: TheoryAttribute
asyncExtensionMethods:
projectFiles:
- fileName: LinqExtensionMethods.cs
projectName: NHibernate
preserveReturnType:
- hasAttributeName: TestAttribute
- hasAttributeName: TheoryAttribute
alwaysAwait:
- hasAttributeName: TestAttribute
- hasAttributeName: TheoryAttribute
- hasAttributeName: SetUpAttribute
- hasAttributeName: TearDownAttribute
typeConversion:
- conversion: Ignore
name: ObjectAssert
Expand All @@ -214,32 +194,24 @@
name: MultiThreadRunner
- conversion: Ignore
name: PeVerifier
- conversion: Ignore
hasAttributeName: IgnoreAttribute
- conversion: NewType
hasAttributeName: TestFixtureAttribute
- conversion: NewType
anyBaseTypeRule: HasTestFixtureAttribute
- conversion: Ignore
rule: IsTestCase
- conversion: Ignore
anyBaseTypeRule: IsTestCase
ignoreSearchForMethodReferences:
- hasAttributeName: TheoryAttribute
- hasAttributeName: TestAttribute
ignoreDocuments:
- filePathEndsWith: Linq/MathTests.cs
- filePathEndsWith: Linq/ExpressionSessionLeakTest.cs
- filePathEndsWith: Linq/NorthwindDbCreator.cs
cancellationTokens:
withoutCancellationToken:
- hasAttributeName: TestAttribute
- hasAttributeName: TheoryAttribute
enabled: true
scanMethodBody: true
scanForMissingAsyncMembers:
- all: true
registerPlugin:
- type: AsyncGenerator.Core.Plugins.NUnitAsyncCounterpartsFinder
- type: AsyncGenerator.Core.Plugins.NUnitPlugin
parameters:
- name: createNewTypes
value: true
assemblyName: AsyncGenerator.Core
- type: AsyncGenerator.Core.Plugins.TransactionScopeAsyncFlowAdder
assemblyName: AsyncGenerator.Core
Expand Down Expand Up @@ -302,6 +274,3 @@ typeRules:
- filters:
- name: TestCase
name: IsTestCase
- filters:
- hasAttributeName: TestFixtureAttribute
name: HasTestFixtureAttribute
39 changes: 1 addition & 38 deletions src/NHibernate.Test/Async/Ado/BatcherFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,44 +102,7 @@ public async Task OneRoundTripUpdateAsync()
await (CleanupAsync());
}

#if NETFX
[Test, Ignore("Not fixed yet.")]
[Description("SqlClient: The batcher should run all different INSERT queries in only one roundtrip.")]
public async Task SqlClientOneRoundTripForUpdateAndInsertAsync()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get it why this was removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until now the generator ignored only tests that had the Ignore attribute on the class, now I've applied the same rule also for methods.

{
if (Sfi.Settings.BatcherFactory is SqlClientBatchingBatcherFactory == false)
Assert.Ignore("This test is for SqlClientBatchingBatcher only");

await (FillDbAsync());

using (var sqlLog = new SqlLogSpy())
using (ISession s = Sfi.OpenSession())
using (ITransaction tx = s.BeginTransaction())
{
await (s.SaveAsync(new VerySimple
{
Name = "test441",
Weight = 894
}));

await (s.SaveAsync(new AlmostSimple
{
Name = "test441",
Weight = 894
}));

await (tx.CommitAsync());

var log = sqlLog.GetWholeLog();
//log should only contain NHibernate.SQL once, because that means
//that we ony generated a single batch (NHibernate.SQL log will output
//once per batch)
Assert.AreEqual(0, log.IndexOf("NHibernate.SQL"), "log should start with NHibernate.SQL");
Assert.AreEqual(-1, log.IndexOf("NHibernate.SQL", "NHibernate.SQL".Length), "NHibernate.SQL should only appear once in the log");
}

await (CleanupAsync());
}
#if NETFX

[Test]
[Description("SqlClient: The batcher log output should be formatted")]
Expand Down
62 changes: 31 additions & 31 deletions src/NHibernate.Test/Async/CacheTest/BatchableCacheFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -866,14 +866,14 @@ public async Task QueryCacheTestAsync()

[TestCase(true)]
[TestCase(false)]
public async Task QueryEntityBatchCacheTestAsync(bool clearEntityCacheAfterQuery, CancellationToken cancellationToken = default(CancellationToken))
public async Task QueryEntityBatchCacheTestAsync(bool clearEntityCacheAfterQuery)
{
var persister = Sfi.GetEntityPersister(typeof(ReadOnlyItem).FullName);
var cache = (BatchableCache) persister.Cache.Cache;
var queryCache = GetDefaultQueryCache();

Sfi.Statistics.Clear();
await (Sfi.EvictQueriesAsync(cancellationToken));
await (Sfi.EvictQueriesAsync());
cache.ClearStatistics();
queryCache.ClearStatistics();

Expand All @@ -884,9 +884,9 @@ public async Task QueryCacheTestAsync()
{
items = await (s.Query<ReadOnlyItem>()
.WithOptions(o => o.SetCacheable(true))
.ToListAsync(cancellationToken));
.ToListAsync());

await (tx.CommitAsync(cancellationToken));
await (tx.CommitAsync());
}

Assert.That(queryCache.GetCalls, Has.Count.EqualTo(1), "Unexpected query cache GetCalls");
Expand All @@ -903,7 +903,7 @@ public async Task QueryCacheTestAsync()

if (clearEntityCacheAfterQuery)
{
await (cache.ClearAsync(cancellationToken));
await (cache.ClearAsync(CancellationToken.None));
}

Sfi.Statistics.Clear();
Expand All @@ -913,9 +913,9 @@ public async Task QueryCacheTestAsync()
{
items = await (s.Query<ReadOnlyItem>()
.WithOptions(o => o.SetCacheable(true))
.ToListAsync(cancellationToken));
.ToListAsync());

await (tx.CommitAsync(cancellationToken));
await (tx.CommitAsync());
}

Assert.That(queryCache.GetCalls, Has.Count.EqualTo(1), "Unexpected query cache GetCalls");
Expand All @@ -935,7 +935,7 @@ public async Task QueryCacheTestAsync()
[TestCase(false, false)]
[TestCase(true, true)]
[TestCase(false, true)]
public async Task QueryFetchCollectionBatchCacheTestAsync(bool clearEntityCacheAfterQuery, bool future, CancellationToken cancellationToken = default(CancellationToken))
public async Task QueryFetchCollectionBatchCacheTestAsync(bool clearEntityCacheAfterQuery, bool future)
{
if (future && !Sfi.ConnectionProvider.Driver.SupportsMultipleQueries)
{
Expand All @@ -954,19 +954,19 @@ public async Task QueryCacheTestAsync()

using (var s = OpenSession())
{
var ids = await (s.Query<ReadOnly>().Select(o => o.Id).OrderBy(o => o).ToListAsync(cancellationToken));
var ids = await (s.Query<ReadOnly>().Select(o => o.Id).OrderBy(o => o).ToListAsync());
middleId = ids[2];
}

Sfi.Statistics.Clear();
await (Sfi.EvictQueriesAsync(cancellationToken));
await (Sfi.EvictQueriesAsync());
queryCache.ClearStatistics();
cache.ClearStatistics();
await (cache.ClearAsync(cancellationToken));
await (cache.ClearAsync(CancellationToken.None));
itemCache.ClearStatistics();
await (itemCache.ClearAsync(cancellationToken));
await (itemCache.ClearAsync(CancellationToken.None));
collectionCache.ClearStatistics();
await (collectionCache.ClearAsync(cancellationToken));
await (collectionCache.ClearAsync(CancellationToken.None));

List<ReadOnly> items;
using (var s = OpenSession())
Expand All @@ -992,10 +992,10 @@ public async Task QueryCacheTestAsync()
items = await (s.Query<ReadOnly>()
.WithOptions(o => o.SetCacheable(true))
.FetchMany(o => o.Items)
.ToListAsync(cancellationToken));
.ToListAsync());
}

await (tx.CommitAsync(cancellationToken));
await (tx.CommitAsync());
}

Assert.That(queryCache.GetCalls, Has.Count.EqualTo(future ? 0 : 1), "Unexpected query cache GetCalls");
Expand All @@ -1018,9 +1018,9 @@ public async Task QueryCacheTestAsync()

if (clearEntityCacheAfterQuery)
{
await (cache.ClearAsync(cancellationToken));
await (collectionCache.ClearAsync(cancellationToken));
await (itemCache.ClearAsync(cancellationToken));
await (cache.ClearAsync(CancellationToken.None));
await (collectionCache.ClearAsync(CancellationToken.None));
await (itemCache.ClearAsync(CancellationToken.None));
}

Sfi.Statistics.Clear();
Expand Down Expand Up @@ -1048,10 +1048,10 @@ public async Task QueryCacheTestAsync()
items = await (s.Query<ReadOnly>()
.WithOptions(o => o.SetCacheable(true))
.FetchMany(o => o.Items)
.ToListAsync(cancellationToken));
.ToListAsync());
}

await (tx.CommitAsync(cancellationToken));
await (tx.CommitAsync());
}

Assert.That(queryCache.GetCalls, Has.Count.EqualTo(future ? 0 : 1), "Unexpected query cache GetCalls");
Expand Down Expand Up @@ -1080,7 +1080,7 @@ public async Task QueryCacheTestAsync()
[TestCase(false, false)]
[TestCase(true, true)]
[TestCase(false, true)]
public async Task QueryFetchEntityBatchCacheTestAsync(bool clearEntityCacheAfterQuery, bool future, CancellationToken cancellationToken = default(CancellationToken))
public async Task QueryFetchEntityBatchCacheTestAsync(bool clearEntityCacheAfterQuery, bool future)
{
if (future && !Sfi.ConnectionProvider.Driver.SupportsMultipleQueries)
{
Expand All @@ -1097,17 +1097,17 @@ public async Task QueryCacheTestAsync()

using (var s = OpenSession())
{
var ids = await (s.Query<ReadOnlyItem>().Select(o => o.Id).OrderBy(o => o).ToListAsync(cancellationToken));
var ids = await (s.Query<ReadOnlyItem>().Select(o => o.Id).OrderBy(o => o).ToListAsync());
middleId = ids[17];
}

Sfi.Statistics.Clear();
await (Sfi.EvictQueriesAsync(cancellationToken));
await (Sfi.EvictQueriesAsync());
queryCache.ClearStatistics();
cache.ClearStatistics();
await (cache.ClearAsync(cancellationToken));
await (cache.ClearAsync(CancellationToken.None));
parentCache.ClearStatistics();
await (parentCache.ClearAsync(cancellationToken));
await (parentCache.ClearAsync(CancellationToken.None));

List<ReadOnlyItem> items;
using (var s = OpenSession())
Expand All @@ -1133,10 +1133,10 @@ public async Task QueryCacheTestAsync()
items = await (s.Query<ReadOnlyItem>()
.WithOptions(o => o.SetCacheable(true))
.Fetch(o => o.Parent)
.ToListAsync(cancellationToken));
.ToListAsync());
}

await (tx.CommitAsync(cancellationToken));
await (tx.CommitAsync());
}

Assert.That(queryCache.GetCalls, Has.Count.EqualTo(future ? 0 : 1), "Unexpected query cache GetCalls");
Expand All @@ -1158,8 +1158,8 @@ public async Task QueryCacheTestAsync()

if (clearEntityCacheAfterQuery)
{
await (cache.ClearAsync(cancellationToken));
await (parentCache.ClearAsync(cancellationToken));
await (cache.ClearAsync(CancellationToken.None));
await (parentCache.ClearAsync(CancellationToken.None));
}

Sfi.Statistics.Clear();
Expand Down Expand Up @@ -1187,10 +1187,10 @@ public async Task QueryCacheTestAsync()
items = await (s.Query<ReadOnlyItem>()
.WithOptions(o => o.SetCacheable(true))
.Fetch(o => o.Parent)
.ToListAsync(cancellationToken));
.ToListAsync());
}

await (tx.CommitAsync(cancellationToken));
await (tx.CommitAsync());
}

Assert.That(queryCache.GetCalls, Has.Count.EqualTo(future ? 0 : 1), "Unexpected query cache GetCalls");
Expand Down
Loading