KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > autodoc > v1 > testserver > Monitor


1 /*
2  * @(#)Monitor.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Part of the GroboUtils package at:
9  * 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
32 import java.util.Hashtable JavaDoc;
33
34
35 /**
36  * Monitors the state of multiple tests through the creation, retrieval, and
37  * sending to a server of the TestData for a specific test. Instances
38  * will be in charge of pooling together events from a {@link TestCorrelate}.
39  * <P>
40  * This class itself is not a singleton, but each framework implementation
41  * should have only one Monitor. Hence, this is called a "pseudo-singleton".
42  * <P>
43  * A Monitor may have multiple tests being tested at the same time. However,
44  * each test must be uniquely identifiable through a {@link TestInfo}; if two
45  * tests execute at the same time with the same <tt>TestInfo</tt>, the monitor
46  * will identify them as the same test. Uniqueness is guaranteed through the
47  * <tt>TestInfo</tt> instances.
48  *
49  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
50  * @since March 17, 2002
51  * @version $Date: 2003/02/10 22:52:13 $
52  */

53 public interface Monitor
54 {
55     /**
56      * Adds a new <tt>TestData</tt> instance related to the given
57      * <tt>TestInfo</tt>. If there already is a <tt>TestData</tt> for the
58      * given <tt>TestInfo</tt>, then an exception is thrown.
59      *
60      * @param info the unique test identifier to create a new <tt>TestData</tt>
61      * instance for.
62      * @exception IllegalStateException if <tt>info</tt> is already
63      * been added without having been sent.
64      * @exception IllegalArgumentException if <tt>info</tt> is <tt>null</tt>.
65      */

66     public void addTestData( TestInfo info );
67     
68     
69     /**
70      * Retrieves the data associated with the given <tt>TestInfo</tt>, as was
71      * created through {@link #addTestData( TestInfo )}. If the <tt>info</tt>
72      * was never passed to the add method, then an exception is thrown.
73      *
74      * @param info the unique test identifier.
75      * @return the data for the given <tt>info</tt>.
76      * @exception IllegalStateException if <tt>info</tt> has not been added,
77      * or has been removed through the send call.
78      * @exception IllegalArgumentException if <tt>info</tt> is <tt>null</tt>.
79      */

80     public TestData getTestData( TestInfo info );
81     
82     
83     /**
84      * Sends the <tt>TestData</tt> associated with <tt>info</tt> to the
85      * inner server, and removes the data from the inner cache. If the
86      * <tt>info</tt> has not been added, then an exception is thrown.
87      *
88      * @param info the unique test identifier
89      * @exception IllegalStateException if <tt>info</tt> has not been added,
90      * or has been removed through the send call.
91      * @exception IllegalArgumentException if <tt>info</tt> is <tt>null</tt>.
92      */

93     public void sendTestData( TestInfo info );
94 }
95
96
Popular Tags