Skip to content

Commit

Permalink
Merge pull request #343 from Particular/release-8.1
Browse files Browse the repository at this point in the history
Release 8.1
  • Loading branch information
Scooletz authored Jul 11, 2018
2 parents 75f0c01 + ab802b9 commit d3c6221
Show file tree
Hide file tree
Showing 60 changed files with 554 additions and 464 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net461</TargetFramework>
<RootNamespace>NServiceBus.NHibernate.AcceptanceTests.Oracle</RootNamespace>
</PropertyGroup>

Expand All @@ -11,9 +11,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.0.0" />
<PackageReference Include="NUnit" Version="3.*" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
<PackageReference Include="NHibernate" Version="5.1.3" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.0.1" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="Oracle.ManagedDataAccess" Version="12.1.2400" />
</ItemGroup>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Linq;
using System.Threading.Tasks;
using NHibernate.Cfg;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Dialect;
using NServiceBus;
using NServiceBus.AcceptanceTesting.Support;
using NServiceBus.Persistence;

public class ConfigureEndpointNHibernatePersistence : EndpointConfigurer
{
public override Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata)
{
var cfg = new Configuration
{
Properties =
{
{Environment.ConnectionString, ConnectionString},
{Environment.Dialect, typeof(MsSql2008Dialect).FullName},
},
};

cfg.BeforeBindMapping += (sender, e) => PrefixMapping(e, "sqlTest_");

configuration.UsePersistence<NHibernatePersistence>()
.UseConfiguration(cfg);

return Task.CompletedTask;
}

