1 /*
2 * File: Log4JFactoryTest.java
3 * Date: Dec 8, 2003
4 */
5 package com.rhi.architecture.logging;
6
7 import com.rhi.architecture.batch.*;
8
9 import java.util.*;
10
11 import junit.framework.*;
12
13 /***
14 * Log4JFactoryTest
15 *
16 * @author <a href="mailto:pete_mckinstry@yahoo.com">Pete McKinstry</a>
17 * @copyright 2003, All rights reserved.
18 */
19 public class Log4JFactoryTest extends TestCase {
20
21 private LogFactory factory;
22
23 /***
24 * Constructor for Log4JFactoryTest.
25 * @param arg0
26 */
27 public Log4JFactoryTest(String arg0) {
28 super(arg0);
29 }
30
31 /*
32 * @see TestCase#setUp()
33 */
34 protected void setUp() throws Exception {
35 super.setUp();
36 factory = LogFactory.getFactory(Log4JFactory.class.getName());
37 Properties p = new Properties();
38 p.setProperty(BasicLog4JFactory.LOG4J_PROPERTYFILE,
39 "example_log4j.properties");
40 p.setProperty(ApplicationConfig.PROG_NAME, "UT");
41 p.setProperty(Log4JFactory.FILE_APPENDER, "logfile");
42 p.setProperty(Log4JFactory.LOGFILE_PATH, ".");
43 p.setProperty(ApplicationConfig.ENVIRONMENT, "DEV");
44 factory.init(p);
45 }
46
47 /*
48 * @see TestCase#tearDown()
49 */
50 protected void tearDown() throws Exception {
51 super.tearDown();
52 }
53
54 /***
55 * test of Factory
56 * @throws Exception
57 */
58 public void testUsage() throws Exception {
59 Logger log = factory.getLogger(this.getClass());
60 log.debug("hello world");
61 }
62
63 /***
64 * test init()
65 * @throws Exception
66 */
67 public void testInit() throws Exception {
68 // no op. tested via setup()
69 }
70
71 /***
72 * suite of all tests
73 * @return Test
74 */
75 public static Test suite() {
76 return new TestSuite(Log4JFactoryTest.class);
77 }
78
79 /***
80 * main()
81 * @param args
82 */
83 public static void main(String[] args) {
84 junit.textui.TestRunner.run(suite());
85 }
86
87
88 }
This page was automatically generated by Maven