@@ -81,10 +81,14 @@ public void runTest(List<String> test, String name) throws Exception {
81
81
while (iter .hasNext ()) {
82
82
String line = iter .next ();
83
83
String [] args = line .split ("%%" );
84
- switch (args [0 ]) {
84
+ if (args [0 ].equals ("EOF" )) {
85
+ handleEOF ();
86
+ continue ;
87
+ }
88
+ switch (args [1 ]) {
85
89
case "subscribe" :
86
90
handleSubscribe (args );
87
- id .add (args [2 ]);
91
+ id .add (args [3 ]);
88
92
break ;
89
93
case "channel" :
90
94
channelTest = true ;
@@ -94,7 +98,7 @@ public void runTest(List<String> test, String name) throws Exception {
94
98
handleEchoChannel (args );
95
99
break ;
96
100
case "await" :
97
- switch (args [1 ]) {
101
+ switch (args [2 ]) {
98
102
case "terminal" :
99
103
handleAwaitTerminal (args );
100
104
break ;
@@ -110,7 +114,7 @@ public void runTest(List<String> test, String name) throws Exception {
110
114
break ;
111
115
112
116
case "assert" :
113
- switch (args [1 ]) {
117
+ switch (args [2 ]) {
114
118
case "no_error" :
115
119
assertNoError (args );
116
120
break ;
@@ -146,9 +150,6 @@ public void runTest(List<String> test, String name) throws Exception {
146
150
case "cancel" :
147
151
handleCancel (args );
148
152
break ;
149
- case "EOF" :
150
- handleEOF ();
151
- break ;
152
153
default :
153
154
// the default behavior is to just skip the line, so we can acommodate slight changes to the TCK
154
155
break ;
@@ -167,32 +168,32 @@ public void runTest(List<String> test, String name) throws Exception {
167
168
* @param args
168
169
*/
169
170
private void handleSubscribe (String [] args ) {
170
- switch (args [1 ]) {
171
+ switch (args [2 ]) {
171
172
case "rr" :
172
173
MySubscriber <Payload > rrsub = new MySubscriber <>(0L , AGENT );
173
- payloadSubscribers .put (args [2 ], rrsub );
174
- idToType .put (args [2 ], args [1 ]);
174
+ payloadSubscribers .put (args [3 ], rrsub );
175
+ idToType .put (args [3 ], args [2 ]);
175
176
RSocket rrclient = createClient .get ();
176
- consoleUtils .info ("Sending RR with " + args [3 ] + " " + args [4 ]);
177
- Publisher <Payload > rrpub = rrclient .requestResponse (new PayloadImpl (args [3 ], args [4 ]));
177
+ consoleUtils .info ("Sending RR with " + args [4 ] + " " + args [5 ]);
178
+ Publisher <Payload > rrpub = rrclient .requestResponse (new PayloadImpl (args [4 ], args [5 ]));
178
179
rrpub .subscribe (rrsub );
179
180
break ;
180
181
case "rs" :
181
182
MySubscriber <Payload > rssub = new MySubscriber <>(0L , AGENT );
182
- payloadSubscribers .put (args [2 ], rssub );
183
- idToType .put (args [2 ], args [1 ]);
183
+ payloadSubscribers .put (args [3 ], rssub );
184
+ idToType .put (args [3 ], args [2 ]);
184
185
RSocket rsclient = createClient .get ();
185
- consoleUtils .info ("Sending RS with " + args [3 ] + " " + args [4 ]);
186
- Publisher <Payload > rspub = rsclient .requestStream (new PayloadImpl (args [3 ], args [4 ]));
186
+ consoleUtils .info ("Sending RS with " + args [4 ] + " " + args [5 ]);
187
+ Publisher <Payload > rspub = rsclient .requestStream (new PayloadImpl (args [4 ], args [5 ]));
187
188
rspub .subscribe (rssub );
188
189
break ;
189
190
case "fnf" :
190
191
MySubscriber <Void > fnfsub = new MySubscriber <>(0L , AGENT );
191
- fnfSubscribers .put (args [2 ], fnfsub );
192
- idToType .put (args [2 ], args [1 ]);
192
+ fnfSubscribers .put (args [3 ], fnfsub );
193
+ idToType .put (args [3 ], args [2 ]);
193
194
RSocket fnfclient = createClient .get ();
194
- consoleUtils .info ("Sending fnf with " + args [3 ] + " " + args [4 ]);
195
- Publisher <Void > fnfpub = fnfclient .fireAndForget (new PayloadImpl (args [3 ], args [4 ]));
195
+ consoleUtils .info ("Sending fnf with " + args [4 ] + " " + args [5 ]);
196
+ Publisher <Void > fnfpub = fnfclient .fireAndForget (new PayloadImpl (args [4 ], args [5 ]));
196
197
fnfpub .subscribe (fnfsub );
197
198
break ;
198
199
default :
@@ -218,7 +219,7 @@ private void handleChannel(String[] args, Iterator<String> iter, String name, bo
218
219
line = iter .next ();
219
220
}
220
221
// set the initial payload
221
- Payload initialPayload = new PayloadImpl (args [1 ], args [2 ]);
222
+ Payload initialPayload = new PayloadImpl (args [2 ], args [3 ]);
222
223
223
224
// this is the subscriber that will request data from the server, like all the other test subscribers
224
225
MySubscriber <Payload > testsub = new MySubscriber <>(1L , AGENT );
@@ -259,7 +260,7 @@ public void subscribe(Subscriber<? super Payload> s) {
259
260
* @param args
260
261
*/
261
262
private void handleEchoChannel (String [] args ) {
262
- Payload initPayload = new PayloadImpl (args [1 ], args [2 ]);
263
+ Payload initPayload = new PayloadImpl (args [2 ], args [3 ]);
263
264
MySubscriber <Payload > testsub = new MySubscriber <>(1L , AGENT );
264
265
RSocket client = createClient .get ();
265
266
Publisher <Payload > pub =
@@ -278,7 +279,7 @@ public void subscribe(Subscriber<? super Payload> s) {
278
279
279
280
private void handleAwaitTerminal (String [] args ) {
280
281
consoleUtils .info ("Awaiting at Terminal" );
281
- String id = args [2 ];
282
+ String id = args [3 ];
282
283
283
284
assertNotEquals ("Could not find subscriber with given id" , idToType .get (id ), null );
284
285
@@ -292,28 +293,28 @@ private void handleAwaitTerminal(String[] args) {
292
293
}
293
294
294
295
private void handleAwaitAtLeast (String [] args ) {
295
- consoleUtils .info ("Awaiting at Terminal for at least " + args [3 ]);
296
+ consoleUtils .info ("Awaiting at Terminal for at least " + args [4 ]);
296
297
try {
297
- String id = args [2 ];
298
+ String id = args [3 ];
298
299
MySubscriber <Payload > sub = payloadSubscribers .get (id );
299
- sub .awaitAtLeast (Long .parseLong (args [3 ]));
300
+ sub .awaitAtLeast (Long .parseLong (args [4 ]));
300
301
} catch (InterruptedException e ) {
301
302
assertNull ("interrupted " , e .getMessage ());
302
303
}
303
304
}
304
305
305
306
private void handleAwaitNoEvents (String [] args ) {
306
307
try {
307
- String id = args [2 ];
308
+ String id = args [3 ];
308
309
MySubscriber <Payload > sub = payloadSubscribers .get (id );
309
- sub .awaitNoEvents (Long .parseLong (args [3 ]));
310
+ sub .awaitNoEvents (Long .parseLong (args [4 ]));
310
311
} catch (InterruptedException e ) {
311
312
assertNull ("interrupted " , e .getMessage ());
312
313
}
313
314
}
314
315
315
316
private void assertNoError (String [] args ) {
316
- String id = args [2 ];
317
+ String id = args [3 ];
317
318
318
319
assertNotNull ("Could not find subscriber with given id" , idToType .get (id ));
319
320
if (idToType .get (id ).equals ("fnf" )) {
@@ -335,7 +336,7 @@ private void assertNoError(String[] args) {
335
336
336
337
private void assertError (String [] args ) {
337
338
consoleUtils .info ("Checking for error" );
338
- String id = args [2 ];
339
+ String id = args [3 ];
339
340
assertNotNull ("Could not find subscriber with given id" , idToType .get (id ));
340
341
if (idToType .get (id ).equals ("fnf" )) {
341
342
MySubscriber <Void > sub = fnfSubscribers .get (id );
@@ -347,10 +348,10 @@ private void assertError(String[] args) {
347
348
}
348
349
349
350
private void assertReceived (String [] args ) {
350
- consoleUtils .info ("Verify we received " + args [3 ]);
351
- String id = args [2 ];
351
+ consoleUtils .info ("Verify we received " + args [4 ]);
352
+ String id = args [3 ];
352
353
MySubscriber <Payload > sub = payloadSubscribers .get (id );
353
- String [] values = args [3 ].split ("&&" );
354
+ String [] values = args [4 ].split ("&&" );
354
355
List <Tuple <String , String >> assertList = new ArrayList <>();
355
356
for (String v : values ) {
356
357
String [] vals = v .split ("," );
@@ -360,24 +361,24 @@ private void assertReceived(String[] args) {
360
361
}
361
362
362
363
private void assertReceivedN (String [] args ) {
363
- String id = args [2 ];
364
+ String id = args [3 ];
364
365
MySubscriber <Payload > sub = payloadSubscribers .get (id );
365
366
try {
366
- sub .assertValueCount (Integer .parseInt (args [3 ]));
367
+ sub .assertValueCount (Integer .parseInt (args [4 ]));
367
368
} catch (Throwable ex ) {
368
369
assertNull (ex .getMessage ());
369
370
}
370
371
}
371
372
372
373
private void assertReceivedAtLeast (String [] args ) {
373
- String id = args [2 ];
374
+ String id = args [3 ];
374
375
MySubscriber <Payload > sub = payloadSubscribers .get (id );
375
- sub .assertReceivedAtLeast (Integer .parseInt (args [3 ]));
376
+ sub .assertReceivedAtLeast (Integer .parseInt (args [4 ]));
376
377
}
377
378
378
379
private void assertCompleted (String [] args ) {
379
380
consoleUtils .info ("Handling onComplete" );
380
- String id = args [2 ];
381
+ String id = args [3 ];
381
382
382
383
assertNotNull ("Could not find subscriber with given id" , idToType .get (id ));
383
384
if (idToType .get (id ).equals ("fnf" )) {
@@ -399,7 +400,7 @@ private void assertCompleted(String[] args) {
399
400
400
401
private void assertNoCompleted (String [] args ) {
401
402
consoleUtils .info ("Handling NO onComplete" );
402
- String id = args [2 ];
403
+ String id = args [3 ];
403
404
404
405
assertNotNull ("Could not find subscriber with given id" , idToType .get (id ));
405
406
if (idToType .get (id ).equals ("fnf" )) {
@@ -420,14 +421,14 @@ private void assertNoCompleted(String[] args) {
420
421
}
421
422
422
423
private void assertCancelled (String [] args ) {
423
- String id = args [2 ];
424
+ String id = args [3 ];
424
425
MySubscriber <Payload > sub = payloadSubscribers .get (id );
425
426
assertTrue (sub .isCancelled ());
426
427
}
427
428
428
429
private void handleRequest (String [] args ) {
429
- Long num = Long .parseLong (args [1 ]);
430
- String id = args [2 ];
430
+ Long num = Long .parseLong (args [2 ]);
431
+ String id = args [3 ];
431
432
432
433
assertNotNull ("Could not find subscriber with given id" , idToType .get (id ));
433
434
if (idToType .get (id ).equals ("fnf" )) {
@@ -442,14 +443,14 @@ private void handleRequest(String[] args) {
442
443
}
443
444
444
445
private void handleTake (String [] args ) {
445
- String id = args [2 ];
446
- Long num = Long .parseLong (args [1 ]);
446
+ String id = args [3 ];
447
+ Long num = Long .parseLong (args [2 ]);
447
448
MySubscriber <Payload > sub = payloadSubscribers .get (id );
448
449
sub .take (num );
449
450
}
450
451
451
452
private void handleCancel (String [] args ) {
452
- String id = args [1 ];
453
+ String id = args [2 ];
453
454
MySubscriber <Payload > sub = payloadSubscribers .get (id );
454
455
sub .cancel ();
455
456
}
0 commit comments