成功捷徑,貴在堅持
          人為善,福雖未至禍已遠離; 人為惡,禍雖未至福已遠離
          ?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 閱讀(2997) 評論(0)  編輯  收藏 所屬分類: Java Exception&Error
          主站蜘蛛池模板: 阜平县| 铁岭县| 衢州市| 武平县| 繁昌县| 九龙城区| 介休市| 怀仁县| 金塔县| 三台县| 巴彦淖尔市| 昔阳县| 睢宁县| 团风县| 巩义市| 祁阳县| 丹寨县| 榆林市| 乡城县| 中宁县| 重庆市| 平度市| 鹤峰县| 中山市| 内黄县| 恩施市| 牡丹江市| 柳林县| 喜德县| 龙南县| 昭苏县| 湖南省| 扎兰屯市| 武隆县| 中阳县| 大新县| 墨玉县| 永新县| 鄱阳县| 嘉黎县| 阿克陶县|