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 Propertiesproperties
-
Constructor Summary
Constructors Constructor Description UnitTestMockRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResource(String key, RegistryResource resource)Add new registry resource to the map.voidclearResources()Clear registry resource map.voiddelete(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 UnitTestMockRegistrygetInstance()Return initialized UnitTestingExecutor initializeThread object.RegistryEntrygetRegistryEntry(String key)Get the registry entry for the given keyPropertiesgetResourceProperties(String entryKey)Get the resource properties of a given resourcebooleanisResourceExists(String path)Check if a resource existsorg.apache.axiom.om.OMNodelookup(String key)Perform an actual lookup for for an XML resource as an OMNode for the given keyorg.apache.axiom.om.OMNodelookupFormat(String key)voidnewNonEmptyResource(String path, boolean isDirectory, String contentType, String content, String propertyName)voidnewResource(String path, boolean isDirectory)Creates a new resource in the given pathvoidupdateRegistryEntry(RegistryEntry entry)Updates the registry enrty (metadata about a resource)voidupdateResource(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:RegistryPerform 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:RegistryGet the resource properties of a given resource- Specified by:
getResourcePropertiesin interfaceRegistry- Overrides:
getResourcePropertiesin classAbstractRegistry- Parameters:
entryKey- The registry entry
-
getRegistryEntry
public RegistryEntry getRegistryEntry(String key)
Description copied from interface:RegistryGet 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:RegistryReturns 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:RegistryReturns 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:RegistryDeletes 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:RegistryCreates 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:RegistryUpdates 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:RegistryUpdates the registry enrty (metadata about a resource)- Parameters:
entry- The registry entry
-
-