Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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<String,Object>` | `beans`
`(package private) List<String>` | `ignoredClassLocations`
`(package private) PathMatcher` | `pathMatcher`
`(package private) List<Resource>` | `resources`
`(package private) ServletContext` | `servletContext`
`(package private) Date` | `startupDate`

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

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)`
`
`<A extends Annotation> A`
` | `findAnnotationOnBean(String name, Class<A> annotation)`
`String[]` | `getAliases(String name)`
`AutowireCapableBeanFactory` | `getAutowireCapableBeanFactory()`
`
`<T> T`
` | `getBean(Class<T> tClass)`
`Object` | `getBean(String name)`
`
`<T> T`
` | `getBean(String name, Class<T> requiredType)`
`Object` | `getBean(String name, Object... args)`
`int` | `getBeanDefinitionCount()`
`String[]` | `getBeanDefinitionNames()`
`String[]` | `getBeanNamesForType(Class type)`
`String[]` | `getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans)`
`
`<T> Map<String,T>`
` | `getBeansOfType(Class<T> type)`
`
`<T> Map<String,T>`
` | `getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)`
`Map<String,Object>` | `getBeansWithAnnotation(Class<? extends Annotation> annotation)`
`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` | `setServletContext(ServletContext servletContext)`
`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<String,Object> beans

### resources

    List<Resource> resources

### ignoredClassLocations

    List<String> ignoredClassLocations

### pathMatcher

    PathMatcher pathMatcher

### servletContext

    ServletContext servletContext

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`

### 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 <T> Map<String,T> getBeansOfType(Class<T> type)
                                 throws BeansException

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

### getBeansOfType

    public <T> Map<String,T> getBeansOfType(Class<T> type,
                                            boolean includeNonSingletons,
                                            boolean allowEagerInit)
                                 throws BeansException

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

### findAnnotationOnBean

    public <A extends Annotation> A findAnnotationOnBean(String name,
                                                         Class<A> annotation)

  Specified by:
    `findAnnotationOnBean` in interface `ListableBeanFactory`

### getBeansWithAnnotation

    public Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotation)
                                              throws BeansException

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

### getBean

    public Object getBean(String name)
                   throws BeansException

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

### getBean

    public <T> T getBean(String name,
                         Class<T> requiredType)
              throws BeansException

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

### getBean

    public <T> T getBean(Class<T> tClass)
              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)

  Specified by:
    `isSingleton` in interface `BeanFactory`

### isPrototype

    public boolean isPrototype(String s)

  Specified by:
    `isPrototype` in interface `BeanFactory`

### isTypeMatch

    public boolean isTypeMatch(String s,
                               Class aClass)

  Specified by:
    `isTypeMatch` in interface `BeanFactory`

### getType

    public Class getType(String name)
                  throws NoSuchBeanDefinitionException

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

### getAliases

    public String[] getAliases(String name)

  Specified by:
    `getAliases` in interface `BeanFactory`

### 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`

### setServletContext

    public void setServletContext(ServletContext servletContext)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD