use of io.quarkus.runtime.StartupEvent in project jobrunr by jobrunr.
the class JobRunrMetricsStarterTest method metricsStarterDoesNotStartStorageProviderMetricsBinderIfNotAvailable.
@Test
void metricsStarterDoesNotStartStorageProviderMetricsBinderIfNotAvailable() {
jobRunrMetricsStarter.startup(new StartupEvent());
verify(storageProviderMetricsBinderInstance, never()).get();
}
use of io.quarkus.runtime.StartupEvent in project jobrunr by jobrunr.
the class JobRunrMetricsStarterTest method metricsStarterStartsStorageProviderMetricsBinderIfAvailable.
@Test
void metricsStarterStartsStorageProviderMetricsBinderIfAvailable() {
when(storageProviderMetricsBinderInstance.isResolvable()).thenReturn(true);
jobRunrMetricsStarter.startup(new StartupEvent());
verify(storageProviderMetricsBinderInstance).get();
}
use of io.quarkus.runtime.StartupEvent 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);
}
});
}
use of io.quarkus.runtime.StartupEvent in project kogito-apps by kiegroup.
the class KafkaConfigurationIT method topicConfigurationDisabledEvents.
@Test
void topicConfigurationDisabledEvents() {
tested = new KafkaConfiguration(defaultKafkaConfiguration, vertx, Optional.of(Boolean.FALSE), TOPIC);
assertThat(tested.getAdminClient()).isNull();
tested.topicConfiguration(new StartupEvent());
assertThat(tested.getAdminClient()).isNull();
}
use of io.quarkus.runtime.StartupEvent in project kogito-apps by kiegroup.
the class PostgresStartupHandlerImplTest method testOnStart.
@Test
void testOnStart() {
final PostgresMappingDefinition definition = new PostgresMappingDefinition("mappingId", "sourceTableName", "sourceTableJsonFieldName", List.of(new PostgresField("key")), List.of(new PostgresPartitionField("sourceTablePartitionFieldName", "sourceTablePartitionName")), "targetTableName", List.of(new PostgresMapping("sourceJsonPath", new PostgresJsonField("targetFieldName", JsonType.STRING))));
final PostgresMappingDefinitions definitions = new PostgresMappingDefinitions(List.of(definition));
when(loader.load()).thenReturn(Optional.of(definitions));
service.onStartup(new StartupEvent());
verify(mappingService).saveMappingDefinition(definition);
verify(databaseManager).createArtifacts(definition);
}
Aggregations