public class StorageOperations extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.mule.munit.runner.component.rules.TemporaryStorageRule |
storageRule |
| Constructor and Description |
|---|
StorageOperations() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearStoredData()
Removes all stored data
|
org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> |
remove(String key)
Removes the value associated to the given
key. |
org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> |
retrieve(String key)
Retrieves the value stored for the given
key. |
void |
store(String key,
org.mule.runtime.api.metadata.TypedValue<Serializable> value,
boolean failIfPresent)
Stores the given
value using the given key. |
void |
storeOAuthToken(String accessToken,
org.mule.runtime.api.store.ObjectStore objectStore,
String ownerConfigName,
String resourceOwnerId,
String refreshToken,
String expiresIn,
String state,
Map<String,Object> additionalParameters,
boolean overwrite)
Stores a test OAuth token in the supplied ObjectStore
|
@Inject protected org.mule.munit.runner.component.rules.TemporaryStorageRule storageRule
@Summary(value="Stores the given data associated with the given key") @Throws(value=StoreErrorProvider.class) public void store(String key, @Optional(defaultValue="#[payload]") @Content org.mule.runtime.api.metadata.TypedValue<Serializable> value, @Optional(defaultValue="false") boolean failIfPresent)
value using the given key.
This operation can be used either for storing new values or updating existing ones. This operation is synchronized on the key level. No other operation will be able to access the same key.
key - the key of the value to be storedvalue - the value to be storedfailIfPresent - whether to fail or update the pre existing value if the key already exists on the store@Summary(value="Retrieves the data associated with the given key") @Throws(value=RetrieveErrorProvider.class) public org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> retrieve(String key)
key.
If no value exists for the key, then a MUNIT-TOOLS:MISSING_KEY error will be thrown. This operations is
synchronized on the key level. No other operation will be able to access the same key while this operation is running
key - the key of the value to be retrieved@Summary(value="Removes the data associated with the given key") @Throws(value=RetrieveErrorProvider.class) public org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> remove(String key)
key.
If no value exist for the key, then a MUNIT-TOOLS:MISSING_KEY error will be thrown.This operation is synchronized on
the key level. No other operation will be able to access the same key while this operation is running.
key - the key of the object to be removed@Summary(value="Clears all stored data") public void clearStoredData()
@Alias(value="store-oauth-token") @Throws(value=StoreOAuthTokenErrorProvider.class) public void storeOAuthToken(String accessToken, @ParameterDsl(allowInlineDefinition=false) org.mule.runtime.api.store.ObjectStore objectStore, @Optional(defaultValue="") String ownerConfigName, @Optional(defaultValue="") String resourceOwnerId, @Optional String refreshToken, @Optional String expiresIn, @Optional String state, @Optional @Content Map<String,Object> additionalParameters, @Optional(defaultValue="true") boolean overwrite) throws org.mule.runtime.api.store.ObjectStoreException
ownerConfigName - the config name of the connector that's going to consume the tokenresourceOwnerId - the id of the resource owneraccessToken - the access tokenrefreshToken - the refresh tokenexpiresIn - the expiration stringstate - the state parameter used in the OAuth danceadditionalParameters - additional parameters returned by the service provideroverwrite - whether to overwrite the token if already exists or fail instead.objectStore - the object store to store the token inorg.mule.runtime.api.store.ObjectStoreExceptionCopyright © 2019 MuleSoft, Inc.. All rights reserved.