01: /*
02: * This software is released under a licence similar to the Apache Software Licence.
03: * See org.logicalcobwebs.proxool.package.html for details.
04: * The latest version is available at http://proxool.sourceforge.net
05: */
06: package org.logicalcobwebs.proxool;
07:
08: import org.apache.commons.logging.Log;
09: import org.apache.commons.logging.LogFactory;
10:
11: /**
12: * A ResultMonitor specifically for State
13: *
14: * @version $Revision: 1.4 $, $Date: 2006/01/18 14:40:06 $
15: * @author bill
16: * @author $Author: billhorsman $ (current maintainer)
17: * @since Proxool 0.8
18: */
19: public class StateResultMonitor extends ResultMonitor implements
20: StateListenerIF {
21:
22: private static final Log LOG = LogFactory
23: .getLog(StateResultMonitor.class);
24:
25: private int upState;
26:
27: private int expectedUpState;
28:
29: /**
30: * waits for statistics
31: * @return {@link #SUCCESS} or {@link #TIMEOUT}
32: * @throws Exception if anything goes wrong
33: */
34: public boolean check() throws Exception {
35: return (upState == expectedUpState);
36: }
37:
38: public void upStateChanged(int upState) {
39: this .upState = upState;
40: }
41:
42: public void setExpectedUpState(int expectedUpState) {
43: this .expectedUpState = expectedUpState;
44: }
45:
46: }
47:
48: /*
49: Revision history:
50: $Log: StateResultMonitor.java,v $
51: Revision 1.4 2006/01/18 14:40:06 billhorsman
52: Unbundled Jakarta's Commons Logging.
53:
54: Revision 1.3 2003/03/04 10:24:40 billhorsman
55: removed try blocks around each test
56:
57: Revision 1.2 2003/03/03 11:12:05 billhorsman
58: fixed licence
59:
60: Revision 1.1 2003/03/02 00:37:23 billhorsman
61: more robust
62:
63: Revision 1.5 2003/03/01 18:17:50 billhorsman
64: arrffgh. fix,
65:
66: Revision 1.4 2003/03/01 16:53:07 billhorsman
67: fix
68:
69: Revision 1.3 2003/03/01 16:38:40 billhorsman
70: fix
71:
72: Revision 1.2 2003/03/01 16:18:31 billhorsman
73: fix
74:
75: Revision 1.1 2003/03/01 16:07:26 billhorsman
76: helper
77:
78: Revision 1.3 2003/03/01 15:27:24 billhorsman
79: checkstyle
80:
81: Revision 1.2 2003/03/01 15:22:50 billhorsman
82: doc
83:
84: Revision 1.1 2003/03/01 15:14:14 billhorsman
85: new ResultMonitor to help cope with test threads
86:
87: */
|