You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2012/02/28 15:21:42 UTC

DO NOT REPLY [Bug 52788] New: HttpRequestHdr : Optimize code to avoid useless work

https://issues.apache.org/bugzilla/show_bug.cgi?id=52788

             Bug #: 52788
           Summary: HttpRequestHdr : Optimize code to avoid useless work
           Product: JMeter
           Version: 2.6
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HTTP
        AssignedTo: issues@jmeter.apache.org
        ReportedBy: p.mouawad@ubik-ingenierie.com
    Classification: Unclassified


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());


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 ?

Regards
Philippe

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52788] HttpRequestHdr : Optimize code to avoid useless work

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52788

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-02-28 14:36:46 UTC ---
(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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52788] HttpRequestHdr : Optimize code to avoid useless work

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52788

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om

--- Comment #1 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-02-28 14:31:19 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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52788] HttpRequestHdr : Optimize code to avoid useless work

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52788

--- Comment #3 from Sebb <se...@apache.org> 2012-02-28 14:45:41 UTC ---
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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 52788] HttpRequestHdr : Optimize code to avoid useless work

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52788

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-02-28 16:21:04 UTC ---
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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.