1 4 package com.tc.config.schema; 5 6 import org.apache.xmlbeans.XmlObject; 7 8 import com.terracottatech.config.Server; 9 import com.terracottatech.config.TcConfigDocument.TcConfig; 10 11 import java.io.File ; 12 13 16 public class NewCommonL2ConfigObjectTest extends ConfigObjectTestBase { 17 18 private NewCommonL2ConfigObject object; 19 20 public void setUp() throws Exception { 21 super.setUp(Server.class); 22 this.object = new NewCommonL2ConfigObject(context()); 23 } 24 25 protected XmlObject getBeanFromTcConfig(TcConfig domainConfig) throws Exception { 26 return domainConfig.getServers().getServerArray(0); 27 } 28 29 public void testConstruction() throws Exception { 30 try { 31 new NewCommonL2ConfigObject(null); 32 fail("Didn't get NPE on no context"); 33 } catch (NullPointerException npe) { 34 } 36 } 37 38 public void testDataPath() throws Exception { 39 addListeners(object.dataPath()); 40 41 assertEquals(new File ("data"), object.dataPath().getFile()); 42 checkNoListener(); 43 44 builder().getServers().getL2s()[0].setData("foobar"); 45 setConfig(); 46 47 assertEquals(new File ("foobar"), object.dataPath().getFile()); 48 checkListener(new File ("data"), new File ("foobar")); 49 } 50 51 public void testLogsPath() throws Exception { 52 addListeners(object.logsPath()); 53 54 assertEquals(new File ("logs"), object.logsPath().getFile()); 55 checkNoListener(); 56 57 builder().getServers().getL2s()[0].setLogs("foobar"); 58 setConfig(); 59 60 assertEquals(new File ("foobar"), object.logsPath().getFile()); 61 checkListener(new File ("logs"), new File ("foobar")); 62 } 63 64 public void testJmxPort() throws Exception { 65 addListeners(object.jmxPort()); 66 67 assertEquals(9520, object.jmxPort().getInt()); 68 checkNoListener(); 69 70 builder().getServers().getL2s()[0].setJMXPort("3285"); 71 setConfig(); 72 73 assertEquals(3285, object.jmxPort().getInt()); 74 checkListener(new Integer (9520), new Integer (3285)); 75 } 76 77 } 78 | Popular Tags |