From 8c710ae8c2e4da3c2815eeaeeee05f7b51ca2879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 23 Mar 2022 15:40:15 +0100 Subject: [PATCH] Remove deprecated mod_aws_sns - It was deprecated for more than 4 years - All functionality is provided by mod_event_pusher now --- ...ITE.erl => mod_event_pusher_sns_SUITE.erl} | 7 +++- src/mod_aws_sns.erl | 39 ------------------- ...s_SUITE.erl => event_pusher_sns_SUITE.erl} | 6 +-- 3 files changed, 8 insertions(+), 44 deletions(-) rename big_tests/tests/{mod_aws_sns_SUITE.erl => mod_event_pusher_sns_SUITE.erl} (98%) delete mode 100644 src/mod_aws_sns.erl rename test/{mod_aws_sns_SUITE.erl => event_pusher_sns_SUITE.erl} (98%) diff --git a/big_tests/tests/mod_aws_sns_SUITE.erl b/big_tests/tests/mod_event_pusher_sns_SUITE.erl similarity index 98% rename from big_tests/tests/mod_aws_sns_SUITE.erl rename to big_tests/tests/mod_event_pusher_sns_SUITE.erl index 032f95e8fc..c7d94e9383 100644 --- a/big_tests/tests/mod_aws_sns_SUITE.erl +++ b/big_tests/tests/mod_event_pusher_sns_SUITE.erl @@ -1,4 +1,4 @@ --module(mod_aws_sns_SUITE). +-module(mod_event_pusher_sns_SUITE). -compile([export_all, nowarn_export_all]). -include_lib("escalus/include/escalus.hrl"). -include_lib("common_test/include/ct.hrl"). @@ -87,9 +87,12 @@ init_per_group(_, Config0) -> Domain = domain(), Config1 = dynamic_modules:save_modules(Domain, Config0), Config = [{sns_config, ?SNS_OPTS} | Config1], - dynamic_modules:ensure_modules(Domain, [{mod_aws_sns, ?SNS_OPTS}]), + dynamic_modules:ensure_modules(Domain, required_modules()), Config. +required_modules() -> + [{mod_event_pusher, [{backends, [{sns, ?SNS_OPTS}]}]}]. + end_per_group(_, Config) -> dynamic_modules:restore_modules(Config), escalus:delete_users(Config, escalus:get_users([bob, alice])). diff --git a/src/mod_aws_sns.erl b/src/mod_aws_sns.erl deleted file mode 100644 index 8f242b7ac6..0000000000 --- a/src/mod_aws_sns.erl +++ /dev/null @@ -1,39 +0,0 @@ -%%%------------------------------------------------------------------- -%%% @author Rafal Slota -%%% @copyright (C) 2017 Erlang Solutions Ltd. -%%% This software is released under the Apache License, Version 2.0 -%%% cited in 'LICENSE.txt'. -%%% @end -%%%------------------------------------------------------------------- -%%% @doc -%%% Amazon SNS notifications. This module gathers all message send by users and all presence -%%% changes and publishes those events to AWS SNS. -%%% @end -%%%------------------------------------------------------------------- --module(mod_aws_sns). --author("Rafal Slota"). - --include("mongoose.hrl"). - --behavior(gen_mod). - -%% MIM module callbacks --export([deps/2, start/2, stop/1]). - -%%%=================================================================== -%%% API functions -%%%=================================================================== - -deps(_Host, Opts) -> - [{mod_event_pusher, [{backends, [{sns, Opts}]}], hard}]. - --spec start(Host :: jid:server(), Opts :: proplists:proplist()) -> any(). -start(_Host, _Opts) -> - Text = <<"mod_aws_sns is deprecated and will be removed in the future.~n" - "Please use mod_event_pusher with sns backend.~n" - "Refer to mod_event_pusher documentation for more information.">>, - ?LOG_WARNING(#{what => module_deprecated, text => Text}). - --spec stop(Host :: jid:server()) -> ok. -stop(_Host) -> - ok. diff --git a/test/mod_aws_sns_SUITE.erl b/test/event_pusher_sns_SUITE.erl similarity index 98% rename from test/mod_aws_sns_SUITE.erl rename to test/event_pusher_sns_SUITE.erl index c48876cb1d..ec9cb7cbc9 100644 --- a/test/mod_aws_sns_SUITE.erl +++ b/test/event_pusher_sns_SUITE.erl @@ -1,4 +1,4 @@ --module(mod_aws_sns_SUITE). +-module(event_pusher_sns_SUITE). -compile([export_all, nowarn_export_all]). @@ -134,7 +134,7 @@ end_per_suite(_) -> init_per_testcase(_, Config) -> meck:new([gen_mod, erlcloud_sns, mongoose_wpool], [non_strict, passthrough]), - meck:expect(erlcloud_sns, new, fun(_, _, _) -> mod_aws_sns_SUITE_erlcloud_sns_new end), + meck:expect(erlcloud_sns, new, fun(_, _, _) -> mod_event_pusher_sns_SUITE_erlcloud_sns_new end), set_sns_config(#{}), meck:expect(mongoose_wpool, cast, fun(_, _, _, {M, F, A}) -> erlang:apply(M, F, A) end), [{sender, jid:from_binary(<<"sender@localhost">>)}, @@ -169,7 +169,7 @@ user_not_present_callback(Config) -> %% Helpers custom_callback_module(UserId, Attributes) -> - Module = mod_aws_sns_SUITE_mockcb, + Module = mod_event_pusher_sns_SUITE_mockcb, set_sns_config(#{plugin_module => Module}), meck:new(Module, [non_strict]), meck:expect(Module, user_guid, fun(_) -> UserId end),