From d8f7a4282c818b161caf977f60409055fbce6510 Mon Sep 17 00:00:00 2001 From: Marcial Rosales Date: Wed, 5 Jun 2024 20:45:09 +0200 Subject: [PATCH] Test with ibm mq There is still an issue with read messsage annotations --- .../src/amqp10_client_session.erl | 3 +- deps/amqp10_client/test/system_SUITE.erl | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/deps/amqp10_client/src/amqp10_client_session.erl b/deps/amqp10_client/src/amqp10_client_session.erl index 95c11c8de484..f7fdf705116f 100644 --- a/deps/amqp10_client/src/amqp10_client_session.erl +++ b/deps/amqp10_client/src/amqp10_client_session.erl @@ -791,7 +791,7 @@ filter_capability(V) when is_binary(V) -> filter_capability({T, _} = V) when is_atom(T) -> %% looks like an already tagged type, just pass it through V. - + % https://people.apache.org/~rgodfrey/amqp-1.0/apache-filters.html translate_legacy_amqp_headers_binding(LegacyHeaders) -> {map, @@ -867,6 +867,7 @@ send_attach(Send, #{name := Name, role := RoleTuple} = Args, {FromPid, _}, rcv_settle_mode = rcv_settle_mode(Args), target = Target, max_message_size = MaxMessageSize}, + ct:log("Attach frame ~p", [Attach]), ok = Send(Attach, State), Ref = make_link_ref(Role, self(), OutHandle), diff --git a/deps/amqp10_client/test/system_SUITE.erl b/deps/amqp10_client/test/system_SUITE.erl index 9b7bf144cbe8..595b9d4288c8 100644 --- a/deps/amqp10_client/test/system_SUITE.erl +++ b/deps/amqp10_client/test/system_SUITE.erl @@ -24,7 +24,7 @@ all() -> {group, rabbitmq}, {group, rabbitmq_strict}, {group, activemq}, -% {group, ibmmq} + {group, ibmmq}, {group, activemq_no_anon}, {group, mock} ]. @@ -33,7 +33,10 @@ groups() -> [ {rabbitmq, [], shared()}, {activemq, [], shared()}, - {ibmmq, [], test()}, + {ibmmq, [], [ + open_close_connection, + basic_roundtrip_ibmmq + ]}, {rabbitmq_strict, [], [ basic_roundtrip_tls, roundtrip_tls_global_config, @@ -62,12 +65,6 @@ groups() -> ]} ]. -test() -> - [ - open_close_connection, - basic_roundtrip - ]. - shared() -> [ open_close_connection, @@ -350,7 +347,7 @@ basic_roundtrip_ibmmq(Config) -> Hostname = ?config(rmq_hostname, Config), Port = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_amqp), OpenConf = #{address => Hostname, port => Port, sasl => ?config(sasl, Config)}, - roundtrip(OpenConf, [{body, <<"banana">>}, {destination, <<"DEV.QUEUE.1">>}]). + roundtrip(OpenConf, [{body, <<"banana">>}, {destination, <<"DEV.QUEUE.3">>}]). roundtrip(OpenConf) -> roundtrip(OpenConf, []). @@ -361,7 +358,7 @@ roundtrip(OpenConf, Args) -> {ok, Connection} = amqp10_client:open_connection(OpenConf), {ok, Session} = amqp10_client:begin_session(Connection), ct:log("Session attached "), - SenderAttachArgs = #{name => <<"banana-sender">>, + SenderAttachArgs = #{name => <<"banana-sender:DEV.QUEUE.3">>, role => {sender, #{address => Destination, durable => unsettled_state, capabilities => <<"queue">>}}, @@ -376,12 +373,14 @@ roundtrip(OpenConf, Args) -> ct:log("Sender attached "), Now = os:system_time(millisecond), - Props = #{creation_time => Now, - message_id => <<"my message ID">>, - correlation_id => <<"my correlation ID">>, + Props = #{content_encoding => <<"my content encoding">>, content_type => <<"my content type">>, - content_encoding => <<"my content encoding">>, - group_id => <<"my group ID">>}, + correlation_id => <<"my correlation ID">>, + creation_time => Now, + group_id => <<"my group ID">>, + message_id => <<"my message ID">>, + to => Destination + }, Msg0 = amqp10_msg:new(<<"my-tag">>, Body, true), Msg1 = amqp10_msg:set_application_properties(#{"a_key" => "a_value"}, Msg0), Msg2 = amqp10_msg:set_properties(Props, Msg1), @@ -403,12 +402,14 @@ roundtrip(OpenConf, Args) -> properties => #{} }, {ok, Receiver} = amqp10_client:attach_link(Session, ReceiverAttachArgs), - {ok, OutMsg} = amqp10_client:get_msg(Receiver, 4 * 60_000), + {ok, OutMsg} = amqp10_client:get_msg(Receiver, 4_000), ok = amqp10_client:end_session(Session), ok = amqp10_client:close_connection(Connection), % ct:pal(?LOW_IMPORTANCE, "roundtrip message Out: ~tp~nIn: ~tp~n", [OutMsg, Msg]), - ?assertMatch(Props, amqp10_msg:properties(OutMsg)), + ActualProps = amqp10_msg:properties(OutMsg), + [ ?assertMatch(V, maps:get(K, ActualProps)) || K := V <- Props, K =/= creation_time], + ?assertEqual(#{<<"a_key">> => <<"a_value">>}, amqp10_msg:application_properties(OutMsg)), ?assertMatch(#{<<"x-key">> := <<"x-value">>, <<"x_key">> := <<"x_value">>}, amqp10_msg:message_annotations(OutMsg)),