mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
More and better test cleanup try 2
This commit is contained in:
@ -45,6 +45,7 @@ import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobType;
|
|||||||
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobsMetaDataProvider;
|
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobsMetaDataProvider;
|
||||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.QScheduleManager;
|
import com.kingsrook.qqq.backend.core.scheduler.QScheduleManager;
|
||||||
|
import com.kingsrook.qqq.backend.core.scheduler.SchedulerTestUtils;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzJobAndTriggerWrapper;
|
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzJobAndTriggerWrapper;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzTestUtils;
|
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzTestUtils;
|
||||||
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||||
@ -97,7 +98,7 @@ class ScheduledJobTableCustomizerTest extends BaseTest
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QuartzTestUtils.afterEach();
|
SchedulerTestUtils.afterEach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class QScheduleManagerTest extends BaseTest
|
|||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class);
|
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class);
|
||||||
QuartzTestUtils.afterEach();
|
SchedulerTestUtils.afterEach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.scheduleing.QScheduleMetaDa
|
|||||||
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJob;
|
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJob;
|
||||||
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobParameter;
|
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobParameter;
|
||||||
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobType;
|
import com.kingsrook.qqq.backend.core.model.scheduledjobs.ScheduledJobType;
|
||||||
|
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzScheduler;
|
||||||
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +87,38 @@ public class SchedulerTestUtils
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public static void afterEach()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QScheduleManager.getInstance().stop();
|
||||||
|
QScheduleManager.getInstance().unInit();
|
||||||
|
}
|
||||||
|
catch(IllegalStateException ise)
|
||||||
|
{
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// ok, might just mean that this test didn't init the instance //
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QuartzScheduler.getInstance().stop();
|
||||||
|
QuartzScheduler.getInstance().unInit();
|
||||||
|
}
|
||||||
|
catch(IllegalStateException ise)
|
||||||
|
{
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// ok, might just mean that this test didn't init the instance //
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -58,28 +58,7 @@ class RescheduleAllJobsProcessTest extends BaseTest
|
|||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class);
|
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class);
|
||||||
|
SchedulerTestUtils.afterEach();
|
||||||
try
|
|
||||||
{
|
|
||||||
QScheduleManager.getInstance().unInit();
|
|
||||||
}
|
|
||||||
catch(IllegalStateException ise)
|
|
||||||
{
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// ok, might just mean that this test didn't init the instance //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QuartzScheduler.getInstance().unInit();
|
|
||||||
}
|
|
||||||
catch(IllegalStateException ise)
|
|
||||||
{
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// ok, might just mean that this test didn't init the instance //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,28 +66,7 @@ class ScheduleAllNewJobsProcessTest extends BaseTest
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
try
|
SchedulerTestUtils.afterEach();
|
||||||
{
|
|
||||||
QScheduleManager.getInstance().stop();
|
|
||||||
QScheduleManager.getInstance().unInit();
|
|
||||||
}
|
|
||||||
catch(IllegalStateException ise)
|
|
||||||
{
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// ok, might just mean that this test didn't init the instance //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QuartzScheduler.getInstance().unInit();
|
|
||||||
}
|
|
||||||
catch(IllegalStateException ise)
|
|
||||||
{
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// ok, might just mean that this test didn't init the instance //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class UnscheduleAllJobsProcessTest extends BaseTest
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach()
|
void beforeEach()
|
||||||
{
|
{
|
||||||
QuartzTestUtils.afterEach();
|
SchedulerTestUtils.afterEach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class UnscheduleAllJobsProcessTest extends BaseTest
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QuartzTestUtils.afterEach();
|
SchedulerTestUtils.afterEach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class QuartzSchedulerTest extends BaseTest
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QuartzTestUtils.afterEach();
|
SchedulerTestUtils.afterEach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ import java.util.Properties;
|
|||||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.scheduleing.quartz.QuartzSchedulerMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.scheduleing.quartz.QuartzSchedulerMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.QScheduleManager;
|
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
|
||||||
|
|
||||||
@ -104,35 +103,4 @@ public class QuartzTestUtils
|
|||||||
return QuartzScheduler.getInstance().queryQuartz();
|
return QuartzScheduler.getInstance().queryQuartz();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
public static void afterEach()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QScheduleManager.getInstance().stop();
|
|
||||||
QScheduleManager.getInstance().unInit();
|
|
||||||
}
|
|
||||||
catch(IllegalStateException ise)
|
|
||||||
{
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// ok, might just mean that this test didn't init the instance //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QuartzScheduler.getInstance().stop();
|
|
||||||
QuartzScheduler.getInstance().unInit();
|
|
||||||
}
|
|
||||||
catch(IllegalStateException ise)
|
|
||||||
{
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// ok, might just mean that this test didn't init the instance //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.QScheduleManager;
|
import com.kingsrook.qqq.backend.core.scheduler.QScheduleManager;
|
||||||
|
import com.kingsrook.qqq.backend.core.scheduler.SchedulerTestUtils;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzJobAndTriggerWrapper;
|
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzJobAndTriggerWrapper;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzScheduler;
|
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzScheduler;
|
||||||
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzTestUtils;
|
import com.kingsrook.qqq.backend.core.scheduler.quartz.QuartzTestUtils;
|
||||||
@ -92,7 +93,7 @@ class QuartzJobsProcessTest extends BaseTest
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QuartzTestUtils.afterEach();
|
SchedulerTestUtils.afterEach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,8 +53,7 @@ class SimpleSchedulerTest extends BaseTest
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach()
|
void afterEach()
|
||||||
{
|
{
|
||||||
QScheduleManager.getInstance().stop();
|
SchedulerTestUtils.afterEach();
|
||||||
QScheduleManager.getInstance().unInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user