@ Override public void execute ( ) throws BuildException { Java javaTask = ( Java ) getProject ( ) . createTask ( "java" ) ; javaTask . setTaskName ( getTaskName ( ) ) ; javaTask . setClassname ( "org.chorusbdd.chorus.Main" ) ; javaTask . setClasspath ( classpath ) ; //if log4j config is set then pass this on to new process String value = System . getProperty ( "log4j.configuration" ) ; if ( value != null ) { Environment . Variable sysp = new Environment . Variable ( ) ; sysp . setKey ( "log4j.configuration" ) ; sysp . setValue ( value ) ; javaTask . addSysproperty ( sysp ) ; } //provide the verbose flag if ( verbose ) { javaTask . createArg ( ) . setValue ( "-verbose" ) ; } //set the feature file args javaTask . createArg ( ) . setValue ( "-f" ) ; for ( File featureFile : featureFiles ) { System . out . println ( "Found feature " + featureFile ) ; javaTask . createArg ( ) . setFile ( featureFile ) ; } System . out . println ( "Classpath " + classpath ) ; //set the base packges args javaTask . createArg ( ) . setValue ( "-h" ) ; for ( String basePackage : handlerBasePackages . split ( "," ) ) { javaTask . createArg ( ) . setValue ( basePackage . trim ( ) ) ; } javaTask . setFork ( true ) ; int exitStatus = javaTask . executeJava ( ) ; if ( exitStatus != 0 ) { String failMessage = "Chorus feature failed, see test results for details." ; if ( failOnTestFailure ) { throw new BuildException ( failMessage ) ; } else { log ( failMessage , Project . MSG_ERR ) ; } } else { log ( "Chorus features all passed" , Project . MSG_INFO ) ; } }
Launches Chorus and runs the Interpreter over the speficied feature files