com.lesfurets.jenkins.unit.InterceptingGCL.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jenkins-pipeline-unit Show documentation
Show all versions of jenkins-pipeline-unit Show documentation
Jenkins Pipeline Unit testing framework
package com.lesfurets.jenkins.unit
import org.codehaus.groovy.control.CompilationFailedException
import org.codehaus.groovy.control.CompilerConfiguration
class InterceptingGCL extends GroovyClassLoader {
PipelineTestHelper helper
InterceptingGCL(PipelineTestHelper helper,
ClassLoader loader,
CompilerConfiguration config) {
super(loader, config)
this.helper = helper
}
@Override
Class parseClass(GroovyCodeSource codeSource, boolean shouldCacheSource)
throws CompilationFailedException {
Class clazz = super.parseClass(codeSource, shouldCacheSource)
clazz.metaClass.invokeMethod = helper.getMethodInterceptor()
clazz.metaClass.static.invokeMethod = helper.getMethodInterceptor()
clazz.metaClass.methodMissing = helper.getMethodMissingInterceptor()
return clazz
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy