-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception for Java-based tests #50
Comments
After trying to put all arguments in Java, I still see the exception and cannot get it to work. Is there something else I am missing here? |
Indeed there seems to be an issue with I'll make a SNAPSHOT release with an explicit call to |
@chbndrhnns SNAPSHOT is currently being deployed to maven-central repository. If you don't want to wait for it to be available on Maven. Please add the following JAR to your |
I see that you are calling So I found out that I get it working if i really specify ALL possible parameters like this:
|
@chbndrhnns Oh yes, my bad I tried to push it out in a hurry 😆 ! Let me actually use the values of |
@chbndrhnns I have uploaded a new JAR this time it is recreating the context (since the context parameters is a private Map and cannot be explicitly reassigned) by doing this: Tell me if it works! |
Hey, with that snapshot, I get
I assume this is because the existing context is overwritten. Shouldn't it be done like this? It seems like I am not able to set any parameters now. |
Yeah, I understand what you mean.. And frankly, I see it that way as well. But I can't seem to find a solution to access and change/add the parameters that are coming from an external source. As I mentioned in an earlier comment, the parameters in Wouldn't it be easier if I provided a static method in my plugin, say |
I am looking at the influxdb code to understand what they did. Without fully understanding it as of now, can specify the parameters I want and the rest is taken from the default but the test does not just fail. Implementing this static method would work but it would make it harder to switch between the influxdb and elasticsearch backend listener as there way of usage differs then. |
They did @Override
public Arguments getDefaultParameters() {
Arguments arguments = new Arguments();
DEFAULT_ARGS.forEach(arguments::addArgument);
return arguments;
}
|
Hey @chbndrhnns, So I just switched the parameters declaration to the style they're using in the InfluxDB Backend Listener, let me know if that helps! Thanks, |
Hey, there is still a NullPointerException:
I see that |
I am having issues understanding how the new way of adding the parameters is causing a NullExceptionPointer. I am basically looping through the private static final Map<String, String> DEFAULT_ARGS = new LinkedHashMap<>();
static {
DEFAULT_ARGS.put(ES_SCHEME, "http");
DEFAULT_ARGS.put(ES_HOST, null);
DEFAULT_ARGS.put(ES_PORT, "9200");
DEFAULT_ARGS.put(ES_INDEX, null);
DEFAULT_ARGS.put(ES_TIMESTAMP, "yyyy-MM-dd'T'HH:mm:ss.SSSZZ");
DEFAULT_ARGS.put(ES_BULK_SIZE, "100");
DEFAULT_ARGS.put(ES_TIMEOUT_MS, Long.toString(DEFAULT_TIMEOUT_MS));
DEFAULT_ARGS.put(ES_SAMPLE_FILTER, null);
DEFAULT_ARGS.put(ES_TEST_MODE, "info");
DEFAULT_ARGS.put(ES_AUTH_USER, "");
DEFAULT_ARGS.put(ES_AUTH_PWD, "");
DEFAULT_ARGS.put(ES_PARSE_REQ_HEADERS, "false");
DEFAULT_ARGS.put(ES_PARSE_RES_HEADERS, "false");
DEFAULT_ARGS.put(ES_AWS_ENDPOINT, "");
DEFAULT_ARGS.put(ES_AWS_REGION, "");
}
@Override
public Arguments getDefaultParameters() {
Arguments arguments = new Arguments();
DEFAULT_ARGS.forEach(arguments::addArgument);
return arguments;
} It's as if making a JMeter test-plan from code isn't calling the same methods... |
Taking a look at https://jmeter.apache.org/api/org/apache/jmeter/visualizers/backend/BackendListenerContext.html#getParameter-java.lang.String-java.lang.String- indicates that the desired default parameter needs to be passed to the |
That is correct 😄, which is why I'm trying to fix the issue where the default parameters are not automatically set when creating a test plan from code (as you're doing). |
My expectation was that I can specify the required paramters (
es.host
,es.index
) and use your backend listener in a Java-based test script. As I end up withNumberFormatException
doing it that way and succeeding when configuring the test via the JMeter GUI, I assume that maybegetDefaultParameters()
is not getting called in the Java case?Here is the exception:
This is my setup code:
The text was updated successfully, but these errors were encountered: