1 7 package net.sourceforge.cruisecontrol.jmx; 8 9 import junit.framework.TestCase; 10 import net.sourceforge.cruisecontrol.CruiseControlController; 11 import net.sourceforge.cruisecontrol.CruiseControlException; 12 13 16 public class CruiseControlControllerJMXAdaptorTest extends TestCase { 17 18 private CruiseControlControllerJMXAdaptor adaptor; 19 20 protected void setUp() throws Exception { 21 super.setUp(); 22 23 adaptor = new CruiseControlControllerJMXAdaptor(new CruiseControlController()); 24 } 25 26 public void testInvalid() throws Exception { 27 try { 28 StringBuffer sb = new StringBuffer (); 29 sb.append("<cruisecontrol>"); 30 sb.append("<project name=\"test\" foo=\"foo\"></project>"); 31 sb.append("</cruisecontrol>"); 32 33 adaptor.validateConfig(sb.toString()); 34 fail("No exception found"); 35 } catch (CruiseControlException cce) { 36 } 38 } 39 40 public void testValid() throws Exception { 41 try { 42 StringBuffer sb = new StringBuffer (); 43 sb.append("<cruisecontrol>"); 44 sb.append("<project name=\"test\">"); 45 sb.append("<modificationset><cvs localworkingcopy=\".\"/></modificationset>"); 46 sb.append("<schedule><ant/></schedule>"); 47 sb.append("</project>"); 48 sb.append("</cruisecontrol>"); 49 50 adaptor.validateConfig(sb.toString()); 51 52 } catch (CruiseControlException cce) { 53 fail("Validation failed on valid config, reason: " + cce.getMessage()); 54 } 55 } 56 } 57 | Popular Tags |