You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by bu...@apache.org on 2008/10/17 08:59:27 UTC

DO NOT REPLY [Bug 46030] New: Extend TCP Sampler to Support Length-Prefixed Binary Data

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

           Summary: Extend TCP Sampler to Support Length-Prefixed Binary
                    Data
           Product: JMeter
           Version: 2.3.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main
        AssignedTo: jmeter-dev@jakarta.apache.org
        ReportedBy: osheehy@fexcodcc.com


Created an attachment (id=22749)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22749)
Code to implement enhancement

We have a requirement to test a TCP service where data is exchanged in
length-prefixed binary format.

To meet this need we have implemented the attached classes which we wish to
submit for a future release of JMeter.  A brief description of the classes
follows:

BinaryTCPClientImpl
Concrete class which implements TCPClient Interface and converts hex-encoded
strings to byte array in 
write(OutputStream, String) and from byte array to hex-encoded string in
read(InputStream). 
write(OutputStream, InputStream) is unsupported.
Contains utility method hexStringToByteArray(String s) which is a mirror of the
JOrphanUtils.baToHexString(byte[]) method.  

TCPClientDecorator                      
Abstract class implementing TCPClient Interface. This is to allow wrapping of
TCPClientImpl/BinaryTCPClientImpl above with length prefixing methods.
Contains two utility methods intToByteArray(int value, int len) and
byteArrayToInt(byte[] b).  Methods support 2 and 4 and byte lengths only and
throw an IllegalArgumentException in other cases.

LengthPrefixedBinaryTCPClientImpl
Extends TCPClientDecorator and instantiates decorator with BinaryTCPClientImpl.
The length to use in the prefix is taken from the properties file and defaults
to 2.
For write(OutputStream os, String s) the length is calculated and written to
the output stream then the method delegates to the BinaryTCPClientImpl write()
method.
read(InputStream is) is overridden.
write(OutputStream os, InputStream is) is not supported.

Have created JUnit tests for the three utility methods but not for the
read/write implementations themselves.  These are in two test classes,
BinaryTCPClientImplTest and TCPClientDecoratorTest.

Have left the utility methods bundled with the client implementations to avoid
modifying existing utility classes.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 46030] Extend TCP Sampler to Support Length-Prefixed Binary Data

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


Sebb <se...@apache.org> changed:

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




--- Comment #1 from Sebb <se...@apache.org>  2008-11-06 10:53:30 PST ---
Code has been added to SVN.

Thanks very much for the contribution.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org