## org.codehaus.groovy.grails.support
Class MockApplicationContext

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          org.codehaus.groovy.grails.support.MockApplicationContext

All Implemented Interfaces:
  groovy.lang.GroovyObject, BeanFactory, HierarchicalBeanFactory, ListableBeanFactory, ApplicationContext, ApplicationEventPublisher, MessageSource, ResourceLoader, ResourcePatternResolver, WebApplicationContext

    public class MockApplicationContext

extends groovy.lang.GroovyObjectSupport
implements WebApplicationContext

Nested Class Summary
`class` `MockApplicationContext.MockResource`

Field Summary
`(package private) Map` `beans`
`(package private) List` `ignoredClassLocations`
`(package private) PathMatcher` `pathMatcher`
`(package private) List` `resources`
`(package private) Date` `startupDate`

Fields inherited from interface org.springframework.web.context.WebApplicationContext
`ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION`

Fields inherited from interface org.springframework.beans.factory.BeanFactory
`FACTORY_BEAN_PREFIX`

Fields inherited from interface org.springframework.beans.factory.BeanFactory
`FACTORY_BEAN_PREFIX`

Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`CLASSPATH_ALL_URL_PREFIX`

Fields inherited from interface org.springframework.core.io.ResourceLoader
`CLASSPATH_URL_PREFIX`

Constructor Summary
`MockApplicationContext()`

Method Summary
`boolean` `containsBean(String name)`
`boolean` `containsBeanDefinition(String beanName)`
`boolean` `containsLocalBean(String arg0)`
`String[]` `getAliases(String name)`
`AutowireCapableBeanFactory` `getAutowireCapableBeanFactory()`
`Object` `getBean(String name)`
`Object` `getBean(String name, Class requiredType)`
`Object` `getBean(String name, Object[] args)`
`int` `getBeanDefinitionCount()`
`String[]` `getBeanDefinitionNames()`
`String[]` `getBeanDefinitionNames(Class type)`
`String[]` `getBeanNamesForType(Class type)`
`String[]` `getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans)`
`Map` `getBeansOfType(Class type)`
`Map` `getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans)`
`ClassLoader` `getClassLoader()`
`String` `getDisplayName()`
`String` `getId()`
`String` `getMessage(MessageSourceResolvable resolvable, Locale locale)`
`String` `getMessage(String code, Object[] args, Locale locale)`
`String` `getMessage(String code, Object[] args, String defaultMessage, Locale locale)`
`ApplicationContext` `getParent()`
`BeanFactory` `getParentBeanFactory()`
`Object` `getProperty(String name)`
`Resource` `getResource(String location)`
`Resource[]` `getResources(String locationPattern)`
`ServletContext` `getServletContext()`
`long` `getStartupDate()`
`Class` `getType(String name)`
`boolean` `isPrototype(String s)`
`boolean` `isSingleton(String name)`
`boolean` `isTypeMatch(String s, Class aClass)`
`void` `publishEvent(ApplicationEvent event)`
`void` `registerIgnoredClassPathLocation(String location)` Registers a resource that should not be found on the classpath.
`void` `registerMockBean(String name, Object instance)`
`void` `registerMockResource(String location)` Registers a mock resource.
`void` `registerMockResource(String location, String contents)` Registers a mock resource.
`void` `unregisterIgnoredClassPathLocation(String location)` Unregisters a resource that should not be found on the classpath.
`void` `unregisterMockResource(String location)` Unregisters a mock resource.

Methods inherited from class groovy.lang.GroovyObjectSupport
`getMetaClass, invokeMethod, setMetaClass, setProperty`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### startupDate

    Date startupDate

### beans

    Map beans

### resources

    List resources

### ignoredClassLocations

    List ignoredClassLocations

### pathMatcher

    PathMatcher pathMatcher

Constructor Detail

### MockApplicationContext

    public MockApplicationContext()

Method Detail

### registerMockBean

    public void registerMockBean(String name,
                                 Object instance)

### registerMockResource

    public void registerMockResource(String location)

  Registers a mock resource. Path separator: "/"

  Parameters:
    `location` - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.properties

### registerMockResource

    public void registerMockResource(String location,
                                     String contents)

  Registers a mock resource. Path separator: "/"

  Parameters:
    `location` - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.properties

### unregisterMockResource

    public void unregisterMockResource(String location)

  Unregisters a mock resource. Path separator: "/"

  Parameters:
    `location` - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.properties

### registerIgnoredClassPathLocation

    public void registerIgnoredClassPathLocation(String location)

  Registers a resource that should not be found on the classpath. Path separator: "/"

  Parameters:
    `location` - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.properties

### unregisterIgnoredClassPathLocation

    public void unregisterIgnoredClassPathLocation(String location)

  Unregisters a resource that should not be found on the classpath. Path separator: "/"

  Parameters:
    `location` - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.properties

### getParent

    public ApplicationContext getParent()

  Specified by:
    `getParent` in interface `ApplicationContext`

### getId

    public String getId()

  Specified by:
    `getId` in interface `ApplicationContext`

### getDisplayName

    public String getDisplayName()

  Specified by:
    `getDisplayName` in interface `ApplicationContext`

### getStartupDate

    public long getStartupDate()

  Specified by:
    `getStartupDate` in interface `ApplicationContext`

### publishEvent

    public void publishEvent(ApplicationEvent event)

  Specified by:
    `publishEvent` in interface `ApplicationEventPublisher`

