Created
June 11, 2012 17:40
-
-
Save glennschler/2911496 to your computer and use it in GitHub Desktop.
I use this OATS OpenScript technique for several advanced script control needs. This example only shows how to stop the "content length is zero" error, though this can be used as a template for any advanced control of virtual users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package yourcompanyname.oats.scripting.modules.http.api; | |
import oracle.oats.scripting.modules.basic.api.exceptions.AbstractScriptException; | |
import oracle.oats.scripting.modules.http.api.HTTPService; | |
import oracle.oats.scripting.modules.http.api.HTTPService.EncodeOptions; | |
public class MyHTTPService extends HTTPService | |
{ | |
private IteratingVUser m_vu = null; | |
public MyHTTPService() | |
{ | |
super(); | |
} | |
/** | |
* @see oracle.oats.scripting.modules.basic.api.IVUserProvider#setCurrentVUser(oracle.oats.scripting.modules.basic.api.IteratingVUser) | |
*/ | |
@Override public void setCurrentVUser(IteratingVUser vu) | |
{ | |
super.setCurrentVUser(vu); | |
/* Consider this work around to stop those warning while running in OATS OLT Tester | |
*/ | |
List<IValidator> httpValidators = this.getValidatorList(); | |
for (int i = 0; i < httpValidators.size(); i++) | |
{ | |
IValidator httpValidator = httpValidators.get(i); | |
if (httpValidator != null && | |
httpValidator.getClass().getName().contains("ZeroLengthContentValidator")) | |
{ | |
removeValidator(httpValidator); | |
break; | |
} | |
} | |
.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this OATS OpenScript technique for several advanced script control needs. In your script, change this:
To this:
Then add the above Gist MyHTTPService.java to your OATS OpenScript project