KickJava   Java API By Example, From Geeks To Geeks.

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


1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testelement/OnErrorTestElement.java,v 1.4 2004/03/30 18:08:09 sebb Exp $
2
/*
3  * Copyright 2003-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 /*
20  * Created on Dec 9, 2003
21  *
22  */

23 package org.apache.jmeter.testelement;
24
25 import org.apache.jmeter.testelement.property.IntegerProperty;
26
27 /**
28  * @version $Revision: 1.4 $ $Date: 2004/03/30 18:08:09 $
29  */

30 public abstract class OnErrorTestElement extends AbstractTestElement
31 {
32     /* Action to be taken when a Sampler error occurs*/
33     public final static int ON_ERROR_CONTINUE = 0;
34     public final static int ON_ERROR_STOPTHREAD = 1;
35     public final static int ON_ERROR_STOPTEST = 2;
36
37     /* Property name */
38     public final static String JavaDoc ON_ERROR_ACTION = "OnError.action";
39
40     protected OnErrorTestElement()
41     {
42         super();
43     }
44     
45     public void setErrorAction(int value)
46     {
47         setProperty(new IntegerProperty(ON_ERROR_ACTION, value));
48     }
49
50     public int getErrorAction()
51     {
52         int value = getPropertyAsInt(ON_ERROR_ACTION);
53         return value;
54     }
55    
56     public boolean isContinue()
57     {
58         int value = getErrorAction();
59         return value == ON_ERROR_CONTINUE;
60     }
61
62     public boolean isStopThread()
63     {
64         int value = getErrorAction();
65         return value == ON_ERROR_STOPTHREAD;
66     }
67     
68     public boolean isStopTest()
69     {
70         int value = getErrorAction();
71         return value == ON_ERROR_STOPTEST;
72     }
73 }
74
Popular Tags