01: /*
02: * @(#)Monitor.java
03: *
04: * Copyright (C) 2002-2003 Matt Albrecht
05: * groboclown@users.sourceforge.net
06: * http://groboutils.sourceforge.net
07: *
08: * Part of the GroboUtils package at:
09: * http://groboutils.sourceforge.net
10: *
11: * Permission is hereby granted, free of charge, to any person obtaining a
12: * copy of this software and associated documentation files (the "Software"),
13: * to deal in the Software without restriction, including without limitation
14: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15: * and/or sell copies of the Software, and to permit persons to whom the
16: * Software is furnished to do so, subject to the following conditions:
17: *
18: * The above copyright notice and this permission notice shall be included in
19: * all copies or substantial portions of the Software.
20: *
21: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27: * DEALINGS IN THE SOFTWARE.
28: */
29: package net.sourceforge.groboutils.autodoc.v1.testserver;
30:
31: import java.util.Hashtable;
32:
33: /**
34: * Monitors the state of multiple tests through the creation, retrieval, and
35: * sending to a server of the TestData for a specific test. Instances
36: * will be in charge of pooling together events from a {@link TestCorrelate}.
37: * <P>
38: * This class itself is not a singleton, but each framework implementation
39: * should have only one Monitor. Hence, this is called a "pseudo-singleton".
40: * <P>
41: * A Monitor may have multiple tests being tested at the same time. However,
42: * each test must be uniquely identifiable through a {@link TestInfo}; if two
43: * tests execute at the same time with the same <tt>TestInfo</tt>, the monitor
44: * will identify them as the same test. Uniqueness is guaranteed through the
45: * <tt>TestInfo</tt> instances.
46: *
47: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
48: * @since March 17, 2002
49: * @version $Date: 2003/02/10 22:52:13 $
50: */
51: public interface Monitor {
52: /**
53: * Adds a new <tt>TestData</tt> instance related to the given
54: * <tt>TestInfo</tt>. If there already is a <tt>TestData</tt> for the
55: * given <tt>TestInfo</tt>, then an exception is thrown.
56: *
57: * @param info the unique test identifier to create a new <tt>TestData</tt>
58: * instance for.
59: * @exception IllegalStateException if <tt>info</tt> is already
60: * been added without having been sent.
61: * @exception IllegalArgumentException if <tt>info</tt> is <tt>null</tt>.
62: */
63: public void addTestData(TestInfo info);
64:
65: /**
66: * Retrieves the data associated with the given <tt>TestInfo</tt>, as was
67: * created through {@link #addTestData( TestInfo )}. If the <tt>info</tt>
68: * was never passed to the add method, then an exception is thrown.
69: *
70: * @param info the unique test identifier.
71: * @return the data for the given <tt>info</tt>.
72: * @exception IllegalStateException if <tt>info</tt> has not been added,
73: * or has been removed through the send call.
74: * @exception IllegalArgumentException if <tt>info</tt> is <tt>null</tt>.
75: */
76: public TestData getTestData(TestInfo info);
77:
78: /**
79: * Sends the <tt>TestData</tt> associated with <tt>info</tt> to the
80: * inner server, and removes the data from the inner cache. If the
81: * <tt>info</tt> has not been added, then an exception is thrown.
82: *
83: * @param info the unique test identifier
84: * @exception IllegalStateException if <tt>info</tt> has not been added,
85: * or has been removed through the send call.
86: * @exception IllegalArgumentException if <tt>info</tt> is <tt>null</tt>.
87: */
88: public void sendTestData(TestInfo info);
89: }
|