Skip to content

Commit

Permalink
Merge pull request #1464 from Particular/cherry-pick-1461-v7
Browse files Browse the repository at this point in the history
Quote the catalog name when preparing the send command text in SQL Server
  • Loading branch information
WilliamBZA authored Nov 6, 2024
2 parents 7ec3284 + 8b508ed commit e5c158f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
echo "Create extra databases"
sqlcmd -Q "CREATE DATABASE nservicebus1"
sqlcmd -Q "CREATE DATABASE nservicebus2"
sqlcmd -Q "CREATE DATABASE [n service.bus&#]"
echo "Create additional schemas"
sqlcmd -Q "CREATE SCHEMA receiver AUTHORIZATION db_owner" -d "nservicebus"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace NServiceBus.Transport.SqlServer.AcceptanceTests.MultiCatalog
{
using System.Threading.Tasks;
using AcceptanceTesting;
using NUnit.Framework;

public class When_catalog_with_special_characters_configured_for_endpoint : MultiCatalogAcceptanceTest
{
static string EndpointConnectionString => WithCustomCatalog(GetDefaultConnectionString(), "n service.bus&#");

[Test]
public async Task Should_be_able_to_send_messages_to_the_endpoint()
{
await Scenario.Define<Context>()
.WithEndpoint<AnEndpoint>(c => c.When(s => s.SendLocal(new Message())))
.Done(c => c.MessageReceived)
.Run();

Assert.Pass();
}

public class AnEndpoint : EndpointConfigurationBuilder
{
public AnEndpoint() =>
EndpointSetup(new CustomizedServer(EndpointConnectionString), (_, __) => { });

class Handler : IHandleMessages<Message>
{
public Handler(Context scenarioContext)
{
ScenarioContext = scenarioContext;
}

public Task Handle(Message message, IMessageHandlerContext context)
{
ScenarioContext.MessageReceived = true;

return Task.FromResult(0);
}

Context ScenarioContext;
}
}

public class Message : ICommand
{
}

class Context : ScenarioContext
{
public bool MessageReceived { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ THEN DATEADD(ms, @TimeToBeReceivedMs, GETUTCDATE()) END,

public static string CheckIfTableHasRecoverableText { get; set; } = @"
SELECT COUNT(*)
FROM {0}.sys.columns c
FROM [{0}].sys.columns c
WHERE c.object_id = OBJECT_ID(N'{1}')
AND c.name = 'Recoverable'";

Expand Down

0 comments on commit e5c158f

Please sign in to comment.