KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openi > project > JdbcDatasourceTest


1 /*********************************************************************************
2  * The contents of this file are subject to the OpenI Public License Version 1.0
3  * ("License"); You may not use this file except in compliance with the
4  * License. You may obtain a copy of the License at
5  * http://www.openi.org/docs/LICENSE.txt
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is: OpenI Open Source
12  *
13  * The Initial Developer of the Original Code is Loyalty Matrix, Inc.
14  * Portions created by Loyalty Matrix, Inc. are
15  * Copyright (C) 2005 Loyalty Matrix, Inc.; All Rights Reserved.
16  *
17  * Contributor(s): ______________________________________.
18  *
19  ********************************************************************************/

20 /*
21  * Created on Jun 8, 2005
22  *
23  * TODO To change the template for this generated file go to
24  * Window - Preferences - Java - Code Style - Code Templates
25  */

26 package org.openi.project;
27
28 import junit.framework.TestCase;
29 import org.apache.log4j.PropertyConfigurator;
30 import org.openi.test.Util;
31 import org.openi.xml.BeanStorage;
32
33
34 public class JdbcDatasourceTest extends TestCase {
35     private BeanStorage storage;
36
37     protected void setUp() throws Exception JavaDoc {
38         super.setUp();
39         this.storage = new BeanStorage();
40         PropertyConfigurator.configure(Util.findTestDirectory()
41             + "/log4jtest.properties");
42     }
43
44     public void testJdbcDatasourceCreate() throws Exception JavaDoc {
45         JdbcDatasource config = new JdbcDatasource();
46         config.setDriverClassName("net.sourceforge.jtds.jdbc.Driver");
47         config.setUrl("jdbc:jtds:sqlserver://moosehead.openi.local/mo_load");
48         config.setUsername("sa");
49         config.setPassword("foobar");
50         this.storage.saveBeanToFile(Util.findTestDirectory()
51             + "/loaddatabaseconfig.xml", config);
52     }
53 }
54
Popular Tags