2018-05-30 12:00:13 +02:00
|
|
|
package util
|
|
|
|
|
2019-03-04 16:02:01 +02:00
|
|
|
import com.sap.piper.DescriptorUtils
|
2018-06-06 11:19:19 +02:00
|
|
|
import com.sap.piper.GitUtils
|
2018-10-18 08:51:48 +02:00
|
|
|
import com.sap.piper.JenkinsUtils
|
2018-05-30 12:00:13 +02:00
|
|
|
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 = [:]
|
2019-01-31 10:39:13 +02:00
|
|
|
nullScript.env = [:]
|
2018-05-30 12:00:13 +02:00
|
|
|
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(nullScript)
|
|
|
|
return nullScript
|
|
|
|
}
|
|
|
|
|
2018-06-06 11:19:19 +02:00
|
|
|
@Bean
|
|
|
|
GitUtils mockGitUtils() {
|
|
|
|
def mockGitUtils = new GitUtils()
|
|
|
|
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockGitUtils)
|
|
|
|
return mockGitUtils
|
|
|
|
}
|
|
|
|
|
2018-05-30 12:00:13 +02:00
|
|
|
@Bean
|
|
|
|
Utils mockUtils() {
|
|
|
|
def mockUtils = new Utils()
|
|
|
|
mockUtils.steps = [
|
2018-09-14 09:08:49 +02:00
|
|
|
stash : { },
|
|
|
|
unstash: { }
|
2018-05-30 12:00:13 +02:00
|
|
|
]
|
|
|
|
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockUtils)
|
|
|
|
return mockUtils
|
|
|
|
}
|
2018-10-18 08:51:48 +02:00
|
|
|
|
|
|
|
@Bean
|
|
|
|
JenkinsUtils mockJenkinsUtils() {
|
|
|
|
def mockJenkinsUtils = new JenkinsUtils()
|
|
|
|
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockJenkinsUtils)
|
|
|
|
return mockJenkinsUtils
|
|
|
|
}
|
2019-03-04 16:02:01 +02:00
|
|
|
|
|
|
|
@Bean
|
|
|
|
DescriptorUtils mockDescriptorUtils() {
|
|
|
|
def mockDescriptorUtils = new DescriptorUtils()
|
|
|
|
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(mockDescriptorUtils)
|
|
|
|
return mockDescriptorUtils
|
|
|
|
}
|
2018-05-30 12:00:13 +02:00
|
|
|
}
|