More and better test cleanup

This commit is contained in:
2024-04-09 08:43:47 -05:00
parent 4dd4d1256a
commit 1b1d066131
5 changed files with 16 additions and 48 deletions

View File

@ -54,28 +54,7 @@ class QScheduleManagerTest extends BaseTest
void afterEach() void afterEach()
{ {
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class); QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class);
QuartzTestUtils.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 //
/////////////////////////////////////////////////////////////////
}
} }

View File

@ -66,10 +66,9 @@ class ScheduleAllNewJobsProcessTest extends BaseTest
@AfterEach @AfterEach
void afterEach() void afterEach()
{ {
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class);
try try
{ {
QScheduleManager.getInstance().stop();
QScheduleManager.getInstance().unInit(); QScheduleManager.getInstance().unInit();
} }
catch(IllegalStateException ise) catch(IllegalStateException ise)

View File

@ -28,7 +28,6 @@ import com.kingsrook.qqq.backend.core.BaseTest;
import com.kingsrook.qqq.backend.core.actions.processes.RunProcessAction; import com.kingsrook.qqq.backend.core.actions.processes.RunProcessAction;
import com.kingsrook.qqq.backend.core.context.QContext; import com.kingsrook.qqq.backend.core.context.QContext;
import com.kingsrook.qqq.backend.core.exceptions.QException; import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.logging.QLogger;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessInput; import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessInput;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerHelper; import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerHelper;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance; import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
@ -40,6 +39,7 @@ 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;
import com.kingsrook.qqq.backend.core.utils.TestUtils; import com.kingsrook.qqq.backend.core.utils.TestUtils;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
@ -52,35 +52,23 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
class UnscheduleAllJobsProcessTest extends BaseTest class UnscheduleAllJobsProcessTest extends BaseTest
{ {
/*******************************************************************************
**
*******************************************************************************/
@BeforeEach
void beforeEach()
{
QuartzTestUtils.afterEach();
}
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
@AfterEach @AfterEach
void afterEach() void afterEach()
{ {
QLogger.deactivateCollectingLoggerForClass(QuartzScheduler.class); QuartzTestUtils.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 //
/////////////////////////////////////////////////////////////////
}
} }

View File

@ -125,6 +125,7 @@ public class QuartzTestUtils
try try
{ {
QuartzScheduler.getInstance().stop();
QuartzScheduler.getInstance().unInit(); QuartzScheduler.getInstance().unInit();
} }
catch(IllegalStateException ise) catch(IllegalStateException ise)

View File

@ -53,6 +53,7 @@ class SimpleSchedulerTest extends BaseTest
@AfterEach @AfterEach
void afterEach() void afterEach()
{ {
QScheduleManager.getInstance().stop();
QScheduleManager.getInstance().unInit(); QScheduleManager.getInstance().unInit();
} }