KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > TestHelper


1 package org.apache.ojb.broker;
2
3 /**
4  * Centralise the most important constants used in the test cases.
5  *
6  * @author <a HREF="mailto:armin@codeAuLait.de">Armin Waibel</a>
7  * @version $Id: TestHelper.java,v 1.3.4.1 2004/07/27 00:31:50 arminw Exp $
8  */

9 public class TestHelper
10 {
11     public static final String JavaDoc DEF_REPOSITORY = "repository.xml";
12
13     public static final String JavaDoc DEF_JCD_ALIAS = PersistenceBrokerFactory.getDefaultKey().getAlias();
14     public static final String JavaDoc DEF_USER = PersistenceBrokerFactory.getDefaultKey().getUser();
15     public static final String JavaDoc DEF_PASSWORD = PersistenceBrokerFactory.getDefaultKey().getPassword();
16     public static final String JavaDoc DEF_DATABASE_NAME;
17     static
18     {
19         DEF_DATABASE_NAME = buildDefDatabase();
20     }
21
22     public static final PBKey DEF_KEY = new PBKey(DEF_JCD_ALIAS, DEF_USER, DEF_PASSWORD);
23
24
25     public static final String JavaDoc FAR_AWAY_CONNECTION_REPOSITORY = "Test_ConnectionDescriptor.xml";
26     public static final String JavaDoc FAR_AWAY_JCD_ALIAS = "farAway";
27     public static final String JavaDoc FAR_AWAY_DATABASE_NAME = "farAway#sa#";
28     public static final PBKey FAR_AWAY_KEY = new PBKey(FAR_AWAY_JCD_ALIAS, "sa", "");
29
30     public static final String JavaDoc DATABASE_REPOSITORY = "repository_database.xml";
31
32
33     protected static String JavaDoc buildDefDatabase()
34     {
35         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
36         PBKey defKey = PersistenceBrokerFactory.getDefaultKey();
37         buf.append(defKey.getAlias());
38         if ((defKey.getUser() != null && !(defKey.getUser().trim().equals(""))))
39         {
40             buf.append("#" + defKey.getUser());
41         }
42         if (defKey.getPassword() != null) buf.append("#" + defKey.getPassword());
43         return buf.toString();
44     }
45 }
46
Popular Tags