You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by ham1 <gi...@git.apache.org> on 2017/12/01 01:56:14 UTC

[GitHub] jmeter pull request #346: Bug 61827 - TextFile always adds newline to end of...

GitHub user ham1 opened a pull request:

    https://github.com/apache/jmeter/pull/346

    Bug 61827 - TextFile always adds newline to end of string

    ## Description
    Re-wrote `getText` (and `setText` while I was there) for `TextFile` because `getText` always appends a newline separator at the end of the file regardless if the original file has one or not.
    
    This changes the behaviour slightly and currently breaks some tests. I'm not sure if it's the tests' fault or the change. I've "fixed" the tests, but these need reviewing by someone who knows how the JMS stuff and anything else which uses it works and any assumptions they made.
    
    ## Motivation and Context
    https://bz.apache.org/bugzilla/show_bug.cgi?id=61827
    > a new line is adding to the content of the file read by a JMS publisher sampler.
    The issue is on the getText method of the TextFile : 
    => sb.append(line + lineEnd);
    
    ## How Has This Been Tested?
    Added unit tests to demo the new behaviour, previous could would have failed by added an extra newline to end of file which did not end in a new line.
    
    ## Screenshots (if appropriate):
    
    ## Types of changes
    <!--- What types of changes does your code introduce? Delete as appropriate -->
    - Bug fix (non-breaking change which fixes an issue)
    - New feature (non-breaking change which adds functionality)
    - Breaking change (fix or feature that would cause existing functionality to not work as expected)
    
    ## Checklist:
    <!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
    <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
    - [ ] My code follows the [code style][style-guide] of this project.
    - [ ] I have updated the documentation accordingly.
    
    [style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ham1/jmeter bug_61827

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jmeter/pull/346.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #346
    
----
commit 944170a6aaf6b416e93cd1f0008460858351cd78
Author: Graham Russell <gr...@ham1.co.uk>
Date:   2017-11-30T17:47:50Z

    Re-wrote getText() method

commit d793c2e18ac32bc9cd7e5805b83750954d74218d
Author: Graham Russell <gr...@ham1.co.uk>
Date:   2017-11-30T19:21:00Z

    Fixed read and write and added tests

commit a52fec86f2b4b0ab966e478ac466c63d695494ff
Author: Graham Russell <gr...@ham1.co.uk>
Date:   2017-11-30T19:21:58Z

    PublisherSampler.java tweaks

commit 0b90d513301e6e498645e4c3d88dce62291e9f41
Author: Graham Russell <gr...@ham1.co.uk>
Date:   2017-12-01T00:07:35Z

    Updated unit tests

commit 16d01091b5655096f285977fbfa296d9d9b45bc7
Author: Graham Russell <gr...@ham1.co.uk>
Date:   2017-12-01T00:16:53Z

    Improve code

commit 8196a066769db7ced7cf32bdc4abf6a3a46c7027
Author: Graham Russell <gr...@ham1.co.uk>
Date:   2017-12-01T01:39:05Z

    Fix other tests

----


---

[GitHub] jmeter issue #346: Bug 61827 - TextFile always adds newline to end of string

Posted by codecov-io <gi...@git.apache.org>.
Github user codecov-io commented on the issue:

    https://github.com/apache/jmeter/pull/346
  
    # [Codecov](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=h1) Report
    > Merging [#346](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=desc) into [trunk](https://codecov.io/gh/apache/jmeter/commit/4d8facc557fda5986837c3da3b2364350f08b368?src=pr&el=desc) will **increase** coverage by `<.01%`.
    > The diff coverage is `83.92%`.
    
    [![Impacted file tree graph](https://codecov.io/gh/apache/jmeter/pull/346/graphs/tree.svg?width=650&height=150&src=pr&token=6Q7CI1wFSh)](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=tree)
    
    ```diff
    @@            Coverage Diff             @@
    ##             trunk    #346      +/-   ##
    ==========================================
    + Coverage     58.1%   58.1%   +<.01%     
    - Complexity   10111   10118       +7     
    ==========================================
      Files         1154    1155       +1     
      Lines        73961   73954       -7     
      Branches      7342    7339       -3     
    ==========================================
    - Hits         42972   42971       -1     
    + Misses       28509   28501       -8     
    - Partials      2480    2482       +2
    ```
    
    
    | [Impacted Files](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
    |---|---|---|---|
    | [...otocol/jms/sampler/render/TextMessageRenderer.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2ptcy9vcmcvYXBhY2hlL2ptZXRlci9wcm90b2NvbC9qbXMvc2FtcGxlci9yZW5kZXIvVGV4dE1lc3NhZ2VSZW5kZXJlci5qYXZh) | `100% <ø> (ø)` | `4 <0> (ø)` | :arrow_down: |
    | [...otocol/jms/sampler/render/MessageRendererTest.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvam1zL3NhbXBsZXIvcmVuZGVyL01lc3NhZ2VSZW5kZXJlclRlc3QuamF2YQ==) | `100% <ø> (ø)` | `4 <0> (ø)` | :arrow_down: |
    | [.../jms/sampler/render/BinaryMessageRendererTest.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvam1zL3NhbXBsZXIvcmVuZGVyL0JpbmFyeU1lc3NhZ2VSZW5kZXJlclRlc3QuamF2YQ==) | `82.97% <100%> (-0.36%)` | `14 <2> (ø)` | |
    | [...ol/jms/sampler/render/TextMessageRendererTest.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvam1zL3NhbXBsZXIvcmVuZGVyL1RleHRNZXNzYWdlUmVuZGVyZXJUZXN0LmphdmE=) | `100% <100%> (ø)` | `12 <1> (ø)` | :arrow_down: |
    | [test/src/org/apache/jorphan/io/TextFileSpec.groovy](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qb3JwaGFuL2lvL1RleHRGaWxlU3BlYy5ncm9vdnk=) | `100% <100%> (ø)` | `7 <7> (?)` | |
    | [.../jms/sampler/render/ObjectMessageRendererTest.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvam1zL3NhbXBsZXIvcmVuZGVyL09iamVjdE1lc3NhZ2VSZW5kZXJlclRlc3QuamF2YQ==) | `100% <100%> (ø)` | `11 <0> (ø)` | :arrow_down: |
    | [.../jmeter/protocol/jms/sampler/PublisherSampler.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2ptcy9vcmcvYXBhY2hlL2ptZXRlci9wcm90b2NvbC9qbXMvc2FtcGxlci9QdWJsaXNoZXJTYW1wbGVyLmphdmE=) | `61.49% <56.25%> (+0.57%)` | `36 <3> (ø)` | :arrow_down: |
    | [src/jorphan/org/apache/jorphan/io/TextFile.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-c3JjL2pvcnBoYW4vb3JnL2FwYWNoZS9qb3JwaGFuL2lvL1RleHRGaWxlLmphdmE=) | `39.53% <75%> (-7.44%)` | `7 <4> (ø)` | |
    | [...ocol/jms/sampler/render/BinaryMessageRenderer.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2ptcy9vcmcvYXBhY2hlL2ptZXRlci9wcm90b2NvbC9qbXMvc2FtcGxlci9yZW5kZXIvQmluYXJ5TWVzc2FnZVJlbmRlcmVyLmphdmE=) | `87.5% <0%> (-12.5%)` | `6% <0%> (ø)` | |
    | [...ocol/jms/org/apache/jmeter/protocol/jms/Utils.java](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2ptcy9vcmcvYXBhY2hlL2ptZXRlci9wcm90b2NvbC9qbXMvVXRpbHMuamF2YQ==) | `54.83% <0%> (-2.16%)` | `15% <0%> (ø)` | |
    | ... and [2 more](https://codecov.io/gh/apache/jmeter/pull/346/diff?src=pr&el=tree-more) | |
    
    ------
    
    [Continue to review full report at Codecov](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=continue).
    > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
    > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
    > Powered by [Codecov](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=footer). Last update [4d8facc...8196a06](https://codecov.io/gh/apache/jmeter/pull/346?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).



---

[GitHub] jmeter pull request #346: Bug 61827 - TextFile always adds newline to end of...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jmeter/pull/346


---

[GitHub] jmeter issue #346: Bug 61827 - TextFile always adds newline to end of string

Posted by max3163 <gi...@git.apache.org>.
Github user max3163 commented on the issue:

    https://github.com/apache/jmeter/pull/346
  
    Hi @ham1, 
    
    I just review your patch, I use exactly the same way in our environment since 1-2 weeks without any problem. 
    
    So lgtm 
    
    +1


---