Search in sources :

Example 6 with ShutdownEvent

use of io.quarkus.runtime.ShutdownEvent in project jobrunr by jobrunr.

the class JobRunrStarterTest method jobRunrStarterStopsStorageProvider.

@Test
void jobRunrStarterStopsStorageProvider() {
    jobRunrStarter.shutdown(new ShutdownEvent());
    verify(storageProvider).close();
}
Also used : ShutdownEvent(io.quarkus.runtime.ShutdownEvent) Test(org.junit.jupiter.api.Test)

Example 7 with ShutdownEvent

use of io.quarkus.runtime.ShutdownEvent in project jobrunr by jobrunr.

the class JobRunrStarterTest method jobRunrStarterStopsBackgroundJobServerIfConfigured.

@Test
void jobRunrStarterStopsBackgroundJobServerIfConfigured() {
    backgroundJobServerConfiguration.enabled = true;
    jobRunrStarter.shutdown(new ShutdownEvent());
    verify(backgroundJobServer).stop();
}
Also used : ShutdownEvent(io.quarkus.runtime.ShutdownEvent) Test(org.junit.jupiter.api.Test)

Example 8 with ShutdownEvent

use of io.quarkus.runtime.ShutdownEvent in project quarkus by quarkusio.

the class ArcRecorder method handleLifecycleEvents.

public void handleLifecycleEvents(ShutdownContext context, LaunchMode launchMode, boolean disableApplicationLifecycleObservers) {
    ArcContainerImpl container = ArcContainerImpl.instance();
    List<Class<?>> mockBeanClasses;
    // If needed then mock all app observers in the test mode
    if (launchMode == LaunchMode.TEST && disableApplicationLifecycleObservers) {
        Predicate<String> predicate = container.select(TestApplicationClassPredicate.class).get();
        mockBeanClasses = new ArrayList<>();
        for (InjectableBean<?> bean : container.getBeans()) {
            // Mock observers for all application class beans
            if (bean.getKind() == Kind.CLASS && predicate.test(bean.getBeanClass().getName())) {
                mockBeanClasses.add(bean.getBeanClass());
            }
        }
    } else {
        mockBeanClasses = Collections.emptyList();
    }
    fireLifecycleEvent(container, new StartupEvent(), mockBeanClasses);
    context.addShutdownTask(new Runnable() {

        @Override
        public void run() {
            fireLifecycleEvent(container, new ShutdownEvent(), mockBeanClasses);
        }
    });
}
Also used : ArcContainerImpl(io.quarkus.arc.impl.ArcContainerImpl) StartupEvent(io.quarkus.runtime.StartupEvent) PreloadedTestApplicationClassPredicate(io.quarkus.arc.runtime.test.PreloadedTestApplicationClassPredicate) TestApplicationClassPredicate(io.quarkus.runtime.test.TestApplicationClassPredicate) ShutdownEvent(io.quarkus.runtime.ShutdownEvent)

Example 9 with ShutdownEvent

use of io.quarkus.runtime.ShutdownEvent in project kogito-apps by kiegroup.

the class TaskAssigningServiceTest method onShutDownEvent.

@Test
void onShutDownEvent() throws Exception {
    prepareStart();
    taskAssigningService.onShutDownEvent(new ShutdownEvent());
    verifyDestroy();
}
Also used : ShutdownEvent(io.quarkus.runtime.ShutdownEvent) Test(org.junit.jupiter.api.Test)

Aggregations

ShutdownEvent (io.quarkus.runtime.ShutdownEvent)9 Test (org.junit.jupiter.api.Test)8 KafkaClientMetrics (io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics)1 KafkaStreamsMetrics (io.micrometer.core.instrument.binder.kafka.KafkaStreamsMetrics)1 ArcContainerImpl (io.quarkus.arc.impl.ArcContainerImpl)1 PreloadedTestApplicationClassPredicate (io.quarkus.arc.runtime.test.PreloadedTestApplicationClassPredicate)1 StartupEvent (io.quarkus.runtime.StartupEvent)1 TestApplicationClassPredicate (io.quarkus.runtime.test.TestApplicationClassPredicate)1