成功捷徑,貴在堅持
          人為善,福雖未至禍已遠離; 人為惡,禍雖未至福已遠離
          ?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 選寶網(wǎng)an9 閱讀(3001) 評論(0)  編輯  收藏 所屬分類: Java Exception&Error
          主站蜘蛛池模板: 织金县| 石泉县| 苏尼特右旗| 东阿县| 南安市| 昌邑市| 蒲城县| 宝丰县| 麟游县| 沂南县| 东源县| 化隆| 东乌珠穆沁旗| 郴州市| 芒康县| 紫阳县| 镇沅| 汉阴县| 卓尼县| 安西县| 丹凤县| 萨迦县| 广安市| 新建县| 淄博市| 万荣县| 青海省| 垦利县| 宽甸| 尼玛县| 建昌县| 丰都县| 河西区| 天等县| 宁夏| 侯马市| 阳新县| 兰州市| 开鲁县| 卫辉市| 京山县|