You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2017/08/30 16:33:11 UTC
[3/3] qpid-proton-j git commit: PROTON-1551: add more specific encode
test
PROTON-1551: add more specific encode test
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/commit/68f30de3
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/tree/68f30de3
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton-j/diff/68f30de3
Branch: refs/heads/master
Commit: 68f30de3597e5d2cb1ce7801741038575b49e1b8
Parents: 0546934
Author: Robbie Gemmell <ro...@apache.org>
Authored: Wed Aug 30 17:25:10 2017 +0100
Committer: Robbie Gemmell <ro...@apache.org>
Committed: Wed Aug 30 17:25:10 2017 +0100
----------------------------------------------------------------------
.../qpid/proton/codec/impl/DataImplTest.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/68f30de3/proton-j/src/test/java/org/apache/qpid/proton/codec/impl/DataImplTest.java
----------------------------------------------------------------------
diff --git a/proton-j/src/test/java/org/apache/qpid/proton/codec/impl/DataImplTest.java b/proton-j/src/test/java/org/apache/qpid/proton/codec/impl/DataImplTest.java
index d02a088..ac56f7f 100644
--- a/proton-j/src/test/java/org/apache/qpid/proton/codec/impl/DataImplTest.java
+++ b/proton-j/src/test/java/org/apache/qpid/proton/codec/impl/DataImplTest.java
@@ -276,6 +276,26 @@ public class DataImplTest
}
@Test
+ public void testEncodeStringBinary32()
+ {
+ byte[] payload = createStringPayloadBytes(1372);
+ assertTrue("Length must be over 255 to ensure use of vbin32 encoding", payload.length > 255);
+
+ int encodedSize = 1 + 4 + payload.length; // 1b type + 4b length + content
+ ByteBuffer expectedEncoding = ByteBuffer.allocate(encodedSize);
+ expectedEncoding.put((byte) 0xB0);
+ expectedEncoding.putInt(payload.length);
+ expectedEncoding.put(payload);
+
+ Data data = new DataImpl();
+ data.putBinary(new Binary(payload));
+
+ Binary encoded = data.encode();
+
+ assertEquals("unexpected encoding", new Binary(expectedEncoding.array()), encoded);
+ }
+
+ @Test
public void testEncodeDecodeBinary32()
{
byte[] initialPayload = createStringPayloadBytes(1025);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org