Search in sources :

Example 31 with StartupEvent

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();
}
Also used : StartupEvent(io.quarkus.runtime.StartupEvent) Test(org.junit.jupiter.api.Test)

Example 32 with StartupEvent

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();
}
Also used : StartupEvent(io.quarkus.runtime.StartupEvent) Test(org.junit.jupiter.api.Test)

Example 33 with StartupEvent

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);
        }
    });
}
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 34 with StartupEvent

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();
}
Also used : StartupEvent(io.quarkus.runtime.StartupEvent) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 35 with StartupEvent

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);
}
Also used : PostgresMappingDefinition(org.kie.kogito.persistence.postgresql.reporting.model.PostgresMappingDefinition) PostgresPartitionField(org.kie.kogito.persistence.postgresql.reporting.model.PostgresPartitionField) PostgresMappingDefinitions(org.kie.kogito.persistence.postgresql.reporting.model.PostgresMappingDefinitions) StartupEvent(io.quarkus.runtime.StartupEvent) PostgresField(org.kie.kogito.persistence.postgresql.reporting.model.PostgresField) PostgresJsonField(org.kie.kogito.persistence.postgresql.reporting.model.PostgresJsonField) PostgresMapping(org.kie.kogito.persistence.postgresql.reporting.model.PostgresMapping) Test(org.junit.jupiter.api.Test)

Aggregations

StartupEvent (io.quarkus.runtime.StartupEvent)36 Test (org.junit.jupiter.api.Test)29 Description (io.qameta.allure.Description)16 SerializedEntandoResource (org.entando.kubernetes.controller.spi.client.SerializedEntandoResource)13 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)12 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)12 CustomResourceDefinition (io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition)12 CustomResourceDefinitionBuilder (io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder)12 ValueHolder (org.entando.kubernetes.test.common.ValueHolder)11 BasicDeploymentSpecBuilder (org.entando.kubernetes.fluentspi.BasicDeploymentSpecBuilder)8 TestResource (org.entando.kubernetes.fluentspi.TestResource)8 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)7 IOException (java.io.IOException)7 ProvidedCapabilityBuilder (org.entando.kubernetes.model.capability.ProvidedCapabilityBuilder)7 Pod (io.fabric8.kubernetes.api.model.Pod)6 CustomResourceDefinitionContext (io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext)5 Allure.attachment (io.qameta.allure.Allure.attachment)5 Allure.step (io.qameta.allure.Allure.step)5 Feature (io.qameta.allure.Feature)5 Issue (io.qameta.allure.Issue)5