KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > testelement > TestElement


1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testelement/TestElement.java,v 1.12.2.1 2004/09/20 11:57:44 sebb Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.testelement;
20
21 import org.apache.jmeter.testelement.property.JMeterProperty;
22 import org.apache.jmeter.testelement.property.PropertyIterator;
23 import org.apache.jmeter.threads.JMeterContext;
24
25 /**
26  * @author Michael Stover
27  * @version $Revision: 1.12.2.1 $
28  */

29
30 public interface TestElement extends Cloneable JavaDoc
31 {
32     public final static String JavaDoc NAME = "TestElement.name";
33     public final static String JavaDoc GUI_CLASS = "TestElement.gui_class";
34     public final static String JavaDoc ENABLED = "TestElement.enabled";
35     public final static String JavaDoc TEST_CLASS = "TestElement.test_class";
36
37     public void addTestElement(TestElement child);
38     
39     public void setProperty(String JavaDoc key,String JavaDoc value);
40     
41     /**
42      * Returns true or false whether the element is the running version.
43      */

44     public boolean isRunningVersion();
45     
46     /**
47      * Test whether a given property is only a temporary resident of the TestElement
48      * @param property
49      * @return
50      * boolean
51      */

52     public boolean isTemporary(JMeterProperty property);
53     
54     /**
55      * Indicate that the given property should be only a temporary property in the TestElement
56      * @param property
57      * void
58      */

59     public void setTemporary(JMeterProperty property);
60     
61     /**
62      * Return a property as a boolean value.
63      */

64     public boolean getPropertyAsBoolean(String JavaDoc key);
65     
66     public long getPropertyAsLong(String JavaDoc key);
67     
68     public int getPropertyAsInt(String JavaDoc key);
69     
70     public float getPropertyAsFloat(String JavaDoc key);
71     
72     /**
73      * Make the test element the running version, or make it no longer the
74      * running version. This tells the test element that it's current state must
75      * be retrievable by a call to recoverRunningVersion(). It is kind of like
76      * making the TestElement Read- Only, but not as strict. Changes can be
77      * made and the element can be modified, but the state of the element at the
78      * time of the call to setRunningVersion() must be recoverable.
79      */

80     public void setRunningVersion(boolean run);
81     
82     /**
83      * Tells the test element to return to the state it was in when
84      * makeRunningVersion() was called.
85      */

86     public void recoverRunningVersion();
87     
88     /**
89      * Clear the TestElement of all data.
90      */

91     public void clear();
92
93     public String JavaDoc getPropertyAsString(String JavaDoc key);
94     
95     /**
96      * Sets and overwrites a property in the TestElement. This call will be
97      * ignored if the TestElement is currently a "running version".
98      */

99     public void setProperty(JMeterProperty property);
100     
101     /**
102      * Given the name of the property, returns the appropriate property from
103      * JMeter. If it is null, a NullProperty object will be returned.
104      */

105     public JMeterProperty getProperty(String JavaDoc propName);
106     
107     /**
108      * Get a Property Iterator for the TestElements properties.
109      * @return PropertyIterator
110      */

111     public PropertyIterator propertyIterator();
112
113     public void removeProperty(String JavaDoc key);
114
115     //lifecycle methods
116

117     public Object JavaDoc clone();
118     
119     /**
120      * Convenient way to traverse a test element.
121      */

122     public void traverse(TestElementTraverser traverser);
123     
124     /**
125      * @return Returns the threadContext.
126      */

127     public JMeterContext getThreadContext();
128     
129     /**
130      * @param threadContext The threadContext to set.
131      */

132     public void setThreadContext(JMeterContext threadContext);
133
134     /**
135      * @return Returns the threadName.
136      */

137     public String JavaDoc getThreadName();
138     
139     /**
140      * @param threadName The threadName to set.
141      */

142     public void setThreadName(String JavaDoc threadName);
143
144     /**
145      * Called at the start of each thread.
146      * TODO - should it hava a parameter?
147      */

148     public void threadStarted();
149
150     /**
151      * Called at the end of each thread.
152      * TODO - should it hava a parameter?
153      */

154     public void threadFinished();
155     
156     /**
157      * Called by Remove to determine if it is
158      * safe to remove the element.
159      * The element can either clean itself up, and return true,
160      * or the element can return false.
161      * @return true if safe to remove the element
162      */

163     public boolean canRemove();
164 }
165
Popular Tags