KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > NewCommonL1ConfigObjectTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema;
5
6 import org.apache.xmlbeans.XmlObject;
7
8 import com.terracottatech.config.Client;
9 import com.terracottatech.config.TcConfigDocument.TcConfig;
10
11 import java.io.File JavaDoc;
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 JavaDoc {
21     super.setUp(Client.class);
22     this.object = new NewCommonL1ConfigObject(context());
23   }
24
25   protected XmlObject getBeanFromTcConfig(TcConfig config) throws Exception JavaDoc {
26     return config.getClients();
27   }
28
29   public void testConstruction() throws Exception JavaDoc {
30     try {
31       new NewCommonL1ConfigObject(null);
32       fail("Didn't get NPE on no context");
33     } catch (NullPointerException JavaDoc npe) {
34       // ok
35
}
36   }
37
38   public void testLogsPath() throws Exception JavaDoc {
39     addListeners(object.logsPath());
40
41     String JavaDoc theString = object.logsPath().getFile().toString();
42     assertTrue(theString.startsWith("logs-"));
43     checkNoListener();
44
45     builder().getClient().setLogs("foobar");
46     setConfig();
47     assertEquals(new File JavaDoc("foobar"), object.logsPath().getFile());
48     checkListener(new File JavaDoc(theString), new File JavaDoc("foobar"));
49   }
50
51 }
52
Popular Tags