@@ -44,21 +44,6 @@ void whenCallingGetAppAsync_thenNoException() {
4444 @ DisplayName ("App Settings update does not throw Exception" )
4545 @ Test
4646 void whenUpdatingAppSettings_thenNoException () {
47- Assertions .assertDoesNotThrow (
48- () ->
49- App .update ()
50- .disableAuthChecks (true )
51- .disablePermissionsChecks (true )
52- .asyncModerationConfig (
53- App .AsyncModerationConfigRequestObject .builder ()
54- .callback (
55- App .AsyncModerationCallback .builder ()
56- .mode ("CALLBACK_MODE_REST" )
57- .serverUrl ("http://localhost.com" )
58- .build ())
59- .timeoutMs (3000 )
60- .build ())
61- .request ());
6247 Assertions .assertDoesNotThrow (
6348 () -> App .update ().disableAuthChecks (false ).disablePermissionsChecks (false ).request ());
6449 }
@@ -214,10 +199,10 @@ void whenUpdatingAppSettingsWithWebhookEventHooks_thenNoException() throws Strea
214199 @ Test
215200 void whenUpdatingAppSettingsWithSQSEventHook_thenNoException () throws StreamException {
216201 EventHook sqsHook = new EventHook ();
217- sqsHook .setId ("sqs-1 " );
202+ sqsHook .setId ("4f811340-1cbb-40ef-8393-1c2b2e0d339a " );
218203 sqsHook .setHookType (App .HookType .SQS );
219204 sqsHook .setEnabled (true );
220- sqsHook .setEventTypes (Arrays .asList ("user.presence.changed " , "user.updated" ));
205+ sqsHook .setEventTypes (Arrays .asList ("message.new " , "user.updated" ));
221206 sqsHook .setSqsQueueURL ("https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue" );
222207 sqsHook .setSqsRegion ("us-east-1" );
223208 sqsHook .setSqsAuthType (App .AuthType .RESOURCE );
@@ -238,7 +223,7 @@ void whenUpdatingAppSettingsWithSQSEventHook_thenNoException() throws StreamExce
238223 @ Test
239224 void whenUpdatingAppSettingsWithSNSEventHook_thenNoException () throws StreamException {
240225 EventHook snsHook = new EventHook ();
241- snsHook .setId ("sns-1 " );
226+ snsHook .setId ("7469e77e-52cd-4765-8ca0-e6a28e95e482 " );
242227 snsHook .setHookType (App .HookType .SNS );
243228 snsHook .setEnabled (true );
244229 snsHook .setEventTypes (Arrays .asList ("channel.created" , "channel.updated" ));
@@ -258,25 +243,28 @@ void whenUpdatingAppSettingsWithSNSEventHook_thenNoException() throws StreamExce
258243 }
259244 }
260245
261- @ DisplayName ("App Settings update webhook events " )
246+ @ DisplayName ("Can update app settings with pending message event hook " )
262247 @ Test
263- void whenUpdatingAppSettings_thenDoesntAlwaysChangeWebhookEvents () {
264- var messageNewList = Arrays .asList ("message.new" );
265- Assertions .assertDoesNotThrow (() -> App .update ().webhookEvents (messageNewList ).request ());
266-
267- var appConfig = Assertions .assertDoesNotThrow (() -> App .get ().request ()).getApp ();
268- Assertions .assertEquals (messageNewList , appConfig .getWebhookEvents ());
269-
270- // Updating another field should not change (reset) webhook events
271- Assertions .assertDoesNotThrow (() -> App .update ().remindersInterval (60 ).request ());
272-
273- appConfig = Assertions .assertDoesNotThrow (() -> App .get ().request ()).getApp ();
274- Assertions .assertEquals (messageNewList , appConfig .getWebhookEvents ());
248+ void whenUpdatingAppSettingsWithPendingMessageEventHook_thenNoException () throws StreamException {
249+ EventHook pendingMessageHook = new EventHook ();
250+ pendingMessageHook .setId ("5944d247-8b4f-4108-a970-fe1d11fca989" );
251+ pendingMessageHook .setHookType (App .HookType .PENDING_MESSAGE );
252+ pendingMessageHook .setEnabled (true );
253+ pendingMessageHook .setWebhookURL ("https://example.com/pending-message-webhook" );
254+ pendingMessageHook .setTimeoutMs (3000 );
255+
256+ App .PendingMessageCallback callback = new App .PendingMessageCallback ();
257+ callback .setMode (App .CallbackMode .REST );
258+ pendingMessageHook .setCallback (callback );
275259
276- // Reset webhook events to defaults using an empty list
277- Assertions .assertDoesNotThrow (() -> App .update ().webhookEvents (new ArrayList <>()).request ());
278- appConfig = Assertions .assertDoesNotThrow (() -> App .get ().request ()).getApp ();
279- Assertions .assertTrue (appConfig .getWebhookEvents ().size () > 1 );
260+ try {
261+ App .update ().eventHooks (Collections .singletonList (pendingMessageHook )).request ();
262+ } catch (StreamException e ) {
263+ if (e .getMessage ().contains ("cannot set event hooks in hook v1 system" )) {
264+ return ;
265+ }
266+ throw e ;
267+ }
280268 }
281269
282270 @ DisplayName ("AppConfig encoding should not include null fields" )
0 commit comments