diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-06 13:33:44 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-06 13:33:44 +0100 |
commit | 6c4df94244ba1e12b90e190234f5d2d6500575f9 (patch) | |
tree | 411acbf2108a723945cc23557c649dac8b06a54c | |
parent | 1c488fc909ae460cf9852dc793ef1367d1bdd948 (diff) | |
parent | 877b428bbe8c70510a26b2c583da35cc32226334 (diff) | |
download | rabbitmq-server-6c4df94244ba1e12b90e190234f5d2d6500575f9.tar.gz |
merged default into bug21954
-rw-r--r-- | src/rabbit_amqqueue.erl | 2 | ||||
-rw-r--r-- | src/rabbit_exchange.erl | 4 | ||||
-rw-r--r-- | src/rabbit_tests.erl | 38 | ||||
-rw-r--r-- | src/rabbit_writer.erl | 1 |
4 files changed, 21 insertions, 24 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 8caf1ace..f1b52768 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -252,7 +252,7 @@ assert_equivalence(#amqqueue{durable = Durable, auto_delete = AutoDelete} = Q, assert_equivalence(#amqqueue{name = QueueName}, _Durable, _AutoDelete, _Args, _Owner) -> rabbit_misc:protocol_error( - precondition_failed, "parameters for ~s not equivalent", + not_allowed, "parameters for ~s not equivalent", [rabbit_misc:rs(QueueName)]). check_exclusive_access(Q, Owner) -> check_exclusive_access(Q, Owner, lax). diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 9dca456d..822c164d 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -222,7 +222,7 @@ assert_equivalence(X = #exchange{ durable = Durable, assert_equivalence(#exchange{ name = Name }, _Type, _Durable, _AutoDelete, _Args) -> rabbit_misc:protocol_error( - precondition_failed, + not_allowed, "cannot redeclare ~s with different type, durable or autodelete value", [rabbit_misc:rs(Name)]). @@ -239,7 +239,7 @@ assert_args_equivalence(#exchange{ name = Name, Ae2 = alternate_exchange_value(Args), if Ae1==Ae2 -> ok; true -> rabbit_misc:protocol_error( - precondition_failed, + not_allowed, "cannot redeclare ~s with inequivalent args", [rabbit_misc:rs(Name)]) end. diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index ad7a11c6..7fbbc1ea 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -355,42 +355,38 @@ test_field_values() -> passed. %% Test that content frames don't exceed frame-max -test_content_framing(FrameMax, Fragments) -> +test_content_framing(FrameMax, BodyBin) -> [Header | Frames] = rabbit_binary_generator:build_simple_content_frames( 1, - #content{class_id = 10, properties = none, properties_bin = <<>>, - payload_fragments_rev = Fragments}, + rabbit_binary_generator:ensure_content_encoded( + rabbit_basic:build_content(#'P_basic'{}, BodyBin)), FrameMax), %% header is formatted correctly and the size is the total of the %% fragments <<_FrameHeader:7/binary, _ClassAndWeight:4/binary, BodySize:64/unsigned, _Rest/binary>> = list_to_binary(Header), - BodySize = size(list_to_binary(Fragments)), - false = lists:any( - fun (ContentFrame) -> - FrameBinary = list_to_binary(ContentFrame), - %% assert - <<_TypeAndChannel:3/binary, - Size:32/unsigned, - _Payload:Size/binary, - 16#CE>> = FrameBinary, - size(FrameBinary) > FrameMax - end, - Frames), + BodySize = size(BodyBin), + true = lists:all( + fun (ContentFrame) -> + FrameBinary = list_to_binary(ContentFrame), + %% assert + <<_TypeAndChannel:3/binary, + Size:32/unsigned, _Payload:Size/binary, 16#CE>> = + FrameBinary, + size(FrameBinary) =< FrameMax + end, Frames), passed. test_content_framing() -> %% no content - passed = test_content_framing(4096, []), - passed = test_content_framing(4096, [<<>>]), + passed = test_content_framing(4096, <<>>), %% easily fit in one frame - passed = test_content_framing(4096, [<<"Easy">>]), + passed = test_content_framing(4096, <<"Easy">>), %% exactly one frame (empty frame = 8 bytes) - passed = test_content_framing(11, [<<"One">>]), + passed = test_content_framing(11, <<"One">>), %% more than one frame - passed = test_content_framing(20, [<<"into more than one frame">>, - <<"This will have to go">>]), + passed = test_content_framing(11, <<"More than one frame">>), passed. test_topic_match(P, R) -> diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index c5f7f547..80602038 100644 --- a/src/rabbit_writer.erl +++ b/src/rabbit_writer.erl @@ -166,6 +166,7 @@ send_command_and_notify(W, Q, ChPid, MethodRecord, Content) -> shutdown(W) -> W ! shutdown, + rabbit_misc:unlink_and_capture_exit(W), ok. %--------------------------------------------------------------------------- |