KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jtests > jms > framework > TestConfig


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2002 INRIA
4  * Contact: joram-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): Jeff Mesnil (jmesnil@inrialpes.fr)
22  * Contributor(s): ______________________________________.
23  */

24
25 package org.objectweb.jtests.jms.framework;
26 import java.util.Properties JavaDoc;
27
28 /**
29  * Class used to provide configurable options in a convenient way
30  *
31  * @author Jeff Mesnil (jmesnil@inrialpes.fr)
32  * @version $Id: TestConfig.java,v 1.3 2002/04/16 12:08:39 joram Exp $
33  */

34 public class TestConfig {
35
36     // name of the configuration file
37
private static final String JavaDoc PROP_FILE_NAME = "test.properties";
38
39     // name of the timeout property
40
private static final String JavaDoc PROP_NAME = "timeout";
41
42     /**
43      * timeout value used by <code>receive</code> method in the tests.
44      * the value is specified in the <code>config/test.properties</code> file.
45      */

46     public static final long TIMEOUT;
47     
48     static {
49     // load tests.properties
50
long tempTimeOut = 0;
51     try {
52         Properties JavaDoc props = new Properties JavaDoc();
53         props.load(ClassLoader.getSystemResourceAsStream(PROP_FILE_NAME));
54         props.list(System.out);
55         tempTimeOut = Long.parseLong(props.getProperty(PROP_NAME, "0"));
56     } catch (Exception JavaDoc e) {
57         tempTimeOut = 0;
58     } finally {
59         TIMEOUT = tempTimeOut;
60     }
61     }
62 }
63
Popular Tags