Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable quartz in unit tests ? #116

Open
vnybst opened this issue May 10, 2022 · 0 comments
Open

How to disable quartz in unit tests ? #116

vnybst opened this issue May 10, 2022 · 0 comments

Comments

@vnybst
Copy link

vnybst commented May 10, 2022

Hi,

I am using quartz org.grails.plugins:quartz:2.0.13 with grails 3.3.14.
My quartz config is as follows:

quartz:
    autoStartup: true
    jdbcStore: true
    waitForJobsToCompleteOnShutdown: false
    exposeSchedulerInRepository: false
    props:
        scheduler:
            skipUpdateCheck: true
    jobStore:
        tablePrefix: 'QRTZ_'
        misfireThreshold: 60000
        maxMisfiresToHandleAtATime: 2
        clusterCheckinInterval: 5000
        class: 'org.quartz.impl.jdbcjobstore.JobStoreTX'
        driverDelegateClass: 'org.quartz.impl.jdbcjobstore.StdJDBCDelegate'
        isClustered: true
        useProperties: false
    threadPool:
        threadCount: 4
        class: 'org.quartz.simpl.SimpleThreadPool'
        threadPriority: 1
    plugin:
        shutdownhook:
            class: 'org.quartz.plugins.management.ShutdownHookPlugin'
            cleanShutdown: true
        triggerHistory:
            class: 'org.quartz.plugins.history.LoggingTriggerHistoryPlugin'
    jobHistory:
        class: 'org.quartz.plugins.history.LoggingJobHistoryPlugin'

Now, i want to disable quartz for test environment. For that i did:

environments:
          test:
              quartz:
                    autoStartup: false
                    jdbcStore: false

in application.yml file.

But it gives me error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler': Invocation of init method failed; nested exception is org.quartz.SchedulerConfigException: DataSource name not set.

Caused by: org.quartz.SchedulerConfigException: DataSource name not set.

I tried setting

environments:
          test:
              quartz:
                    pluginEnabled: false

But then it gives me

Caused by: java.lang.NullPointerException: Cannot get property 'group' on null object
	at grails.plugins.quartz.QuartzJob$Trait$Helper.schedule(QuartzJob.groovy:58)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant