@@ -44,6 +44,7 @@ public class ITConnectorTest {
44
44
private ConnectionInfoRepository connectionInfoRepo ;
45
45
private CredentialFactoryProvider credentialFactoryProvider ;
46
46
private AccessTokenSupplier accessTokenSupplier ;
47
+ private static final String USER_AGENT = "integration tests" ;
47
48
48
49
@ Before
49
50
public void setUp () throws IOException {
@@ -54,7 +55,8 @@ public void setUp() throws IOException {
54
55
credentialFactoryProvider = new CredentialFactoryProvider ();
55
56
CredentialFactory instanceCredentialFactory =
56
57
credentialFactoryProvider .getInstanceCredentialFactory (config );
57
- connectionInfoRepositoryFactory = new DefaultConnectionInfoRepositoryFactory (executor );
58
+ connectionInfoRepositoryFactory =
59
+ new DefaultConnectionInfoRepositoryFactory (executor , USER_AGENT );
58
60
connectionInfoRepo = connectionInfoRepositoryFactory .create (instanceCredentialFactory , config );
59
61
accessTokenSupplier = new DefaultAccessTokenSupplier (instanceCredentialFactory );
60
62
}
@@ -87,7 +89,8 @@ public void testConnect_createsSocketConnection() throws IOException {
87
89
RsaKeyPairGenerator .generateKeyPair (),
88
90
new DefaultConnectionInfoCacheFactory (),
89
91
new ConcurrentHashMap <>(),
90
- accessTokenSupplier );
92
+ accessTokenSupplier ,
93
+ USER_AGENT );
91
94
92
95
socket = (SSLSocket ) connector .connect (config );
93
96
@@ -132,7 +135,8 @@ public void testConnect_whenTlsHandshakeFails()
132
135
clientConnectorKeyPair ,
133
136
connectionInfoCacheFactory ,
134
137
new ConcurrentHashMap <>(),
135
- accessTokenSupplier );
138
+ accessTokenSupplier ,
139
+ USER_AGENT );
136
140
socket = (SSLSocket ) connector .connect (config );
137
141
} catch (ConnectException ignore ) {
138
142
// The socket connect will fail because it's trying to connect to localhost with TLS certs.
@@ -174,7 +178,8 @@ public void testEquals() {
174
178
clientConnectorKeyPair ,
175
179
connectionInfoCacheFactory ,
176
180
new ConcurrentHashMap <>(),
177
- accessTokenSupplier );
181
+ accessTokenSupplier ,
182
+ USER_AGENT );
178
183
179
184
assertThat (a )
180
185
.isNotEqualTo (
@@ -185,7 +190,8 @@ public void testEquals() {
185
190
clientConnectorKeyPair ,
186
191
connectionInfoCacheFactory ,
187
192
new ConcurrentHashMap <>(),
188
- accessTokenSupplier ));
193
+ accessTokenSupplier ,
194
+ USER_AGENT ));
189
195
190
196
assertThat (a )
191
197
.isNotEqualTo (
@@ -196,7 +202,8 @@ public void testEquals() {
196
202
clientConnectorKeyPair ,
197
203
connectionInfoCacheFactory ,
198
204
new ConcurrentHashMap <>(),
199
- accessTokenSupplier ));
205
+ accessTokenSupplier ,
206
+ USER_AGENT ));
200
207
201
208
assertThat (a )
202
209
.isNotEqualTo (
@@ -207,7 +214,8 @@ public void testEquals() {
207
214
clientConnectorKeyPair ,
208
215
connectionInfoCacheFactory ,
209
216
new ConcurrentHashMap <>(),
210
- accessTokenSupplier ));
217
+ accessTokenSupplier ,
218
+ USER_AGENT ));
211
219
212
220
assertThat (a )
213
221
.isNotEqualTo (
@@ -218,7 +226,8 @@ public void testEquals() {
218
226
RsaKeyPairGenerator .generateKeyPair (), // Different
219
227
connectionInfoCacheFactory ,
220
228
new ConcurrentHashMap <>(),
221
- accessTokenSupplier ));
229
+ accessTokenSupplier ,
230
+ USER_AGENT ));
222
231
223
232
assertThat (a )
224
233
.isNotEqualTo (
@@ -229,7 +238,8 @@ public void testEquals() {
229
238
clientConnectorKeyPair ,
230
239
new DefaultConnectionInfoCacheFactory (), // Different
231
240
new ConcurrentHashMap <>(),
232
- accessTokenSupplier ));
241
+ accessTokenSupplier ,
242
+ USER_AGENT ));
233
243
234
244
assertThat (a )
235
245
.isNotEqualTo (
@@ -240,6 +250,19 @@ public void testEquals() {
240
250
clientConnectorKeyPair ,
241
251
connectionInfoCacheFactory ,
242
252
new ConcurrentHashMap <>(),
253
+ null , // Different
254
+ USER_AGENT ));
255
+
256
+ assertThat (a )
257
+ .isNotEqualTo (
258
+ new Connector (
259
+ config ,
260
+ executor ,
261
+ connectionInfoRepo ,
262
+ clientConnectorKeyPair ,
263
+ connectionInfoCacheFactory ,
264
+ new ConcurrentHashMap <>(),
265
+ accessTokenSupplier ,
243
266
null )); // Different
244
267
}
245
268
@@ -259,7 +282,8 @@ public void testHashCode() {
259
282
clientConnectorKeyPair ,
260
283
connectionInfoCacheFactory ,
261
284
instances ,
262
- accessTokenSupplier );
285
+ accessTokenSupplier ,
286
+ USER_AGENT );
263
287
264
288
assertThat (a .hashCode ())
265
289
.isEqualTo (
@@ -270,6 +294,7 @@ public void testHashCode() {
270
294
clientConnectorKeyPair ,
271
295
connectionInfoCacheFactory ,
272
296
instances ,
273
- accessTokenSupplier ));
297
+ accessTokenSupplier ,
298
+ USER_AGENT ));
274
299
}
275
300
}
0 commit comments