static void PrefixMapping(BindMappingEventArgs e, string prefix)
{
var c = e.Mapping.RootClasses.Single();

c.table = prefix + (c.table ?? c.Name);
foreach (var prop in c.Properties.OfType<HbmProperty>())
{
foreach (var column in prop.Columns)
{
if (!string.IsNullOrEmpty(column.index))
{
column.index = prefix + column.index;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ public static string ConnectionString
{
get
{
var envVar = Environment.GetEnvironmentVariable("NH_ACC_TEST_CONNSTR");
if (!string.IsNullOrEmpty(envVar))
var env = Environment.GetEnvironmentVariable("NH_ACC_TEST_CONNSTR");
if (!string.IsNullOrEmpty(env))
{
return envVar;
return env;
}

env = Environment.GetEnvironmentVariable("SQLServerConnectionString");
if (!string.IsNullOrEmpty(env))
{
return env;
}


return defaultConnStr;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<RootNamespace>NServiceBus.NHibernate.AcceptanceTests.SqlTransport</RootNamespace>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,10 +11,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.0.0" />
<PackageReference Include="NServiceBus.SqlServer" Version="4.0.0" />
<PackageReference Include="NUnit" Version="3.*" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
<PackageReference Include="NHibernate" Version="5.1.3" />
<PackageReference Include="NServiceBus.SqlServer" Version="4.1.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.0.1" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace NServiceBus.AcceptanceTests
{
using NUnit.Framework;

public abstract partial class NServiceBusAcceptanceTest
{
[SetUp]
public void SetUp2()
{
if (TestContext.CurrentContext?.Test?.FullName == "NServiceBus.AcceptanceTests.DelayedDelivery.When_deferring_to_non_local.Message_should_be_received")
{
Assert.Ignore("This is a flaky time-dependent test. It's ignored for now.");
}
}
}
}
12 changes: 9 additions & 3 deletions src/NServiceBus.NHibernate.AcceptanceTests/EndpointConfigurer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ public static string ConnectionString
{
get
{
var envVar = Environment.GetEnvironmentVariable("NH_ACC_TEST_CONNSTR");
if (!string.IsNullOrEmpty(envVar))
var env = Environment.GetEnvironmentVariable("NH_ACC_TEST_CONNSTR");
if (!string.IsNullOrEmpty(env))
{
return envVar;
return env;
}

env = Environment.GetEnvironmentVariable("SQLServerConnectionString");
if (!string.IsNullOrEmpty(env))
{
return env;
}

return defaultConnStr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,10 +11,12 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="NHibernate" Version="5.1.3" />
<PackageReference Include="NServiceBus.Gateway.AcceptanceTests.Sources" Version="3.0.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.0.0" />
<PackageReference Include="NUnit" Version="3.*" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.0.1" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net461</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand All @@ -10,8 +10,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="7.0.0" />
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="2.0.0" />
<PackageReference Include="NHibernate" Version="5.1.3" />
<PackageReference Include="NServiceBus" Version="7.0.1" />
<PackageReference Include="NServiceBus.Newtonsoft.Json" Version="2.1.0" />
<PackageReference Include="NServiceBus.Transport.Msmq" Version="1.0.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.NHibernate.Tests/API/APIApprovals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class APIApprovals
[MethodImpl(MethodImplOptions.NoInlining)]
public void Approve()
{
var publicApi = ApiGenerator.GeneratePublicApi(typeof(NHibernatePersistence).Assembly);
var publicApi = ApiGenerator.GeneratePublicApi(typeof(NHibernatePersistence).Assembly, excludeAttributes: new[] { "System.Runtime.Versioning.TargetFrameworkAttribute" });
TestApprover.Verify(publicApi);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute(@"NServiceBus.NHibernate.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName=".NET Framework 4.5.2")]

namespace NServiceBus.Features
{

public class NHibernateGatewayDeduplication : NServiceBus.Features.Feature
{
public NHibernateGatewayDeduplication() { }
Expand All @@ -27,7 +24,6 @@ namespace NServiceBus.Features
}
namespace NServiceBus.NHibernate.Outbox
{

public class static OutboxConfig
{
public static NServiceBus.PersistenceExtensions<NServiceBus.NHibernatePersistence> UseOutboxRecord<TEntity, TMapping>(this NServiceBus.PersistenceExtensions<NServiceBus.NHibernatePersistence> persistenceConfiguration)
Expand All @@ -37,7 +33,6 @@ namespace NServiceBus.NHibernate.Outbox
}
namespace NServiceBus.NHibernate
{

public class ScriptGenerator<T>
where T : NHibernate.Dialect.Dialect, new ()
{
Expand All @@ -52,7 +47,6 @@ namespace NServiceBus.NHibernate
}
namespace NServiceBus
{

public class NHibernatePersistence : NServiceBus.Persistence.PersistenceDefinition
{
public NHibernatePersistence() { }
Expand All @@ -65,7 +59,6 @@ namespace NServiceBus
}
namespace NServiceBus.Outbox.NHibernate
{

public interface IOutboxRecord
{
bool Dispatched { get; set; }
Expand All @@ -76,7 +69,6 @@ namespace NServiceBus.Outbox.NHibernate
}
namespace NServiceBus.Persistence.NHibernate
{

public class static DeduplicationConfig
{
public static NServiceBus.PersistenceExtensions<NServiceBus.NHibernatePersistence> DisableGatewayDeduplicationSchemaUpdate(this NServiceBus.PersistenceExtensions<NServiceBus.NHibernatePersistence> persistenceConfiguration) { }
Expand Down Expand Up @@ -105,7 +97,6 @@ namespace NServiceBus.Persistence.NHibernate
}
namespace NServiceBus.Persistence
{

public class static SharedConfig
{
public static NServiceBus.PersistenceExtensions<NServiceBus.NHibernatePersistence> ConnectionString(this NServiceBus.PersistenceExtensions<NServiceBus.NHibernatePersistence> persistenceConfiguration, string connectionString) { }
Expand All @@ -115,7 +106,6 @@ namespace NServiceBus.Persistence
}
namespace NServiceBus.SagaPersisters.NHibernate
{

[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.All)]
public sealed class LockModeAttribute : System.Attribute
{
Expand Down Expand Up @@ -146,7 +136,6 @@ namespace NServiceBus.SagaPersisters.NHibernate
}
namespace NServiceBus.Testing
{

public class TestingNHibernateSynchronizedStorageSession : NServiceBus.Persistence.SynchronizedStorageSession
{
public TestingNHibernateSynchronizedStorageSession(NHibernate.ISession session) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK236CFC11C9055018]') AND parent_object_id = OBJECT_ID('MySaga_CollectionEntry'))
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK236CFC11C9055018]') and parent_object_id = OBJECT_ID(N'MySaga_CollectionEntry'))
alter table MySaga_CollectionEntry drop constraint FK236CFC11C9055018


Expand Down
5 changes: 4 additions & 1 deletion src/NServiceBus.NHibernate.Tests/ApprovalTestConfig.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using ApprovalTests.Reporters;
#if NETFRAMEWORK
[assembly: UseReporter(typeof(DiffReporter), typeof(AllFailingTestsClipboardReporter))]

#else
[assembly: UseReporter(typeof(NUnitReporter))]
#endif
21 changes: 21 additions & 0 deletions src/NServiceBus.NHibernate.Tests/Consts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace NServiceBus.NHibernate.Tests
{
static class Consts
{
const string @default = @"Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True;";

public static string SqlConnectionString
{
get
{
var env = System.Environment.GetEnvironmentVariable("SQLServerConnectionString");
if (!string.IsNullOrEmpty(env))
{
return env;
}

return @default;
}
}
}
}
3 changes: 3 additions & 0 deletions src/NServiceBus.NHibernate.Tests/GenerateScriptsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ public void GatewayDeduplication()
TestApprover.Verify(script);
}

#if !NETCOREAPP
// This test is ignored for .NETCore because of the unstable foreing key name generation in NHibernate https://github.com/nhibernate/nhibernate-core/issues/1769
[Test]
[MethodImpl(MethodImplOptions.NoInlining)]
public void MySaga()
{
var script = ScriptGenerator<MsSql2012Dialect>.GenerateSagaScript<MySaga>();
TestApprover.Verify(script);
}
#endif
}

class MySaga : Saga<MySaga.SagaData>, IAmStartedByMessages<MyMessage>
Expand Down
Loading

0 comments on commit d3c6221

Please sign in to comment.