Source Code Cross Referenced for ParamMask.java in  » Testing » jakarta-jmeter » org » apache » jmeter » protocol » http » modifier » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » jakarta jmeter » org.apache.jmeter.protocol.http.modifier 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *   http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         * 
017:         */
018:
019:        package org.apache.jmeter.protocol.http.modifier;
020:
021:        import java.io.Serializable;
022:
023:        import org.apache.jmeter.testelement.AbstractTestElement;
024:        import org.apache.jmeter.testelement.property.LongProperty;
025:
026:        /**
027:         * This object defines with what a parameter has its value replaced, and the
028:         * policies for how that value changes. Used in {@link ParamModifier}.
029:         * 
030:         * @author David La France
031:         * @author <a href="mailto:seade@backstagetech.com.au">Scott Eade</a>
032:         * @version $Revision: 493789 $ updated on $Date: 2007-01-07 18:10:21 +0000 (Sun, 07 Jan 2007) $
033:         */
034:        public class ParamMask extends AbstractTestElement implements 
035:                Serializable {
036:            private String PREFIX = "ParamModifier.prefix";
037:
038:            private String FIELD_NAME = "ParamModifier.field_name";
039:
040:            private String UPPER_BOUND = "ParamModifier.upper_bound";
041:
042:            private String LOWER_BOUND = "ParamModifier.lower_bound";
043:
044:            private String INCREMENT = "ParamModifier.increment";
045:
046:            private String SUFFIX = "ParamModifier.suffix";
047:
048:            private long _value = 0;
049:
050:            /**
051:             * Default constructor.
052:             */
053:            public ParamMask() {
054:                setFieldName("");
055:                setPrefix("");
056:                setLowerBound(0);
057:                setUpperBound(0);
058:                setIncrement(0);
059:                setSuffix("");
060:            }
061:
062:            /**
063:             * Sets the prefix for the <code>long</code> value. The prefix, the value
064:             * and the suffix are concatenated to give the parameter value. This allows
065:             * a wider range of posibilities for the parameter values.
066:             * 
067:             * @param prefix
068:             *            a string to prefix to the parameter value
069:             */
070:            public void setPrefix(String prefix) {
071:                setProperty(PREFIX, prefix);
072:            }
073:
074:            /**
075:             * Set the current value of the <code>long<code> portion of the parameter
076:             * value to replace. This is usually not used, as the method
077:             * {@link #resetValue} is used to define a policy for the starting value.
078:             *
079:             * @param  val  the new parameter value
080:             */
081:            public void setValue(long val) {
082:                _value = val;
083:            }
084:
085:            public void setFieldName(String fieldName) {
086:                setProperty(FIELD_NAME, fieldName);
087:            }
088:
089:            /**
090:             * Sets the lowest possible value that the <code>long</code> portion of
091:             * the parameter value may be.
092:             * 
093:             * @param val
094:             *            the new lowest possible parameter value
095:             */
096:            public void setLowerBound(long val) {
097:                setProperty(new LongProperty(LOWER_BOUND, val));
098:            }
099:
100:            /**
101:             * Sets the highest possible value that the <code>long</code> portion of
102:             * the parameter value may be.
103:             * 
104:             * @param val
105:             *            the new highest possible parameter value
106:             */
107:            public void setUpperBound(long val) {
108:                setProperty(new LongProperty(UPPER_BOUND, val));
109:            }
110:
111:            /**
112:             * Sets the number by which the parameter value is incremented between
113:             * loops.
114:             * 
115:             * @param incr
116:             *            the new increment for the parameter value
117:             */
118:            public void setIncrement(long incr) {
119:                setProperty(new LongProperty(INCREMENT, incr));
120:            }
121:
122:            /**
123:             * Sets the suffix for the <code>long</code> value. The prefix, the value
124:             * and the suffix are concatenated to give the parameter value. This allows
125:             * a wider range of posibilities for the parameter values.
126:             * 
127:             * @param suffix
128:             *            a string to suffix to the parameter value
129:             */
130:            public void setSuffix(String suffix) {
131:                setProperty(SUFFIX, suffix);
132:            }
133:
134:            /**
135:             * Accessor method to return the <code>String</code> that will be prefixed
136:             * to the <code>long</code> value.
137:             * 
138:             * @return the parameter value prefix
139:             */
140:            public String getPrefix() {
141:                return getPropertyAsString(PREFIX);
142:            }
143:
144:            /**
145:             * Accessor method, returns the lowest possible value that the
146:             * <code>long</code> portion of the parameter value may be.
147:             * 
148:             * @return the lower bound of the possible values
149:             */
150:            public long getLowerBound() {
151:                return getPropertyAsLong(LOWER_BOUND);
152:            }
153:
154:            /**
155:             * Accessor method, returns the highest possible value that the
156:             * <code>long</code> portion of the parameter value may be.
157:             * 
158:             * @return the higher bound of the possible values
159:             */
160:            public long getUpperBound() {
161:                return getPropertyAsLong(UPPER_BOUND);
162:            }
163:
164:            /**
165:             * Accessor method, returns the number by which the parameter value is
166:             * incremented between loops.
167:             * 
168:             * @return the increment
169:             */
170:            public long getIncrement() {
171:                return getPropertyAsLong(INCREMENT);
172:            }
173:
174:            /**
175:             * Accessor method to return the <code>String</code> that will be suffixed
176:             * to the <code>long</code> value.
177:             * 
178:             * @return the parameter value suffix
179:             */
180:            public String getSuffix() {
181:                return getPropertyAsString(SUFFIX);
182:            }
183:
184:            /*
185:             * -----------------------------------------------------------------------
186:             * Methods
187:             * -----------------------------------------------------------------------
188:             */
189:
190:            /**
191:             * Returns the current value, prefixed and suffixed, as a string, then
192:             * increments it. If the incremented value is above the upper bound, the
193:             * value is reset to the lower bound. <BR>
194:             * <P>
195:             * This method determines the policy of what happens when an upper bound is
196:             * reached/surpassed.
197:             * 
198:             * @return a <code>String</code> representing the current
199:             *         <code>long</code> value
200:             */
201:            public String getNextValue() {
202:                // return the current value (don't forget the prefix!)
203:                String retval = getPrefix() + Long.toString(_value)
204:                        + getSuffix();
205:
206:                // increment the value
207:                _value += getIncrement();
208:                if (_value > getUpperBound()) {
209:                    _value = getLowerBound();
210:                }
211:
212:                return retval;
213:            }
214:
215:            /**
216:             * This method determines the policy of what value to start (and re-start)
217:             * at.
218:             */
219:            public void resetValue() {
220:                _value = getLowerBound();
221:            }
222:
223:            public String getFieldName() {
224:                return getPropertyAsString(FIELD_NAME);
225:            }
226:
227:            /**
228:             * For debugging purposes.
229:             * 
230:             * @return a <code>String</code> representing the object
231:             */
232:            public String toString() {
233:                StringBuffer sb = new StringBuffer();
234:                sb.append("-------------------------------\n");
235:                sb.append("Dumping ParamMask Object\n");
236:                sb.append("-------------------------------\n");
237:                sb.append("Name          = " + getFieldName() + "\n");
238:                sb.append("Prefix        = " + getPrefix() + "\n");
239:                sb.append("Current Value = " + _value + "\n");
240:                sb.append("Lower Bound   = " + getLowerBound() + "\n");
241:                sb.append("Upper Bound   = " + getUpperBound() + "\n");
242:                sb.append("Increment     = " + getIncrement() + "\n");
243:                sb.append("Suffix        = " + getSuffix() + "\n");
244:                sb.append("-------------------------------\n");
245:
246:                return sb.toString();
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.