Package org.apache.synapse.unittest
Class UnitTestMockRegistry
- java.lang.Object
-
- org.apache.synapse.registry.AbstractRegistry
-
- org.apache.synapse.unittest.UnitTestMockRegistry
-
- All Implemented Interfaces:
Registry
public class UnitTestMockRegistry extends AbstractRegistry
Class responsible for the add and return registry resources uses for Unit test flow. Mock the AbstractRegistry class only usage of the synapse unit testing framework
-
-
Field Summary
Fields Modifier and Type Field Description protected Properties
properties
-
Constructor Summary
Constructors Constructor Description UnitTestMockRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResource(String key, RegistryResource resource)
Add new registry resource to the map.void
clearResources()
Clear registry resource map.void
delete(String path)
Deletes a resource in the given pathRegistryEntry[]
getChildren(RegistryEntry entry)
Returns the child elements of a given registry entryRegistryEntry[]
getDescendants(RegistryEntry entry)
Returns all descendant entries of the given registry entrystatic UnitTestMockRegistry
getInstance()
Return initialized UnitTestingExecutor initializeThread object.RegistryEntry
getRegistryEntry(String key)
Get the registry entry for the given keyProperties
getResourceProperties(String entryKey)
Get the resource properties of a given resourceboolean
isResourceExists(String path)
Check if a resource existsorg.apache.axiom.om.OMNode
lookup(String key)
Perform an actual lookup for for an XML resource as an OMNode for the given keyorg.apache.axiom.om.OMNode
lookupFormat(String key)
void
newNonEmptyResource(String path, boolean isDirectory, String contentType, String content, String propertyName)
void
newResource(String path, boolean isDirectory)
Creates a new resource in the given pathvoid
updateRegistryEntry(RegistryEntry entry)
Updates the registry enrty (metadata about a resource)void
updateResource(String path, Object value)
Updates the value of a resource-
Methods inherited from class org.apache.synapse.registry.AbstractRegistry
getConfigurationProperties, getFormat, getProviderClass, getResource, init
-
-
-
-
Field Detail
-
properties
protected final Properties properties
-
-
Method Detail
-
getInstance
public static UnitTestMockRegistry getInstance()
Return initialized UnitTestingExecutor initializeThread object.
-
addResource
public void addResource(String key, RegistryResource resource)
Add new registry resource to the map.- Parameters:
key
- resource keyresource
- resource object
-
clearResources
public void clearResources()
Clear registry resource map.
-
lookup
public org.apache.axiom.om.OMNode lookup(String key)
Description copied from interface:Registry
Perform an actual lookup for for an XML resource as an OMNode for the given key- Parameters:
key
- the key for the registry lookup- Returns:
- the XML content from the registry as an OMNode
-
getResourceProperties
public Properties getResourceProperties(String entryKey)
Description copied from interface:Registry
Get the resource properties of a given resource- Specified by:
getResourceProperties
in interfaceRegistry
- Overrides:
getResourceProperties
in classAbstractRegistry
- Parameters:
entryKey
- The registry entry
-
getRegistryEntry
public RegistryEntry getRegistryEntry(String key)
Description copied from interface:Registry
Get the registry entry for the given key- Parameters:
key
- the registry key- Returns:
- The registry entry for the given key
-
lookupFormat
public org.apache.axiom.om.OMNode lookupFormat(String key)
-
getChildren
public RegistryEntry[] getChildren(RegistryEntry entry)
Description copied from interface:Registry
Returns the child elements of a given registry entry- Parameters:
entry
- - parent registry entry- Returns:
- Array of child registry entries of the given parent registry entry
-
getDescendants
public RegistryEntry[] getDescendants(RegistryEntry entry)
Description copied from interface:Registry
Returns all descendant entries of the given registry entry- Parameters:
entry
- - parent registry entry- Returns:
- Array of decendant registry entries of the given registry entry
-
delete
public void delete(String path)
Description copied from interface:Registry
Deletes a resource in the given path- Parameters:
path
- The path the of resource
-
newResource
public void newResource(String path, boolean isDirectory)
Description copied from interface:Registry
Creates a new resource in the given path- Parameters:
path
- The new resource pathisDirectory
- Whether resource is a collection or not
-
newNonEmptyResource
public void newNonEmptyResource(String path, boolean isDirectory, String contentType, String content, String propertyName)
- Parameters:
path
- new Resource pathisDirectory
- whether the resource is a collection or notcontentType
- content type of the resourcecontent
- resource content
-
updateResource
public void updateResource(String path, Object value)
Description copied from interface:Registry
Updates the value of a resource- Parameters:
path
- The resource to be updatedvalue
- The value to be set
-
updateRegistryEntry
public void updateRegistryEntry(RegistryEntry entry)
Description copied from interface:Registry
Updates the registry enrty (metadata about a resource)- Parameters:
entry
- The registry entry
-
-