Skip to content
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

5.6: After disabling the Java Request sampler, it cannot be enabled again #6004

Closed
LeeBaul opened this issue Jun 25, 2023 · 1 comment · Fixed by #6012
Closed

5.6: After disabling the Java Request sampler, it cannot be enabled again #6004

LeeBaul opened this issue Jun 25, 2023 · 1 comment · Fixed by #6012

Comments

@LeeBaul
Copy link

LeeBaul commented Jun 25, 2023

Expected behavior

In version 5.6 of jmeter, I used a java request sampler in my script. When I disable a Java request sampler and enable it again, the GUI page displays successful activation. When I click on other components, it automatically sets it to disabled status.
In jmeter version 5.5, this phenomenon was not replicated.

Actual behavior

I am using org. apache. jmeter. protocol. java. test. JavaTest, and this issue also exists when I switch to my own customized Java sample request.

Steps to reproduce the problem

in Thread Group disable Java Request1

image

enable again Java Request1 , GUI display enabled successfully.

image

When I click on other requests, it automatically switches to a disabled state.

image

JMeter Version

5.6

Java Version

sun jdk version 1.8.0_201

OS Version

Microsoft Windows [版本 10.0.22621.1848]

@vlsi
Copy link
Collaborator

vlsi commented Jun 27, 2023

The reason is that JavaTestSamplerGui re-creates the sampler instead of configuring the existing element:

JavaConfig config = (JavaConfig) javaPanel.createTestElement();
configureTestElement(sampler);
sampler.addTestElement(config);

javaPanel.createTestElement creates config element with enabled=false state since AbstractJMeterGuiComponent.enabled was initialized with false.


The thing can be fixed in several ways:
a) Skip TestElement.enabled in org.apache.jmeter.testelement.AbstractTestElement#mergeIn. The drawback is there might be other properties with similar pitfalls.
b) Pass "isEnabled" to org.apache.jmeter.protocol.java.control.gui.JavaTestSamplerGui#javaPanel. It would resolve the issue, however, the drawback is that there might be other samplers with similar pitfalls (==creating dummy elements and merging them)
c) something else

@vlsi vlsi removed the to-triage label Jun 27, 2023
vlsi added a commit to vlsi/jmeter that referenced this issue Jun 27, 2023
…gain

Java sampler was inheriting "enabled" status from its config element
as internally, Java Sampler UI always creates a config element and merges it
to the java sampler.

The solution is to move "configureTestElement(sampler);" to the very end of
modifyTestElement so all the base properties are populated based on
the element properties rather than "config element" properties.

Ideally we should somehow limit "mergeIn", and we should refrain from merging
unexpected properties.

Fixes apache#6004
vlsi added a commit that referenced this issue Jun 27, 2023
…gain

Java sampler was inheriting "enabled" status from its config element
as internally, Java Sampler UI always creates a config element and merges it
to the java sampler.

The solution is to move "configureTestElement(sampler);" to the very end of
modifyTestElement so all the base properties are populated based on
the element properties rather than "config element" properties.

Ideally we should somehow limit "mergeIn", and we should refrain from merging
unexpected properties.

Fixes #6004
@vlsi vlsi changed the title After disabling the Java Request sampler, it cannot be enabled again. 5.6: After disabling the Java Request sampler, it cannot be enabled again. Jun 29, 2023
@vlsi vlsi added regression and removed defect labels Jun 29, 2023
@vlsi vlsi pinned this issue Jun 29, 2023
@vlsi vlsi changed the title 5.6: After disabling the Java Request sampler, it cannot be enabled again. 5.6: After disabling the Java Request sampler, it cannot be enabled again Jun 29, 2023
@vlsi vlsi unpinned this issue Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants