Source Code Cross Referenced for InterleaveControl.java in  » Testing » jakarta-jmeter » org » apache » jmeter » control » 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.control 
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.control;
020:
021:        import java.io.Serializable;
022:
023:        import org.apache.jmeter.samplers.Sampler;
024:        import org.apache.jmeter.testelement.TestElement;
025:        import org.apache.jmeter.testelement.property.IntegerProperty;
026:
027:        public class InterleaveControl extends GenericController implements 
028:                Serializable {
029:            private static final String STYLE = "InterleaveControl.style";// $NON-NLS-1$
030:
031:            public static final int IGNORE_SUB_CONTROLLERS = 0;
032:
033:            public static final int USE_SUB_CONTROLLERS = 1;
034:
035:            private boolean skipNext;
036:
037:            transient private TestElement searchStart = null;
038:
039:            private boolean currentReturnedAtLeastOne;
040:
041:            private boolean stillSame = true;
042:
043:            /***************************************************************************
044:             * Constructor for the InterleaveControl object
045:             **************************************************************************/
046:            public InterleaveControl() {
047:            }
048:
049:            /*
050:             * (non-Javadoc)
051:             * 
052:             * @see org.apache.jmeter.control.GenericController#reInitialize()
053:             */
054:            public void reInitialize() {
055:                setFirst(true);
056:                currentReturnedAtLeastOne = false;
057:                searchStart = null;
058:                stillSame = true;
059:                skipNext = false;
060:                incrementIterCount();
061:                recoverRunningVersion();
062:            }
063:
064:            public void setStyle(int style) {
065:                setProperty(new IntegerProperty(STYLE, style));
066:            }
067:
068:            public int getStyle() {
069:                return getPropertyAsInt(STYLE);
070:            }
071:
072:            /*
073:             * (non-Javadoc)
074:             * 
075:             * @see org.apache.jmeter.control.Controller#next()
076:             */
077:            public Sampler next() {
078:                if (isSkipNext()) {
079:                    reInitialize();
080:                    return null;
081:                }
082:                return super .next();
083:            }
084:
085:            /*
086:             * (non-Javadoc)
087:             * 
088:             * @see GenericController#nextIsAController(Controller)
089:             */
090:            protected Sampler nextIsAController(Controller controller)
091:                    throws NextIsNullException {
092:                Sampler sampler = controller.next();
093:                if (sampler == null) {
094:                    currentReturnedNull(controller);
095:                    return next();
096:                }
097:                currentReturnedAtLeastOne = true;
098:                if (getStyle() == IGNORE_SUB_CONTROLLERS) {
099:                    incrementCurrent();
100:                    skipNext = true;
101:                } else {
102:                    searchStart = null;
103:                }
104:                return sampler;
105:            }
106:
107:            /*
108:             * (non-Javadoc)
109:             * 
110:             * @see org.apache.jmeter.control.GenericController#nextIsASampler(Sampler)
111:             */
112:            protected Sampler nextIsASampler(Sampler element)
113:                    throws NextIsNullException {
114:                skipNext = true;
115:                incrementCurrent();
116:                return element;
117:            }
118:
119:            /**
120:             * If the current is null, reset and continue searching. The searchStart
121:             * attribute will break us off when we start a repeat.
122:             * 
123:             * @see org.apache.jmeter.testelement.AbstractTestElement#nextIsNull()
124:             */
125:            protected Sampler nextIsNull() {
126:                resetCurrent();
127:                return next();
128:            }
129:
130:            /*
131:             * (non-Javadoc)
132:             * 
133:             * @see GenericController#setCurrentElement(TestElement)
134:             */
135:            protected void setCurrentElement(TestElement currentElement)
136:                    throws NextIsNullException {
137:                // Set the position when next is first called, and don't overwrite
138:                // until reInitialize is called.
139:                if (searchStart == null) {
140:                    searchStart = currentElement;
141:                } else if (searchStart == currentElement && !stillSame) {
142:                    // We've gone through the whole list and are now back at the start
143:                    // point of our search.
144:                    reInitialize();
145:                    throw new NextIsNullException();
146:                }
147:            }
148:
149:            /*
150:             * (non-Javadoc)
151:             * 
152:             * @see GenericController#currentReturnedNull(Controller)
153:             */
154:            protected void currentReturnedNull(Controller c) {
155:                if (c.isDone()) {
156:                    removeCurrentElement();
157:                } else if (getStyle() == USE_SUB_CONTROLLERS) {
158:                    incrementCurrent();
159:                }
160:            }
161:
162:            /**
163:             * @return skipNext
164:             */
165:            protected boolean isSkipNext() {
166:                return skipNext;
167:            }
168:
169:            /**
170:             * @param skipNext
171:             */
172:            protected void setSkipNext(boolean skipNext) {
173:                this .skipNext = skipNext;
174:            }
175:
176:            /*
177:             * (non-Javadoc)
178:             * 
179:             * @see org.apache.jmeter.control.GenericController#incrementCurrent()
180:             */
181:            protected void incrementCurrent() {
182:                if (currentReturnedAtLeastOne) {
183:                    skipNext = true;
184:                }
185:                stillSame = false;
186:                super.incrementCurrent();
187:            }
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.