use of org.olat.core.configuration.Destroyable in project OpenOLAT by OpenOLAT.
the class SpringInitDestroyVerficationTest method testDestroyMethodCalls.
@Test
public void testDestroyMethodCalls() {
XmlWebApplicationContext context = (XmlWebApplicationContext) applicationContext;
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
Map<String, Destroyable> beans = applicationContext.getBeansOfType(Destroyable.class);
for (Iterator<String> iterator = beans.keySet().iterator(); iterator.hasNext(); ) {
String beanName = iterator.next();
try {
GenericBeanDefinition beanDef = (GenericBeanDefinition) beanFactory.getBeanDefinition(beanName);
assertNotNull("Spring Bean (" + beanName + ") of type Destroyable does not have the required destroy-method attribute or the method name is not destroy!", beanDef.getDestroyMethodName());
if (beanDef.getDestroyMethodName() != null) {
assertTrue("Spring Bean (" + beanName + ") of type Destroyable does not have the required destroy-method attribute or the method name is not destroy!", beanDef.getDestroyMethodName().equals("destroy"));
}
} catch (NoSuchBeanDefinitionException e) {
log.error("testDestroyMethodCalls: Error while trying to analyze bean with name: " + beanName + " :" + e);
} catch (Exception e) {
log.error("testDestroyMethodCalls: Error while trying to analyze bean with name: " + beanName + " :" + e);
}
}
}
use of org.olat.core.configuration.Destroyable in project openolat by klemens.
the class SpringInitDestroyVerficationTest method testDestroyMethodCalls.
@Test
public void testDestroyMethodCalls() {
XmlWebApplicationContext context = (XmlWebApplicationContext) applicationContext;
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
Map<String, Destroyable> beans = applicationContext.getBeansOfType(Destroyable.class);
for (Iterator<String> iterator = beans.keySet().iterator(); iterator.hasNext(); ) {
String beanName = iterator.next();
try {
GenericBeanDefinition beanDef = (GenericBeanDefinition) beanFactory.getBeanDefinition(beanName);
assertNotNull("Spring Bean (" + beanName + ") of type Destroyable does not have the required destroy-method attribute or the method name is not destroy!", beanDef.getDestroyMethodName());
if (beanDef.getDestroyMethodName() != null) {
assertTrue("Spring Bean (" + beanName + ") of type Destroyable does not have the required destroy-method attribute or the method name is not destroy!", beanDef.getDestroyMethodName().equals("destroy"));
}
} catch (NoSuchBeanDefinitionException e) {
log.error("testDestroyMethodCalls: Error while trying to analyze bean with name: " + beanName + " :" + e);
} catch (Exception e) {
log.error("testDestroyMethodCalls: Error while trying to analyze bean with name: " + beanName + " :" + e);
}
}
}
Aggregations