use of org.kie.kogito.KogitoGAV in project kogito-runtimes by kiegroup.
the class DecisionModelEventTest method testGetters.
@Test
public void testGetters() {
final KogitoGAV gav = new KogitoGAV("groupID", "artifactId", "version");
final DecisionModelEvent e = new DecisionModelEvent(gav, "name", "namespace", new DecisionModelMetadata("http://www.omg.org/spec/DMN/20151101/dmn.xsd"), "definition");
assertEquals(gav.getGroupId(), e.getGav().getGroupId());
assertEquals(gav.getArtifactId(), e.getGav().getArtifactId());
assertEquals(gav.getVersion(), e.getGav().getVersion());
assertEquals("name", e.getName());
assertEquals("namespace", e.getNamespace());
assertEquals(ModelDomain.DECISION, e.getModelMetadata().getModelDomain());
assertEquals("http://www.omg.org/spec/DMN/20151101/dmn.xsd", e.getModelMetadata().getSpecVersion());
assertEquals("definition", e.getDefinition());
}
use of org.kie.kogito.KogitoGAV in project kogito-runtimes by kiegroup.
the class KogitoQuarkusResourceUtils method kogitoBuildContext.
public static KogitoBuildContext kogitoBuildContext(Path outputTarget, Iterable<Path> paths, IndexView index, Dependency appArtifact) {
// scan and parse paths
AppPaths.BuildTool buildTool;
if (System.getProperty("org.gradle.appname") == null) {
buildTool = AppPaths.BuildTool.MAVEN;
} else {
buildTool = AppPaths.BuildTool.GRADLE;
}
AppPaths appPaths = AppPaths.fromQuarkus(outputTarget, paths, buildTool);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
KogitoBuildContext context = QuarkusKogitoBuildContext.builder().withApplicationPropertyProvider(new KogitoQuarkusApplicationPropertiesProvider()).withClassLoader(classLoader).withClassAvailabilityResolver(className -> classAvailabilityResolver(classLoader, index, className)).withClassSubTypeAvailabilityResolver(classSubTypeAvailabilityResolver(index)).withAppPaths(appPaths).withGAV(new KogitoGAV(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getVersion())).withSourceFileProcessBindNotifier(new SourceFileCodegenBindNotifier()).build();
if (!context.hasClassAvailable(QuarkusKogitoBuildContext.QUARKUS_REST)) {
LOGGER.info("Disabling REST generation because class '" + QuarkusKogitoBuildContext.QUARKUS_REST + "' is not available");
context.setApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST, "false");
}
if (!context.hasClassAvailable(QuarkusKogitoBuildContext.QUARKUS_DI)) {
LOGGER.info("Disabling dependency injection generation because class '" + QuarkusKogitoBuildContext.QUARKUS_DI + "' is not available");
context.setApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_DI, "false");
}
return context;
}
use of org.kie.kogito.KogitoGAV in project kogito-runtimes by kiegroup.
the class ModelEventTest method testGetters.
@Test
public void testGetters() {
final KogitoGAV gav = new KogitoGAV("groupID", "artifactId", "version");
final ModelEvent e = new ModelEvent(gav, "name", new ModelMetadata(ModelDomain.DECISION) {
}, ModelDomain.DECISION) {
};
assertEquals(gav.getGroupId(), e.getGav().getGroupId());
assertEquals(gav.getArtifactId(), e.getGav().getArtifactId());
assertEquals(gav.getVersion(), e.getGav().getVersion());
assertEquals("name", e.getName());
}
use of org.kie.kogito.KogitoGAV in project kogito-runtimes by kiegroup.
the class ConfigBeanGeneratorTest method generate.
@ParameterizedTest
@MethodSource("org.kie.kogito.codegen.api.utils.KogitoContextTestUtils#contextBuilders")
public void generate(KogitoBuildContext.Builder contextBuilder) {
// null GAV
assertThat(contextBuilder.build().getGAV()).isEmpty();
Optional<MethodCallExpr> setGavNull = getGavMethodCallExpr(contextBuilder);
setGavNull.ifPresent(methodCallExpr -> assertThat(methodCallExpr.toString()).contains("null"));
// with GAV
KogitoGAV kogitoGAV = new KogitoGAV("groupId", "artifactId", "version");
contextBuilder.withGAV(kogitoGAV);
Optional<MethodCallExpr> setGav = getGavMethodCallExpr(contextBuilder);
setGav.ifPresent(methodCallExpr -> assertThat(methodCallExpr.toString()).contains(kogitoGAV.getGroupId()).contains(kogitoGAV.getArtifactId()).contains(kogitoGAV.getVersion()));
}
use of org.kie.kogito.KogitoGAV in project kogito-runtimes by kiegroup.
the class QuarkusModelEventEmitterTest method makeModel.
private DecisionModelResource makeModel() {
final DecisionModelResource model = mock(DecisionModelResource.class);
when(model.getGav()).thenReturn(new KogitoGAV("groupId", "artifactId", "version"));
when(model.getModelName()).thenReturn("name");
when(model.getNamespace()).thenReturn("namespace");
when(model.getModelMetadata()).thenReturn(new DecisionModelMetadata("http://www.omg.org/spec/DMN/20151101/dmn.xsd"));
when(model.get()).thenReturn("model");
return model;
}
Aggregations