Skip to content

Commit

Permalink
Merge pull request #514 from Particular/core-7.2
Browse files Browse the repository at this point in the history
Update NServiceBus.Core packages
  • Loading branch information
SeanFeldman authored Oct 18, 2019
2 parents bc8981d + 2150f6f commit e6ed46c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.1.6" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="7.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,73 +70,14 @@ await Scenario.Define<Context>()
}
});
})
.Done(c => c.Logs.Any(l => l.Level == LogLevel.Error))
.Run();

Assert.True(MessageExistsInErrorQueue(connectionString), "The message should have been moved to the error queue");
}
finally
{
PurgeQueues(connectionString);
}
}

#if NET452
[TestCase(TransportTransactionMode.TransactionScope)]
#endif
[TestCase(TransportTransactionMode.SendsAtomicWithReceive)]
[TestCase(TransportTransactionMode.ReceiveOnly)]
[TestCase(TransportTransactionMode.None)]
public async Task Should_move_it_to_the_error_queue_when_body_corrupted(TransportTransactionMode txMode)
{
PurgeQueues(connectionString);
try
{
await Scenario.Define<Context>()
.WithEndpoint<Endpoint>(b =>
.Done(c =>
{
b.DoNotFailOnErrorMessages();
b.CustomConfig(c =>
{
c.UseTransport<SqlServerTransport>()
.Transactions(txMode);
});
b.When(async (bus, c) =>
{
var endpoint = Conventions.EndpointNamingConvention(typeof(Endpoint));

using (var conn = new SqlConnection(connectionString))
{
await conn.OpenAsync();
var command = conn.CreateCommand();
var guid = Guid.NewGuid();
command.CommandText =
$@"INSERT INTO [dbo].[{endpoint}] ([Id],[CorrelationId],[ReplyToAddress],[Recoverable],[Expires],[Headers],[Body])
VALUES (@Id,@CorrelationId,@ReplyToAddress,@Recoverable,@Expires,@Headers,@Body)";
command.Parameters.Add("Id", SqlDbType.UniqueIdentifier).Value = guid;
command.Parameters.Add("CorrelationId", SqlDbType.UniqueIdentifier).Value = guid;
command.Parameters.Add("ReplyToAddress", SqlDbType.VarChar).Value = "";
command.Parameters.Add("Recoverable", SqlDbType.Bit).Value = true;
command.Parameters.Add("Expires", SqlDbType.DateTime).Value = DateTime.Now.AddHours(1);
command.Parameters.Add("Headers", SqlDbType.VarChar).Value = "{\"NServiceBus.MessageIntent\":\"Send\",\"NServiceBus.CorrelationId\":\"{guid}\"," +
"\"NServiceBus.OriginatingMachine\":\"SCHMETTERLING\",\"NServiceBus.OriginatingEndpoint\":\"ReceivingWithNativeMultiQueueTransaction.Endpoint\"," +
"\"$.diagnostics.originating.hostid\":\"3c921610dc4d3ddde4347cd65addcb9f\"," +
"\"NServiceBus.ReplyToAddress\":\"ReceivingWithNativeMultiQueueTransaction.Endpoint@dbo\"," +
"\"NServiceBus.ContentType\":\"text/xml\"," +
"\"NServiceBus.EnclosedMessageTypes\":\"NServiceBus.AcceptanceTests.Tx.When_receiving_with_native_multi_queue_transaction + When_receiving_with_native_multi_queue_transaction.MessageHandledEvent, NServiceBus.SqlServer.AcceptanceTests, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null\"" +
",\"NServiceBus.RelatedTo\":\"{guid}\"," +
"\"NServiceBus.ConversationId\":\"{guid}\"," +
"\"NServiceBus.MessageId\":\"{guid}\"," +
"\"NServiceBus.Version\":\"6.0.0\"," +
"\"NServiceBus.TimeSent\":\"2015-12-16 11:53:22:631646 Z\"}";

command.Parameters.Add("Body", SqlDbType.VarBinary).Value = Encoding.UTF8.GetBytes("body corrupted");

await command.ExecuteNonQueryAsync();
}
});
var firstErrorEntry = c.Logs.FirstOrDefault(l => l.Level == LogLevel.Error
&& l.Message != null
&& l.Message.StartsWith("Error receiving message. Probable message metadata corruption. Moving to error queue."));
c.FirstErrorEntry = firstErrorEntry?.Message;
return c.FirstErrorEntry != null;
})
.Done(c => c.Logs.Any(l => l.Level == LogLevel.Error))
.Run();

Assert.True(MessageExistsInErrorQueue(connectionString), "The message should have been moved to the error queue");
Expand Down Expand Up @@ -179,6 +120,7 @@ static bool MessageExistsInErrorQueue(string connectionString)

public class Context : ScenarioContext
{
public string FirstErrorEntry { get; set; }
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NServiceBus" Version="7.1.6" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NServiceBus" Version="7.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NServiceBus" Version="7.1.6" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NServiceBus" Version="7.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public TransportConfigurationResult Configure(SettingsHolder settings, Transport
}
#endif
this.settings = settings;
settings.Set(transportTransactionMode);
settings.Set("NServiceBus.SharedQueue", settings.EndpointName());
settings.Set(LogicalAddress.CreateLocalAddress(settings.EndpointName(), new Dictionary<string, string>()));
var delayedDeliverySettings = new DelayedDeliverySettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NServiceBus.TransportTests.Sources" Version="7.2.0-beta0079" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NServiceBus.TransportTests.Sources" Version="7.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
</ItemGroup>

<ItemGroup>
<Compile Remove="\**\When_modifying_incoming_headers.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NServiceBus" Version="7.1.6" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NServiceBus" Version="7.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
<PackageReference Include="Particular.Approvals" Version="0.2.0" />
<PackageReference Include="PublicApiGenerator" Version="8.0.1" />
Expand Down

0 comments on commit e6ed46c

Please sign in to comment.