Package com.github.tomakehurst.wiremock
Class WireMockServer
java.lang.Object
com.github.tomakehurst.wiremock.WireMockServer
- Direct Known Subclasses:
WireMockClassRule
,WireMockRule
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWireMockServer
(int port) WireMockServer
(int port, FileSource fileSource, boolean enableBrowserProxying) WireMockServer
(int port, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings) WireMockServer
(int port, Integer httpsPort) WireMockServer
(int port, Integer httpsPort, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings, Notifier notifier) WireMockServer
(Options options) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMockServiceRequestListener
(RequestListener listener) void
addStubMapping
(StubMapping stubMapping) baseUrl()
void
countRequestsMatching
(RequestPattern requestPattern) void
editStub
(MappingBuilder mappingBuilder) void
editStubMapping
(StubMapping stubMapping) void
enableRecordMappings
(FileSource mappingsFileSource, FileSource filesFileSource) findAll
(RequestPatternBuilder requestPatternBuilder) findAllNearMissesFor
(RequestPatternBuilder requestPatternBuilder) findAllStubsByMetadata
(StringValuePattern pattern) findNearMissesFor
(LoggedRequest loggedRequest) findRequestsMatching
(RequestPattern requestPattern) findTopNearMissesFor
(RequestPattern requestPattern) findTopNearMissesFor
(LoggedRequest loggedRequest) getServedStub
(UUID id) getServeEvents
(ServeEventQuery query) getStubMapping
(UUID id) givenThat
(MappingBuilder mappingBuilder) int
void
importStubs
(StubImport stubImport) boolean
boolean
boolean
void
loadMappingsUsing
(MappingsLoader mappingsLoader) int
port()
void
removeServeEvent
(UUID eventId) removeServeEventsForStubsMatchingMetadata
(StringValuePattern metadataPattern) removeServeEventsMatching
(RequestPattern requestPattern) void
removeStub
(MappingBuilder mappingBuilder) void
removeStub
(StubMapping stubMapping) void
removeStubMapping
(StubMapping stubMapping) void
void
void
removeStubsByMetadata
(StringValuePattern pattern) void
resetAll()
void
void
void
resetScenario
(String name) void
void
void
void
setGlobalFixedDelay
(int milliseconds) void
setScenarioState
(String name, String state) void
shutdown()
Gracefully shutdown the server.void
snapshotRecord
(RecordSpec spec) void
start()
void
startRecording
(RecordSpec spec) void
startRecording
(RecordSpecBuilder recordSpec) void
startRecording
(String targetBaseUrl) void
stop()
stubFor
(MappingBuilder mappingBuilder) void
updateGlobalSettings
(GlobalSettings newSettings) void
verify
(int count, RequestPatternBuilder requestPatternBuilder) void
verify
(CountMatchingStrategy countMatchingStrategy, RequestPatternBuilder requestPatternBuilder) void
verify
(RequestPatternBuilder requestPatternBuilder)
-
Field Details
-
options
-
client
-
-
Constructor Details
-
WireMockServer
-
WireMockServer
public WireMockServer(int port, Integer httpsPort, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings, Notifier notifier) -
WireMockServer
public WireMockServer(int port, FileSource fileSource, boolean enableBrowserProxying, ProxySettings proxySettings) -
WireMockServer
-
WireMockServer
public WireMockServer(int port) -
WireMockServer
-
WireMockServer
public WireMockServer()
-
-
Method Details
-
loadMappingsUsing
-
addMockServiceRequestListener
-
enableRecordMappings
-
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() -
port
public int port() -
httpsPort
public int httpsPort() -
url
-
baseUrl
-
isRunning
public boolean isRunning() -
givenThat
-
stubFor
-
editStub
-
removeStub
- Specified by:
removeStub
in interfaceStubbing
-
removeStub
- Specified by:
removeStub
in interfaceStubbing
-
getStubMappings
- Specified by:
getStubMappings
in interfaceStubbing
-
getSingleStubMapping
- Specified by:
getSingleStubMapping
in interfaceStubbing
-
findStubMappingsByMetadata
- Specified by:
findStubMappingsByMetadata
in interfaceStubbing
-
removeStubMappingsByMetadata
- Specified by:
removeStubMappingsByMetadata
in interfaceStubbing
-
removeStubMapping
- Specified by:
removeStubMapping
in interfaceAdmin
-
removeStubMapping
- Specified by:
removeStubMapping
in interfaceAdmin
-
verify
-
verify
-
verify
public void verify(CountMatchingStrategy countMatchingStrategy, RequestPatternBuilder requestPatternBuilder) -
findAll
-
getAllServeEvents
- Specified by:
getAllServeEvents
in interfaceStubbing
-
setGlobalFixedDelay
public void setGlobalFixedDelay(int milliseconds) - Specified by:
setGlobalFixedDelay
in interfaceStubbing
-
findAllUnmatchedRequests
- Specified by:
findAllUnmatchedRequests
in interfaceStubbing
-
findNearMissesForAllUnmatchedRequests
- Specified by:
findNearMissesForAllUnmatchedRequests
in interfaceStubbing
-
findAllNearMissesFor
- Specified by:
findAllNearMissesFor
in interfaceStubbing
-
findNearMissesFor
- Specified by:
findNearMissesFor
in interfaceStubbing
-
addStubMapping
- Specified by:
addStubMapping
in interfaceAdmin
-
editStubMapping
- Specified by:
editStubMapping
in interfaceAdmin
-
listAllStubMappings
- Specified by:
listAllStubMappings
in interfaceAdmin
-
getStubMapping
- Specified by:
getStubMapping
in interfaceAdmin
-
saveMappings
public void saveMappings()- Specified by:
saveMappings
in interfaceAdmin
-
resetAll
public void resetAll() -
resetRequests
public void resetRequests()- Specified by:
resetRequests
in interfaceAdmin
-
resetToDefaultMappings
public void resetToDefaultMappings()- Specified by:
resetToDefaultMappings
in interfaceAdmin
-
getServeEvents
- Specified by:
getServeEvents
in interfaceAdmin
-
getServeEvents
- Specified by:
getServeEvents
in interfaceAdmin
-
getServedStub
- Specified by:
getServedStub
in interfaceAdmin
-
resetScenarios
public void resetScenarios()- Specified by:
resetScenarios
in interfaceAdmin
-
resetMappings
public void resetMappings()- Specified by:
resetMappings
in interfaceAdmin
-
countRequestsMatching
- Specified by:
countRequestsMatching
in interfaceAdmin
-
findRequestsMatching
- Specified by:
findRequestsMatching
in interfaceAdmin
-
findUnmatchedRequests
- Specified by:
findUnmatchedRequests
in interfaceAdmin
-
removeServeEvent
- Specified by:
removeServeEvent
in interfaceAdmin
-
removeServeEventsMatching
- Specified by:
removeServeEventsMatching
in interfaceAdmin
-
removeServeEventsForStubsMatchingMetadata
public FindServeEventsResult removeServeEventsForStubsMatchingMetadata(StringValuePattern metadataPattern) - Specified by:
removeServeEventsForStubsMatchingMetadata
in interfaceAdmin
-
updateGlobalSettings
- Specified by:
updateGlobalSettings
in interfaceAdmin
-
findNearMissesForUnmatchedRequests
- Specified by:
findNearMissesForUnmatchedRequests
in interfaceAdmin
-
getAllScenarios
- Specified by:
getAllScenarios
in interfaceAdmin
-
resetScenario
- Specified by:
resetScenario
in interfaceAdmin
-
setScenarioState
- Specified by:
setScenarioState
in interfaceAdmin
-
findTopNearMissesFor
- Specified by:
findTopNearMissesFor
in interfaceAdmin
-
findTopNearMissesFor
- Specified by:
findTopNearMissesFor
in interfaceAdmin
-
startRecording
- Specified by:
startRecording
in interfaceAdmin
-
startRecording
- Specified by:
startRecording
in interfaceAdmin
-
startRecording
- Specified by:
startRecording
in interfaceAdmin
-
stopRecording
- Specified by:
stopRecording
in interfaceAdmin
-
getRecordingStatus
- Specified by:
getRecordingStatus
in interfaceAdmin
-
snapshotRecord
- Specified by:
snapshotRecord
in interfaceAdmin
-
snapshotRecord
- Specified by:
snapshotRecord
in interfaceAdmin
-
snapshotRecord
- Specified by:
snapshotRecord
in interfaceAdmin
-
getOptions
- Specified by:
getOptions
in interfaceAdmin
-
shutdownServer
public void shutdownServer()- Specified by:
shutdownServer
in interfaceAdmin
-
findAllStubsByMetadata
- Specified by:
findAllStubsByMetadata
in interfaceAdmin
-
removeStubsByMetadata
- Specified by:
removeStubsByMetadata
in interfaceAdmin
-
importStubs
- Specified by:
importStubs
in interfaceAdmin
-
getGlobalSettings
- Specified by:
getGlobalSettings
in interfaceAdmin
-
checkForUnmatchedRequests
public void checkForUnmatchedRequests()
-