### containsBeanDefinition

    public boolean containsBeanDefinition(String beanName)

  Specified by:
    `containsBeanDefinition` in interface `ListableBeanFactory`

### getBeanDefinitionCount

    public int getBeanDefinitionCount()

  Specified by:
    `getBeanDefinitionCount` in interface `ListableBeanFactory`

### getBeanDefinitionNames

    public String[] getBeanDefinitionNames()

  Specified by:
    `getBeanDefinitionNames` in interface `ListableBeanFactory`

### getBeanDefinitionNames

    public String[] getBeanDefinitionNames(Class type)

### getBeanNamesForType

    public String[] getBeanNamesForType(Class type)

  Specified by:
    `getBeanNamesForType` in interface `ListableBeanFactory`

### getBeanNamesForType

    public String[] getBeanNamesForType(Class type,
                                        boolean includePrototypes,
                                        boolean includeFactoryBeans)

  Specified by:
    `getBeanNamesForType` in interface `ListableBeanFactory`

### getBeansOfType

    public Map getBeansOfType(Class type)
                       throws BeansException

  Specified by:
    `getBeansOfType` in interface `ListableBeanFactory`
  Throws:
    `BeansException`

### getBeansOfType

    public Map getBeansOfType(Class type,
                              boolean includePrototypes,
                              boolean includeFactoryBeans)
                       throws BeansException

  Specified by:
    `getBeansOfType` in interface `ListableBeanFactory`
  Throws:
    `BeansException`

### getBean

    public Object getBean(String name)
                   throws BeansException

  Specified by:
    `getBean` in interface `BeanFactory`
  Throws:
    `BeansException`

### getBean

    public Object getBean(String name,
                          Class requiredType)
                   throws BeansException

  Specified by:
    `getBean` in interface `BeanFactory`
  Throws:
    `BeansException`

### getBean

    public Object getBean(String name,
                          Object[] args)
                   throws BeansException

  Specified by:
    `getBean` in interface `BeanFactory`
  Throws:
    `BeansException`

### getProperty

    public Object getProperty(String name)

  Specified by:
    `getProperty` in interface `groovy.lang.GroovyObject`
  Overrides:
    `getProperty` in class `groovy.lang.GroovyObjectSupport`

### containsBean

    public boolean containsBean(String name)

  Specified by:
    `containsBean` in interface `BeanFactory`

### isSingleton

    public boolean isSingleton(String name)
                        throws NoSuchBeanDefinitionException

  Specified by:
    `isSingleton` in interface `BeanFactory`
  Throws:
    `NoSuchBeanDefinitionException`

### isPrototype

    public boolean isPrototype(String s)
                        throws NoSuchBeanDefinitionException

  Specified by:
    `isPrototype` in interface `BeanFactory`
  Throws:
    `NoSuchBeanDefinitionException`

### isTypeMatch

    public boolean isTypeMatch(String s,
                               Class aClass)
                        throws NoSuchBeanDefinitionException

  Specified by:
    `isTypeMatch` in interface `BeanFactory`
  Throws:
    `NoSuchBeanDefinitionException`

### getType

    public Class getType(String name)
                  throws NoSuchBeanDefinitionException

  Specified by:
    `getType` in interface `BeanFactory`
  Throws:
    `NoSuchBeanDefinitionException`

### getAliases

    public String[] getAliases(String name)
                        throws NoSuchBeanDefinitionException

  Specified by:
    `getAliases` in interface `BeanFactory`
  Throws:
    `NoSuchBeanDefinitionException`

### getParentBeanFactory

    public BeanFactory getParentBeanFactory()

  Specified by:
    `getParentBeanFactory` in interface `HierarchicalBeanFactory`

### getMessage

    public String getMessage(String code,
                             Object[] args,
                             String defaultMessage,
                             Locale locale)

  Specified by:
    `getMessage` in interface `MessageSource`

### getMessage

    public String getMessage(String code,
                             Object[] args,
                             Locale locale)
                      throws NoSuchMessageException

  Specified by:
    `getMessage` in interface `MessageSource`
  Throws:
    `NoSuchMessageException`

### getMessage

    public String getMessage(MessageSourceResolvable resolvable,
                             Locale locale)
                      throws NoSuchMessageException

  Specified by:
    `getMessage` in interface `MessageSource`
  Throws:
    `NoSuchMessageException`

### getResources

    public Resource[] getResources(String locationPattern)
                            throws IOException

  Specified by:
    `getResources` in interface `ResourcePatternResolver`
  Throws:
    `IOException`

### getResource

    public Resource getResource(String location)

  Specified by:
    `getResource` in interface `ResourceLoader`

### containsLocalBean

    public boolean containsLocalBean(String arg0)

  Specified by:
    `containsLocalBean` in interface `HierarchicalBeanFactory`

### getAutowireCapableBeanFactory

    public AutowireCapableBeanFactory getAutowireCapableBeanFactory()
                                                             throws IllegalStateException

  Specified by:
    `getAutowireCapableBeanFactory` in interface `ApplicationContext`
  Throws:
    `IllegalStateException`

### getClassLoader

    public ClassLoader getClassLoader()

  Specified by:
    `getClassLoader` in interface `ResourceLoader`

### getServletContext

    public ServletContext getServletContext()

  Specified by:
    `getServletContext` in interface `WebApplicationContext`

Copyright (c) 2005-2009 The Grails project