forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[incubator-kie-issues#1473] Introduce Transactional annotation, condi…
…tionally deleted (apache#3671) * [incubator-kie-issues#1473] WIP - Implemented transactional imports and annotations with optional removal. Add unit tests. Small refactoring to allow unit testing/ TDD * [incubator-kie-issues#1473] Simplified following suggestions. Now the annotation is conditionally add during code generation. * [incubator-kie-issues#1473] Implemented KogitoContextTestUtils#restContextBuilders for rest-specific tests. Enforced exclusion of "Java" context from processes' rest generation. * [incubator-kie-issues#1473] Set log level to debug inside manageTransactional * [incubator-kie-issues#1473] Add spring-tx dependency to jbpm-spring-boot-starter to be always available for springboot projects * [incubator-kie-issues#1473] Add quarkus-narayana-jta dependency to kogito-quarkus-workflow-common to be always available for quarkus projects * [incubator-kie-issues#1473] Add quarkus-narayana-jta-deployment dependency * [incubator-kie-issues#1473] Introduce nasty workaround (delay) to avoid ARJUNA issues with nested threads * [incubator-kie-issues#1473] Disabling transaction for sonataflow-quarkus-integration-test * [incubator-kie-issues#1473] Conditionally add the thread sleep. Fix kogito.processes.transactionEnabled variable * [incubator-kie-issues#1473] Importing new wait strategy. * [incubator-kie-issues#1473] WIP - Experimenting Thread.join inside transaction (instead of Thread.sleep) * [incubator-kie-issues#1473] WIP - fix formatting * [incubator-kie-issues#1473] WIP - commented out conditionally excluded serverless transaction. Disable transaction workaround. * [incubator-kie-issues#1473] WIP - commented out conditionally excluded serverless transaction. Disable transaction workaround. * [incubator-kie-issues#1473] Disabling transaction for serverless * [incubator-kie-issues#1473] Fix formatting * [incubator-kie-issues#1473] Fix test * [incubator-kie-issues#1473] Fixed as per PR suggestion. Using context.hasRest() instead of name.equals("Java") to check for rest endpoint creation. Implemented MockQuarkusKogitoBuildContext and MockSpringBootKogitoBuildContext to override the hasRest method during tests. --------- Co-authored-by: Gabriele-Cardosi <[email protected]>
- Loading branch information
1 parent
f2ca753
commit 3e8a0cc
Showing
13 changed files
with
397 additions
and
77 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
.../src/test/java/org/kie/kogito/codegen/api/context/impl/MockQuarkusKogitoBuildContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.kie.kogito.codegen.api.context.impl; | ||
|
||
/** | ||
* Mocked <code>QuarkusKogitoBuildContext</code> to provide <code>hasRest() = true</code> | ||
* during test | ||
*/ | ||
public class MockQuarkusKogitoBuildContext extends QuarkusKogitoBuildContext { | ||
|
||
protected MockQuarkusKogitoBuildContext(MockQuarkusKogitoBuildContextBuilder builder) { | ||
super(builder); | ||
} | ||
|
||
public static Builder builder() { | ||
return new MockQuarkusKogitoBuildContextBuilder(); | ||
} | ||
|
||
@Override | ||
public boolean hasRest() { | ||
return true; | ||
} | ||
|
||
protected static class MockQuarkusKogitoBuildContextBuilder extends QuarkusKogitoBuildContextBuilder { | ||
|
||
protected MockQuarkusKogitoBuildContextBuilder() { | ||
} | ||
|
||
@Override | ||
public MockQuarkusKogitoBuildContext build() { | ||
return new MockQuarkusKogitoBuildContext(this); | ||
} | ||
|
||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...c/test/java/org/kie/kogito/codegen/api/context/impl/MockSpringBootKogitoBuildContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.kie.kogito.codegen.api.context.impl; | ||
|
||
/** | ||
* Mocked <code>SpringBootKogitoBuildContext</code> to provide <code>hasRest() = true</code> | ||
* during test | ||
*/ | ||
public class MockSpringBootKogitoBuildContext extends SpringBootKogitoBuildContext { | ||
|
||
protected MockSpringBootKogitoBuildContext(MockSpringBootKogitoBuildContextBuilder builder) { | ||
super(builder); | ||
} | ||
|
||
public static Builder builder() { | ||
return new MockSpringBootKogitoBuildContextBuilder(); | ||
} | ||
|
||
@Override | ||
public boolean hasRest() { | ||
return true; | ||
} | ||
|
||
protected static class MockSpringBootKogitoBuildContextBuilder extends SpringBootKogitoBuildContextBuilder { | ||
|
||
protected MockSpringBootKogitoBuildContextBuilder() { | ||
} | ||
|
||
@Override | ||
public MockSpringBootKogitoBuildContext build() { | ||
return new MockSpringBootKogitoBuildContext(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.