Clover coverage report -
Coverage timestamp: Do Okt 21 2004 12:21:23 CEST
file stats: LOC: 93   Methods: 6
NCLOC: 65   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ConfigServerTest.java - 0% 0% 0%
coverage
 1    /*
 2    * Created on 23.07.2003
 3    *
 4    * To change the template for this generated file go to
 5    * Window>Preferences>Java>Code Generation>Code and Comments
 6    */
 7    package org.jconfig.server;
 8   
 9    import java.io.File;
 10    import java.io.InputStream;
 11   
 12    import junit.framework.TestCase;
 13   
 14    import org.jconfig.Configuration;
 15    import org.jconfig.handler.ConfigServerHandler;
 16    import org.jconfig.utils.ConfigurationUtils;
 17    /**
 18    * test cases for the new category object
 19    * these tests are an extension of the existing test
 20    * cases used in the ConfigurationTest
 21    *
 22    * @since 2.2
 23    * @author Andreas Mecky <andreas.mecky@xcom.de>
 24    * @author Terry Dye <terry.dye@xcom.de>
 25    */
 26    public class ConfigServerTest extends TestCase {
 27   
 28    private static ConfigurationServer cs;
 29    private static final String URL = "jconfig://localhost:8766";
 30    /**
 31    * Constructor for CategoryTest.
 32    * @param arg0
 33    */
 34  0 public ConfigServerTest(String arg0) {
 35  0 super(arg0);
 36    }
 37   
 38  0 public static void main(String[] args) {
 39  0 File file = ConfigurationUtils.getFileFromInputStream("config.xml");
 40  0 String documentRoot = file.getPath();
 41  0 documentRoot = documentRoot.substring(0,documentRoot.indexOf("config.xml"));
 42  0 cs = new ConfigurationServer(8766,documentRoot);
 43  0 junit.textui.TestRunner.run(ConfigServerTest.class);
 44  0 cs.shutdown();
 45  0 System.exit(0);
 46    }
 47   
 48  0 public void setUp() throws Exception {
 49    }
 50   
 51  0 public void testStartServer() {
 52  0 java.net.URL jcfURL = null;
 53  0 InputStream is = null;
 54  0 try {
 55  0 ConfigServerHandler urlHandler = new ConfigServerHandler();
 56  0 urlHandler.setURL(URL+"/config");
 57  0 Configuration config = urlHandler.load();
 58  0 assertNotNull(config);
 59  0 assertEquals("testuser",config.getProperty("USER",null,"JDBC"));
 60    }
 61    catch ( Exception e ) {
 62  0 e.printStackTrace();
 63    }
 64    }
 65   
 66  0 public void testAnotherServer() {
 67  0 java.net.URL jcfURL = null;
 68  0 InputStream is = null;
 69  0 try {
 70  0 ConfigServerHandler urlHandler = new ConfigServerHandler();
 71  0 urlHandler.setURL(URL+"/serverconfig");
 72  0 Configuration config = urlHandler.load();
 73  0 assertNotNull(config);
 74  0 assertEquals("serveruser",config.getProperty("USER",null,"JDBC"));
 75    }
 76    catch ( Exception e ) {
 77  0 e.printStackTrace();
 78    }
 79    }
 80   
 81  0 public void testNoFileFound() {
 82  0 java.net.URL jcfURL = null;
 83  0 InputStream is = null;
 84  0 try {
 85  0 ConfigServerHandler urlHandler = new ConfigServerHandler();
 86  0 urlHandler.setURL(URL+"/memyselfandi");
 87  0 Configuration config = urlHandler.load();
 88  0 fail("exception expected");
 89    }
 90    catch ( Exception e ) {
 91    }
 92    }
 93    }