Class MockApplicationContext
- java.lang.Object
-
- net.shibboleth.ext.spring.service.MockApplicationContext
-
- All Implemented Interfaces:
Closeable,AutoCloseable,BeanFactory,HierarchicalBeanFactory,ListableBeanFactory,ApplicationContext,ApplicationEventPublisher,ConfigurableApplicationContext,Lifecycle,MessageSource,EnvironmentCapable,ResourceLoader,ResourcePatternResolver
public class MockApplicationContext extends Object implements ConfigurableApplicationContext
Placeholder, which can be set on testAbstractServiceableComponents to stop the "must be null" test firing.
-
-
Field Summary
-
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
-
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
-
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
-
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX
-
-
Constructor Summary
Constructors Constructor Description MockApplicationContext()
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.context.ApplicationEventPublisher
publishEvent
-
-
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getIdin interfaceApplicationContext
-
getApplicationName
public String getApplicationName()
- Specified by:
getApplicationNamein interfaceApplicationContext
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayNamein interfaceApplicationContext
-
getStartupDate
public long getStartupDate()
- Specified by:
getStartupDatein interfaceApplicationContext
-
getParent
public ApplicationContext getParent()
- Specified by:
getParentin interfaceApplicationContext
-
getAutowireCapableBeanFactory
public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException
- Specified by:
getAutowireCapableBeanFactoryin interfaceApplicationContext- Throws:
IllegalStateException
-
containsBeanDefinition
public boolean containsBeanDefinition(String beanName)
- Specified by:
containsBeanDefinitionin interfaceListableBeanFactory
-
getBeanDefinitionCount
public int getBeanDefinitionCount()
- Specified by:
getBeanDefinitionCountin interfaceListableBeanFactory
-
getBeanDefinitionNames
public String[] getBeanDefinitionNames()
- Specified by:
getBeanDefinitionNamesin interfaceListableBeanFactory
-
getBeanNamesForType
public String[] getBeanNamesForType(ResolvableType type)
- Specified by:
getBeanNamesForTypein interfaceListableBeanFactory
-
getBeanNamesForType
public String[] getBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)
- Specified by:
getBeanNamesForTypein interfaceListableBeanFactory
-
getBeanNamesForType
public String[] getBeanNamesForType(Class<?> type)
- Specified by:
getBeanNamesForTypein interfaceListableBeanFactory
-
getBeanNamesForType
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
- Specified by:
getBeanNamesForTypein interfaceListableBeanFactory
-
getBeansOfType
public <T> Map<String,T> getBeansOfType(Class<T> type) throws BeansException
- Specified by:
getBeansOfTypein interfaceListableBeanFactory- Throws:
BeansException
-
getBeansOfType
public <T> Map<String,T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException
- Specified by:
getBeansOfTypein interfaceListableBeanFactory- Throws:
BeansException
-
getBeanNamesForAnnotation
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType)
- Specified by:
getBeanNamesForAnnotationin interfaceListableBeanFactory
-
getBeansWithAnnotation
public Map<String,Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) throws BeansException
- Specified by:
getBeansWithAnnotationin interfaceListableBeanFactory- Throws:
BeansException
-
findAnnotationOnBean
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) throws NoSuchBeanDefinitionException
- Specified by:
findAnnotationOnBeanin interfaceListableBeanFactory- Throws:
NoSuchBeanDefinitionException
-
getBean
public Object getBean(String name) throws BeansException
- Specified by:
getBeanin interfaceBeanFactory- Throws:
BeansException
-
getBean
public <T> T getBean(String name, Class<T> requiredType) throws BeansException
- Specified by:
getBeanin interfaceBeanFactory- Throws:
BeansException
-
getBean
public Object getBean(String name, Object... args) throws BeansException
- Specified by:
getBeanin interfaceBeanFactory- Throws:
BeansException
-
getBean
public <T> T getBean(Class<T> requiredType) throws BeansException
- Specified by:
getBeanin interfaceBeanFactory- Throws:
BeansException
-
getBean
public <T> T getBean(Class<T> requiredType, Object... args) throws BeansException
- Specified by:
getBeanin interfaceBeanFactory- Throws:
BeansException
-
getBeanProvider
public <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType)
- Specified by:
getBeanProviderin interfaceBeanFactory
-
getBeanProvider
public <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType)
- Specified by:
getBeanProviderin interfaceBeanFactory
-
containsBean
public boolean containsBean(String name)
- Specified by:
containsBeanin interfaceBeanFactory
-
isSingleton
public boolean isSingleton(String name) throws NoSuchBeanDefinitionException
- Specified by:
isSingletonin interfaceBeanFactory- Throws:
NoSuchBeanDefinitionException
-
isPrototype
public boolean isPrototype(String name) throws NoSuchBeanDefinitionException
- Specified by:
isPrototypein interfaceBeanFactory- Throws:
NoSuchBeanDefinitionException
-
isTypeMatch
public boolean isTypeMatch(String name, ResolvableType typeToMatch) throws NoSuchBeanDefinitionException
- Specified by:
isTypeMatchin interfaceBeanFactory- Throws:
NoSuchBeanDefinitionException
-
isTypeMatch
public boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException
- Specified by:
isTypeMatchin interfaceBeanFactory- Throws:
NoSuchBeanDefinitionException
-
getType
public Class<?> getType(String name) throws NoSuchBeanDefinitionException
- Specified by:
getTypein interfaceBeanFactory- Throws:
NoSuchBeanDefinitionException
-
getType
public Class<?> getType(String name, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException
- Specified by:
getTypein interfaceBeanFactory- Throws:
NoSuchBeanDefinitionException
-
getAliases
public String[] getAliases(String name)
- Specified by:
getAliasesin interfaceBeanFactory
-
getParentBeanFactory
public BeanFactory getParentBeanFactory()
- Specified by:
getParentBeanFactoryin interfaceHierarchicalBeanFactory
-
containsLocalBean
public boolean containsLocalBean(String name)
- Specified by:
containsLocalBeanin interfaceHierarchicalBeanFactory
-
getMessage
public String getMessage(String code, Object[] args, String defaultMessage, Locale locale)
- Specified by:
getMessagein interfaceMessageSource
-
getMessage
public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException
- Specified by:
getMessagein interfaceMessageSource- Throws:
NoSuchMessageException
-
getMessage
public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException
- Specified by:
getMessagein interfaceMessageSource- Throws:
NoSuchMessageException
-
publishEvent
public void publishEvent(Object event)
- Specified by:
publishEventin interfaceApplicationEventPublisher
-
getResources
public Resource[] getResources(String locationPattern) throws IOException
- Specified by:
getResourcesin interfaceResourcePatternResolver- Throws:
IOException
-
getResource
public Resource getResource(String location)
- Specified by:
getResourcein interfaceResourceLoader
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoaderin interfaceResourceLoader
-
setId
public void setId(String id)
- Specified by:
setIdin interfaceConfigurableApplicationContext
-
setParent
public void setParent(ApplicationContext parent)
- Specified by:
setParentin interfaceConfigurableApplicationContext
-
setEnvironment
public void setEnvironment(ConfigurableEnvironment environment)
- Specified by:
setEnvironmentin interfaceConfigurableApplicationContext
-
getEnvironment
public ConfigurableEnvironment getEnvironment()
- Specified by:
getEnvironmentin interfaceConfigurableApplicationContext- Specified by:
getEnvironmentin interfaceEnvironmentCapable
-
addBeanFactoryPostProcessor
public void addBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor)
- Specified by:
addBeanFactoryPostProcessorin interfaceConfigurableApplicationContext
-
addApplicationListener
public void addApplicationListener(ApplicationListener<?> listener)
- Specified by:
addApplicationListenerin interfaceConfigurableApplicationContext
-
addProtocolResolver
public void addProtocolResolver(ProtocolResolver resolver)
- Specified by:
addProtocolResolverin interfaceConfigurableApplicationContext
-
refresh
public void refresh() throws BeansException, IllegalStateException- Specified by:
refreshin interfaceConfigurableApplicationContext- Throws:
BeansExceptionIllegalStateException
-
registerShutdownHook
public void registerShutdownHook()
- Specified by:
registerShutdownHookin interfaceConfigurableApplicationContext
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConfigurableApplicationContext
-
isActive
public boolean isActive()
- Specified by:
isActivein interfaceConfigurableApplicationContext
-
getBeanFactory
public ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException
- Specified by:
getBeanFactoryin interfaceConfigurableApplicationContext- Throws:
IllegalStateException
-
-