Implementing the MongoOptions seemed rather innocuous at the time; after all it's just another bunch of properties the user can alter. I ended up just adding them all at once. Imagine my disappointment when the extension failed to load in Jmeter as intended. To keep a long story short, the offender was wTimeout. Now, wtimeout (is one of a group a rather poorly named variables, others include j and w ), but why was there an issue with wtimeout?
The error of my ways
This is the error that was generated when starting up JMeter:
This file contains hidden or 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
ERROR - jmeter.testbeans.BeanInfoSupport: Cannot find property: wTimeout in class class jan.mongometer.ScriptSampler |
This is how it was defined, firstly in ScriptSamplerBeanInfo.java
This file contains hidden or 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
createPropertyGroup("options", new String[] { | |
"wTimeout", | |
"fsync", | |
"j", | |
"safe", | |
"w" }); | |
... | |
p = property("wTimeout"); | |
p.setValue(NOT_UNDEFINED, Boolean.TRUE); | |
p.setValue(DEFAULT, "0"); |
Next, in ScriptSamplerResource.properties
This file contains hidden or 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
wTimeout.displayName=wtimeout | |
wTimeout.shortDescription=The wtimeout value of the global WriteConcern. Default is 0. |
And finally, in ScriptSampler.java
This file contains hidden or 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
public final static String W_TIMEOUT = "ScriptSampler.wTimeout"; //$NON-NLS-1$ | |
... | |
public String getWTimeout() { | |
return getPropertyAsString(W_TIMEOUT); | |
} | |
public void setWTimeout(String wTimeout) { | |
setProperty(W_TIMEOUT, wTimeout); | |
} |
I checked and double checked the spelling. It didn't really make sense, it should've been fine. Out of all the properties that were defined, the wTimeout property was the odd one out, in that it was the only one that had the pattern of lowercase{1}uppercase{N}. All the others were either lowercase{1}, lowercase{N} or lowercase{N}uppercase{N}. So long story, short; switching from wTimeout to doubleuTimeout resolved the issue.
This file contains hidden or 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
createPropertyGroup("options", new String[] { | |
"doubleuTimeout", | |
"fsync", | |
"j", | |
"safe", | |
"w" }); | |
... | |
p = property("doubleuTimeout"); | |
p.setValue(NOT_UNDEFINED, Boolean.TRUE); | |
p.setValue(DEFAULT, "0"); |
Next, in ScriptSamplerResource.properties
This file contains hidden or 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
doubleuTimeout.displayName=wtimeout | |
doubleuTimeout.shortDescription=The wtimeout value of the global WriteConcern. Default is 0. |
And finally, in ScriptSampler.java
This file contains hidden or 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
public final static String W_TIMEOUT = "ScriptSampler.doubleuTimeout"; //$NON-NLS-1$ | |
... | |
public String getDoubleuTimeout() { | |
return getPropertyAsString(W_TIMEOUT); | |
} | |
public void setDoubleuTimeout(String doubleuTimeout) { | |
setProperty(W_TIMEOUT, doubleuTimeout); | |
} |
It seems that when performing the creation of the property, if there is only a single lowercase character followed by an uppercase character, we get an error.
The moral of the story
Hmmmm. I don't really do morals, but if this is a bug, then it needs to be fixed. Either way j, w and wtimeout are really rather poor names for variables.
0.0
ReplyDelete