com.opensymphony.xwork2.config.impl

## Class MockConfiguration

- java.lang.Object
- - com.opensymphony.xwork2.config.impl.MockConfiguration

- All Implemented Interfaces:
    Configuration, Serializable

      public class MockConfiguration
      extends Object
      implements Configuration

  Simple configuration used for unit testing
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<UnknownHandlerConfig>` | `unknownHandlerStack`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MockConfiguration()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPackageConfig(String name, PackageConfig packageContext)`
    `void` | `buildRuntimeConfiguration()`
    `void` | `destroy()` Allow the Configuration to clean up any resources that have been used.
    `Container` | `getContainer()`
    `Set<String>` | `getLoadedFileNames()`
    `PackageConfig` | `getPackageConfig(String name)`
    `Set<String>` | `getPackageConfigNames()`
    `Map<String,PackageConfig>` | `getPackageConfigs()`
    `RuntimeConfiguration` | `getRuntimeConfiguration()` The current runtime configuration.
    `List<UnknownHandlerConfig>` | `getUnknownHandlerStack()`
    `void` | `rebuildRuntimeConfiguration()`
    `List<PackageProvider>` | `reloadContainer(List<ContainerProvider> containerProviders)`
    `PackageConfig` | `removePackageConfig(String name)` Removes a package from the the list of packages.
    `void` | `selfRegister()`
    `void` | `setUnknownHandlerStack(List<UnknownHandlerConfig> unknownHandlerStack)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### unknownHandlerStack

          protected List<UnknownHandlerConfig> unknownHandlerStack

  - ### Constructor Detail

    - #### MockConfiguration

          public MockConfiguration()

  - ### Method Detail

    - #### selfRegister

          public void selfRegister()

    - #### getPackageConfig

          public PackageConfig getPackageConfig(String name)

      Specified by:
        `getPackageConfig` in interface `Configuration`

    - #### getPackageConfigNames

          public Set<String> getPackageConfigNames()

      Specified by:
        `getPackageConfigNames` in interface `Configuration`

    - #### getPackageConfigs

          public Map<String,PackageConfig> getPackageConfigs()

      Specified by:
        `getPackageConfigs` in interface `Configuration`

    - #### getRuntimeConfiguration

          public RuntimeConfiguration getRuntimeConfiguration()

      Description copied from interface: `Configuration`
      The current runtime configuration. Currently, if changes have been made to the Configuration since the last time buildRuntimeConfiguration() was called, you'll need to make sure to.
      Specified by:
        `getRuntimeConfiguration` in interface `Configuration`
      Returns:
        the current runtime configuration

    - #### addPackageConfig

          public void addPackageConfig(String name,
                                       PackageConfig packageContext)

      Specified by:
        `addPackageConfig` in interface `Configuration`

    - #### buildRuntimeConfiguration

          public void buildRuntimeConfiguration()

    - #### destroy

          public void destroy()

      Description copied from interface: `Configuration`
      Allow the Configuration to clean up any resources that have been used.
      Specified by:
        `destroy` in interface `Configuration`

    - #### rebuildRuntimeConfiguration

          public void rebuildRuntimeConfiguration()

      Specified by:
        `rebuildRuntimeConfiguration` in interface `Configuration`

    - #### removePackageConfig

          public PackageConfig removePackageConfig(String name)

      Description copied from interface: `Configuration`
      Removes a package from the the list of packages. Changes to the configuration won't take effect until buildRuntimeConfiguration is called.
      Specified by:
        `removePackageConfig` in interface `Configuration`
      Parameters:
        `name` - the name of the package to remove
      Returns:
        the package removed (if any)

    - #### getContainer

          public Container getContainer()

      Specified by:
        `getContainer` in interface `Configuration`
      Returns:
        the container

    - #### getLoadedFileNames

          public Set<String> getLoadedFileNames()

      Specified by:
        `getLoadedFileNames` in interface `Configuration`

    - #### reloadContainer

          public List<PackageProvider> reloadContainer(List<ContainerProvider> containerProviders)
                                                throws ConfigurationException

      Specified by:
        `reloadContainer` in interface `Configuration`
      Parameters:
        `containerProviders` - list of container providers
      Returns:
        list of package providers
      Throws:
        `ConfigurationException` - in case of any configuration errors

    - #### getUnknownHandlerStack

          public List<UnknownHandlerConfig> getUnknownHandlerStack()

      Specified by:
        `getUnknownHandlerStack` in interface `Configuration`
      Returns:
        list of unknown handlers

    - #### setUnknownHandlerStack

          public void setUnknownHandlerStack(List<UnknownHandlerConfig> unknownHandlerStack)

      Specified by:
        `setUnknownHandlerStack` in interface `Configuration`
      Parameters:
        `unknownHandlerStack` - list of unknown handlers

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.