Search in sources :

Example 1 with AddonsConfig

use of org.kie.kogito.codegen.api.AddonsConfig in project kogito-runtimes by kiegroup.

the class AddonsConfigDiscovery method discover.

public static AddonsConfig discover(Predicate<String> classAvailabilityResolver) {
    boolean usePersistence = classAvailabilityResolver.test(PERSISTENCE_FACTORY_CLASS);
    boolean usePrometheusMonitoring = classAvailabilityResolver.test(PROMETHEUS_CLASS);
    boolean useMonitoring = usePrometheusMonitoring || classAvailabilityResolver.test(MONITORING_CORE_CLASS);
    boolean useTracing = classAvailabilityResolver.test(TRACING_CLASS);
    boolean useCloudEvents = classAvailabilityResolver.test(QUARKUS_CLOUD_EVENTS) || classAvailabilityResolver.test(SPRING_CLOUD_EVENTS);
    boolean useExplainability = classAvailabilityResolver.test(QUARKUS_EXPLAINABILITY) || classAvailabilityResolver.test(SPRING_EXPLAINABILITY);
    boolean useProcessSVG = classAvailabilityResolver.test(QUARKUS_PROCESS_SVG) || classAvailabilityResolver.test(SPRING_PROCESS_SVG);
    boolean useEventDrivenDecisions = classAvailabilityResolver.test(EVENT_DRIVEN_DECISIONS_CLASS);
    boolean useEventDrivenRules = classAvailabilityResolver.test(EVENT_DRIVEN_RULES_CLASS);
    AddonsConfig addonsConfig = AddonsConfig.builder().withPersistence(usePersistence).withMonitoring(useMonitoring).withPrometheusMonitoring(usePrometheusMonitoring).withTracing(useTracing).withCloudEvents(useCloudEvents).withExplainability(useExplainability).withProcessSVG(useProcessSVG).withEventDrivenDecisions(useEventDrivenDecisions).withEventDrivenRules(useEventDrivenRules).build();
    LOGGER.info("Performed addonsConfig discovery, found: {}", addonsConfig);
    return addonsConfig;
}
Also used : AddonsConfig(org.kie.kogito.codegen.api.AddonsConfig)

Example 2 with AddonsConfig

use of org.kie.kogito.codegen.api.AddonsConfig in project kogito-runtimes by kiegroup.

the class ProcessCodegenTest method whenMonitoringAndPrometheusEnabledGrafanaDashboardsAreGenerated.

@ParameterizedTest
@MethodSource("org.kie.kogito.codegen.api.utils.KogitoContextTestUtils#contextBuilders")
public void whenMonitoringAndPrometheusEnabledGrafanaDashboardsAreGenerated(KogitoBuildContext.Builder contextBuilder) throws Exception {
    AddonsConfig addonsConfig = AddonsConfig.builder().withMonitoring(true).withPrometheusMonitoring(true).build();
    KogitoBuildContext context = contextBuilder.withAddonsConfig(addonsConfig).build();
    ProcessCodegen codeGenerator = ProcessCodegen.ofCollectedResources(context, CollectedResourceProducer.fromFiles(BASE_PATH, MESSAGE_USERTASK_SOURCE_FULL_SOURCE.toFile()));
    generateTestDashboards(codeGenerator, 2);
}
Also used : AddonsConfig(org.kie.kogito.codegen.api.AddonsConfig) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 3 with AddonsConfig

use of org.kie.kogito.codegen.api.AddonsConfig in project kogito-runtimes by kiegroup.

the class ProcessCodegenTest method whenMonitoringAndPrometheusEnabledGrafanaDashboardsAreNotGenerated.

@ParameterizedTest
@MethodSource("org.kie.kogito.codegen.api.utils.KogitoContextTestUtils#contextBuilders")
public void whenMonitoringAndPrometheusEnabledGrafanaDashboardsAreNotGenerated(KogitoBuildContext.Builder contextBuilder) throws Exception {
    AddonsConfig addonsConfig = AddonsConfig.builder().withMonitoring(true).withPrometheusMonitoring(true).build();
    KogitoBuildContext context = contextBuilder.withAddonsConfig(addonsConfig).build();
    ProcessCodegen codeGenerator = ProcessCodegen.ofCollectedResources(context, CollectedResourceProducer.fromFiles(BASE_PATH, MESSAGE_USERTASK_SOURCE_FULL_SOURCE.toFile()));
    KogitoBuildContext build = contextBuilder.build();
    build.setApplicationProperty(DISABLED_OPERATIONAL_DASHBOARDS, "Global,UserTasksProcess");
    generateTestDashboards(codeGenerator, 0);
}
Also used : AddonsConfig(org.kie.kogito.codegen.api.AddonsConfig) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

AddonsConfig (org.kie.kogito.codegen.api.AddonsConfig)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 KogitoBuildContext (org.kie.kogito.codegen.api.context.KogitoBuildContext)2