Interface StubGenerator<T>
-
- Type Parameters:
T
- - type of stub mapping
- All Known Implementing Classes:
DslToWireMockClientConverter
,DslToWireMockConverter
public interface StubGenerator<T>
Converts contracts into their stub representation.- Since:
- 1.1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
canReadStubMapping(File mapping)
Map<org.springframework.cloud.contract.spec.Contract,String>
convertContents(String rootName, org.springframework.cloud.contract.verifier.file.ContractMetadata content)
default T
defaultStubMappingPostProcessing(T stubMapping, org.springframework.cloud.contract.spec.Contract contract)
Stub mapping to chose when no post processors where found on the classpath.default String
fileExtension()
Describes the file extension of the generated mapping that this stub generator can handle.String
generateOutputFileNameForInput(String inputFileName)
default T
postProcessStubMapping(T stubMapping, org.springframework.cloud.contract.spec.Contract contract)
Post process a generated stub mapping.
-
-
-
Method Detail
-
canReadStubMapping
default boolean canReadStubMapping(File mapping)
- Parameters:
mapping
- - potential stub mapping mapping- Returns:
true
if this converter could have generated this mapping stub.
-
convertContents
Map<org.springframework.cloud.contract.spec.Contract,String> convertContents(String rootName, org.springframework.cloud.contract.verifier.file.ContractMetadata content)
- Parameters:
rootName
- - root name of the contractcontent
- - metadata of the contract- Returns:
- the collection of converted contracts into stubs. One contract can result in multiple stubs.
-
postProcessStubMapping
default T postProcessStubMapping(T stubMapping, org.springframework.cloud.contract.spec.Contract contract)
Post process a generated stub mapping.- Parameters:
stubMapping
- - mapping of a stubcontract
- - contract for which stub was generated- Returns:
- the converted stub mapping
-
defaultStubMappingPostProcessing
default T defaultStubMappingPostProcessing(T stubMapping, org.springframework.cloud.contract.spec.Contract contract)
Stub mapping to chose when no post processors where found on the classpath.- Parameters:
stubMapping
- - mapping of a stubcontract
- - contract for which stub was generated- Returns:
- the converted stub mapping
-
generateOutputFileNameForInput
String generateOutputFileNameForInput(String inputFileName)
- Parameters:
inputFileName
- - name of the input file- Returns:
- the name of the converted stub file. If you have multiple contracts in a
single file then a prefix will be added to the generated file. If you provide the
Contract.getName()
field then that field will override the generated file name. Example: name of file with 2 contracts isfoo.groovy
, it will be converted by the implementation tofoo.json
. The recursive file converter will create two files0_foo.json
and1_foo.json
-
fileExtension
default String fileExtension()
Describes the file extension of the generated mapping that this stub generator can handle.- Returns:
- string describing the file extension
-
-