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 2018/12/20 11:02:31 UTC

[Bug 63025] New: Search and replace not working for port number

https://bz.apache.org/bugzilla/show_bug.cgi?id=63025

            Bug ID: 63025
           Summary: Search and replace not working for port number
           Product: JMeter
           Version: 5.0
          Hardware: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: HTTP
          Assignee: issues@jmeter.apache.org
          Reporter: j8t@qad.com
  Target Milestone: JMETER_5.1

Description

Port numbers of HTTP requests cannot be changed through search and replace.

Steps to reproduce

1. Create a HTTP Request sampler with a port 'XXX'
2. Click [ctrl+f]
3. Enter the port 'XXX' into the search field.
4. Enter something into the 'Replace by' field.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #2 from Mohamed Ibrahim <ro...@gmail.com> ---
Created attachment 36359
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36359&action=edit
Source code to fix search and replace functionality in Jmeter 5.0




Source code location to replace:
/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #14 from Felix Schumacher <fe...@internetallee.de> ---
Date: Sat Jan  5 21:51:33 2019
New Revision: 1850515

URL: http://svn.apache.org/viewvc?rev=1850515&view=rev
Log:
Further code deduplication for Replaceable

Part of Bugzilla Id: 63025

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/test/src/org/apache/jorphan/util/TestJorphanUtils.java

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

Felix Schumacher <fe...@internetallee.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #36358|0                           |1
        is obsolete|                            |
  Attachment #36359|0                           |1
        is obsolete|                            |

--- Comment #5 from Felix Schumacher <fe...@internetallee.de> ---
Created attachment 36360
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36360&action=edit
Replace port and protocol in HTTP Samplers

This is basically the diff from the originally attached source. It has been
refactored to eliminate duplicate code. That should make it easy to add more
parameters to be replaced, like the proxy parameters.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #13 from Felix Schumacher <fe...@internetallee.de> ---
Date: Sat Jan  5 12:45:32 2019
New Revision: 1850484

URL: http://svn.apache.org/viewvc?rev=1850484&view=rev
Log:
Mention contributor of initial code for fix of bug 63025

Bugzilla Id: 63025

Modified:
    jmeter/trunk/xdocs/changes.xml

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

Mohamed Ibrahim <ro...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rollno748@gmail.com

--- Comment #1 from Mohamed Ibrahim <ro...@gmail.com> ---
Created attachment 36358
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36358&action=edit
Jar to be replaced in JMETER_DIR\lib\ext\

Replace the jar to get the search and replace functionality for entire Jmeter
test plan.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #7 from Mohamed Ibrahim <ro...@gmail.com> ---
Hello all,

This is my first try in contribution to open source.
I just followed the steps given in the following apache page
https://jmeter.apache.org/building.html



I did exactly whatever has been given in the instructions. But, I don't know
how it was not updated in the trunk.

You can still check my forked repo in github.

https://github.com/rollno748/jmeter/blob/63025/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java


I was trying my best to do it to push the code.

