KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > admin > AdminTestCase


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: AdminTestCase.java,v $
31  * Revision 1.2 2005/04/09 17:19:11 colinmacleod
32  * Changed copyright text to GPL v2 explicitly.
33  *
34  * Revision 1.1.1.1 2005/03/10 17:50:14 colinmacleod
35  * Restructured ivata op around Hibernate/PicoContainer.
36  * Renamed ivata groupware.
37  *
38  * Revision 1.1 2004/07/13 19:41:17 colinmacleod
39  * Moved project to POJOs from EJBs.
40  * Applied PicoContainer to services layer (replacing session EJBs).
41  * Applied Hibernate to persistence layer (replacing entity EJBs).
42  * -----------------------------------------------------------------------------
43  */

44 package com.ivata.groupware.admin;
45
46 import java.io.File JavaDoc;
47 import java.util.Properties JavaDoc;
48
49 import net.sf.hibernate.HibernateException;
50 import net.sf.hibernate.cfg.Configuration;
51
52 import com.ivata.groupware.GroupwareTestCase;
53
54 /**
55  * @author Colin MacLeod
56  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
57  * @since Jun 7, 2004
58  * @version $Revision: 1.2 $
59  */

60 public abstract class AdminTestCase extends GroupwareTestCase {
61
62     /**
63      * @param hibernateConfiguration
64      * @param arg0
65      */

66     public AdminTestCase(String JavaDoc arg0) throws HibernateException {
67         super(getHibernateConfiguration(), arg0);
68     }
69
70     /**
71      * <p>
72      * Helper called by the constructor to create a valid hibernate
73      * configuration for all the address book's functionality.
74      * </p>
75      *
76      * @return valid hibernate configuration.
77      * @throws HibernateException
78      */

79     private static Configuration getHibernateConfiguration() throws HibernateException {
80         Configuration hibernateConfiguration = new Configuration();
81         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/admin/setting/SettingDO.hbm.xml"));
82         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/admin/security/user/UserDO.hbm.xml"));
83         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/address/AddressDO.hbm.xml"));
84         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/address/country/CountryDO.hbm.xml"));
85         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/person/PersonDO.hbm.xml"));
86         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/person/group/right/RightDO.hbm.xml"));
87         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/person/group/right/detail/RightDetailDO.hbm.xml"));
88         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/person/group/GroupDO.hbm.xml"));
89         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/person/employee/EmployeeDO.hbm.xml"));
90         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/business/addressbook/telecomaddress/TelecomAddressDO.hbm.xml"));
91         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/navigation/menu/MenuDO.hbm.xml"));
92         hibernateConfiguration.addFile(new File JavaDoc("../hibernate/target/xdoclet/hibernatedoclet/com/ivata/groupware/navigation/menu/item/MenuItemDO.hbm.xml"));
93
94         Properties JavaDoc hibernateProperties = new Properties JavaDoc();
95         hibernateProperties.setProperty("hibernate.connection.driver_class", "org.postgresql.Driver");
96         hibernateProperties.setProperty("hibernate.connection.URL", "jdbc:postgresql://localhost:5432/portal");
97         hibernateProperties.setProperty("hibernate.connection.username", "postgres");
98         hibernateProperties.setProperty("hibernate.connection.password", "");
99         hibernateProperties.setProperty("hibernate.dialect", "net.sf.hibernate.dialect.PostgreSQLDialect");
100         hibernateProperties.setProperty("hibernate.show_sql", "true");
101         hibernateConfiguration.setProperties(hibernateProperties);
102
103         return hibernateConfiguration;
104     }
105
106
107 }
108
Popular Tags