Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2008 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis
5
 *  Purpose: To test the Access Controls in metacat by JUnit
6
 *
7
 *   '$Author: daigle $'
8
 *     '$Date: 2008-09-16 13:38:32 -0700 (Tue, 16 Sep 2008) $'
9
 * '$Revision: 4355 $'
10
 *
11
 * This program is free software; you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by
13
 * the Free Software Foundation; either version 2 of the License, or
14
 * (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24
 */
25

    
26
package edu.ucsb.nceas;
27

    
28
import junit.framework.TestCase;
29

    
30
import edu.ucsb.nceas.metacat.service.PropertyService;
31
import edu.ucsb.nceas.metacat.service.ServiceException;
32
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
33

    
34
/**
35
 * A base JUnit class for Metacat tests
36
 */
37
public class MCTestCase
38
    extends TestCase {
39
	
40
    private static boolean printDebug = false;
41
    
42
	protected static String EML2_0_0 = "EML2_0_0";
43
	protected static String EML2_0_1 = "EML2_0_1";
44
	protected static String EML2_1_0 = "EML2_1_0";
45
	
46
	protected boolean SUCCESS = true;
47
	protected boolean FAILURE = false;
48

    
49
	static {
50
		try {
51
			PropertyService.getInstance("build/tests");
52
		    String printDebugString = PropertyService.getProperty("test.printdebug");
53
		    printDebug = Boolean.parseBoolean(printDebugString);
54
		} catch (PropertyNotFoundException pnfe) {
55
			System.err.println("Could not get property in static block: " 
56
					+ pnfe.getMessage());
57
		} catch (ServiceException se) {
58
			System.err.println("Could not get PropertyService instance in static block: " 
59
					+ se.getMessage());
60
		}
61
	}
62

    
63
    /**
64
     * Constructor to build the test
65
     */
66
    public MCTestCase() {
67
        super();
68
    }
69
	
70
    /**
71
     * Constructor to build the test
72
     *
73
     * @param name the name of the test method
74
     */
75
    public MCTestCase(String name) {
76
        super(name);
77
    }
78
    
79
    protected static void debug(String debugMessage) {
80
    	if (printDebug) {
81
    		System.err.println(debugMessage);
82
    	}
83
    }
84
}
    (1-1/1)