47
47
import java .util .concurrent .CompletableFuture ;
48
48
import java .util .concurrent .ScheduledExecutorService ;
49
49
50
- import static org .junit .jupiter .api .Assertions .assertTrue ;
51
50
import static org .mockito .ArgumentMatchers .any ;
52
51
import static org .mockito .Mockito .*;
53
52
@@ -60,24 +59,23 @@ class ReceiveMessageBatchManagerTest {
60
59
61
60
private final ScheduledExecutorService executor = Executors .newScheduledThreadPool (4 );
62
61
63
-
64
62
private ReceiveMessageBatchManager receiveMessageBatchManager ;
65
63
66
64
67
65
@ ParameterizedTest (name = "{index} => {0}" )
68
66
@ MethodSource ("provideBatchOverrideConfigurations" )
69
67
@ DisplayName ("Test BatchRequest with various configurations" )
70
68
void testBatchRequest_WhenBufferingDisabledAndInCompatible_ShouldNotUseBatchManager (String testCaseName ,
71
- BatchOverrideConfiguration overrideConfig ,
69
+ ResponseBatchConfiguration overrideConfig ,
72
70
ReceiveMessageRequest request ,
73
71
boolean useBatchManager ) throws Exception {
74
72
75
73
// Initialize the ResponseBatchConfiguration and ReceiveMessageBatchManager
76
74
ResponseBatchConfiguration config = ResponseBatchConfiguration .builder ()
77
- .messageSystemAttributeNames (overrideConfig .receiveMessageSystemAttributeNames ())
75
+ .messageSystemAttributeNames (overrideConfig .messageSystemAttributeNames ())
78
76
.receiveMessageAttributeNames (overrideConfig .receiveMessageAttributeNames ())
79
- .visibilityTimeout (overrideConfig .receiveMessageVisibilityTimeout ())
80
- .messageMinWaitDuration (overrideConfig .receiveMessageMinWaitDuration ()).build ();
77
+ .visibilityTimeout (overrideConfig .visibilityTimeout ())
78
+ .messageMinWaitDuration (overrideConfig .messageMinWaitDuration ()).build ();
81
79
82
80
receiveMessageBatchManager = new ReceiveMessageBatchManager (sqsClient , executor , overrideConfig );
83
81
@@ -122,9 +120,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
122
120
return Stream .of (
123
121
Arguments .of (
124
122
"Buffering enabled, compatible system and message attributes, and no visibility timeout" ,
125
- BatchOverrideConfiguration .builder ()
123
+ ResponseBatchConfiguration .builder ()
126
124
.receiveMessageAttributeNames (Collections .singletonList ("attr1" ))
127
- .receiveMessageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
125
+ .messageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
128
126
.build (),
129
127
ReceiveMessageRequest .builder ()
130
128
.queueUrl ("testQueueUrl" )
@@ -135,9 +133,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
135
133
),
136
134
Arguments .of (
137
135
"Buffering , compatible attributes, and no visibility timeout" ,
138
- BatchOverrideConfiguration .builder ()
136
+ ResponseBatchConfiguration .builder ()
139
137
.receiveMessageAttributeNames (Collections .singletonList ("attr1" ))
140
- .receiveMessageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
138
+ .messageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
141
139
.build (),
142
140
ReceiveMessageRequest .builder ()
143
141
.queueUrl ("testQueueUrl" )
@@ -150,9 +148,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
150
148
),
151
149
Arguments .of (
152
150
"Buffering disabled, incompatible system attributes, and no visibility timeout" ,
153
- BatchOverrideConfiguration .builder ()
151
+ ResponseBatchConfiguration .builder ()
154
152
.receiveMessageAttributeNames (Collections .singletonList ("attr1" ))
155
- .receiveMessageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENT_TIMESTAMP ))
153
+ .messageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENT_TIMESTAMP ))
156
154
.build (),
157
155
ReceiveMessageRequest .builder ()
158
156
.queueUrl ("testQueueUrl" )
@@ -164,9 +162,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
164
162
),
165
163
Arguments .of (
166
164
"Buffering disabled, compatible attributes, but visibility timeout is set" ,
167
- BatchOverrideConfiguration .builder ()
165
+ ResponseBatchConfiguration .builder ()
168
166
.receiveMessageAttributeNames (Collections .singletonList ("attr1" ))
169
- .receiveMessageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
167
+ .messageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
170
168
.build (),
171
169
ReceiveMessageRequest .builder ()
172
170
.queueUrl ("testQueueUrl" )
@@ -178,9 +176,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
178
176
),
179
177
Arguments .of (
180
178
"Buffering disabled, compatible attributes, no visibility timeout, but request has attribute names" ,
181
- BatchOverrideConfiguration .builder ()
179
+ ResponseBatchConfiguration .builder ()
182
180
.receiveMessageAttributeNames (Collections .singletonList ("attr1" ))
183
- .receiveMessageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
181
+ .messageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
184
182
.build (),
185
183
ReceiveMessageRequest .builder ()
186
184
.queueUrl ("testQueueUrl" )
@@ -192,8 +190,8 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
192
190
),
193
191
Arguments .of (
194
192
"Buffering enabled, with messageSystemAttributeName in Config and simple ReceiveMessageRequest" ,
195
- BatchOverrideConfiguration .builder ()
196
- .receiveMessageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
193
+ ResponseBatchConfiguration .builder ()
194
+ .messageSystemAttributeNames (Collections .singletonList (MessageSystemAttributeName .SENDER_ID ))
197
195
.build (),
198
196
ReceiveMessageRequest .builder ()
199
197
.queueUrl ("testQueueUrl" )
0 commit comments