forked from Activiti/Activiti
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 5.11-specific tests to the upgrade job. Fixed upgrade scripts t…
…o cope with not compiling new methods in old activiti versions.
- Loading branch information
Showing
30 changed files
with
5,580 additions
and
398 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions
58
modules/activiti-upgrade/src/main/java/org/activiti/upgrade/UpgradeUtil.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,58 @@ | ||
/* 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.activiti.upgrade; | ||
|
||
import java.io.FileInputStream; | ||
import java.util.Properties; | ||
|
||
import org.activiti.engine.ProcessEngine; | ||
import org.activiti.engine.ProcessEngineConfiguration; | ||
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl; | ||
|
||
/** | ||
* @author Joram Barrez | ||
*/ | ||
public class UpgradeUtil { | ||
|
||
/** | ||
* Returns the number after the 5. of the process engine version. Ie 5.11 -> 11 | ||
*/ | ||
public static int getProcessEngineVersion(ProcessEngine processEngine) { | ||
return Integer.parseInt(processEngine.VERSION.toLowerCase() | ||
.replace("-snapshot", "") | ||
.replace("5.", "")); | ||
} | ||
|
||
public static ProcessEngineConfigurationImpl createProcessEngineConfiguration(String database) throws Exception { | ||
ProcessEngineConfigurationImpl processEngineConfiguration; | ||
processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration | ||
.createStandaloneProcessEngineConfiguration() | ||
.setDatabaseSchemaUpdate("true") | ||
.setHistory("full") | ||
.setJobExecutorActivate(false); | ||
|
||
// loading properties | ||
String propertiesFileName = System.getProperty("user.home")+System.getProperty("file.separator")+".activiti"+System.getProperty("file.separator")+"upgrade"+System.getProperty("file.separator")+"build."+database+".properties"; | ||
Properties properties = new Properties(); | ||
properties.load(new FileInputStream(propertiesFileName)); | ||
|
||
// configure the jdbc parameters in the process engine configuration | ||
processEngineConfiguration.setJdbcDriver(properties.getProperty("jdbc.driver")); | ||
processEngineConfiguration.setJdbcUrl(properties.getProperty("jdbc.url")); | ||
processEngineConfiguration.setJdbcUsername(properties.getProperty("jdbc.username")); | ||
processEngineConfiguration.setJdbcPassword(properties.getProperty("jdbc.password")); | ||
|
||
return processEngineConfiguration; | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...activiti-upgrade/src/main/java/org/activiti/upgrade/data/Activiti_5_10_DataGenerator.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,57 @@ | ||
/* 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.activiti.upgrade.data; | ||
|
||
import org.activiti.engine.ProcessEngine; | ||
import org.activiti.engine.repository.Deployment; | ||
import org.activiti.engine.repository.ProcessDefinition; | ||
|
||
/** | ||
* @author Joram Barrez | ||
*/ | ||
public class Activiti_5_10_DataGenerator implements DataGenerator { | ||
|
||
protected ProcessEngine processEngine; | ||
|
||
public static int NR_OF_INSTANCES_FOR_SUSPENSION = 5; | ||
|
||
public void run() { | ||
|
||
// VerifyProcessDefinitionDescriptionTest | ||
processEngine.getRepositoryService() | ||
.createDeployment() | ||
.name("verifyProcessDefinitionDescription") | ||
.addClasspathResource("org/activiti/upgrade/test/VerifyProcessDefinitionDescriptionTest.bpmn20.xml") | ||
.deploy(); | ||
|
||
// SuspendAndActivateFunctionalityTest | ||
// Deploy test process, and start a few process instances | ||
Deployment deployment = processEngine.getRepositoryService().createDeployment() | ||
.name(Activiti_5_10_DataGenerator.class.getName()) | ||
.addClasspathResource("org/activiti/upgrade/test/SuspendAndActivateUpgradeTest.bpmn20.xml") | ||
.deploy(); | ||
|
||
ProcessDefinition processDefinition = processEngine.getRepositoryService().createProcessDefinitionQuery() | ||
.deploymentId(deployment.getId()) | ||
.singleResult(); | ||
|
||
for (int i=0; i<NR_OF_INSTANCES_FOR_SUSPENSION; i++) { | ||
processEngine.getRuntimeService().startProcessInstanceById(processDefinition.getId()); | ||
} | ||
} | ||
|
||
public void setProcessEngine(org.activiti.engine.ProcessEngine processEngine) { | ||
this.processEngine = processEngine; | ||
}; | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
modules/activiti-upgrade/src/main/java/org/activiti/upgrade/data/CommonDataGenerator.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,60 @@ | ||
/* 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.activiti.upgrade.data; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.activiti.engine.ProcessEngine; | ||
import org.activiti.engine.RuntimeService; | ||
import org.activiti.engine.TaskService; | ||
|
||
/** | ||
* @author Joram Barrez | ||
*/ | ||
public class CommonDataGenerator implements DataGenerator { | ||
|
||
protected ProcessEngine processEngine; | ||
|
||
public void run() { | ||
|
||
// UpgradeTaskOneTest | ||
RuntimeService runtimeService = processEngine.getRuntimeService(); | ||
TaskService taskService = processEngine.getTaskService(); | ||
|
||
processEngine.getRepositoryService() | ||
.createDeployment() | ||
.name("simpleTaskProcess") | ||
.addClasspathResource("org/activiti/upgrade/test/UserTaskBeforeTest.testSimplestTask.bpmn20.xml") | ||
.deploy(); | ||
|
||
runtimeService.startProcessInstanceByKey("simpleTaskProcess"); | ||
String taskId = taskService.createTaskQuery().singleResult().getId(); | ||
taskService.complete(taskId); | ||
|
||
// UpgradeTaskTwoTest | ||
processEngine.getRepositoryService().createDeployment().name("simpleTaskProcess") | ||
.addClasspathResource("org/activiti/upgrade/test/UserTaskBeforeTest.testTaskWithExecutionVariables.bpmn20.xml") | ||
.deploy(); | ||
|
||
Map<String, Object> variables = new HashMap<String, Object>(); | ||
variables.put("instrument", "trumpet"); | ||
variables.put("player", "gonzo"); | ||
runtimeService.startProcessInstanceByKey("taskWithExecutionVariablesProcess", variables); | ||
} | ||
|
||
public void setProcessEngine(ProcessEngine processEngine) { | ||
this.processEngine = processEngine; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
modules/activiti-upgrade/src/main/java/org/activiti/upgrade/data/DataGenerator.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,24 @@ | ||
/* 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.activiti.upgrade.data; | ||
|
||
import org.activiti.engine.ProcessEngine; | ||
|
||
/** | ||
* @author Joram Barrez | ||
*/ | ||
public interface DataGenerator extends Runnable { | ||
|
||
void setProcessEngine(ProcessEngine processEngine); | ||
|
||
} |
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.