成功捷徑,貴在堅(jiān)持
          人為善,福雖未至禍已遠(yuǎn)離; 人為惡,禍雖未至福已遠(yuǎn)離
          ?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做為連接池測(cè)試的應(yīng)用程序,注釋的部分去掉即可解決Exception.
          posted on 2008-05-19 14:51 選寶網(wǎng)an9 閱讀(3001) 評(píng)論(0)  編輯  收藏 所屬分類: Java Exception&Error
          主站蜘蛛池模板: 成都市| 永宁县| 会东县| 桐柏县| 中山市| 富阳市| 桃园县| 伊金霍洛旗| 长白| 辉南县| 班戈县| 广南县| 平昌县| 凤庆县| 咸丰县| 万载县| 土默特右旗| 瓦房店市| 长阳| 桐梓县| 博爱县| 板桥市| 长葛市| 三原县| 饶河县| 海宁市| 贡嘎县| 静乐县| 曲麻莱县| 六安市| 皋兰县| 平和县| 梓潼县| 黄大仙区| 公主岭市| 永嘉县| 黄骅市| 鄂托克前旗| 娄底市| 蕲春县| 苏州市|