forked from apache/avro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AVRO-516. Ruby socket RPC should use big endian buffer lengths. merge…
… from trunk git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.3@951276 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Jeff Hodges
committed
Jun 4, 2010
1 parent
98a1cab
commit 0006247
Showing
5 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'test_help' | ||
|
||
class TestSocketTransport < Test::Unit::TestCase | ||
def test_buffer_writing | ||
io = StringIO.new | ||
st = Avro::IPC::SocketTransport.new(io) | ||
buffer_length = "\000\000\000\006" # 6 in big-endian | ||
message = 'abcdef' | ||
null_ending = "\000\000\000\000" # 0 in big-endian | ||
full = buffer_length + message + null_ending | ||
st.write_framed_message('abcdef') | ||
assert_equal full, io.string | ||
end | ||
|
||
def test_buffer_reading | ||
buffer_length = "\000\000\000\005" # 5 in big-endian | ||
message = "hello" | ||
null_ending = "\000\000\000\000" # 0 in big-endian | ||
full = buffer_length + message + null_ending | ||
io = StringIO.new(full) | ||
st = Avro::IPC::SocketTransport.new(io) | ||
assert_equal 'hello', st.read_framed_message | ||
end | ||
end |