2013-06-26 19:55:29 +02:00
|
|
|
-include_lib("common_test/include/ct.hrl").
|
2016-02-03 19:22:59 +01:00
|
|
|
-include_lib("fast_xml/include/fxml.hrl").
|
2020-09-23 16:52:21 +02:00
|
|
|
-include_lib("xmpp/include/jid.hrl").
|
|
|
|
-include_lib("xmpp/include/ns.hrl").
|
|
|
|
-include_lib("xmpp/include/xmpp_codec.hrl").
|
2013-06-26 19:55:29 +02:00
|
|
|
-include("mod_proxy65.hrl").
|
|
|
|
|
|
|
|
-define(STREAM_TRAILER, <<"</stream:stream>">>).
|
|
|
|
|
|
|
|
-define(PUBSUB(Node), <<(?NS_PUBSUB)/binary, "#", Node>>).
|
|
|
|
|
2014-07-15 09:53:40 +02:00
|
|
|
-define(EJABBERD_CT_URI, <<"http://www.process-one.net/en/ejabberd_ct/">>).
|
|
|
|
|
2015-04-09 16:39:52 +02:00
|
|
|
-define(recv1(P1),
|
|
|
|
P1 = (fun() ->
|
2019-04-30 13:41:54 +02:00
|
|
|
V = suite:recv(Config),
|
2015-04-09 16:39:52 +02:00
|
|
|
case V of
|
|
|
|
P1 -> V;
|
|
|
|
_ -> suite:match_failure([V], [??P1])
|
|
|
|
end
|
|
|
|
end)()).
|
|
|
|
|
2013-06-26 19:55:29 +02:00
|
|
|
-define(recv2(P1, P2),
|
|
|
|
(fun() ->
|
2019-04-30 13:41:54 +02:00
|
|
|
case {R1 = suite:recv(Config), R2 = suite:recv(Config)} of
|
2013-06-26 19:55:29 +02:00
|
|
|
{P1, P2} -> {R1, R2};
|
2015-02-04 14:42:03 +01:00
|
|
|
{P2, P1} -> {R2, R1};
|
|
|
|
{P1, V1} -> suite:match_failure([V1], [P2]);
|
|
|
|
{P2, V2} -> suite:match_failure([V2], [P1]);
|
2015-04-09 16:39:52 +02:00
|
|
|
{V3, P1} -> suite:match_failure([V3], [P2]);
|
|
|
|
{V4, P2} -> suite:match_failure([V4], [P1]);
|
|
|
|
{V5, V6} -> suite:match_failure([V5, V6], [P1, P2])
|
2013-06-26 19:55:29 +02:00
|
|
|
end
|
|
|
|
end)()).
|
|
|
|
|
|
|
|
-define(recv3(P1, P2, P3),
|
|
|
|
(fun() ->
|
2019-04-30 13:41:54 +02:00
|
|
|
case R3 = suite:recv(Config) of
|
2013-06-26 19:55:29 +02:00
|
|
|
P1 -> insert(R3, 1, ?recv2(P2, P3));
|
|
|
|
P2 -> insert(R3, 2, ?recv2(P1, P3));
|
2015-02-04 14:42:03 +01:00
|
|
|
P3 -> insert(R3, 3, ?recv2(P1, P2));
|
|
|
|
V -> suite:match_failure([V], [P1, P2, P3])
|
2013-06-26 19:55:29 +02:00
|
|
|
end
|
|
|
|
end)()).
|
|
|
|
|
|
|
|
-define(recv4(P1, P2, P3, P4),
|
|
|
|
(fun() ->
|
2019-04-30 13:41:54 +02:00
|
|
|
case R4 = suite:recv(Config) of
|
2013-06-26 19:55:29 +02:00
|
|
|
P1 -> insert(R4, 1, ?recv3(P2, P3, P4));
|
|
|
|
P2 -> insert(R4, 2, ?recv3(P1, P3, P4));
|
|
|
|
P3 -> insert(R4, 3, ?recv3(P1, P2, P4));
|
2015-02-04 14:42:03 +01:00
|
|
|
P4 -> insert(R4, 4, ?recv3(P1, P2, P3));
|
|
|
|
V -> suite:match_failure([V], [P1, P2, P3, P4])
|
2013-06-26 19:55:29 +02:00
|
|
|
end
|
|
|
|
end)()).
|
|
|
|
|
|
|
|
-define(recv5(P1, P2, P3, P4, P5),
|
|
|
|
(fun() ->
|
2019-04-30 13:41:54 +02:00
|
|
|
case R5 = suite:recv(Config) of
|
2013-06-26 19:55:29 +02:00
|
|
|
P1 -> insert(R5, 1, ?recv4(P2, P3, P4, P5));
|
|
|
|
P2 -> insert(R5, 2, ?recv4(P1, P3, P4, P5));
|
|
|
|
P3 -> insert(R5, 3, ?recv4(P1, P2, P4, P5));
|
|
|
|
P4 -> insert(R5, 4, ?recv4(P1, P2, P3, P5));
|
2015-02-04 14:42:03 +01:00
|
|
|
P5 -> insert(R5, 5, ?recv4(P1, P2, P3, P4));
|
|
|
|
V -> suite:match_failure([V], [P1, P2, P3, P4, P5])
|
2013-06-26 19:55:29 +02:00
|
|
|
end
|
|
|
|
end)()).
|
|
|
|
|
2016-10-07 09:31:03 +02:00
|
|
|
-define(match(Pattern, Result),
|
2018-09-14 20:27:59 +02:00
|
|
|
(fun() ->
|
2016-10-07 09:31:03 +02:00
|
|
|
case Result of
|
|
|
|
Pattern ->
|
2018-09-14 20:27:59 +02:00
|
|
|
ok;
|
2016-10-07 09:31:03 +02:00
|
|
|
Mismatch ->
|
|
|
|
suite:match_failure([Mismatch], [??Pattern])
|
2018-09-14 20:27:59 +02:00
|
|
|
end
|
|
|
|
end)()).
|
2016-10-07 09:31:03 +02:00
|
|
|
|
2019-04-30 13:41:54 +02:00
|
|
|
-define(match(Pattern, Result, PatternRes),
|
|
|
|
(fun() ->
|
|
|
|
case Result of
|
|
|
|
Pattern ->
|
|
|
|
PatternRes;
|
|
|
|
Mismatch ->
|
|
|
|
suite:match_failure([Mismatch], [??Pattern])
|
|
|
|
end
|
|
|
|
end)()).
|
|
|
|
|
|
|
|
-define(send_recv(Send, Recv),
|
|
|
|
?match(Recv, suite:send_recv(Config, Send))).
|
|
|
|
|
2013-06-26 19:55:29 +02:00
|
|
|
-define(COMMON_VHOST, <<"localhost">>).
|
|
|
|
-define(MNESIA_VHOST, <<"mnesia.localhost">>).
|
2016-02-19 15:06:41 +01:00
|
|
|
-define(REDIS_VHOST, <<"redis.localhost">>).
|
2013-06-26 19:55:29 +02:00
|
|
|
-define(MYSQL_VHOST, <<"mysql.localhost">>).
|
2020-04-28 16:22:42 +02:00
|
|
|
-define(MSSQL_VHOST, <<"mssql.localhost">>).
|
2013-06-26 19:55:29 +02:00
|
|
|
-define(PGSQL_VHOST, <<"pgsql.localhost">>).
|
2015-03-16 19:53:19 +01:00
|
|
|
-define(SQLITE_VHOST, <<"sqlite.localhost">>).
|
2013-06-26 19:55:29 +02:00
|
|
|
-define(LDAP_VHOST, <<"ldap.localhost">>).
|
|
|
|
-define(EXTAUTH_VHOST, <<"extauth.localhost">>).
|
2016-09-23 11:30:33 +02:00
|
|
|
-define(S2S_VHOST, <<"s2s.localhost">>).
|
2018-05-17 12:24:23 +02:00
|
|
|
-define(UPLOAD_VHOST, <<"upload.localhost">>).
|
2013-06-26 19:55:29 +02:00
|
|
|
|
2020-04-28 16:22:42 +02:00
|
|
|
-define(BACKENDS, [mnesia, redis, mysql, mssql, odbc, pgsql, sqlite, ldap, extauth]).
|
2019-06-14 11:33:26 +02:00
|
|
|
|
2013-06-26 19:55:29 +02:00
|
|
|
insert(Val, N, Tuple) ->
|
|
|
|
L = tuple_to_list(Tuple),
|
|
|
|
{H, T} = lists:split(N-1, L),
|
|
|
|
list_to_tuple(H ++ [Val|T]).
|