private String buildMarkupBuilderScript ( String scriptData ) { try { ClassLoader parent = GroovyScriptMessageBuilder . class . getClassLoader ( ) ; GroovyClassLoader loader = new GroovyClassLoader ( parent ) ; Class < ? > groovyClass = loader . parseClass ( TemplateBasedScriptBuilder . fromTemplateResource ( scriptTemplateResource ) . withCode ( scriptData ) . build ( ) ) ; if ( groovyClass == null ) { throw new CitrusRuntimeException ( "Could not load groovy script!" ) ; } GroovyObject groovyObject = ( GroovyObject ) groovyClass . newInstance ( ) ; return ( String ) groovyObject . invokeMethod ( "run" , new Object [ ] { } ) ; } catch ( CompilationFailedException e ) { throw new CitrusRuntimeException ( e ) ; } catch ( InstantiationException e ) { throw new CitrusRuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new CitrusRuntimeException ( e ) ; } }
Builds an automatic Groovy MarkupBuilder script with given script body .