Skip to content
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

Quote the catalog name when preparing the send command text in SQL Server #1464

Open
wants to merge 6 commits into
base: release-7.0
Choose a base branch
from
Open
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
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