public void parse(){
  for (  String line : commands) {
    String[] args=line.split("%%");
switch (args[0]) {
case "respond":
      handleResponse(args);
    break;
case "await":
switch (args[1]) {
case "terminal":
    sub.awaitTerminalEvent();
  break;
case "atLeast":
try {
  sub.awaitAtLeast(Long.parseLong(args[3]));
}
 catch (InterruptedException e) {
  ConsoleUtils.error("interrupted");
}
break;
case "no_events":
try {
sub.awaitNoEvents(Long.parseLong(args[3]));
}
 catch (InterruptedException e) {
ConsoleUtils.error("interrupted");
}
break;
}
break;
case "assert":
switch (args[1]) {
case "no_error":
sub.assertNoErrors();
break;
case "error":
sub.assertError(new Throwable());
break;
case "received":
handleReceived(args);
break;
case "received_n":
sub.assertValueCount(Integer.parseInt(args[3]));
break;
case "received_at_least":
sub.assertReceivedAtLeast(Integer.parseInt(args[3]));
break;
case "completed":
sub.assertComplete();
break;
case "no_completed":
sub.assertNotComplete();
break;
case "canceled":
sub.isCancelled();
break;
}
break;
case "take":
sub.take(Long.parseLong(args[1]));
break;
case "request":
sub.request(Long.parseLong(args[1]));
ConsoleUtils.info("requesting " + args[1]);
break;
case "cancel":
sub.cancel();
break;
}
}
if (name.equals("")) {
name="CHANNEL";
}
if (sub.hasPassed() && this.pass) ConsoleUtils.success(name);
 else if (!sub.hasPassed() && !this.pass) ConsoleUtils.success(name);
 else ConsoleUtils.failure(name);
}

public void parse ( ) { for ( String line : commands ) { String [ ] args = line . split ( "%%" ) ; switch ( args [ 0 ] ) { case "respond" : handleResponse ( args ) ; break ; case "await" : switch ( args [ 1 ] ) { case "terminal" : sub . awaitTerminalEvent ( ) ; break ; case "atLeast" : try { sub . awaitAtLeast ( Long . parseLong ( args [ 3 ] ) ) ; } catch ( InterruptedException e ) { ConsoleUtils . error ( "interrupted" ) ; } break ; case "no_events" : try { sub . awaitNoEvents ( Long . parseLong ( args [ 3 ] ) ) ; } catch ( InterruptedException e ) { ConsoleUtils . error ( "interrupted" ) ; } break ; } break ; case "assert" : switch ( args [ 1 ] ) { case "no_error" : sub . assertNoErrors ( ) ; break ; case "error" : sub . assertError ( new Throwable ( ) ) ; break ; case "received" : handleReceived ( args ) ; break ; case "received_n" : sub . assertValueCount ( Integer . parseInt ( args [ 3 ] ) ) ; break ; case "received_at_least" : sub . assertReceivedAtLeast ( Integer . parseInt ( args [ 3 ] ) ) ; break ; case "completed" : sub . assertComplete ( ) ; break ; case "no_completed" : sub . assertNotComplete ( ) ; break ; case "canceled" : sub . isCancelled ( ) ; break ; } break ; case "take" : sub . take ( Long . parseLong ( args [ 1 ] ) ) ; break ; case "request" : sub . request ( Long . parseLong ( args [ 1 ] ) ) ; ConsoleUtils . info ( "requesting " + args [ 1 ] ) ; break ; case "cancel" : sub . cancel ( ) ; break ; } } if ( name . equals ( "" ) ) { name = "CHANNEL" ; } if ( sub . hasPassed ( ) && this . pass ) ConsoleUtils . success ( name ) ; else if ( ! sub . hasPassed ( ) && ! this . pass ) ConsoleUtils . success ( name ) ; else ConsoleUtils . failure ( name ) ; }
this parses through each line of the marble test and executes the commands in each line most of the functionality is the same as the switch statement in the javaclientdriver , but this also allows for the channel to stage items to emit .
