Revision 2158
Added by Duane Costa over 20 years ago
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java | ||
---|---|---|
58 | 58 |
|
59 | 59 |
|
60 | 60 |
protected void setUp() { |
61 |
File configfile = new File("./lib/harvester", "harvester.properties"); |
|
62 | 61 |
Connection conn; |
63 | 62 |
String contactEmail = "jdoe@institution.edu"; |
64 | 63 |
String dateLastHarvest = "2004-04-01 00:00:00.0"; |
... | ... | |
77 | 76 |
int revision = 1; |
78 | 77 |
String scope = "docname"; |
79 | 78 |
int siteScheduleID = 1; |
79 |
boolean test = true; |
|
80 | 80 |
String unit = "months"; |
81 | 81 |
int updateFrequency = 1; |
82 | 82 |
|
83 | 83 |
harvester = new Harvester(); |
84 |
Harvester.loadProperties(configfile);
|
|
84 |
Harvester.loadOptions(test);
|
|
85 | 85 |
conn = harvester.getConnection(); // initializes the database connection |
86 | 86 |
harvester.initLogIDs(); |
87 | 87 |
harvestLogID = harvester.getHarvestLogID(); |
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java | ||
---|---|---|
28 | 28 |
package edu.ucsb.nceas.metacattest.harvesterClient; |
29 | 29 |
|
30 | 30 |
import edu.ucsb.nceas.metacat.harvesterClient.Harvester; |
31 |
import edu.ucsb.nceas.utilities.Options; |
|
31 | 32 |
import java.io.File; |
32 | 33 |
import java.io.FileInputStream; |
33 | 34 |
import java.io.IOException; |
34 |
import java.util.Properties; |
|
35 | 35 |
import junit.framework.Test; |
36 | 36 |
import junit.framework.TestCase; |
37 | 37 |
import junit.framework.TestSuite; |
... | ... | |
84 | 84 |
/** |
85 | 85 |
* Tests loading of Harvester properties from a configuration file. |
86 | 86 |
*/ |
87 |
public void testLoadProperties() { |
|
88 |
File configfile = new File("./lib/harvester", "harvester.properties"); |
|
89 |
Properties properties = new Properties(); |
|
90 |
|
|
91 |
try { |
|
92 |
properties.load(new FileInputStream(configfile)); |
|
93 |
} |
|
94 |
catch (IOException e) { |
|
95 |
fail("IOException: " + e.getMessage()); |
|
96 |
} |
|
87 |
public void testLoadOptions() { |
|
88 |
Options options; |
|
89 |
String ctm; |
|
90 |
boolean test = true; |
|
91 |
|
|
92 |
Harvester.loadOptions(test); |
|
93 |
options = Harvester.options; |
|
94 |
ctm = options.getOption("connectToMetacat"); |
|
95 |
assertTrue(ctm.equals("true") || ctm.equals("false")); |
|
97 | 96 |
} |
98 | 97 |
|
99 | 98 |
|
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java | ||
---|---|---|
57 | 57 |
|
58 | 58 |
|
59 | 59 |
protected void setUp() { |
60 |
File configfile = new File("./lib/harvester", "harvester.properties"); |
|
61 | 60 |
String contactEmail = "jdoe@institution.edu"; |
62 | 61 |
String dateLastHarvest = "2004-04-01 00:00:00.0"; |
63 | 62 |
String dateNextHarvest = "2004-05-01 00:00:00.0"; |
... | ... | |
78 | 77 |
String scope = "docname"; |
79 | 78 |
int siteScheduleID = 1; |
80 | 79 |
int status = 0; |
80 |
boolean test = true; |
|
81 | 81 |
String unit = "months"; |
82 | 82 |
int updateFrequency = 1; |
83 | 83 |
|
84 | 84 |
harvester = new Harvester(); |
85 |
Harvester.loadProperties(configfile);
|
|
85 |
Harvester.loadOptions(test);
|
|
86 | 86 |
harvester.getConnection(); // initializes the database connection |
87 | 87 |
harvester.initLogIDs(); |
88 | 88 |
harvester.setHarvestStartTime(new Date()); |
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java | ||
---|---|---|
34 | 34 |
import java.sql.SQLException; |
35 | 35 |
import java.sql.SQLWarning; |
36 | 36 |
import java.util.Date; |
37 |
import java.util.Properties; |
|
38 | 37 |
import edu.ucsb.nceas.metacat.harvesterClient.Harvester; |
39 | 38 |
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDetailLog; |
40 | 39 |
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument; |
... | ... | |
66 | 65 |
|
67 | 66 |
|
68 | 67 |
protected void setUp() { |
69 |
File configfile = new File("./lib/harvester", "harvester.properties"); |
|
70 | 68 |
String contactEmail = "jdoe@institution.edu"; |
71 | 69 |
String dateLastHarvest = "2004-04-01 00:00:00.0"; |
72 | 70 |
String dateNextHarvest = "2004-05-01 00:00:00.0"; |
... | ... | |
89 | 87 |
String scope = "docname"; |
90 | 88 |
int siteScheduleID = 1; |
91 | 89 |
int status = 0; |
90 |
boolean test = true; |
|
92 | 91 |
String unit = "months"; |
93 | 92 |
int updateFrequency = 1; |
94 | 93 |
|
95 | 94 |
harvester = new Harvester(); |
96 |
Harvester.loadProperties(configfile);
|
|
95 |
Harvester.loadOptions(test);
|
|
97 | 96 |
conn = harvester.getConnection(); // initializes the database connection |
98 | 97 |
harvester.initLogIDs(); |
99 | 98 |
harvestLogID = harvester.getHarvestLogID(); |
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
|
58 | 58 |
protected void setUp() { |
59 |
File configfile = new File("./lib/harvester", "harvester.properties"); |
|
60 | 59 |
String contactEmail = "jdoe@institution.edu"; |
61 | 60 |
String dateLastHarvest = "2004-04-01 00:00:00.0"; |
62 | 61 |
String dateNextHarvestFuture = "2056-01-01 00:00:00.0"; |
... | ... | |
66 | 65 |
String ldapDN = "uid=jdoe,o=lter,dc=ecoinformatics,dc=org"; |
67 | 66 |
String ldapPwd = "secretpassword"; |
68 | 67 |
int siteScheduleID = 1; |
68 |
boolean test = true; |
|
69 | 69 |
String unit = "months"; |
70 | 70 |
int updateFrequency = 1; |
71 | 71 |
|
72 | 72 |
harvester = new Harvester(); |
73 |
Harvester.loadProperties(configfile);
|
|
73 |
Harvester.loadOptions(test);
|
|
74 | 74 |
harvester.getConnection(); // initializes the database connection |
75 | 75 |
harvester.initLogIDs(); |
76 | 76 |
harvester.setHarvestStartTime(new Date()); |
Also available in: Unified diff
Revise test suite after moving Harvester properties to metacat.properties.