Class StubRunner
java.lang.Object
org.springframework.cloud.contract.stubrunner.StubRunner
- All Implemented Interfaces:
Closeable,AutoCloseable,StubFinder,StubRunning,StubTrigger
Represents a single instance of ready-to-run stubs. Can run the stubs and then will
return the name of the collaborator together with its URI. Can also be queried if the
current groupid and artifactid are matching the corresponding running stub.
- Author:
- Marcin Grzejszczak
-
Constructor Summary
ConstructorsConstructorDescriptionStubRunner(StubRunnerOptions stubRunnerOptions, String repositoryPath, StubConfiguration stubsConfiguration) StubRunner(StubRunnerOptions stubRunnerOptions, String repositoryPath, StubConfiguration stubsConfiguration, org.springframework.cloud.contract.verifier.messaging.MessageVerifierSender<?> contractVerifierMessaging) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()findStubUrl(String ivyNotation) For the given Ivy notation[groupId]:artifactId:[version]:[classifier]tries to find the matching URL of the running stub.findStubUrl(String groupId, String artifactId) For the given groupId and artifactId tries to find the matching URL of the running stub.Map<StubConfiguration,Collection<org.springframework.cloud.contract.spec.Contract>> labels()Feature related to messaging.runStubs()booleantrigger()Triggers all possible events.booleanTriggers an event by a given label.booleanTriggers an event by a given label for a givengroupid:artifactidnotation.
-
Constructor Details
-
StubRunner
public StubRunner(StubRunnerOptions stubRunnerOptions, String repositoryPath, StubConfiguration stubsConfiguration) -
StubRunner
public StubRunner(StubRunnerOptions stubRunnerOptions, String repositoryPath, StubConfiguration stubsConfiguration, org.springframework.cloud.contract.verifier.messaging.MessageVerifierSender<?> contractVerifierMessaging)
-
-
Method Details
-
runStubs
- Specified by:
runStubsin interfaceStubRunning- Returns:
- runs the stubs and returns the
RunningStubs. If the stubs were already started then a cached version will be returned.
-
findStubUrl
Description copied from interface:StubFinderFor the given groupId and artifactId tries to find the matching URL of the running stub.- Specified by:
findStubUrlin interfaceStubFinder- Parameters:
groupId- - might be null. In that case a search only via artifactId takes placeartifactId- - artifact id of the stub- Returns:
- URL of a running stub or throws exception if not found
-
findStubUrl
Description copied from interface:StubFinderFor the given Ivy notation[groupId]:artifactId:[version]:[classifier]tries to find the matching URL of the running stub. You can also pass onlyartifactId.- Specified by:
findStubUrlin interfaceStubFinder- Parameters:
ivyNotation- - Ivy representation of the Maven artifact- Returns:
- URL of a running stub or throws exception if not found
-
findAllRunningStubs
- Specified by:
findAllRunningStubsin interfaceStubFinder- Returns:
- all running stubs
-
getContracts
public Map<StubConfiguration,Collection<org.springframework.cloud.contract.spec.Contract>> getContracts()- Specified by:
getContractsin interfaceStubFinder- Returns:
- the list of Contracts
-
trigger
Description copied from interface:StubTriggerTriggers an event by a given label for a givengroupid:artifactidnotation. You can use onlyartifactIdtoo. Feature related to messaging.- Specified by:
triggerin interfaceStubTrigger- Parameters:
ivyNotation- ivy notation of a stublabelName- name of the label to trigger- Returns:
- true - if managed to run a trigger
-
trigger
Description copied from interface:StubTriggerTriggers an event by a given label. Feature related to messaging.- Specified by:
triggerin interfaceStubTrigger- Parameters:
labelName- name of the label to trigger- Returns:
- true - if managed to run a trigger
-
trigger
public boolean trigger()Description copied from interface:StubTriggerTriggers all possible events. Feature related to messaging.- Specified by:
triggerin interfaceStubTrigger- Returns:
- true - if managed to run a trigger
-
labels
Description copied from interface:StubTriggerFeature related to messaging.- Specified by:
labelsin interfaceStubTrigger- Returns:
- a mapping of ivy notation of a dependency to all the labels it has.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-