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. |
@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()
Copyright © 2019 MuleSoft, Inc.. All rights reserved.