pibizza commented on code in PR #3671:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3671#discussion_r1764615530
##########
kogito-codegen-modules/kogito-codegen-processes/src/test/java/org/kie/kogito/codegen/process/ProcessResourceGeneratorTest.java:
##########
@@ -152,31 +162,139 @@ void
testGenerateStartSignalEventNoPayload(KogitoBuildContext.Builder contextBui
.forEach(method -> assertMethodOutputModelType(method,
outputType));
}
- void testOpenApiDocumentation(KogitoBuildContext.Builder contextBuilder,
String fileName, String expectedSummary, String expectedDescription) {
+ @ParameterizedTest
+
@MethodSource("org.kie.kogito.codegen.api.utils.KogitoContextTestUtils#contextBuilders")
+ void testTransactionEnabled(KogitoBuildContext.Builder contextBuilder) {
+ String fileName =
"src/test/resources/startsignal/StartSignalEventNoPayload.bpmn2";
+
+ ProcessResourceGenerator processResourceGenerator =
getProcessResourceGenerator(contextBuilder, fileName, true);
+ CompilationUnit compilationUnit =
+
processResourceGenerator.createCompilationUnit(processResourceGenerator.createTemplatedGeneratorBuilder());
+ assertThat(compilationUnit).isNotNull();
+ Optional<ClassOrInterfaceDeclaration>
classOrInterfaceDeclarationOptional = compilationUnit.getChildNodes().stream()
+ .filter(ClassOrInterfaceDeclaration.class::isInstance)
+ .map(ClassOrInterfaceDeclaration.class::cast)
+ .findFirst();
+ assertThat(classOrInterfaceDeclarationOptional).isPresent();
+ ClassOrInterfaceDeclaration classOrInterfaceDeclaration =
classOrInterfaceDeclarationOptional.get();
+ switch (contextBuilder.build().name()) {
+ case QuarkusKogitoBuildContext.CONTEXT_NAME ->
testTransactionEnabled(compilationUnit, classOrInterfaceDeclaration,
JAKARTA_TRANSACTIONAL_IMPORT, TRANSACTIONAL_ANNOTATION,
+ JAKARTA_REST_ANNOTATIONS);
+ case SpringBootKogitoBuildContext.CONTEXT_NAME ->
testTransactionEnabled(compilationUnit, classOrInterfaceDeclaration,
SPRING_TRANSACTIONAL_IMPORT, TRANSACTIONAL_ANNOTATION,
+ SPRING_REST_ANNOTATIONS);
+ case JavaKogitoBuildContext.CONTEXT_NAME ->
testTransactionEnabled(compilationUnit, classOrInterfaceDeclaration,
JAKARTA_TRANSACTIONAL_IMPORT, TRANSACTIONAL_ANNOTATION,
+ JAKARTA_REST_ANNOTATIONS);
+ }
+ processResourceGenerator.manageTransactional(compilationUnit);
+ switch (contextBuilder.build().name()) {
+ case QuarkusKogitoBuildContext.CONTEXT_NAME ->
testTransactionEnabled(compilationUnit, classOrInterfaceDeclaration,
JAKARTA_TRANSACTIONAL_IMPORT, TRANSACTIONAL_ANNOTATION,
Review Comment:
See above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]