org.activiti.engine.repository.Deployment Java Examples
The following examples show how to use
org.activiti.engine.repository.Deployment.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeploymentCacheLimitTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testDeploymentCacheLimit() { int processDefinitionCacheLimit = 3; // This is set in the configuration // above DefaultDeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = (DefaultDeploymentCache<ProcessDefinitionCacheEntry>) processEngineConfiguration.getProcessDefinitionCache(); assertEquals(0, processDefinitionCache.size()); String processDefinitionTemplate = DeploymentCacheTestUtil.readTemplateFile("/org/activiti/standalone/deploy/deploymentCacheTest.bpmn20.xml"); for (int i = 1; i <= 5; i++) { repositoryService.createDeployment().addString("Process " + i + ".bpmn20.xml", MessageFormat.format(processDefinitionTemplate, i)).deploy(); if (i < processDefinitionCacheLimit) { assertEquals(i, processDefinitionCache.size()); } else { assertEquals(processDefinitionCacheLimit, processDefinitionCache.size()); } } // Cleanup for (Deployment deployment : repositoryService.createDeploymentQuery().list()) { repositoryService.deleteDeployment(deployment.getId(), true); } }
Example #2
Source File: ProcessDefinitionQueryTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testQueryByMessageSubscription() { Deployment deployment = repositoryService.createDeployment() .addClasspathResource("org/activiti5/engine/test/api/repository/processWithNewBookingMessage.bpmn20.xml") .addClasspathResource("org/activiti5/engine/test/api/repository/processWithNewInvoiceMessage.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); assertEquals(1,repositoryService.createProcessDefinitionQuery() .messageEventSubscriptionName("newInvoiceMessage") .count()); assertEquals(1,repositoryService.createProcessDefinitionQuery() .messageEventSubscriptionName("newBookingMessage") .count()); assertEquals(0,repositoryService.createProcessDefinitionQuery() .messageEventSubscriptionName("bogus") .count()); repositoryService.deleteDeployment(deployment.getId()); }
Example #3
Source File: ActivitiController.java From acitviti6.0 with MIT License | 6 votes |
@RequestMapping("helloWorld") public void helloWorld() { //根据bpmn文件部署流程 Deployment deploy = repositoryService.createDeployment() .addClasspathResource("TestProcess.bpmn") .deploy(); //获取流程定义 ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult(); //启动流程定义,返回流程实例 ProcessInstance pi = runtimeService.startProcessInstanceById(processDefinition.getId()); String processId = pi.getId(); System.out.println("流程创建成功,当前流程实例ID:"+processId); Task task=taskService.createTaskQuery().processInstanceId(processId).singleResult(); System.out.println("执行前,任务名称:"+task.getName()); taskService.complete(task.getId()); task = taskService.createTaskQuery().processInstanceId(processId).singleResult(); System.out.println("task为null,任务执行完毕:"+task); }
Example #4
Source File: VariablesTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@org.activiti.engine.test.Deployment public void testGetVariableInDelegateMixed3() { Map<String, Object> vars = generateVariables(); vars.put("testVar1", "one"); vars.put("testVar2", "two"); vars.put("testVar3", "three"); String processInstanceId = runtimeService.startProcessInstanceByKey("variablesFetchingTestProcess", vars).getId(); taskService.complete(taskService.createTaskQuery().taskName("Task A").singleResult().getId()); taskService.complete(taskService.createTaskQuery().taskName("Task B").singleResult().getId()); // Triggers // service // task // invocation assertEquals("one-CHANGED", (String) runtimeService.getVariable(processInstanceId, "testVar1")); assertEquals("two-CHANGED", (String) runtimeService.getVariable(processInstanceId, "testVar2")); assertNull(runtimeService.getVariable(processInstanceId, "testVar3")); }
Example #5
Source File: ModelController.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 根据Model部署流程 */ @RequestMapping(value = "deploy/{modelId}") public String deploy(@PathVariable("modelId") String modelId, RedirectAttributes redirectAttributes) { try { Model modelData = repositoryService.getModel(modelId); ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId())); byte[] bpmnBytes = null; BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode); bpmnBytes = new BpmnXMLConverter().convertToXML(model); String processName = modelData.getName() + ".bpmn20.xml"; Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes)).deploy(); redirectAttributes.addFlashAttribute("message", "部署成功,部署ID=" + deployment.getId()); } catch (Exception e) { logger.error("根据模型部署流程失败:modelId={}", modelId, e); } return "redirect:/chapter20/model/list"; }
Example #6
Source File: CallActivityTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testInstantiateSubprocess() throws Exception { BpmnModel mainBpmnModel = loadBPMNModel(MAIN_PROCESS_RESOURCE); BpmnModel childBpmnModel = loadBPMNModel(CHILD_PROCESS_RESOURCE); Deployment childDeployment = processEngine.getRepositoryService().createDeployment().name("childProcessDeployment").addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy(); Deployment masterDeployment = processEngine.getRepositoryService().createDeployment().name("masterProcessDeployment").addBpmnModel("masterProcess.bpmn20.xml", mainBpmnModel).deploy(); suspendProcessDefinitions(childDeployment); try { ProcessInstance masterProcessInstance = runtimeService.startProcessInstanceByKey("masterProcess"); fail("Exception expected"); } catch (ActivitiException ae) { assertTextPresent("Cannot start process instance. Process definition Child Process", ae.getMessage()); } }
Example #7
Source File: ProcessDefinitionHandler.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * @description 部署流程模板 * @param name * @return */ public boolean deploymentProcessDefinition_classpath(String name){ Deployment deployment = null;//完成部署 try { deployment = repositoryService //与流程定义和部署对象相关的Service .createDeployment()//创建一个部署对象 .name(name)//添加部署的名称 .addClasspathResource("diagrams/" + name + ".bpmn") //从classpath的资源中加载,一次只能加载一个文件 //.addClasspathResource("diagrams/" + name + ".png") //从classpath的资源中加载,一次只能加载一个文件 .deploy(); } catch (ActivitiIllegalArgumentException e) { logger.error("[部署失败] " + e.getMessage()); return false; } logger.info("[部署成功] ID:" + deployment.getId() + ", 名称:" + deployment.getName()); return true; }
Example #8
Source File: TextQueryTest.java From CrazyWorkflowHandoutsActiviti6 with MIT License | 6 votes |
public static void main(String[] args) throws Exception { // 新建流程引擎 ProcessEngine engine = ProcessEngines.getDefaultProcessEngine(); // 存储服务 RepositoryService repositoryService = engine.getRepositoryService(); // 新建部署构造器 DeploymentBuilder deploymentBuilder = repositoryService .createDeployment(); deploymentBuilder.addClasspathResource("my_text.txt"); Deployment deployment = deploymentBuilder.deploy(); // 数据查询 InputStream inputStream = repositoryService.getResourceAsStream( deployment.getId(), "my_text.txt"); int count = inputStream.available(); byte[] contents = new byte[count]; inputStream.read(contents); String result = new String(contents); // 输入结果 System.out.println(result); // 关闭流程引擎 engine.close(); }
Example #9
Source File: ProcessDeployController.java From my_curd with Apache License 2.0 | 6 votes |
/** * 下载部署包 */ @Before(IdRequired.class) public void downloadZip() { String deploymentId = getPara("id"); Deployment deployment = ActivitiKit.getRepositoryService().createDeploymentQuery() .deploymentId(deploymentId) .singleResult(); if (deployment == null) { renderFail("部署包不存在"); return; } List<String> resourceNames = ActivitiKit.getRepositoryService().getDeploymentResourceNames(deploymentId); List<InputStream> resourceDatas = new ArrayList<>(); for (String resourceName : resourceNames) { resourceDatas.add(ActivitiKit.getRepositoryService().getResourceAsStream(deploymentId, resourceName)); } render(ZipRender.me().filenames(resourceNames).dataIn(resourceDatas).fileName("部署包[" + deployment.getId() + "].zip")); }
Example #10
Source File: ProcessDefinitionCategoryTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testQueryByCategoryNotEquals() { Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/engine/test/api/repository/processCategoryOne.bpmn20.xml") .addClasspathResource("org/activiti/engine/test/api/repository/processCategoryTwo.bpmn20.xml").addClasspathResource("org/activiti/engine/test/api/repository/processCategoryThree.bpmn20.xml") .deploy(); HashSet<String> processDefinitionNames = getProcessDefinitionNames(repositoryService.createProcessDefinitionQuery().processDefinitionCategoryNotEquals("one").list()); HashSet<String> expectedProcessDefinitionNames = new HashSet<String>(); expectedProcessDefinitionNames.add("processTwo"); expectedProcessDefinitionNames.add("processThree"); assertEquals(expectedProcessDefinitionNames, processDefinitionNames); processDefinitionNames = getProcessDefinitionNames(repositoryService.createProcessDefinitionQuery().processDefinitionCategoryNotEquals("two").list()); expectedProcessDefinitionNames = new HashSet<String>(); expectedProcessDefinitionNames.add("processOne"); expectedProcessDefinitionNames.add("processThree"); assertEquals(expectedProcessDefinitionNames, processDefinitionNames); repositoryService.deleteDeployment(deployment.getId()); }
Example #11
Source File: MuleHttpBasicAuthTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void httpWithBasicAuth() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService() .createDeployment() .addClasspathResource("org/activiti5/mule/testHttpBasicAuth.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(10, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example #12
Source File: VariablesTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@org.activiti.engine.test.Deployment public void testGetVariableAllVariableFetchingDefault() { // Testing it the default way, all using getVariable("someVar"); Map<String, Object> vars = generateVariables(); vars.put("testVar", "hello"); String processInstanceId = runtimeService.startProcessInstanceByKey("variablesFetchingTestProcess", vars).getId(); taskService.complete(taskService.createTaskQuery().taskName("Task A").singleResult().getId()); taskService.complete(taskService.createTaskQuery().taskName("Task B").singleResult().getId()); // Triggers service task invocation vars = runtimeService.getVariables(processInstanceId); assertEquals(71, vars.size()); String varValue = (String) runtimeService.getVariable(processInstanceId, "testVar"); assertEquals("HELLO world", varValue); }
Example #13
Source File: Activiti6Test.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test @org.activiti.engine.test.Deployment public void testSimpleNestedParallelGateway() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("simpleParallelGateway"); assertNotNull(processInstance); assertFalse(processInstance.isEnded()); List<Task> tasks = taskService.createTaskQuery().processDefinitionKey("simpleParallelGateway").orderByTaskName().asc().list(); assertEquals(4, tasks.size()); assertEquals("Task a", tasks.get(0).getName()); assertEquals("Task b1", tasks.get(1).getName()); assertEquals("Task b2", tasks.get(2).getName()); assertEquals("Task c", tasks.get(3).getName()); for (Task task : tasks) { taskService.complete(task.getId()); } assertEquals(0, runtimeService.createProcessInstanceQuery().count()); }
Example #14
Source File: Activiti6Test.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test @org.activiti.engine.test.Deployment public void testSimpleParallelGateway() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("simpleParallelGateway"); assertNotNull(processInstance); assertFalse(processInstance.isEnded()); List<Task> tasks = taskService.createTaskQuery().processDefinitionKey("simpleParallelGateway").orderByTaskName().asc().list(); assertEquals(2, tasks.size()); assertEquals("Task a", tasks.get(0).getName()); assertEquals("Task b", tasks.get(1).getName()); for (Task task : tasks) { taskService.complete(task.getId()); } assertEquals(0, runtimeService.createProcessInstanceQuery().count()); }
Example #15
Source File: GetDeploymentResourceCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public InputStream execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } if (resourceName == null) { throw new ActivitiIllegalArgumentException("resourceName is null"); } ResourceEntity resource = commandContext .getResourceEntityManager() .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName); if (resource == null) { if (commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId) == null) { throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class); } else { throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class); } } return new ByteArrayInputStream(resource.getBytes()); }
Example #16
Source File: MuleHttpTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void http() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttp.bpmn20.xml").deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(20, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example #17
Source File: MuleHttpBasicAuthTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void httpWithBasicAuth() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttpBasicAuth.bpmn20.xml").deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(10, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example #18
Source File: MuleVMTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test public void send() throws Exception { Assert.assertTrue(muleContext.isStarted()); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/mule/testVM.bpmn20.xml").deploy(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess"); Assert.assertFalse(processInstance.isEnded()); Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable"); Assert.assertEquals(30, result); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId()); repositoryService.deleteDeployment(deployment.getId()); assertAndEnsureCleanDb(processEngine); ProcessEngines.destroy(); }
Example #19
Source File: GetDeploymentResourceCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public InputStream execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } if (resourceName == null) { throw new ActivitiIllegalArgumentException("resourceName is null"); } ResourceEntity resource = commandContext.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName); if (resource == null) { if (commandContext.getDeploymentEntityManager().findById(deploymentId) == null) { throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class); } else { throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class); } } return new ByteArrayInputStream(resource.getBytes()); }
Example #20
Source File: Activiti6Test.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test @org.activiti.engine.test.Deployment public void testScriptTask() { Map<String, Object> variableMap = new HashMap<String, Object>(); variableMap.put("a", 1); variableMap.put("b", 2); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", variableMap); assertNotNull(processInstance); assertFalse(processInstance.isEnded()); Number sumVariable = (Number) runtimeService.getVariable(processInstance.getId(), "sum"); assertEquals(3, sumVariable.intValue()); Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyChildExecutions().singleResult(); assertNotNull(execution); runtimeService.trigger(execution.getId()); assertNull(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult()); }
Example #21
Source File: Activiti6Test.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Test @org.activiti.engine.test.Deployment public void testLongServiceTaskLoop() { int maxCount = 3210; // You can make this as big as you want (as long as // it still fits within transaction timeouts). Go // on, try it! Map<String, Object> vars = new HashMap<String, Object>(); vars.put("counter", new Integer(0)); vars.put("maxCount", maxCount); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testLongServiceTaskLoop", vars); assertNotNull(processInstance); assertTrue(processInstance.isEnded()); assertEquals(maxCount, CountingServiceTaskTestDelegate.CALL_COUNT.get()); assertEquals(0, runtimeService.createExecutionQuery().count()); if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { assertEquals(maxCount, historyService.createHistoricActivityInstanceQuery() .processInstanceId(processInstance.getId()).activityId("serviceTask").count()); } }
Example #22
Source File: EventJavaTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testStartEventWithExecutionListener() throws Exception { BpmnModel bpmnModel = new BpmnModel(); Process process = new Process(); process.setId("simpleProcess"); process.setName("Very simple process"); bpmnModel.getProcesses().add(process); StartEvent startEvent = new StartEvent(); startEvent.setId("startEvent1"); TimerEventDefinition timerDef = new TimerEventDefinition(); timerDef.setTimeDuration("PT5M"); startEvent.getEventDefinitions().add(timerDef); ActivitiListener listener = new ActivitiListener(); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION); listener.setImplementation("${test}"); listener.setEvent("end"); startEvent.getExecutionListeners().add(listener); process.addFlowElement(startEvent); UserTask task = new UserTask(); task.setId("reviewTask"); task.setAssignee("kermit"); process.addFlowElement(task); SequenceFlow flow1 = new SequenceFlow(); flow1.setId("flow1"); flow1.setSourceRef("startEvent1"); flow1.setTargetRef("reviewTask"); process.addFlowElement(flow1); EndEvent endEvent = new EndEvent(); endEvent.setId("endEvent1"); process.addFlowElement(endEvent); byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel); new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml))); Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy(); repositoryService.deleteDeployment(deployment.getId()); }
Example #23
Source File: ChineseConverterTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void deployProcess(BpmnModel bpmnModel) { byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel); try { Deployment deployment = processEngine.getRepositoryService().createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy(); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); } finally { processEngine.close(); } }
Example #24
Source File: DeploymentQueryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testNativeQuery() { assertEquals("ACT_RE_DEPLOYMENT", managementService.getTableName(Deployment.class)); assertEquals("ACT_RE_DEPLOYMENT", managementService.getTableName(DeploymentEntity.class)); String tableName = managementService.getTableName(Deployment.class); String baseQuerySql = "SELECT * FROM " + tableName; assertEquals(2, repositoryService.createNativeDeploymentQuery().sql(baseQuerySql).list().size()); assertEquals(1, repositoryService.createNativeDeploymentQuery().sql(baseQuerySql + " where NAME_ = #{name}") .parameter("name", "org/activiti5/engine/test/repository/one.bpmn20.xml").list().size()); // paging assertEquals(2, repositoryService.createNativeDeploymentQuery().sql(baseQuerySql).listPage(0, 2).size()); assertEquals(1, repositoryService.createNativeDeploymentQuery().sql(baseQuerySql).listPage(1, 3).size()); }
Example #25
Source File: AbstractServiceTest.java From herd with Apache License 2.0 | 5 votes |
/** * Deletes all deployments in the database and any associated tables. */ protected void deleteActivitiDeployments() { for (Deployment deployment : activitiRepositoryService.createDeploymentQuery().list()) { activitiRepositoryService.deleteDeployment(deployment.getId(), true); } }
Example #26
Source File: DeployCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected Deployment deployAsActiviti5ProcessDefinition(CommandContext commandContext) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = commandContext.getProcessEngineConfiguration().getActiviti5CompatibilityHandler(); if (activiti5CompatibilityHandler == null) { throw new ActivitiException("Found Activiti 5 process definition, but no compatibility handler on the classpath. " + "Cannot use the deployment property " + DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION); } return activiti5CompatibilityHandler.deploy(deploymentBuilder); }
Example #27
Source File: ChineseConverterTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void deployProcess(BpmnModel bpmnModel) { byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel); try { Deployment deployment = processEngine.getRepositoryService().createDeployment() .name("test") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .addString("test.bpmn20.xml", new String(xml)) .deploy(); processEngine.getRepositoryService().deleteDeployment(deployment.getId()); } finally { processEngine.close(); } }
Example #28
Source File: SubProcessTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Test public void testSimpleSubProcess() { Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/examples/bpmn/subprocess/SubProcessTest.fixSystemFailureProcess.bpmn20.xml").deploy(); // After staring the process, both tasks in the subprocess should be // active ProcessInstance pi = runtimeService.startProcessInstanceByKey("fixSystemFailure"); List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).orderByTaskName().asc().list(); // Tasks are ordered by name (see query) Assert.assertEquals(2, tasks.size()); Task investigateHardwareTask = tasks.get(0); Task investigateSoftwareTask = tasks.get(1); Assert.assertEquals("Investigate hardware", investigateHardwareTask.getName()); Assert.assertEquals("Investigate software", investigateSoftwareTask.getName()); // Completing both the tasks finishes the subprocess and enables the // task after the subprocess taskService.complete(investigateHardwareTask.getId()); taskService.complete(investigateSoftwareTask.getId()); Task writeReportTask = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); Assert.assertEquals("Write report", writeReportTask.getName()); // Clean up repositoryService.deleteDeployment(deployment.getId(), true); }
Example #29
Source File: DeploymentResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Get a deployment", tags = {"Deployment"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the deployment was found and returned."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @RequestMapping(value = "/repository/deployments/{deploymentId}", method = RequestMethod.GET, produces = "application/json") public DeploymentResponse getDeployment(@ApiParam(name = "deploymentId", value = "The id of the deployment to get.") @PathVariable String deploymentId, HttpServletRequest request) { Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class); } return restResponseFactory.createDeploymentResponse(deployment); }
Example #30
Source File: DeployCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public Deployment execute(CommandContext commandContext) { // Backwards compatibility with Activiti v5 if (commandContext.getProcessEngineConfiguration().isActiviti5CompatibilityEnabled() && deploymentBuilder.getDeploymentProperties() != null && deploymentBuilder.getDeploymentProperties().containsKey(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION) && deploymentBuilder.getDeploymentProperties().get(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION).equals(Boolean.TRUE)) { return deployAsActiviti5ProcessDefinition(commandContext); } return executeDeploy(commandContext); }