Revision 4382
Added by daigle about 16 years ago
test/edu/ucsb/nceas/MCTestCase.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import junit.framework.TestCase; |
29 | 29 |
|
30 |
import java.io.IOException; |
|
31 |
|
|
30 | 32 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
31 | 33 |
import edu.ucsb.nceas.metacat.service.ServiceException; |
32 | 34 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
35 |
import edu.ucsb.nceas.utilities.SortedProperties; |
|
33 | 36 |
|
34 | 37 |
/** |
35 | 38 |
* A base JUnit class for Metacat tests |
... | ... | |
48 | 51 |
|
49 | 52 |
static { |
50 | 53 |
try { |
51 |
PropertyService.getInstance("build/tests"); |
|
54 |
SortedProperties testProperties = |
|
55 |
new SortedProperties("build/tests/test.properties"); |
|
56 |
testProperties.load(); |
|
57 |
String metacatContextDir = testProperties.getProperty("metacat.contextDir"); |
|
58 |
PropertyService.getInstance(metacatContextDir + "/WEB-INF"); |
|
52 | 59 |
String printDebugString = PropertyService.getProperty("test.printdebug"); |
53 | 60 |
printDebug = Boolean.parseBoolean(printDebugString); |
61 |
} catch (IOException ioe) { |
|
62 |
System.err.println("Could not read property file in static block: " |
|
63 |
+ ioe.getMessage()); |
|
54 | 64 |
} catch (PropertyNotFoundException pnfe) { |
55 | 65 |
System.err.println("Could not get property in static block: " |
56 | 66 |
+ pnfe.getMessage()); |
build.xml | ||
---|---|---|
866 | 866 |
<include name="edu/**"/> |
867 | 867 |
</fileset> |
868 | 868 |
</copy> |
869 |
<copy todir="${build.tests}" file="lib/metacat.properties" filtering="yes"/> |
|
870 |
<copy todir="${build.tests}" file="lib/metacat.properties.metadata.xml" filtering="yes"/> |
|
871 |
<copy todir="${build.tests}" file="lib/org.properties.metadata.xml" filtering="yes"/> |
|
872 |
<copy todir="${build.tests}" file="lib/ldap.properties.metadata.xml" filtering="yes"/> |
|
869 |
<copy todir="${build.tests}" file="${testdir}/test.properties" filtering="yes"/> |
|
873 | 870 |
|
874 | 871 |
<!-- copy and compile the tests into a jar file --> |
875 | 872 |
<javac srcdir="${build.tests}" |
Also available in: Unified diff
Have test cases read properties from configured metacat.properties file.