From f1063ca93504929411f5b3ab208e613eac04e025 Mon Sep 17 00:00:00 2001 From: Vitalii Samolovskikh Date: Wed, 21 Feb 2018 18:59:05 +0500 Subject: [PATCH] #80 Fix onStartup signature Quartz 2.0.13 Flush on send --- README.md | 4 ++-- build.gradle | 4 ++-- .../plugin/asyncmail/AsynchronousMailService.groovy | 2 +- .../AsynchronousMailPersistenceServiceSpec.groovy | 9 ++++++++- .../plugin/asyncmail/AsynchronousMailGrailsPlugin.groovy | 5 +++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d850c4d..8b31c28 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,13 @@ Installation To install just add the plugin to the plugins block of `build.gradle`. For Grails 3.3.x ```groovy -compile "org.grails.plugins:asynchronous-mail:2.0.1" +compile "org.grails.plugins:asynchronous-mail:2.0.2" ``` For Grails 3.2.11 and earlier ```groovy -compile "org.grails.plugins:asynchronous-mail:2.0.1-3.2.x" +compile "org.grails.plugins:asynchronous-mail:2.0.2-3.2.x" ``` Configuration diff --git a/build.gradle b/build.gradle index a66bcfb..9f9ba3a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } } -version "2.0.1" +version "2.0.2" group "org.grails.plugins" apply plugin: 'idea' @@ -49,7 +49,7 @@ dependencies { testCompile "com.h2database:h2:1.4.196" compile "org.grails.plugins:mail:2.0.0" - compile "org.grails.plugins:quartz:2.0.12" + compile "org.grails.plugins:quartz:2.0.13" } assets { diff --git a/grails-app/services/grails/plugin/asyncmail/AsynchronousMailService.groovy b/grails-app/services/grails/plugin/asyncmail/AsynchronousMailService.groovy index d44690d..eaf9ba9 100644 --- a/grails-app/services/grails/plugin/asyncmail/AsynchronousMailService.groovy +++ b/grails-app/services/grails/plugin/asyncmail/AsynchronousMailService.groovy @@ -45,7 +45,7 @@ class AsynchronousMailService { savedMessage = asynchronousMailPersistenceService.save(message, true, true) } } else { - savedMessage = asynchronousMailPersistenceService.save(message, immediately, true) + savedMessage = asynchronousMailPersistenceService.save(message, true, true) } if (!savedMessage) { diff --git a/src/integration-test/groovy/grails/plugin/asyncmail/AsynchronousMailPersistenceServiceSpec.groovy b/src/integration-test/groovy/grails/plugin/asyncmail/AsynchronousMailPersistenceServiceSpec.groovy index c1b4ca0..e681190 100644 --- a/src/integration-test/groovy/grails/plugin/asyncmail/AsynchronousMailPersistenceServiceSpec.groovy +++ b/src/integration-test/groovy/grails/plugin/asyncmail/AsynchronousMailPersistenceServiceSpec.groovy @@ -39,6 +39,10 @@ class AsynchronousMailPersistenceServiceSpec extends Specification { then: "message1 id message" message1.id == message.id + message1.from == 'John Smith ' + message1.to == ['Mary Smith '] + message1.subject == 'Subject' + message1.text == 'Text' when: 'deleted the message' asynchronousMailPersistenceService.delete(message1, true) @@ -91,8 +95,11 @@ class AsynchronousMailPersistenceServiceSpec extends Specification { text: 'Text' ) - expect: + when: asynchronousMailPersistenceService.save(message, true, true) + then: + AsynchronousMailMessage dbMessage = asynchronousMailPersistenceService.getMessage(message.id) + dbMessage.bcc == ['mary@example.com'] cleanup: asynchronousMailPersistenceService.delete(message, true) diff --git a/src/main/groovy/grails/plugin/asyncmail/AsynchronousMailGrailsPlugin.groovy b/src/main/groovy/grails/plugin/asyncmail/AsynchronousMailGrailsPlugin.groovy index 3a7bcc1..8434a2a 100644 --- a/src/main/groovy/grails/plugin/asyncmail/AsynchronousMailGrailsPlugin.groovy +++ b/src/main/groovy/grails/plugin/asyncmail/AsynchronousMailGrailsPlugin.groovy @@ -10,7 +10,7 @@ import org.quartz.TriggerKey @Slf4j class AsynchronousMailGrailsPlugin extends Plugin { - def grailsVersion = "3.1.0 > *" + def grailsVersion = "3.3.0 > *" def loadAfter = ['mail', 'quartz', 'hibernate', 'hibernate3', 'hibernate4', 'hibernate5', 'mongodb'] Closure doWithSpring() { { -> @@ -22,7 +22,8 @@ class AsynchronousMailGrailsPlugin extends Plugin { } } - void onStartup() { + @Override + void onStartup(Map event) { // Starts jobs startJobs(applicationContext) }