com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.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.global.lib
import groovy.transform.CompileStatic
import groovy.transform.builder.Builder
import groovy.transform.builder.ExternalStrategy
/**
* Mock for org.jenkinsci.plugins.workflow.libs.LibraryConfiguration
*/
@CompileStatic
class LibraryConfiguration {
String name
String defaultVersion = 'master'
SourceRetriever retriever
boolean implicit = false
boolean allowOverride = true
String targetPath
LibraryConfiguration validate() {
if (name && defaultVersion && retriever && targetPath)
return this
throw new IllegalStateException("LibraryConfiguration is not properly initialized ${this.toString()}")
}
static LibraryBuilder library(String libName = null) {
return new LibraryBuilder() {
LibraryConfiguration build() { return super.build().validate() }
}.with { it.name(libName) }
}
@Builder(builderStrategy = ExternalStrategy, forClass = LibraryConfiguration)
static class LibraryBuilder {
}
@Override
String toString() {
return "LibraryConfiguration{" +
"name='" + name + '\'' +
", defaultVersion='" + defaultVersion + '\'' +
", retriever=" + retriever +
", implicit=" + implicit +
", allowOverride=" + allowOverride +
'}'
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy