From 6b9ff362bc1a122d9174b500781fc2d37b0189ca Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Fri, 29 Sep 2023 14:32:34 +0200 Subject: [PATCH] LDEV-1868 fix cfapplication mailservers https://luceeserver.atlassian.net/browse/LDEV-1868 --- .../java/lucee/runtime/tag/Application.java | 2 +- test/tickets/LDEV1868.cfc | 61 +++++++++++++++++++ test/tickets/_LDEV1868.cfc | 30 --------- 3 files changed, 62 insertions(+), 31 deletions(-) create mode 100644 test/tickets/LDEV1868.cfc delete mode 100644 test/tickets/_LDEV1868.cfc diff --git a/core/src/main/java/lucee/runtime/tag/Application.java b/core/src/main/java/lucee/runtime/tag/Application.java index 9301b79574..a55b6e10a9 100644 --- a/core/src/main/java/lucee/runtime/tag/Application.java +++ b/core/src/main/java/lucee/runtime/tag/Application.java @@ -329,7 +329,7 @@ public void setLogs(Struct logs) { this.logs = logs; } - public void setMails(Array mails) { + public void setMailservers(Array mails) { this.mails = mails; } diff --git a/test/tickets/LDEV1868.cfc b/test/tickets/LDEV1868.cfc new file mode 100644 index 0000000000..4619ad6aa8 --- /dev/null +++ b/test/tickets/LDEV1868.cfc @@ -0,0 +1,61 @@ +component extends="org.lucee.cfml.test.LuceeTestCase" skip=true { + function run( testResults , testBox ) { + describe( "Test case for LDEV-1868", function() { + it( title='Checking Application context for MailSettings', body=function( currentSpec ) { + defineMailSettings_mailservers(25, false, false); + var settings = getApplicationSettings(); + assertEquals(25, settings.mails[1].port); + assertEquals(false, settings.mails[1].tls); + assertEquals(false, settings.mails[1].ssl); + + defineMailSettings_mailservers(587, true, true); + var settings = getApplicationSettings(); + assertEquals(587, settings.mails[1].port); + assertEquals(true, settings.mails[1].tls); + assertEquals(true, settings.mails[1].ssl); + }); + + it( title='Checking Application context for Mail', body=function( currentSpec ) { + defineMailSettings_mails(25, false, false); + var settings = getApplicationSettings(); + assertEquals(25, settings.mails[1].port); + assertEquals(false, settings.mails[1].tls); + assertEquals(false, settings.mails[1].ssl); + + defineMailSettings_mails(587, true, true); + var settings = getApplicationSettings(); + assertEquals(587, settings.mails[1].port); + assertEquals(true, settings.mails[1].tls); + assertEquals(true, settings.mails[1].ssl); + }); + }); + } + + private void function defineMailSettings_mailservers(port, tls, ssl){ + application action="update" + mailservers =[ { + server :"smtp.mail.com" + , port: arguments.port + , userName:"testing@mail.com" + , password:"password" + , useTLS:arguments.tls + , useSSL:arguments.ssl + , lifeTimespan: createTimeSpan(0,0,1,0) + , idleTimespan: createTimeSpan(0,0,2,0) + }]; + } + + private void function defineMailSettings_mails(port, tls, ssl){ + application action="update" + mails =[ { + server :"smtp.mail.com" + , port: arguments.port + , userName:"testing@mail.com" + , password:"password" + , useTLS:arguments.tls + , useSSL:arguments.ssl + , lifeTimespan: createTimeSpan(0,0,1,0) + , idleTimespan: createTimeSpan(0,0,2,0) + }]; + } +} \ No newline at end of file diff --git a/test/tickets/_LDEV1868.cfc b/test/tickets/_LDEV1868.cfc deleted file mode 100644 index 279dce9c4d..0000000000 --- a/test/tickets/_LDEV1868.cfc +++ /dev/null @@ -1,30 +0,0 @@ -component extends="org.lucee.cfml.test.LuceeTestCase"{ - function run( testResults , testBox ) { - describe( "Test case for LDEV-1868", function() { - it( title='Checking Application context for MailSettings', body=function( currentSpec ) { - defineMailSettings(25, false, false); - assertEquals(25, getApplicationSettings().mails[1].port); - assertEquals(false, getApplicationSettings().mails[1].tls); - assertEquals(false, getApplicationSettings().mails[1].ssl); - defineMailSettings(587, true, true); - assertEquals(587, getApplicationSettings().mails[1].port); - assertEquals(true, getApplicationSettings().mails[1].tls); - assertEquals(true, getApplicationSettings().mails[1].ssl); - }); - }); - } - - private void function defineMailSettings(port, tls, ssl){ - application action="update" - mails =[ { - server :"smtp.mail.com" - , port: arguments.port - , userName:"testing@mail.com" - , password:"password" - , useTLS:arguments.tls - , useSSL:arguments.ssl - , lifeTimespan: createTimeSpan(0,0,1,0) - , idleTimespan: createTimeSpan(0,0,2,0) - }]; - } -} \ No newline at end of file