public void testSaveServers() throws Exception {
List theServers = new ArrayList();
CruisecontrolServer theNewServer = new CruisecontrolServer( new Element("server") );
theNewServer.setHost( "10.10.10.10" );
theNewServer.setName( "My New Server" );
theNewServer.setRmiPort( "21" );
theNewServer.setJmxPort( "10" );
assertEquals( "Host not set.", "10.10.10.10", theNewServer.getHost() );
assertEquals( "Name not set", "My New Server", theNewServer.getName() );
assertEquals( "Rmi port not set", "21", theNewServer.getRmiPort() );
assertEquals( "JMX port not set", "10", theNewServer.getJmxPort() );
theServers.add( theNewServer );
CruisecontrolServerManager.resetServers();
CruisecontrolServerManager.saveServers( theServers, "test-files/server_config2.xml" );
theServers = CruisecontrolServerManager.getServers( "test-files/server_config2.xml" );
assertEquals( "Server size not correct.", 1, theServers.size() );
theNewServer = (CruisecontrolServer) theServers.get(0);
assertEquals( "Host not set.", "10.10.10.10", theNewServer.getHost() );
assertEquals( "Name not set", "My New Server", theNewServer.getName() );
assertEquals( "Rmi port not set", "21", theNewServer.getRmiPort() );
assertEquals( "JMX port not set", "10", theNewServer.getJmxPort() );
theServers.remove( theNewServer );
CruisecontrolServerManager.removeServer( theNewServer );
CruisecontrolServerManager.saveServers( theServers, "test-files/server_config2.xml" );