01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: TestRife.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife;
09:
10: import java.util.Locale;
11: import javax.naming.NamingException;
12: import junit.textui.TestRunner;
13: import org.postgresql.ds.PGSimpleDataSource;
14: import org.springframework.mock.jndi.SimpleNamingContextBuilder;
15:
16: public class TestRife {
17: public static void main(String[] args) {
18: // set the default locale to be English, otherwise some tests will
19: // fail in other contries or for other languages
20: Locale.setDefault(Locale.ENGLISH);
21:
22: // initialize a mock JNDI context
23: SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
24: PGSimpleDataSource pgdatasource = new PGSimpleDataSource();
25: pgdatasource.setDatabaseName("unittests");
26: pgdatasource.setServerName("localhost");
27: pgdatasource.setPortNumber(5432);
28: pgdatasource.setUser("unittests");
29: pgdatasource.setPassword("password");
30:
31: builder.bind("java:comp/env/jdbc/unittestspostgres",
32: pgdatasource);
33:
34: try {
35: builder.activate();
36: } catch (NamingException e) {
37: throw new RuntimeException(e);
38: }
39:
40: // run tests
41: TestRunner.run(TestRifeTests.suite());
42: }
43: }
|