01: package com.caucho.netbeans;
02:
03: import junit.framework.TestCase;
04:
05: public class ResinConfigurationTest extends TestCase {
06: public void testParseURI() {
07: uriTest("resin:home=/bar", "resin:home=/bar");
08:
09: uriTest(
10: "resin:home=/resin/home:conf=/conf/resin.conf:server-id=:server-i:server-port=9999:server-address=127.0.0.2",
11: "resin:home=/resin/home:conf=/conf/resin.conf:server-id=:server-i:server-port=9999:server-address=127.0.0.2");
12:
13: uriTest("resin:home=/resin/home:conf=/conf/resin.conf",
14: "resin:home=/resin/home:conf=/conf/resin.conf");
15:
16: uriTest("resin:home=/resin/home:conf=conf/resin.conf",
17: "resin:home=/resin/home:conf=/resin/home/conf/resin.conf");
18:
19: boolean isException = false;
20: try {
21: uriTest("resin:home=:conf=conf/resin.conf",
22: "resin:home=:conf=conf/resin.conf");
23: } catch (IllegalArgumentException ex) {
24: isException = true;
25: assertEquals(
26: "problem parsing URI 'resin:home=:conf=conf/resin.conf': java.lang.IllegalArgumentException: no resin-home set for relative conf conf/resin.conf",
27: ex.getMessage());
28:
29: }
30:
31: assertTrue(isException);
32: }
33:
34: private static void uriTest(String uri, String compare) {
35: ResinConfiguration configuration = new ResinConfiguration();
36: configuration.parseURI(uri);
37:
38: assertEquals(configuration.getURI(), compare);
39: }
40: }
|