-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deployment issue with getting a definition from the cache
- Loading branch information
1 parent
d3fabfd
commit dbc8247
Showing
34 changed files
with
946 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
97 changes: 97 additions & 0 deletions
97
...wable-cmmn-engine/src/test/java/org/flowable/cmmn/test/cache/CaseDefinitionCacheTest.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,97 @@ | ||
/* Licensed 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.flowable.cmmn.test.cache; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.flowable.cmmn.api.CmmnHistoryService; | ||
import org.flowable.cmmn.api.CmmnManagementService; | ||
import org.flowable.cmmn.api.CmmnRepositoryService; | ||
import org.flowable.cmmn.api.CmmnRuntimeService; | ||
import org.flowable.cmmn.api.repository.CmmnDeployment; | ||
import org.flowable.cmmn.api.repository.CmmnDeploymentBuilder; | ||
import org.flowable.cmmn.engine.CmmnEngine; | ||
import org.flowable.cmmn.engine.CmmnEngineConfiguration; | ||
import org.flowable.cmmn.engine.test.FlowableCmmnTestCase; | ||
import org.flowable.cmmn.engine.test.impl.CmmnHistoryTestHelper; | ||
import org.flowable.cmmn.engine.test.impl.CmmnJobTestHelper; | ||
import org.flowable.common.engine.api.FlowableException; | ||
import org.flowable.common.engine.impl.history.HistoryLevel; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @author Joram Barrez | ||
*/ | ||
public class CaseDefinitionCacheTest { | ||
|
||
@Test | ||
public void testCaseDefinitionCache() { | ||
CmmnEngine cmmnEngine = null; | ||
String flowableCmmnCfgXml = "flowable.cache.cfg.xml"; | ||
try (InputStream inputStream = FlowableCmmnTestCase.class.getClassLoader().getResourceAsStream(flowableCmmnCfgXml)) { | ||
cmmnEngine = CmmnEngineConfiguration.createCmmnEngineConfigurationFromInputStream(inputStream).buildCmmnEngine(); | ||
CmmnEngineConfiguration cmmnEngineConfiguration = cmmnEngine.getCmmnEngineConfiguration(); | ||
CmmnManagementService cmmnManagementService = cmmnEngine.getCmmnManagementService(); | ||
CmmnRepositoryService cmmnRepositoryService = cmmnEngine.getCmmnRepositoryService(); | ||
CmmnRuntimeService cmmnRuntimeService = cmmnEngine.getCmmnRuntimeService(); | ||
CmmnHistoryService cmmnHistoryService = cmmnEngine.getCmmnHistoryService(); | ||
|
||
List<String> deploymentIds = new ArrayList<>(); | ||
int nrOfModels = 9; | ||
for (int nrOfIterations = 0; nrOfIterations < 10; nrOfIterations++) { | ||
CmmnDeploymentBuilder deploymentBuilder = cmmnRepositoryService.createDeployment(); | ||
for (int i = 1; i <= nrOfModels; i++) { | ||
deploymentBuilder.addClasspathResource("org/flowable/cmmn/test/cache/case" + i + ".cmmn"); | ||
} | ||
CmmnDeployment deployment = deploymentBuilder.deploy(); | ||
deploymentIds.add(0, deployment.getId()); | ||
|
||
assertThat(cmmnRepositoryService.createCaseDefinitionQuery().count()).isEqualTo((nrOfIterations + 1) * nrOfModels); | ||
|
||
for (int i = 1; i <= nrOfModels; i++) { | ||
cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("case" + i).start(); | ||
} | ||
|
||
assertThat(cmmnManagementService.createJobQuery().count()).isEqualTo((nrOfIterations + 1) * nrOfModels); | ||
} | ||
|
||
CmmnJobTestHelper.waitForJobExecutorToProcessAllJobs(cmmnEngine, 30000, 200, true); | ||
|
||
assertThat(cmmnManagementService.createJobQuery().count()).isEqualTo(0); | ||
|
||
if (CmmnHistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, cmmnEngineConfiguration)) { | ||
for (int i = 1; i <= nrOfModels; i++) { | ||
assertThat(cmmnHistoryService.createHistoricCaseInstanceQuery().caseDefinitionKey("case" + i).count()).isEqualTo(10); | ||
} | ||
} | ||
|
||
for (String deploymentId : deploymentIds) { | ||
cmmnRepositoryService.deleteDeployment(deploymentId, true); | ||
} | ||
|
||
} catch (IOException e) { | ||
throw new FlowableException("Could not create CMMN engine", e); | ||
|
||
} finally { | ||
if (cmmnEngine != null) { | ||
cmmnEngine.close(); | ||
} | ||
} | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
modules/flowable-cmmn-engine/src/test/resources/flowable.cache.cfg.xml
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,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
|
||
<bean id="dataSource" class="org.flowable.common.engine.impl.test.ClosingDataSource"> | ||
<constructor-arg> | ||
<bean class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> | ||
<constructor-arg> | ||
<bean class="com.zaxxer.hikari.HikariConfig"> | ||
<property name="minimumIdle" value="0" /> | ||
<property name="jdbcUrl" value="${jdbc.url:jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000}"/> | ||
<property name="driverClassName" value="${jdbc.driver:org.h2.Driver}"/> | ||
<property name="username" value="${jdbc.username:sa}"/> | ||
<property name="password" value="${jdbc.password:}"/> | ||
</bean> | ||
</constructor-arg> | ||
</bean> | ||
</constructor-arg> | ||
</bean> | ||
|
||
<bean id="cmmnEngineConfiguration" class="org.flowable.cmmn.engine.impl.cfg.StandaloneInMemCmmnEngineConfiguration"> | ||
<property name="dataSource" ref="dataSource"/> | ||
|
||
<property name="engineLifecycleListeners"> | ||
<list> | ||
<ref bean="dataSource"/> | ||
</list> | ||
</property> | ||
|
||
<property name="databaseSchemaUpdate" value="true" /> | ||
|
||
<property name="asyncExecutorActivate" value="false" /> | ||
<property name="asyncExecutorDefaultAsyncJobAcquireWaitTime" value="1000" /> | ||
<property name="asyncExecutorDefaultTimerJobAcquireWaitTime" value="1000" /> | ||
|
||
<property name="asyncFailedJobWaitTime" value="1" /> | ||
|
||
<property name="enableEntityLinks" value="true" /> | ||
<property name="enableCaseDefinitionHistoryLevel" value="true" /> | ||
|
||
<property name="caseDefinitionCacheLimit" value="9" /> | ||
</bean> | ||
|
||
</beans> |
17 changes: 17 additions & 0 deletions
17
modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/cache/case1.cmmn
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" | ||
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" | ||
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" | ||
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:flowable="http://flowable.org/cmmn" | ||
targetNamespace="http://flowable.org/cmmn"> | ||
|
||
<case id="case1"> | ||
<casePlanModel id="myPlanModel" name="My CasePlanModel"> | ||
<planItem id="planItem1" name="The Task" definitionRef="theTask" /> | ||
<task id="theTask" name="The Task" isBlocking="false" flowable:async="true" flowable:type="java" flowable:class="org.flowable.cmmn.test.delegate.TestJavaDelegate" /> | ||
</casePlanModel> | ||
</case> | ||
|
||
</definitions> |
17 changes: 17 additions & 0 deletions
17
modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/cache/case2.cmmn
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" | ||
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" | ||
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" | ||
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:flowable="http://flowable.org/cmmn" | ||
targetNamespace="http://flowable.org/cmmn"> | ||
|
||
<case id="case2"> | ||
<casePlanModel id="myPlanModel" name="My CasePlanModel"> | ||
<planItem id="planItem1" name="The Task" definitionRef="theTask" /> | ||
<task id="theTask" name="The Task" isBlocking="false" flowable:async="true" flowable:type="java" flowable:class="org.flowable.cmmn.test.delegate.TestJavaDelegate" /> | ||
</casePlanModel> | ||
</case> | ||
|
||
</definitions> |
17 changes: 17 additions & 0 deletions
17
modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/cache/case3.cmmn
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" | ||
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" | ||
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" | ||
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:flowable="http://flowable.org/cmmn" | ||
targetNamespace="http://flowable.org/cmmn"> | ||
|
||
<case id="case3"> | ||
<casePlanModel id="myPlanModel" name="My CasePlanModel"> | ||
<planItem id="planItem1" name="The Task" definitionRef="theTask" /> | ||
<task id="theTask" name="The Task" isBlocking="false" flowable:async="true" flowable:type="java" flowable:class="org.flowable.cmmn.test.delegate.TestJavaDelegate" /> | ||
</casePlanModel> | ||
</case> | ||
|
||
</definitions> |
17 changes: 17 additions & 0 deletions
17
modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/cache/case4.cmmn
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" | ||
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" | ||
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" | ||
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:flowable="http://flowable.org/cmmn" | ||
targetNamespace="http://flowable.org/cmmn"> | ||
|
||
<case id="case4"> | ||
<casePlanModel id="myPlanModel" name="My CasePlanModel"> | ||
<planItem id="planItem1" name="The Task" definitionRef="theTask" /> | ||
<task id="theTask" name="The Task" isBlocking="false" flowable:async="true" flowable:type="java" flowable:class="org.flowable.cmmn.test.delegate.TestJavaDelegate" /> | ||
</casePlanModel> | ||
</case> | ||
|
||
</definitions> |
17 changes: 17 additions & 0 deletions
17
modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/cache/case5.cmmn
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" | ||
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" | ||
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" | ||
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:flowable="http://flowable.org/cmmn" | ||
targetNamespace="http://flowable.org/cmmn"> | ||
|
||
<case id="case5"> | ||
<casePlanModel id="myPlanModel" name="My CasePlanModel"> | ||
<planItem id="planItem1" name="The Task" definitionRef="theTask" /> | ||
<task id="theTask" name="The Task" isBlocking="false" flowable:async="true" flowable:type="java" flowable:class="org.flowable.cmmn.test.delegate.TestJavaDelegate" /> | ||
</casePlanModel> | ||
</case> | ||
|
||
</definitions> |
17 changes: 17 additions & 0 deletions
17
modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/cache/case6.cmmn
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" | ||
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" | ||
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" | ||
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:flowable="http://flowable.org/cmmn" | ||
targetNamespace="http://flowable.org/cmmn"> | ||
|
||
<case id="case6"> | ||
<casePlanModel id="myPlanModel" name="My CasePlanModel"> | ||
<planItem id="planItem1" name="The Task" definitionRef="theTask" /> | ||
<task id="theTask" name="The Task" isBlocking="false" flowable:async="true" flowable:type="java" flowable:class="org.flowable.cmmn.test.delegate.TestJavaDelegate" /> | ||
</casePlanModel> | ||
</case> | ||
|
||
</definitions> |
Oops, something went wrong.