1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package kortsoft.kmx.bootstrap;
17
18 import java.io.IOException;
19 import java.io.InputStream;
20 import java.net.URL;
21 import java.util.Properties;
22
23 import junit.framework.TestCase;
24
25 /***
26 * <a href="MockKmxMain.java.html"><b><i>View Source</i></b></a>
27 *
28 * @author Alvaro
29 * @version $Revision: 1.1 $
30 *
31 */
32 public class MockKmxMain implements KmxMain {
33 public static boolean startup=false;
34 public static boolean closed=false;
35 public static final String TEST_PROPERTY_FILE="test.properties";
36 public static final String TEST_PROPERTY="test_property";
37 public static final String TEST_PROPERTY_VALUE="test_property_value";
38
39 public MockKmxMain(){
40 super();
41 }
42
43
44
45 public void startup(Properties prop) {
46 System.out.println("Startup Called");
47 startup=true;
48
49 Properties testProperties=new Properties();
50 URL propURL=Thread.currentThread().getContextClassLoader().getResource(TEST_PROPERTY_FILE);
51 InputStream propIs=null;
52 try {
53 propIs = propURL.openStream();
54 testProperties.load(propIs);
55 } catch (IOException e) {
56 TestCase.fail("Error loading test properties from classpath: "+e);
57 } finally {
58 if (propIs!=null) try {propIs.close();} catch (IOException e1) {}
59 }
60 }
61
62
63
64
65 public void closeServices() {
66 closed=true;
67 }
68
69 }