Class WireMockApp
java.lang.Object
com.github.tomakehurst.wiremock.core.WireMockApp
- All Implemented Interfaces:
Admin,StubServer
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWireMockApp(boolean browserProxyingEnabled, MappingsLoader defaultMappingsLoader, Map<String, MappingsLoaderExtension> mappingsLoaderExtensions, MappingsSaver mappingsSaver, boolean requestJournalDisabled, Integer maxRequestJournalEntries, Map<String, ResponseDefinitionTransformer> transformers, Map<String, ResponseDefinitionTransformerV2> v2transformers, Map<String, RequestMatcherExtension> requestMatchers, FileSource rootFileSource, Container container) WireMockApp(Options options, Container container) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessageStubMapping(MessageStubMapping messageStubMapping) Adds a message stub mapping that will be matched against incoming messages on channels.voidaddStubMapping(StubMapping stubMapping) intcountMessageEventsMatching(MessagePattern pattern) Counts message events matching the given pattern.countRequestsMatching(RequestPattern requestPattern) voideditStubMapping(StubMapping stubMapping) Finds all message stub mappings matching the given metadata pattern.findAllStubsByMetadata(StringValuePattern pattern) findMessageEventsMatching(MessagePattern pattern) Gets message events matching the given pattern.findRequestsMatching(RequestPattern requestPattern) findTopNearMissesFor(RequestPattern requestPattern) findTopNearMissesFor(LoggedRequest loggedRequest) Gets a specific message serve event by ID.Gets all message serve events from the message journal.getServedStub(UUID id) getServeEvents(ServeEventQuery query) getStubMapping(UUID id) voidimportStubs(StubImport stubImport) Lists all active message channels.Lists all message stub mappings.voidloadMappingsUsing(MappingsLoader mappingsLoader) voidloadMessageMappingsUsing(MappingsLoader mappingsLoader) intport()voidremoveMessageServeEvent(UUID eventId) Removes a specific message serve event from the journal.Removes all message serve events for stubs matching the given metadata pattern.Removes all message serve events matching the given pattern.voidRemoves a message stub mapping by its ID.voidRemoves all message stub mappings matching the given metadata pattern.voidremoveServeEvent(UUID eventId) removeServeEventsForStubsMatchingMetadata(StringValuePattern metadataPattern) removeServeEventsMatching(RequestPattern requestPattern) voidremoveStubMapping(StubMapping stubMapping) voidvoidremoveStubMappings(List<StubMapping> stubMappings) voidremoveStubsByMetadata(StringValuePattern pattern) voidresetAll()voidvoidResets the message journal, removing all events.voidRemoves all message stub mappings.voidvoidresetScenario(String name) voidvoidvoidsendChannelMessage(ChannelType type, RequestPattern requestPattern, MessageDefinition message) Sends a message to all channels of the specified type matching the given request pattern.serveStubFor(ServeEvent initialServeEvent) voidsetScenarioState(String name, String state) voidsnapshotRecord(RecordSpec recordSpec) voidstartRecording(RecordSpec recordSpec) voidstartRecording(RecordSpecBuilder recordSpec) voidstartRecording(String targetBaseUrl) voidupdateGlobalSettings(GlobalSettings newSettings) waitForMessageEvent(MessagePattern pattern, Duration maxWait) Waits for a message event matching the given pattern to appear in the journal.waitForMessageEvents(MessagePattern pattern, int count, Duration maxWait) Waits for a specific number of message events matching the given pattern.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.tomakehurst.wiremock.core.Admin
sendChannelMessage
-
Field Details
-
FILES_ROOT
- See Also:
-
ADMIN_CONTEXT_ROOT_SEGMENT
public static final org.wiremock.url.Segment ADMIN_CONTEXT_ROOT_SEGMENT -
ADMIN_CONTEXT_ROOT
-
MAPPINGS_ROOT
- See Also:
-
MESSAGE_MAPPINGS_ROOT
- See Also:
-
-
Constructor Details
-
WireMockApp
-
WireMockApp
public WireMockApp(boolean browserProxyingEnabled, MappingsLoader defaultMappingsLoader, Map<String, MappingsLoaderExtension> mappingsLoaderExtensions, MappingsSaver mappingsSaver, boolean requestJournalDisabled, Integer maxRequestJournalEntries, Map<String, ResponseDefinitionTransformer> transformers, Map<String, ResponseDefinitionTransformerV2> v2transformers, Map<String, RequestMatcherExtension> requestMatchers, FileSource rootFileSource, Container container)
-
-
Method Details
-
buildAdminRequestHandler
-
buildStubRequestHandler
-
buildMessageStubRequestHandler
-
loadMappingsUsing
-
loadMessageMappingsUsing
-
serveStubFor
- Specified by:
serveStubForin interfaceStubServer
-
addStubMapping
- Specified by:
addStubMappingin interfaceAdmin
-
removeStubMapping
- Specified by:
removeStubMappingin interfaceAdmin
-
removeStubMapping
- Specified by:
removeStubMappingin interfaceAdmin
-
editStubMapping
- Specified by:
editStubMappingin interfaceAdmin
-
listAllStubMappings
- Specified by:
listAllStubMappingsin interfaceAdmin
-
getStubMapping
- Specified by:
getStubMappingin interfaceAdmin
-
saveMappings
public void saveMappings()- Specified by:
saveMappingsin interfaceAdmin
-
resetAll
public void resetAll() -
resetRequests
public void resetRequests()- Specified by:
resetRequestsin interfaceAdmin
-
resetToDefaultMappings
public void resetToDefaultMappings()- Specified by:
resetToDefaultMappingsin interfaceAdmin
-
resetScenarios
public void resetScenarios()- Specified by:
resetScenariosin interfaceAdmin
-
resetMappings
public void resetMappings()- Specified by:
resetMappingsin interfaceAdmin
-
getServeEvents
- Specified by:
getServeEventsin interfaceAdmin
-
getServeEvents
- Specified by:
getServeEventsin interfaceAdmin
-
getServedStub
- Specified by:
getServedStubin interfaceAdmin
-
countRequestsMatching
- Specified by:
countRequestsMatchingin interfaceAdmin
-
findRequestsMatching
- Specified by:
findRequestsMatchingin interfaceAdmin
-
findUnmatchedRequests
- Specified by:
findUnmatchedRequestsin interfaceAdmin
-
removeServeEvent
- Specified by:
removeServeEventin interfaceAdmin
-
removeServeEventsMatching
- Specified by:
removeServeEventsMatchingin interfaceAdmin
-
removeServeEventsForStubsMatchingMetadata
public FindServeEventsResult removeServeEventsForStubsMatchingMetadata(StringValuePattern metadataPattern) - Specified by:
removeServeEventsForStubsMatchingMetadatain interfaceAdmin
-
findNearMissesForUnmatchedRequests
- Specified by:
findNearMissesForUnmatchedRequestsin interfaceAdmin
-
getAllScenarios
- Specified by:
getAllScenariosin interfaceAdmin
-
resetScenario
- Specified by:
resetScenarioin interfaceAdmin
-
setScenarioState
- Specified by:
setScenarioStatein interfaceAdmin
-
findTopNearMissesFor
- Specified by:
findTopNearMissesForin interfaceAdmin
-
findTopNearMissesFor
- Specified by:
findTopNearMissesForin interfaceAdmin
-
getGlobalSettings
- Specified by:
getGlobalSettingsin interfaceAdmin
-
updateGlobalSettings
- Specified by:
updateGlobalSettingsin interfaceAdmin
-
port
public int port() -
getOptions
- Specified by:
getOptionsin interfaceAdmin
-
getExtensions
-
shutdownServer
public void shutdownServer()- Specified by:
shutdownServerin interfaceAdmin
-
snapshotRecord
- Specified by:
snapshotRecordin interfaceAdmin
-
snapshotRecord
- Specified by:
snapshotRecordin interfaceAdmin
-
snapshotRecord
- Specified by:
snapshotRecordin interfaceAdmin
-
startRecording
- Specified by:
startRecordingin interfaceAdmin
-
startRecording
- Specified by:
startRecordingin interfaceAdmin
-
startRecording
- Specified by:
startRecordingin interfaceAdmin
-
stopRecording
- Specified by:
stopRecordingin interfaceAdmin
-
getRecordingStatus
- Specified by:
getRecordingStatusin interfaceAdmin
-
findUnmatchedStubs
- Specified by:
findUnmatchedStubsin interfaceAdmin
-
findAllStubsByMetadata
- Specified by:
findAllStubsByMetadatain interfaceAdmin
-
removeStubsByMetadata
- Specified by:
removeStubsByMetadatain interfaceAdmin
-
importStubs
- Specified by:
importStubsin interfaceAdmin
-
removeStubMappings
- Specified by:
removeStubMappingsin interfaceAdmin
-
getLoadedExtensionNames
-
sendChannelMessage
public SendChannelMessageResult sendChannelMessage(ChannelType type, RequestPattern requestPattern, MessageDefinition message) Description copied from interface:AdminSends a message to all channels of the specified type matching the given request pattern.- Specified by:
sendChannelMessagein interfaceAdmin- Parameters:
type- the channel type to targetrequestPattern- the pattern to match against the original upgrade requestmessage- the message to send- Returns:
- result containing the matched channels that were messaged
-
listAllMessageChannels
Description copied from interface:AdminLists all active message channels.- Specified by:
listAllMessageChannelsin interfaceAdmin- Returns:
- result containing all message channels
-
addMessageStubMapping
Description copied from interface:AdminAdds a message stub mapping that will be matched against incoming messages on channels.- Specified by:
addMessageStubMappingin interfaceAdmin- Parameters:
messageStubMapping- the message stub mapping to add
-
removeMessageStubMapping
Description copied from interface:AdminRemoves a message stub mapping by its ID.- Specified by:
removeMessageStubMappingin interfaceAdmin- Parameters:
id- the ID of the message stub mapping to remove
-
resetMessageStubMappings
public void resetMessageStubMappings()Description copied from interface:AdminRemoves all message stub mappings.- Specified by:
resetMessageStubMappingsin interfaceAdmin
-
findAllMessageStubsByMetadata
Description copied from interface:AdminFinds all message stub mappings matching the given metadata pattern.- Specified by:
findAllMessageStubsByMetadatain interfaceAdmin- Parameters:
pattern- the pattern to match stub metadata against- Returns:
- result containing matching message stub mappings
-
removeMessageStubsByMetadata
Description copied from interface:AdminRemoves all message stub mappings matching the given metadata pattern.- Specified by:
removeMessageStubsByMetadatain interfaceAdmin- Parameters:
pattern- the pattern to match stub metadata against
-
listAllMessageStubMappings
Description copied from interface:AdminLists all message stub mappings.- Specified by:
listAllMessageStubMappingsin interfaceAdmin- Returns:
- result containing all message stub mappings
-
getMessageServeEvents
Description copied from interface:AdminGets all message serve events from the message journal.- Specified by:
getMessageServeEventsin interfaceAdmin- Returns:
- result containing all message serve events
-
getMessageServeEvent
Description copied from interface:AdminGets a specific message serve event by ID.- Specified by:
getMessageServeEventin interfaceAdmin- Parameters:
id- the event ID- Returns:
- the event if found
-
countMessageEventsMatching
Description copied from interface:AdminCounts message events matching the given pattern.- Specified by:
countMessageEventsMatchingin interfaceAdmin- Parameters:
pattern- the pattern to match events against- Returns:
- the count of matching events
-
findMessageEventsMatching
Description copied from interface:AdminGets message events matching the given pattern.- Specified by:
findMessageEventsMatchingin interfaceAdmin- Parameters:
pattern- the pattern to match events against- Returns:
- list of matching events
-
removeMessageServeEvent
Description copied from interface:AdminRemoves a specific message serve event from the journal.- Specified by:
removeMessageServeEventin interfaceAdmin- Parameters:
eventId- the ID of the event to remove
-
removeMessageServeEventsMatching
Description copied from interface:AdminRemoves all message serve events matching the given pattern.- Specified by:
removeMessageServeEventsMatchingin interfaceAdmin- Parameters:
pattern- the pattern to match events against- Returns:
- result containing the removed events
-
removeMessageServeEventsForStubsMatchingMetadata
public FindMessageServeEventsResult removeMessageServeEventsForStubsMatchingMetadata(StringValuePattern pattern) Description copied from interface:AdminRemoves all message serve events for stubs matching the given metadata pattern.- Specified by:
removeMessageServeEventsForStubsMatchingMetadatain interfaceAdmin- Parameters:
pattern- the pattern to match stub metadata against- Returns:
- result containing the removed events
-
resetMessageJournal
public void resetMessageJournal()Description copied from interface:AdminResets the message journal, removing all events.- Specified by:
resetMessageJournalin interfaceAdmin
-
waitForMessageEvent
Description copied from interface:AdminWaits for a message event matching the given pattern to appear in the journal.- Specified by:
waitForMessageEventin interfaceAdmin- Parameters:
pattern- the pattern to match events againstmaxWait- the maximum duration to wait- Returns:
- the matching event if found within the timeout
-
waitForMessageEvents
public List<MessageServeEvent> waitForMessageEvents(MessagePattern pattern, int count, Duration maxWait) Description copied from interface:AdminWaits for a specific number of message events matching the given pattern.- Specified by:
waitForMessageEventsin interfaceAdmin- Parameters:
pattern- the pattern to match events againstcount- the number of events to wait formaxWait- the maximum duration to wait- Returns:
- list of matching events
-