summaryrefslogtreecommitdiff
path: root/deps/rabbitmq_web_stomp/test/src/rabbit_ws_test_util.erl
blob: 822d9c27f1c8b86248a613d808a3bc8e175352c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2007-2020 VMware, Inc. or its affiliates.  All rights reserved.
%%

-module(rabbit_ws_test_util).

-export([update_app_env/3, get_web_stomp_port_str/1]).

update_app_env(Config, Key, Val) ->
    ok = rabbit_ct_broker_helpers:rpc(Config, 0,
                                      application, set_env,
                                      [rabbitmq_web_stomp, Key, Val]),
    ok = rabbit_ct_broker_helpers:rpc(Config, 0,
                                      application, stop,
                                      [rabbitmq_web_stomp]),
    ok = rabbit_ct_broker_helpers:rpc(Config, 0,
                                      application, start,
                                      [rabbitmq_web_stomp]).

get_web_stomp_port_str(Config) ->
    Port = case rabbit_ct_helpers:get_config(Config, protocol) of
        "ws" ->
            rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_web_stomp);
        "wss" ->
            rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_web_stomp_tls)
    end,
    integer_to_list(Port).