成功捷径,贵在坚持
人为善,福虽未至祸已远离; 人为恶,祸虽未至福已远离
 1 package  com.e104cn.pda.test;
 2 import  org.junit.AfterClass;
 3 import  org.junit.BeforeClass;
 4 import  org.junit.Test;
 5 import  org.logicalcobwebs.proxool.ProxoolFacade;
 6 import  org.springframework.context.ApplicationContext;
 7 import  org.springframework.context.support.FileSystemXmlApplicationContext;
 8
 9 import  tw.com.testing.util.Code;
10
11 import  com.e104cn.pda.data.anno.Basic;
12 import  com.e104cn.pda.data.dao.IBasicDao;
13 public   class  BasicDAOTest {
14      private   static  ApplicationContext context;
15     @BeforeClass
16      public   static   void  setUp() {
17         context  =   new  FileSystemXmlApplicationContext( new  String[] { " WebContent/WEB-INF/applicationContext-hibernate.xml " , " WebContent/WEB-INF/applicationContext-service.xml " , " WebContent/WEB-INF/applicationContext-dao.xml " } );
18     }

19     
20     @AfterClass
21      public   static   void  tearDown() {
22          // ProxoolFacade.shutdown(0); 
23     }

24     
25     @Test
26      public   void  contextInit() {
27          if (context  !=   null ) {
28             IBasicDao basicDao  =  (IBasicDao)context.getBean( " basicDao " );
29              if (basicDao  !=   null ) {
30                  try   {
31                     Basic basic  =  (Basic)basicDao.getData( " 105400 " );
32                      if (basic  !=   null ) {
33                         System.out.println( new  Code().decode(basic.getEmail()));
34                     }

35                 }
  catch  (Exception e)  {
36                     e.printStackTrace();
37                 }

38             }

39         }

40     }

41 }

42
spring2.0,hibernate annotation,juint4, proxool做为连接池测试的应用程序,注释的部分去掉即可解决Exception.
posted on 2008-05-19 14:51 选宝网an9 阅读(2977) 评论(0)  编辑  收藏 所属分类: Java Exception&Error

只有注册用户登录后才能发表评论。


网站导航: