Package com.github.tomakehurst.wiremock
Class WireMockServer
- java.lang.Object
-
- com.github.tomakehurst.wiremock.WireMockServer
-
- Direct Known Subclasses:
WireMockClassRule
,WireMockRule
public class WireMockServer extends java.lang.Object implements Container, Stubbing, Admin
-
-
Constructor Summary
Constructors Constructor Description WireMockServer()
WireMockServer(int port)
WireMockServer(int port, FileSource fileSource, boolean enableBrowserProxying)
WireMockServer(int port, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings)
WireMockServer(int port, java.lang.Integer httpsPort)
WireMockServer(int port, java.lang.Integer httpsPort, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings, Notifier notifier)
WireMockServer(Options options)
WireMockServer(java.lang.String filenameTemplate)
-
Method Summary
-
-
-
Constructor Detail
-
WireMockServer
public WireMockServer(Options options)
-
WireMockServer
public WireMockServer(int port, java.lang.Integer httpsPort, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings, Notifier notifier)
-
WireMockServer
public WireMockServer(int port, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings)
-
WireMockServer
public WireMockServer(int port, FileSource fileSource, boolean enableBrowserProxying)
-
WireMockServer
public WireMockServer(int port)
-
WireMockServer
public WireMockServer(int port, java.lang.Integer httpsPort)
-
WireMockServer
public WireMockServer()
-
WireMockServer
public WireMockServer(java.lang.String filenameTemplate)
-
-
Method Detail
-
loadMappingsUsing
public void loadMappingsUsing(MappingsLoader mappingsLoader)
-
addMockServiceRequestListener
public void addMockServiceRequestListener(RequestListener listener)
-
enableRecordMappings
public void enableRecordMappings(FileSource mappingsFileSource, FileSource filesFileSource)
-
stop
public void stop()
-
start
public void start()
-
shutdown
public void shutdown()
Gracefully shutdown the server.This method assumes it is being called as the result of an incoming HTTP request.
-
isHttpEnabled
public boolean isHttpEnabled()
-
isHttpsEnabled
public boolean isHttpsEnabled()
-
httpsPort
public int httpsPort()
-
url
public java.lang.String url(java.lang.String path)
-
baseUrl
public java.lang.String baseUrl()
-
isRunning
public boolean isRunning()
-
givenThat
public StubMapping givenThat(MappingBuilder mappingBuilder)
-
stubFor
public StubMapping stubFor(MappingBuilder mappingBuilder)
-
editStub
public void editStub(MappingBuilder mappingBuilder)
-
removeStub
public void removeStub(MappingBuilder mappingBuilder)
- Specified by:
removeStub
in interfaceStubbing
-
removeStub
public void removeStub(StubMapping stubMapping)
- Specified by:
removeStub
in interfaceStubbing
-
getStubMappings
public java.util.List<StubMapping> getStubMappings()
- Specified by:
getStubMappings
in interfaceStubbing
-
getSingleStubMapping
public StubMapping getSingleStubMapping(java.util.UUID id)
- Specified by:
getSingleStubMapping
in interfaceStubbing
-
findStubMappingsByMetadata
public java.util.List<StubMapping> findStubMappingsByMetadata(StringValuePattern pattern)
- Specified by:
findStubMappingsByMetadata
in interfaceStubbing
-
removeStubMappingsByMetadata
public void removeStubMappingsByMetadata(StringValuePattern pattern)
- Specified by:
removeStubMappingsByMetadata
in interfaceStubbing
-
removeStubMapping
public void removeStubMapping(StubMapping stubMapping)
- Specified by:
removeStubMapping
in interfaceAdmin
-
removeStubMapping
public void removeStubMapping(java.util.UUID id)
- Specified by:
removeStubMapping
in interfaceAdmin
-
verify
public void verify(RequestPatternBuilder requestPatternBuilder)
-
verify
public void verify(int count, RequestPatternBuilder requestPatternBuilder)
-
verify
public void verify(CountMatchingStrategy countMatchingStrategy, RequestPatternBuilder requestPatternBuilder)
-
findAll
public java.util.List<LoggedRequest> findAll(RequestPatternBuilder requestPatternBuilder)
-
getAllServeEvents
public java.util.List<ServeEvent> getAllServeEvents()
- Specified by:
getAllServeEvents
in interfaceStubbing
-
setGlobalFixedDelay
public void setGlobalFixedDelay(int milliseconds)
- Specified by:
setGlobalFixedDelay
in interfaceStubbing
-
findAllUnmatchedRequests
public java.util.List<LoggedRequest> findAllUnmatchedRequests()
- Specified by:
findAllUnmatchedRequests
in interfaceStubbing
-
findNearMissesForAllUnmatchedRequests
public java.util.List<NearMiss> findNearMissesForAllUnmatchedRequests()
- Specified by:
findNearMissesForAllUnmatchedRequests
in interfaceStubbing
-
findAllNearMissesFor
public java.util.List<NearMiss> findAllNearMissesFor(RequestPatternBuilder requestPatternBuilder)
- Specified by:
findAllNearMissesFor
in interfaceStubbing
-
findNearMissesFor
public java.util.List<NearMiss> findNearMissesFor(LoggedRequest loggedRequest)
- Specified by:
findNearMissesFor
in interfaceStubbing
-
addStubMapping
public void addStubMapping(StubMapping stubMapping)
- Specified by:
addStubMapping
in interfaceAdmin
-
editStubMapping
public void editStubMapping(StubMapping stubMapping)
- Specified by:
editStubMapping
in interfaceAdmin
-
listAllStubMappings
public ListStubMappingsResult listAllStubMappings()
- Specified by:
listAllStubMappings
in interfaceAdmin
-
getStubMapping
public SingleStubMappingResult getStubMapping(java.util.UUID id)
- Specified by:
getStubMapping
in interfaceAdmin
-
saveMappings
public void saveMappings()
- Specified by:
saveMappings
in interfaceAdmin
-
resetRequests
public void resetRequests()
- Specified by:
resetRequests
in interfaceAdmin
-
resetToDefaultMappings
public void resetToDefaultMappings()
- Specified by:
resetToDefaultMappings
in interfaceAdmin
-
getServeEvents
public GetServeEventsResult getServeEvents()
- Specified by:
getServeEvents
in interfaceAdmin
-
getServeEvents
public GetServeEventsResult getServeEvents(ServeEventQuery query)
- Specified by:
getServeEvents
in interfaceAdmin
-
getServedStub
public SingleServedStubResult getServedStub(java.util.UUID id)
- Specified by:
getServedStub
in interfaceAdmin
-
resetScenarios
public void resetScenarios()
- Specified by:
resetScenarios
in interfaceAdmin
-
resetMappings
public void resetMappings()
- Specified by:
resetMappings
in interfaceAdmin
-
countRequestsMatching
public VerificationResult countRequestsMatching(RequestPattern requestPattern)
- Specified by:
countRequestsMatching
in interfaceAdmin
-
findRequestsMatching
public FindRequestsResult findRequestsMatching(RequestPattern requestPattern)
- Specified by:
findRequestsMatching
in interfaceAdmin
-
findUnmatchedRequests
public FindRequestsResult findUnmatchedRequests()
- Specified by:
findUnmatchedRequests
in interfaceAdmin
-
removeServeEvent
public void removeServeEvent(java.util.UUID eventId)
- Specified by:
removeServeEvent
in interfaceAdmin
-
removeServeEventsMatching
public FindServeEventsResult removeServeEventsMatching(RequestPattern requestPattern)
- Specified by:
removeServeEventsMatching
in interfaceAdmin
-
removeServeEventsForStubsMatchingMetadata
public FindServeEventsResult removeServeEventsForStubsMatchingMetadata(StringValuePattern metadataPattern)
- Specified by:
removeServeEventsForStubsMatchingMetadata
in interfaceAdmin
-
updateGlobalSettings
public void updateGlobalSettings(GlobalSettings newSettings)
- Specified by:
updateGlobalSettings
in interfaceAdmin
-
findNearMissesForUnmatchedRequests
public FindNearMissesResult findNearMissesForUnmatchedRequests()
- Specified by:
findNearMissesForUnmatchedRequests
in interfaceAdmin
-
getAllScenarios
public GetScenariosResult getAllScenarios()
- Specified by:
getAllScenarios
in interfaceAdmin
-
resetScenario
public void resetScenario(java.lang.String name)
- Specified by:
resetScenario
in interfaceAdmin
-
setScenarioState
public void setScenarioState(java.lang.String name, java.lang.String state)
- Specified by:
setScenarioState
in interfaceAdmin
-
findTopNearMissesFor
public FindNearMissesResult findTopNearMissesFor(LoggedRequest loggedRequest)
- Specified by:
findTopNearMissesFor
in interfaceAdmin
-
findTopNearMissesFor
public FindNearMissesResult findTopNearMissesFor(RequestPattern requestPattern)
- Specified by:
findTopNearMissesFor
in interfaceAdmin
-
startRecording
public void startRecording(java.lang.String targetBaseUrl)
- Specified by:
startRecording
in interfaceAdmin
-
startRecording
public void startRecording(RecordSpec spec)
- Specified by:
startRecording
in interfaceAdmin
-
startRecording
public void startRecording(RecordSpecBuilder recordSpec)
- Specified by:
startRecording
in interfaceAdmin
-
stopRecording
public SnapshotRecordResult stopRecording()
- Specified by:
stopRecording
in interfaceAdmin
-
getRecordingStatus
public RecordingStatusResult getRecordingStatus()
- Specified by:
getRecordingStatus
in interfaceAdmin
-
snapshotRecord
public SnapshotRecordResult snapshotRecord()
- Specified by:
snapshotRecord
in interfaceAdmin
-
snapshotRecord
public SnapshotRecordResult snapshotRecord(RecordSpecBuilder spec)
- Specified by:
snapshotRecord
in interfaceAdmin
-
snapshotRecord
public SnapshotRecordResult snapshotRecord(RecordSpec spec)
- Specified by:
snapshotRecord
in interfaceAdmin
-
getOptions
public Options getOptions()
- Specified by:
getOptions
in interfaceAdmin
-
shutdownServer
public void shutdownServer()
- Specified by:
shutdownServer
in interfaceAdmin
-
findAllStubsByMetadata
public ListStubMappingsResult findAllStubsByMetadata(StringValuePattern pattern)
- Specified by:
findAllStubsByMetadata
in interfaceAdmin
-
removeStubsByMetadata
public void removeStubsByMetadata(StringValuePattern pattern)
- Specified by:
removeStubsByMetadata
in interfaceAdmin
-
importStubs
public void importStubs(StubImport stubImport)
- Specified by:
importStubs
in interfaceAdmin
-
getGlobalSettings
public GetGlobalSettingsResult getGlobalSettings()
- Specified by:
getGlobalSettings
in interfaceAdmin
-
checkForUnmatchedRequests
public void checkForUnmatchedRequests()
-
-