package com.easyagents.scheduler.quartz;

import org.junit.Test;

import java.util.Properties;

import static org.junit.Assert.assertEquals;

/** {@link QuartzSchedulerFactory} 原生属性映射测试。 */
public class QuartzSchedulerFactoryTest {

    @Test
    public void batchAcquisitionMustRunWithinJobStoreLock() {
        QuartzSchedulerConfig config = new QuartzSchedulerConfig(
            "batch-scheduler",
            "NON_CLUSTERED",
            "QRTZ_",
            QuartzSchedulerConfig.STANDARD_JDBC_DELEGATE,
            false,
            8,
            Thread.NORM_PRIORITY,
            8,
            1_000L,
            15_000L,
            60_000L,
            true,
            30_000L,
            false
        );

        Properties properties = QuartzSchedulerFactory.properties(config, "testDs");

        assertEquals("8", properties.getProperty(
            "org.quartz.scheduler.batchTriggerAcquisitionMaxCount"));
        assertEquals("1000", properties.getProperty(
            "org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow"));
        assertEquals("true", properties.getProperty(
            "org.quartz.jobStore.acquireTriggersWithinLock"));
    }
}
