01: package org.apache.ojb.broker;
02:
03: /**
04: * Centralise the most important constants used in the test cases.
05: *
06: * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
07: * @version $Id: TestHelper.java,v 1.3.4.1 2004/07/27 00:31:50 arminw Exp $
08: */
09: public class TestHelper {
10: public static final String DEF_REPOSITORY = "repository.xml";
11:
12: public static final String DEF_JCD_ALIAS = PersistenceBrokerFactory
13: .getDefaultKey().getAlias();
14: public static final String DEF_USER = PersistenceBrokerFactory
15: .getDefaultKey().getUser();
16: public static final String DEF_PASSWORD = PersistenceBrokerFactory
17: .getDefaultKey().getPassword();
18: public static final String DEF_DATABASE_NAME;
19: static {
20: DEF_DATABASE_NAME = buildDefDatabase();
21: }
22:
23: public static final PBKey DEF_KEY = new PBKey(DEF_JCD_ALIAS,
24: DEF_USER, DEF_PASSWORD);
25:
26: public static final String FAR_AWAY_CONNECTION_REPOSITORY = "Test_ConnectionDescriptor.xml";
27: public static final String FAR_AWAY_JCD_ALIAS = "farAway";
28: public static final String FAR_AWAY_DATABASE_NAME = "farAway#sa#";
29: public static final PBKey FAR_AWAY_KEY = new PBKey(
30: FAR_AWAY_JCD_ALIAS, "sa", "");
31:
32: public static final String DATABASE_REPOSITORY = "repository_database.xml";
33:
34: protected static String buildDefDatabase() {
35: StringBuffer buf = new StringBuffer();
36: PBKey defKey = PersistenceBrokerFactory.getDefaultKey();
37: buf.append(defKey.getAlias());
38: if ((defKey.getUser() != null && !(defKey.getUser().trim()
39: .equals("")))) {
40: buf.append("#" + defKey.getUser());
41: }
42: if (defKey.getPassword() != null)
43: buf.append("#" + defKey.getPassword());
44: return buf.toString();
45: }
46: }
|