-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
test/ActiveMQ.Artemis.Client.IntegrationTests/MessageFirstAcquirerSpec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace ActiveMQ.Artemis.Client.IntegrationTests | ||
{ | ||
public class MessageFirstAcquirerSpec : ActiveMQNetIntegrationSpec | ||
{ | ||
public MessageFirstAcquirerSpec(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task Should_receive_msg_with_FirstAcquirer_set_when_msg_was_received_for_the_first_time() | ||
{ | ||
await using var connection = await CreateConnection(); | ||
var address = Guid.NewGuid().ToString(); | ||
await using var producer = await connection.CreateProducerAsync(address, RoutingType.Anycast); | ||
await using var consumer1 = await connection.CreateConsumerAsync(address, RoutingType.Anycast); | ||
await using var consumer2 = await connection.CreateConsumerAsync(address, RoutingType.Anycast); | ||
|
||
await producer.SendAsync(new Message("foo")); | ||
var msg = await consumer1.ReceiveAsync(CancellationToken); | ||
Assert.True(msg.FirstAcquirer); | ||
} | ||
|
||
[Fact] | ||
public async Task Should_receive_msg_with_FirstAcquirer_set_to_false_when_msg_was_redelivered() | ||
{ | ||
await using var connection = await CreateConnection(); | ||
var address = Guid.NewGuid().ToString(); | ||
await using var producer = await connection.CreateProducerAsync(address, RoutingType.Anycast); | ||
await using var consumer1 = await connection.CreateConsumerAsync(address, RoutingType.Anycast); | ||
await using var consumer2 = await connection.CreateConsumerAsync(address, RoutingType.Anycast); | ||
|
||
await producer.SendAsync(new Message("foo")); | ||
var msg = await consumer1.ReceiveAsync(CancellationToken); | ||
consumer1.Reject(msg); | ||
|
||
var msg2 = await consumer2.ReceiveAsync(CancellationToken); | ||
Assert.False(msg2.FirstAcquirer); | ||
} | ||
} | ||
} |