| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.student.common.test.spring; |
| 17 |
|
|
| 18 |
|
import org.springframework.beans.BeansException; |
| 19 |
|
import org.springframework.beans.factory.config.BeanDefinition; |
| 20 |
|
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; |
| 21 |
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
| 22 |
|
import org.springframework.beans.factory.support.BeanDefinitionRegistry; |
| 23 |
|
import org.springframework.beans.factory.support.RootBeanDefinition; |
| 24 |
|
import org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor; |
| 25 |
|
|
|
|
|
| 82.6% |
Uncovered Elements: 4 (23) |
Complexity: 7 |
Complexity Density: 0.44 |
|
| 26 |
|
public class DaoPostProcessor implements BeanFactoryPostProcessor { |
| 27 |
|
private String daoImplClasses; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
@return |
| 31 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 32 |
0
|
public String getDaoImplClasses() {... |
| 33 |
0
|
return daoImplClasses; |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
@param |
| 38 |
|
|
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 40 |
15
|
public void setDaoImplClasses(String daoImplClasses) {... |
| 41 |
15
|
this.daoImplClasses = daoImplClasses; |
| 42 |
|
} |
| 43 |
|
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 5 |
Complexity Density: 0.36 |
|
| 44 |
15
|
@Override... |
| 45 |
|
public void postProcessBeanFactory( |
| 46 |
|
ConfigurableListableBeanFactory beanFactory) throws BeansException { |
| 47 |
15
|
String[] classes = daoImplClasses.split(","); |
| 48 |
15
|
BeanDefinitionRegistry registry = ((BeanDefinitionRegistry) beanFactory); |
| 49 |
15
|
PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor(); |
| 50 |
15
|
if (classes != null && classes.length > 0) { |
| 51 |
15
|
for (String line : classes) { |
| 52 |
17
|
if (!"".equals(line)) { |
| 53 |
14
|
try { |
| 54 |
14
|
String[] split = line.split("\\|"); |
| 55 |
14
|
String className = split[0]; |
| 56 |
14
|
Class<?> clazz = Class.forName(className); |
| 57 |
14
|
BeanDefinition definition = new RootBeanDefinition( |
| 58 |
|
clazz); |
| 59 |
14
|
registry.registerBeanDefinition(clazz.getSimpleName(), |
| 60 |
|
definition); |
| 61 |
14
|
pabpp.postProcessMergedBeanDefinition( |
| 62 |
|
(RootBeanDefinition) definition, clazz, clazz |
| 63 |
|
.getSimpleName()); |
| 64 |
|
|
| 65 |
|
} catch (Exception e) { |
| 66 |
0
|
throw new RuntimeException(e); |
| 67 |
|
} |
| 68 |
|
} |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
|
} |