Please let me know where i went wrong and Is there any proper documentation
available code committing?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

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

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

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |JMETER_5.1

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #8 from Felix Schumacher <fe...@internetallee.de> ---
(In reply to Philippe Mouawad from comment #6)
> (In reply to Felix Schumacher from comment #5)
> > Created attachment 36360 [details]
> > Replace port and protocol in HTTP Samplers
> > 
> > This is basically the diff from the originally attached source. It has been
> > refactored to eliminate duplicate code. That should make it easy to add more
> > parameters to be replaced, like the proxy parameters.
> 
> Hello, 
> Thanks for patch.
> Look good to me except that if I understand correctly, it would not be
> possible to replace port by ${portNumber} due to this:
> 
> (s) -> setPort(Integer.parseInt(s)

That has to be done, as setPort accepts int, only. The expression is probably
set on the ui element and not on the sampler.


> 
> Regards

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #6 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to Felix Schumacher from comment #5)
> Created attachment 36360 [details]
> Replace port and protocol in HTTP Samplers
> 
> This is basically the diff from the originally attached source. It has been
> refactored to eliminate duplicate code. That should make it easy to add more
> parameters to be replaced, like the proxy parameters.

Hello, 
Thanks for patch.
Look good to me except that if I understand correctly, it would not be possible
to replace port by ${portNumber} due to this:

(s) -> setPort(Integer.parseInt(s)

Regards

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

Felix Schumacher <fe...@internetallee.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO
           Keywords|                            |FixedInTrunk

--- Comment #11 from Felix Schumacher <fe...@internetallee.de> ---
Thanks for the report and initial code example.

This will be included in version 5.1. It would be really nice, if you could
test the next nightly, if this fix does what you want. (You can close this
enhancement, if it works for you)

In the end I decided to change directly the properties that contain the string
representation for port and protocol instead of the derived values, that
getPort and getProtocol return.

Date: Sat Jan  5 12:06:49 2019
New Revision: 1850475

URL: http://svn.apache.org/viewvc?rev=1850475&view=rev
Log:
Extract duplicate code into private method

Refactoring to make bug 63025 easier to fix.

Bugzilla Id: 63025

Modified:
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java

Date: Sat Jan  5 12:19:26 2019
New Revision: 1850478

URL: http://svn.apache.org/viewvc?rev=1850478&view=rev
Log:
Enhance Search & Replace functionality for HTTP Request to include port and
protocol field.

Bugzilla Id: 63025

Modified:
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #12 from Felix Schumacher <fe...@internetallee.de> ---
(In reply to Philippe Mouawad from comment #10)
> (In reply to Felix Schumacher from comment #8)
> > (In reply to Philippe Mouawad from comment #6)
> > > (In reply to Felix Schumacher from comment #5)
> > > > Created attachment 36360 [details]
> > > > Replace port and protocol in HTTP Samplers
> > > > 
> > > > This is basically the diff from the originally attached source. It has been
> > > > refactored to eliminate duplicate code. That should make it easy to add more
> > > > parameters to be replaced, like the proxy parameters.
> > > 
> > > Hello, 
> > > Thanks for patch.
> > > Look good to me except that if I understand correctly, it would not be
> > > possible to replace port by ${portNumber} due to this:
> > > 
> > > (s) -> setPort(Integer.parseInt(s)
> > 
> > That has to be done, as setPort accepts int, only. The expression is
> > probably set on the ui element and not on the sampler.
> > 
> > 
> > > 
> > > Regards
> 
> Hi Felix,
> I think we can safely introduce this setPort(String value) method.
> When we read it, it's read as StringProperty.

I opted to change the property directly. That makes it really easy to add more
properties if we want to change them as well.

I wonder if we should use that path for the already implemented getDomain and
getPath as getPath changes the property value by encoding spaces.

> 
> I don't want to commit your work as you should be the committer (I don't
> want to have credit for your work :-) ), so if you can commit this code, I
> can add it later or you can also do it if you want.

No problem, I would not have been angry with you.

> 
> Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #15 from Felix Schumacher <fe...@internetallee.de> ---
Date: Sat Jan  5 21:56:31 2019
New Revision: 1850516

URL: http://svn.apache.org/viewvc?rev=1850516&view=rev
Log:
Correct number of replaced values

Bugzilla Id: 63025

Modified:
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HeaderManager.java

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #9 from Felix Schumacher <fe...@internetallee.de> ---
(In reply to Mohamed Ibrahim from comment #7)
> Hello all,
> 
> This is my first try in contribution to open source.
> I just followed the steps given in the following apache page
> https://jmeter.apache.org/building.html

And you did great.

> 
> 
> 
> I did exactly whatever has been given in the instructions. But, I don't know
> how it was not updated in the trunk.

JMeter's trunk can only be updated by Committers. See
https://www.apache.org/foundation/getinvolved.html for more on this.

I suspect, you followed the "Create a PR using GIT" instruction on the building
page. There is one last step there, that you missed. It is the creation of the
pull request. That way we would have been notified of your changes.

For more information and or further discussion about contributing, I suggest
that you subscribe to the users (or developers) mailing list and send your
questions/suggestions there.


> 
> You can still check my forked repo in github.
> 
> https://github.com/rollno748/jmeter/blob/63025/src/protocol/http/org/apache/
> jmeter/protocol/http/sampler/HTTPSamplerProxy.java
> 
> 
> I was trying my best to do it to push the code.

And thanks again for trying.

> 
> Please let me know where i went wrong and Is there any proper documentation
> available code committing?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

--- Comment #10 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to Felix Schumacher from comment #8)
> (In reply to Philippe Mouawad from comment #6)
> > (In reply to Felix Schumacher from comment #5)
> > > Created attachment 36360 [details]
> > > Replace port and protocol in HTTP Samplers
> > > 
> > > This is basically the diff from the originally attached source. It has been
> > > refactored to eliminate duplicate code. That should make it easy to add more
> > > parameters to be replaced, like the proxy parameters.
> > 
> > Hello, 
> > Thanks for patch.
> > Look good to me except that if I understand correctly, it would not be
> > possible to replace port by ${portNumber} due to this:
> > 
> > (s) -> setPort(Integer.parseInt(s)
> 
> That has to be done, as setPort accepts int, only. The expression is
> probably set on the ui element and not on the sampler.
> 
> 
> > 
> > Regards

Hi Felix,
I think we can safely introduce this setPort(String value) method.
When we read it, it's read as StringProperty.

I don't want to commit your work as you should be the committer (I don't want
to have credit for your work :-) ), so if you can commit this code, I can add
it later or you can also do it if you want.

Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
   Target Milestone|JMETER_5.1                  |---
           Hardware|PC                          |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

Mohamed Ibrahim <ro...@gmail.com> changed:

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

--- Comment #3 from Mohamed Ibrahim <ro...@gmail.com> ---
Hello,

Issue has been fixed by adding a code block in Jmeter Http sampler base.

Kindly verify and confirm.


Thanks,
Mohamed Ibrahim

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63025] Search and replace not working for port number

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

Felix Schumacher <fe...@internetallee.de> changed:

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

--- Comment #4 from Felix Schumacher <fe...@internetallee.de> ---
A bug entry should be closed, when the bug report is either invalid, or solved
in trunk.

As this is a valid report (thank you for opening it) and it hasn't been fixed
in trunk, it should be in open status.

-- 
You are receiving this mail because:
You are the assignee for the bug.