Package org.mule.munit.tools.util.store
Class StorageOperations
java.lang.Object
org.mule.munit.tools.util.store.StorageOperations
Operations to store temporary data
- Since:
- 2.2.0
- Author:
- Mulesoft Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.mule.munit.runner.component.rules.TemporaryStorageRule -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all stored dataorg.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> Removes the value associated to the givenkey.org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> Retrieves the value stored for the givenkey.voidstore(String key, org.mule.runtime.api.metadata.TypedValue<Serializable> value, boolean failIfPresent) Stores the givenvalueusing the givenkey.voidstoreOAuthToken(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
-
Field Details
-
storageRule
@Inject protected org.mule.munit.runner.component.rules.TemporaryStorageRule storageRule
-
-
Constructor Details
-
StorageOperations
public StorageOperations()
-
-
Method Details
-
store
@Summary("Stores the given data associated with the given key") @Throws(StoreErrorProvider.class) public void store(String key, @Optional(defaultValue="#[payload]") @Content org.mule.runtime.api.metadata.TypedValue<Serializable> value, @Optional(defaultValue="false") boolean failIfPresent) Stores the givenvalueusing the givenkey.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.
- Parameters:
key- the key of thevalueto be storedvalue- the value to be storedfailIfPresent- whether to fail or update the pre existing value if thekeyalready exists on the store
-
retrieve
@Summary("Retrieves the data associated with the given key") @Throws(RetrieveErrorProvider.class) public org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> retrieve(String key) Retrieves the value stored for the givenkey.If no value exists for the
key, then aMUNIT-TOOLS:MISSING_KEYerror 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- Parameters:
key- the key of thevalueto be retrieved- Returns:
- The stored value
-
remove
@Summary("Removes the data associated with the given key") @Throws(RetrieveErrorProvider.class) public org.mule.runtime.extension.api.runtime.operation.Result<Serializable,Void> remove(String key) Removes the value associated to the givenkey.If no value exist for the key, then a
MUNIT-TOOLS:MISSING_KEYerror 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.- Parameters:
key- the key of the object to be removed- Returns:
- The storage value
-
clearStoredData
@Summary("Clears all stored data") public void clearStoredData()Removes all stored data -
storeOAuthToken
@Alias("store-oauth-token") @Throws(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.ObjectStoreExceptionStores a test OAuth token in the supplied ObjectStore- Parameters:
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 in- Throws:
org.mule.runtime.api.store.ObjectStoreException
-