use of com.ctrip.platform.dal.dao.annotation.autowire.TransactionAnnoClass in project dal by ctripcorp.
the class DalAnnotationValidatorTest method testValidateRawBean.
@Test
public void testValidateRawBean() throws Exception {
DalAnnotationValidator test = new DalAnnotationValidator();
try {
TransactionAnnoClass bean = new TransactionAnnoClass();
test.postProcessAfterInitialization(bean, "beanName");
fail();
} catch (BeanInstantiationException e) {
assertTrue(e.getMessage().contains(DalAnnotationValidator.VALIDATION_MSG));
}
}
use of com.ctrip.platform.dal.dao.annotation.autowire.TransactionAnnoClass in project dal by ctripcorp.
the class DalAnnotationValidatorTest method testValidateFactoryBeanProxyAgain.
@Test
public void testValidateFactoryBeanProxyAgain() throws Exception {
DalAnnotationValidator test = new DalAnnotationValidator();
try {
TransactionAnnoClass bean = DalTransactionManager.create(TransactionAnnoClass.class);
// Try to wrap it again
Class targetClass = bean.getClass();
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(targetClass);
enhancer.setClassLoader(targetClass.getClassLoader());
enhancer.setCallbackFilter(new CallbackFilter() {
@Override
public int accept(Method method) {
return method.getName().startsWith("per") ? 0 : 1;
}
});
Callback[] callbacks = new Callback[] { new MethodInterceptor() {
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
return proxy.invoke(obj, args);
}
}, NoOp.INSTANCE };
enhancer.setCallbacks(callbacks);
bean = (TransactionAnnoClass) enhancer.create();
test.postProcessAfterInitialization(bean, "beanName");
} catch (BeansException e) {
fail();
}
}
use of com.ctrip.platform.dal.dao.annotation.autowire.TransactionAnnoClass in project dal by ctripcorp.
the class DalAnnotationValidatorTest method testValidateFactoryBean.
@Test
public void testValidateFactoryBean() throws Exception {
DalAnnotationValidator test = new DalAnnotationValidator();
try {
TransactionAnnoClass bean = DalTransactionManager.create(TransactionAnnoClass.class);
test.postProcessAfterInitialization(bean, "beanName");
} catch (BeansException e) {
fail();
}
}
Aggregations