@@ -61,14 +61,14 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
61
61
def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
62
62
63
63
when :
64
- enqueueSuccessfulReplies(false , null )
64
+ enqueueSuccessfulReplies(false , 123 )
65
65
def description = initializer. startHandshake(internalConnection, operationContext)
66
66
description = initializer. finishHandshake(internalConnection, description, operationContext)
67
67
def connectionDescription = description. connectionDescription
68
68
def serverDescription = description. serverDescription
69
69
70
70
then :
71
- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, null )
71
+ connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
72
72
serverDescription == getExpectedServerDescription(serverDescription)
73
73
}
74
74
@@ -77,7 +77,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
77
77
def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
78
78
79
79
when :
80
- enqueueSuccessfulReplies(false , null )
80
+ enqueueSuccessfulReplies(false , 123 )
81
81
def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
82
82
initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
83
83
def description = futureCallback. get()
@@ -88,7 +88,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
88
88
def serverDescription = description. serverDescription
89
89
90
90
then :
91
- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, null )
91
+ connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
92
92
serverDescription == getExpectedServerDescription(serverDescription)
93
93
}
94
94
@@ -106,20 +106,6 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
106
106
connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
107
107
}
108
108
109
- def ' should create correct description with server connection id from hello' () {
110
- given :
111
- def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
112
-
113
- when :
114
- enqueueSuccessfulRepliesWithConnectionIdIsHelloResponse(false , 123 )
115
- def internalDescription = initializer. startHandshake(internalConnection, operationContext)
116
- def connectionDescription = initializer. finishHandshake(internalConnection, internalDescription, operationContext)
117
- .connectionDescription
118
-
119
- then :
120
- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
121
- }
122
-
123
109
def ' should create correct description with server connection id asynchronously' () {
124
110
given :
125
111
def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
@@ -137,31 +123,13 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
137
123
connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
138
124
}
139
125
140
- def ' should create correct description with server connection id from hello asynchronously' () {
141
- given :
142
- def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
143
-
144
- when :
145
- enqueueSuccessfulRepliesWithConnectionIdIsHelloResponse(false , 123 )
146
- def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
147
- initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
148
- def description = futureCallback. get()
149
- futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
150
- initializer. finishHandshakeAsync(internalConnection, description, operationContext, futureCallback)
151
- description = futureCallback. get()
152
- def connectionDescription = description. connectionDescription
153
-
154
- then :
155
- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
156
- }
157
-
158
126
def ' should authenticate' () {
159
127
given :
160
128
def firstAuthenticator = Mock (Authenticator )
161
129
def initializer = new InternalStreamConnectionInitializer (SINGLE , firstAuthenticator, null , [], null )
162
130
163
131
when :
164
- enqueueSuccessfulReplies(false , null )
132
+ enqueueSuccessfulReplies(false , 123 )
165
133
166
134
def internalDescription = initializer. startHandshake(internalConnection, operationContext)
167
135
def connectionDescription = initializer. finishHandshake(internalConnection, internalDescription, operationContext)
@@ -178,7 +146,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
178
146
def initializer = new InternalStreamConnectionInitializer (SINGLE , authenticator, null , [], null )
179
147
180
148
when :
181
- enqueueSuccessfulReplies(false , null )
149
+ enqueueSuccessfulReplies(false , 123 )
182
150
183
151
def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
184
152
initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
@@ -198,7 +166,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
198
166
def initializer = new InternalStreamConnectionInitializer (SINGLE , authenticator, null , [], null )
199
167
200
168
when :
201
- enqueueSuccessfulReplies(true , null )
169
+ enqueueSuccessfulReplies(true , 123 )
202
170
203
171
def internalDescription = initializer. startHandshake(internalConnection, operationContext)
204
172
def connectionDescription = initializer. finishHandshake(internalConnection, internalDescription, operationContext)
@@ -215,7 +183,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
215
183
def initializer = new InternalStreamConnectionInitializer (SINGLE , authenticator, null , [], null )
216
184
217
185
when :
218
- enqueueSuccessfulReplies(true , null )
186
+ enqueueSuccessfulReplies(true , 123 )
219
187
220
188
def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
221
189
initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
@@ -240,7 +208,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
240
208
}
241
209
242
210
when :
243
- enqueueSuccessfulReplies(false , null )
211
+ enqueueSuccessfulReplies(false , 123 )
244
212
if (async) {
245
213
def callback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
246
214
initializer. startHandshakeAsync(internalConnection, operationContext, callback)
@@ -277,7 +245,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
277
245
}
278
246
279
247
when :
280
- enqueueSuccessfulReplies(false , null )
248
+ enqueueSuccessfulReplies(false , 123 )
281
249
if (async) {
282
250
def callback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
283
251
initializer. startHandshakeAsync(internalConnection, operationContext, callback)
@@ -477,25 +445,12 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
477
445
}
478
446
479
447
def enqueueSuccessfulReplies (final boolean isArbiter , final Integer serverConnectionId ) {
480
- internalConnection. enqueueReply(buildSuccessfulReply(
481
- ' {ok: 1, ' +
482
- ' maxWireVersion: 3' +
483
- (isArbiter ? ' , isreplicaset: true, arbiterOnly: true' : ' ' ) +
484
- ' }' ))
485
- internalConnection. enqueueReply(buildSuccessfulReply(
486
- ' {ok: 1 ' +
487
- (serverConnectionId == null ? ' ' : ' , connectionId: ' + serverConnectionId) +
488
- ' }' ))
489
- }
490
-
491
- def enqueueSuccessfulRepliesWithConnectionIdIsHelloResponse (final boolean isArbiter , final Integer serverConnectionId ) {
492
448
internalConnection. enqueueReply(buildSuccessfulReply(
493
449
' {ok: 1, ' +
494
450
' maxWireVersion: 3,' +
495
451
' connectionId: ' + serverConnectionId +
496
452
(isArbiter ? ' , isreplicaset: true, arbiterOnly: true' : ' ' ) +
497
453
' }' ))
498
- internalConnection. enqueueReply(buildSuccessfulReply(' {ok: 1, versionArray : [3, 0, 0]}' ))
499
454
}
500
455
501
456
def enqueueSpeculativeAuthenticationResponsesForScramSha256 () {
0 commit comments