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 `in`.specmatic.core.Feature
import `in`.specmatic.core.log.logger
import `in`.specmatic.core.utilities.ContractPathData
import `in`.specmatic.mock.ScenarioStub
import `in`.specmatic.stub.loadContractStubsFromFiles
import `in`.specmatic.stub.loadContractStubsFromImplicitPaths
import org.springframework.stereotype.Component
import java.io.File
@Component
class StubLoaderEngine {
fun loadStubs(contractPathDataList: List, dataDirs: List): List>> {
contractPathDataList.forEach { contractPath ->
if(!File(contractPath.path).exists()) {
logger.log("$contractPath does not exist.")
}
}
return when {
dataDirs.isNotEmpty() -> loadContractStubsFromFiles(contractPathDataList, dataDirs)
else -> loadContractStubsFromImplicitPaths(contractPathDataList)
}
}
}