1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/test/groovy/util/BasePiperTestContext.groovy
Oliver Nocon 455461d3c1
add step pipelineRestartSteps (#337)
This step allows to restart a set of steps in order to retry in case of e.g. infrastructure failures which first need to be fixed.

* update documentation
2018-10-18 08:51:48 +02:00

48 lines
1.3 KiB
Groovy

#!groovy
package util
import com.sap.piper.GitUtils
import com.sap.piper.JenkinsUtils
import com.sap.piper.Utils
import org.codehaus.groovy.runtime.InvokerHelper
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class BasePiperTestContext {
@Bean
Script nullScript() {
def nullScript = InvokerHelper.createScript(null, new Binding())
nullScript.currentBuild = [:]
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(nullScript)
return nullScript
}
@Bean
GitUtils mockGitUtils() {
def mockGitUtils = new GitUtils()
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockGitUtils)
return mockGitUtils
}
@Bean
Utils mockUtils() {
def mockUtils = new Utils()
mockUtils.steps = [
stash : { },
unstash: { }
]
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockUtils)
return mockUtils
}
@Bean
JenkinsUtils mockJenkinsUtils() {
def mockJenkinsUtils = new JenkinsUtils()
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockJenkinsUtils)
return mockJenkinsUtils
}
}