01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.config.schema;
05:
06: import org.apache.xmlbeans.XmlObject;
07:
08: import com.terracottatech.config.Client;
09: import com.terracottatech.config.TcConfigDocument.TcConfig;
10:
11: import java.io.File;
12:
13: /**
14: * Unit/subsystem test for {@link NewCommonL1ConfigObject}.
15: */
16: public class NewCommonL1ConfigObjectTest extends ConfigObjectTestBase {
17:
18: private NewCommonL1ConfigObject object;
19:
20: public void setUp() throws Exception {
21: super .setUp(Client.class);
22: this .object = new NewCommonL1ConfigObject(context());
23: }
24:
25: protected XmlObject getBeanFromTcConfig(TcConfig config)
26: throws Exception {
27: return config.getClients();
28: }
29:
30: public void testConstruction() throws Exception {
31: try {
32: new NewCommonL1ConfigObject(null);
33: fail("Didn't get NPE on no context");
34: } catch (NullPointerException npe) {
35: // ok
36: }
37: }
38:
39: public void testLogsPath() throws Exception {
40: addListeners(object.logsPath());
41:
42: String theString = object.logsPath().getFile().toString();
43: assertTrue(theString.startsWith("logs-"));
44: checkNoListener();
45:
46: builder().getClient().setLogs("foobar");
47: setConfig();
48: assertEquals(new File("foobar"), object.logsPath().getFile());
49: checkListener(new File(theString), new File("foobar"));
50: }
51:
52: }
|