~lsinger/play/1.1

« back to all changes in this revision

Viewing changes to framework/tests/src/play/db/TestDb.java

  • Committer: Guillaume Bort
  • Date: 2008-06-18 16:50:27 UTC
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: guillaume.bort@gmail.com-20080618165027-1nm9amjekqfd6j7v
eclipsify & netbeansify !

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package play.db;
 
2
 
 
3
import java.sql.Connection;
 
4
import java.util.Properties;
 
5
import javax.sql.DataSource;
 
6
import junit.framework.TestCase;
 
7
import play.Play;
 
8
 
 
9
public class TestDb extends TestCase  {
 
10
    
 
11
    public void testDatasource () throws Exception{
 
12
        DB.init();
 
13
        assertNotNull(DB.datasource);
 
14
        Connection c = DB.datasource.getConnection();
 
15
        assertNotNull(c);
 
16
        c.close();
 
17
    }
 
18
    
 
19
    public void testNoReload () throws Exception{
 
20
        DB.init();
 
21
        DataSource ds = DB.datasource;
 
22
        DB.init();
 
23
        assertSame(DB.datasource, ds);
 
24
    }
 
25
    
 
26
    protected void setUp() throws Exception {
 
27
        Properties p = new Properties ();
 
28
        p.setProperty("db.driver", "org.hsqldb.jdbcDriver");
 
29
        p.setProperty("db.url", "jdbc:hsqldb:mem:aname");
 
30
        p.setProperty("db.user", "sa");
 
31
        p.setProperty("db.pass", "");
 
32
        Play.configuration=p;
 
33
    }
 
34
}