Java tutorial
/* * Copyright 2012 Alibaba.com All right reserved. This software is the * confidential and proprietary information of Alibaba.com ("Confidential * Information"). You shall not disclose such Confidential Information and shall * use it only in accordance with the terms of the license agreement you entered * into with Alibaba.com. */ package com.taobao.tanggong; import java.sql.SQLException; import javax.sql.DataSource; import org.junit.Assert; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.taobao.tanggong.h2.H2Server; /** * InterceptPersisterImplTest.java??TODO ?? * * @author jingjing.zhijj 2012-12-20 ?3:56:22 */ public class H2ServerTest { private ApplicationContext appContext = new ClassPathXmlApplicationContext("appContext.xml"); @Test public void test() { H2Server h = (H2Server) this.appContext.getBean("h2Server"); DataSource dataSource = (DataSource) this.appContext.getBean("dataSource"); try { Assert.assertNotNull(dataSource.getConnection()); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Thread.sleep(1000000l); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }