Summary: | HttpRequestHdr : Optimize code to avoid useless work | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Philippe Mouawad <p.mouawad> |
Component: | HTTP | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | p.mouawad |
Priority: | P2 | ||
Version: | 2.6 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All |
Description
Philippe Mouawad
2012-02-28 14:21:42 UTC
(In reply to comment #0) > Hello, > Analyzing code I must say I don't understand what's the use of these lines in > HttpRequestHdr#createSampler: > > // Damn! A whole new GUI just to instantiate a test element? > // Isn't there a beter way? > HttpTestSampleGui tempGui = new HttpTestSampleGui(); > sampler.setProperty(TestElement.GUI_CLASS, > tempGui.getClass().getName()); > tempGui.configure(sampler); > tempGui.modifyTestElement(sampler); > > > They should be in my opinion replaced by: > > sampler.setProperty(TestElement.GUI_CLASS, > HttpTestSampleGui.class.getName()); Replaced by; HttpTestSampleGui tempGui = new HttpTestSampleGui(); sampler.setProperty(TestElement.GUI_CLASS, tempGui.class.getName()); > > > My analysis is the following: > > Configure will configure GUI from Sampler > Then sampler is configured from GUI > And then GUI is thrown away > > > Did I miss something ? 1) tempGui.configure(sampler) => will configure GUI from Sampler 2) tempGui.modifyTestElement(sampler); => will reconfigure sampler from GUI (that has just been configured from Sampler) 3) And then tempGui is thrown away > > Regards > Philippe (In reply to comment #1) > (In reply to comment #0) > > Hello, > > Analyzing code I must say I don't understand what's the use of these lines in > > HttpRequestHdr#createSampler: > > > > // Damn! A whole new GUI just to instantiate a test element? > > // Isn't there a beter way? > > HttpTestSampleGui tempGui = new HttpTestSampleGui(); > > sampler.setProperty(TestElement.GUI_CLASS, > > tempGui.getClass().getName()); > > tempGui.configure(sampler); > > tempGui.modifyTestElement(sampler); > > > > > > They should be in my opinion replaced by: > > > > sampler.setProperty(TestElement.GUI_CLASS, > > HttpTestSampleGui.class.getName()); > Replaced by; > HttpTestSampleGui tempGui = new HttpTestSampleGui(); > sampler.setProperty(TestElement.GUI_CLASS, > tempGui.class.getName()); Replaced by; sampler.setProperty(TestElement.GUI_CLASS, HttpTestSampleGui.getClass().getName()); > > > > > > My analysis is the following: > > > > Configure will configure GUI from Sampler > > Then sampler is configured from GUI > > And then GUI is thrown away > > > > > > Did I miss something ? > 1) tempGui.configure(sampler) => will configure GUI from Sampler > 2) tempGui.modifyTestElement(sampler); => will reconfigure sampler from GUI > (that has just been configured from Sampler) > 3) And then tempGui is thrown away > > > > Regards > > Philippe AFAIK, this was from before I started on JMeter. At present, the convoluted process only results in setting the GUI_CLASS. However, perhaps the thinking was that in future the code might change, and so it was safer to create use the normal way of creating a sampler, rather than trying to shorten the process. Date: Tue Feb 28 16:01:05 2012 New Revision: 1294708 URL: http://svn.apache.org/viewvc?rev=1294708&view=rev Log: Bug 52788 - HttpRequestHdr : Optimize code to avoid useless work Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java jmeter/trunk/xdocs/changes.xml This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2757 |