Skip to content

Commit

Permalink
Merge branch 'hotfix-3.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
SzymonPobiega committed Jan 3, 2018
2 parents 49706fa + bfc6e05 commit 3f1e7e9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using NUnit.Framework;

//note: this test will no longer be relevant in v7
public class When_requesting_immediate_dispatch_using_scope_suppress : NServiceBusAcceptanceTest
public partial class When_requesting_immediate_dispatch_using_scope_suppress : NServiceBusAcceptanceTest
{
[Test]
public async Task Should_dispatch_immediately()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace NServiceBus.AcceptanceTests.Tx
{
using NUnit.Framework;

[Explicit("SQL transport does not support immediate dispatch via scope suppress")]
public partial class When_requesting_immediate_dispatch_using_scope_suppress
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace NServiceBus.AcceptanceTests.Tx
{
using NUnit.Framework;

[Explicit("SQL transport does not support immediate dispatch via scope suppress")]
public partial class When_requesting_immediate_dispatch_using_scope_suppress
{
}
}
18 changes: 10 additions & 8 deletions src/SqlPersistence.Tests/Saga/SagaPersisterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,15 +1172,17 @@ public async Task UseConfiguredSchema()
};

using (var connection = GetConnection()(null))
using (var transaction = connection.BeginTransaction())
using (var storageSession = new StorageSession(connection, transaction, false, null))
{
SagaWithNoCorrelation.SagaData result;
using (var transaction = connection.BeginTransaction())
using (var storageSession = new StorageSession(connection, transaction, false, null))
{
await defaultSchemaPersister.Save(sagaData, storageSession, null).ConfigureAwait(false);
result = (await schemaPersister.Get<SagaWithNoCorrelation.SagaData>(id, storageSession).ConfigureAwait(false)).Data;
}
connection.ExecuteCommand(SagaScriptBuilder.BuildDropScript(definition, sqlDialect), endpointName, schema: null);
await defaultSchemaPersister.Save(sagaData, storageSession, null).ConfigureAwait(false);
}

using (var connection = GetConnection()(schema))
using (var transaction = connection.BeginTransaction())
using (var storageSession = new StorageSession(connection, transaction, false, null))
{
var result = (await schemaPersister.Get<SagaWithNoCorrelation.SagaData>(id, storageSession).ConfigureAwait(false)).Data;
Assert.IsNull(result);
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/SqlPersistence/ScriptLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

static class ScriptLocation
{
const string ScriptFolder = "NServiceBus.Persistence.Sql";

public static string FindScriptDirectory(ReadOnlySettings settings)
{
var currentDirectory = GetCurrentDirectory(settings);
return Path.Combine(currentDirectory, "NServiceBus.Persistence.Sql", settings.GetSqlDialect().Name);
return Path.Combine(currentDirectory, ScriptFolder, settings.GetSqlDialect().Name);
}

static string GetCurrentDirectory(ReadOnlySettings settings)
Expand All @@ -21,7 +23,14 @@ static string GetCurrentDirectory(ReadOnlySettings settings)
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly == null)
{
return AppDomain.CurrentDomain.BaseDirectory;
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
var scriptDir = Path.Combine(baseDir, ScriptFolder);
//if the app domain base dir contains the scripts folder, return it. Otherwise add "bin" to the base dir so that web apps work correctly
if (Directory.Exists(scriptDir))
{
return baseDir;
}
return Path.Combine(baseDir, "bin");
}
var codeBase = entryAssembly.CodeBase;
return Directory.GetParent(new Uri(codeBase).LocalPath).FullName;
Expand Down

0 comments on commit 3f1e7e9

Please sign in to comment.