application.StubLoaderEngine.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of specmatic-executable Show documentation
Show all versions of specmatic-executable Show documentation
Command-line standalone executable jar for Specmatic
package application
import io.specmatic.core.Feature
import io.specmatic.core.getConfigFilePath
import io.specmatic.core.loadSpecmaticConfigOrDefault
import io.specmatic.core.log.logger
import io.specmatic.core.utilities.ContractPathData
import io.specmatic.mock.ScenarioStub
import io.specmatic.stub.loadContractStubsFromFiles
import io.specmatic.stub.loadContractStubsFromImplicitPaths
import org.springframework.stereotype.Component
import java.io.File
@Component
class StubLoaderEngine {
fun loadStubs(
contractPathDataList: List,
dataDirs: List,
specmaticConfigPath: String? = null,
strictMode: Boolean
): List>> {
contractPathDataList.forEach { contractPath ->
if(!File(contractPath.path).exists()) {
logger.log("$contractPath does not exist.")
}
}
val specmaticConfig = loadSpecmaticConfigOrDefault(specmaticConfigPath ?: getConfigFilePath())
return when {
dataDirs.isNotEmpty() -> {
loadContractStubsFromFiles(contractPathDataList, dataDirs, specmaticConfig, strictMode)
}
else -> loadContractStubsFromImplicitPaths(contractPathDataList, specmaticConfig)
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy