package com
.imooc
.activitiweb
;
import org
.activiti
.engine
.RepositoryService
;
import org
.activiti
.engine
.repository
.Deployment
;
import org
.junit
.jupiter
.api
.Test
;
import org
.springframework
.beans
.factory
.annotation
.Autowired
;
import org
.springframework
.boot
.test
.context
.SpringBootTest
;
import java
.io
.InputStream
;
import java
.util
.List
;
import java
.util
.zip
.ZipInputStream
;
@SpringBootTest
public class Part1_Deployment {
@Autowired
private RepositoryService repositoryService
;
@Test
public void initDeploymentBPMN(){
String filename
="BPMN/Part4_Task_claim.bpmn";
Deployment deployment
=repositoryService
.createDeployment()
.addClasspathResource(filename
)
.name("流程部署测试候选人task")
.deploy();
System
.out
.println(deployment
.getName());
}
@Test
public void initDeploymentZIP() {
InputStream fileInputStream
= this.getClass()
.getClassLoader()
.getResourceAsStream("BPMN/Part1_DeploymentV2.zip");
ZipInputStream zip
=new ZipInputStream(fileInputStream
);
Deployment deployment
=repositoryService
.createDeployment()
.addZipInputStream(zip
)
.name("流程部署测试zip")
.deploy();
System
.out
.println(deployment
.getName());
}
@Test
public void getDeployments() {
List
<Deployment> list
= repositoryService
.createDeploymentQuery().list();
for(Deployment dep
: list
){
System
.out
.println("Id:"+dep
.getId());
System
.out
.println("Name:"+dep
.getName());
System
.out
.println("DeploymentTime:"+dep
.getDeploymentTime());
System
.out
.println("Key:"+dep
.getKey());
}
}
}
执行完部署流程,会在这两个表生成数据。
转载请注明原文地址: https://lol.8miu.com/read-35863.html