Revision 4231
Added by daigle over 15 years ago
PropertyServiceTest.java | ||
---|---|---|
157 | 157 |
//====1 read a single property from the properties file that should exist |
158 | 158 |
debug("Test 1: read a single property from the properties file that should exist"); |
159 | 159 |
try { |
160 |
String metacatURL = PropertyService.getProperty("test.metacat.url");
|
|
160 |
String metacatURL = PropertyService.getProperty("test.metacatUrl");
|
|
161 | 161 |
debug("Test 1: read the metacatURL: " + metacatURL); |
162 | 162 |
} catch (PropertyNotFoundException pnfe) { |
163 | 163 |
fail("Test 1: Could not read property: metacatURL : " + pnfe.getMessage()); |
... | ... | |
196 | 196 |
// ====5 write property to main properties |
197 | 197 |
try { |
198 | 198 |
String testValue = "testing" + random.nextInt(); |
199 |
debug("Test 5: set property 'test.testproperty' : " + testValue);
|
|
200 |
PropertyService.setProperty("test.testproperty", testValue);
|
|
201 |
String testValue2 = PropertyService.getProperty("test.testproperty");
|
|
199 |
debug("Test 5: set property 'test.testProperty' : " + testValue);
|
|
200 |
PropertyService.setProperty("test.testProperty", testValue);
|
|
201 |
String testValue2 = PropertyService.getProperty("test.testProperty");
|
|
202 | 202 |
if (testValue.equals(testValue2)) { |
203 |
fail("Test 5: couldn't set 'test.testproperty' to " + testValue);
|
|
203 |
fail("Test 5: couldn't set 'test.testProperty' to " + testValue);
|
|
204 | 204 |
} |
205 | 205 |
} catch (PropertyNotFoundException pnfe) { |
206 |
fail("Test 5: Could not set property 'test.testproperty' : " + pnfe.getMessage());
|
|
206 |
fail("Test 5: Could not set property 'test.testProperty' : " + pnfe.getMessage());
|
|
207 | 207 |
} |
208 | 208 |
|
209 | 209 |
// ====6 set property and persist to main properties |
210 | 210 |
try { |
211 | 211 |
String testValue = "testing" + random.nextInt(); |
212 |
debug("Test 6: set property 'test.testproperty' : " + testValue);
|
|
213 |
PropertyService.setPropertyNoPersist("test.testproperty", testValue);
|
|
212 |
debug("Test 6: set property 'test.testProperty' : " + testValue);
|
|
213 |
PropertyService.setPropertyNoPersist("test.testProperty", testValue);
|
|
214 | 214 |
PropertyService.persistProperties(); |
215 |
String testValue2 = PropertyService.getProperty("test.testproperty");
|
|
215 |
String testValue2 = PropertyService.getProperty("test.testProperty");
|
|
216 | 216 |
if (testValue.equals(testValue2)) { |
217 |
fail("Test 6: couldn't set 'test.testproperty' to " + testValue);
|
|
217 |
fail("Test 6: couldn't set 'test.testProperty' to " + testValue);
|
|
218 | 218 |
} |
219 | 219 |
} catch (PropertyNotFoundException pnfe) { |
220 |
fail("Test 6: Could not set property 'test.testproperty' : " + pnfe.getMessage());
|
|
220 |
fail("Test 6: Could not set property 'test.testProperty' : " + pnfe.getMessage());
|
|
221 | 221 |
} |
222 | 222 |
|
223 | 223 |
|
Also available in: Unified diff
Convert properties to camel case