Class 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 Detail

      • properties

        protected final Properties properties
    • Constructor Detail

      • UnitTestMockRegistry

        public UnitTestMockRegistry()
    • 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 key
        resource - 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
      • 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 path
        isDirectory - 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 path
        isDirectory - whether the resource is a collection or not
        contentType - content type of the resource
        content - 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 updated
        value - 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
      • isResourceExists

        public boolean isResourceExists​(String path)
        Description copied from interface: Registry
        Check if a resource exists
        Parameters:
        path - The path of the resource
        Returns:
        true if the resource exists