KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > timers > ConstantTimer


1 // $Header: /home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/timers/ConstantTimer.java,v 1.17 2004/02/13 03:46:14 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.timers;
20
21 import java.io.Serializable JavaDoc;
22
23 import org.apache.jmeter.engine.event.LoopIterationEvent;
24 import org.apache.jmeter.engine.event.LoopIterationListener;
25 import org.apache.jmeter.testelement.AbstractTestElement;
26 import org.apache.jmeter.util.JMeterUtils;
27
28 /**
29  * This class implements a constant timer with its own panel and fields for
30  * value update and user interaction.
31  *
32  * @author <a HREF="mailto:stefano@apache.org">Stefano Mazzocchi</a>
33  * @author <a HREF="mailto:seade@backstagetech.com.au">Scott Eade</a>
34  * @version $Revision: 1.17 $ $Date: 2004/02/13 03:46:14 $
35  */

36 public class ConstantTimer
37     extends AbstractTestElement
38     implements Timer, Serializable JavaDoc, LoopIterationListener
39 {
40
41     public final static String JavaDoc DELAY = "ConstantTimer.delay";
42     private long delay = 0;
43
44     /**
45      * No-arg constructor.
46      */

47     public ConstantTimer()
48     {
49     }
50
51     /**
52      * Set the delay for this timer.
53      *
54      */

55     public void setDelay(String JavaDoc delay)
56     {
57         setProperty(DELAY, delay);
58     }
59
60     /**
61      * Set the range (not used for this timer).
62      *
63      */

64     public void setRange(double range)
65     {
66     }
67
68     /**
69      * Get the delay value for display.
70      *
71      * @return the delay value for display.
72      */

73     public String JavaDoc getDelay()
74     {
75         return getPropertyAsString(DELAY);
76     }
77
78     /**
79      * Retrieve the range (not used for this timer).
80      *
81      * @return the range (always zero for this timer).
82      */

83     public double getRange()
84     {
85         return (double) 0;
86     }
87
88     /**
89      * Retrieve the delay to use during test execution.
90      *
91      * @return the delay.
92      */

93     public long delay()
94     {
95         return delay;
96     }
97
98     /**
99      * Provide a description of this timer class.
100      *
101      * @return the description of this timer class.
102      */

103     public String JavaDoc toString()
104     {
105         return JMeterUtils.getResString("constant_timer_memo");
106     }
107
108     /**
109      * Gain access to any variables that have been defined.
110      *
111      * @see LoopIterationListener#iterationStart(LoopIterationEvent)
112      */

113     public void iterationStart(LoopIterationEvent event)
114     {
115         delay = getPropertyAsLong(DELAY);
116         
117     }
118
119     /* This method doesn't appear to be used anymore.
120      * jeremy_a@bigfoot.com 02 May 2003
121      *
122      * Make changes to variables available elsewhere.
123      *
124      * @see ThreadListener#setJMeterVariables(JMeterVariables)
125     public void setJMeterVariables(JMeterVariables jmVars)
126     {
127         //vars.addJMeterVariables(jmVars);
128     }
129      */

130
131 }
132
Popular Tags