Java Code Examples for org.activiti.engine.repository.Deployment#getId()

The following examples show how to use org.activiti.engine.repository.Deployment#getId() . 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: DeploymentPersistenceTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void testDeploymentPersistence() {
  Deployment deployment = repositoryService.createDeployment().name("strings").addString("org/activiti/test/HelloWorld.string", "hello world").addString("org/activiti/test/TheAnswer.string", "42")
      .deploy();

  List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
  assertEquals(1, deployments.size());
  deployment = deployments.get(0);

  assertEquals("strings", deployment.getName());
  assertNotNull(deployment.getDeploymentTime());

  String deploymentId = deployment.getId();
  List<String> resourceNames = repositoryService.getDeploymentResourceNames(deploymentId);
  Set<String> expectedResourceNames = new HashSet<String>();
  expectedResourceNames.add("org/activiti/test/HelloWorld.string");
  expectedResourceNames.add("org/activiti/test/TheAnswer.string");
  assertEquals(expectedResourceNames, new HashSet<String>(resourceNames));

  InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, "org/activiti/test/HelloWorld.string");
  assertTrue(Arrays.equals("hello world".getBytes(), IoUtil.readInputStream(resourceStream, "test")));

  resourceStream = repositoryService.getResourceAsStream(deploymentId, "org/activiti/test/TheAnswer.string");
  assertTrue(Arrays.equals("42".getBytes(), IoUtil.readInputStream(resourceStream, "test")));

  repositoryService.deleteDeployment(deploymentId);
}
 
Example 2
Source File: ZipStreamDeploymentTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
@Test
public void testZipStreamFromAbsoluteFilePath() throws Exception {
    // 从classpath读取资源并部署到引擎中
    InputStream zipStream = getClass().getClassLoader().getResourceAsStream("chapter5/chapter5-deployment.bar");
    repositoryService.createDeployment().addZipInputStream(new ZipInputStream(zipStream)).deploy();

    // 统计已部署流程定义的数量
    long count = repositoryService.createProcessDefinitionQuery().count();
    assertEquals(2, count);

    // 查询部署记录
    Deployment deployment = repositoryService.createDeploymentQuery().singleResult();
    assertNotNull(deployment);
    String deploymentId = deployment.getId();

    // 验证4个资源文件是否都已成功部署
    assertNotNull(repositoryService.getResourceAsStream(deploymentId, "candidateUserInUserTask.bpmn"));
    assertNotNull(repositoryService.getResourceAsStream(deploymentId, "candidateUserInUserTask.png"));
    assertNotNull(repositoryService.getResourceAsStream(deploymentId, "userAndGroupInUserTask.bpmn"));
    assertNotNull(repositoryService.getResourceAsStream(deploymentId, "userAndGroupInUserTask.png"));
}
 
Example 3
Source File: BxlcTaskListeningImpl.java    From gem with MIT License 5 votes vote down vote up
/**
 * @Description:发布流程
 * @param type 流程的key
 * @author: Ryan
 * @date 2018年11月18日
 */
public String deployment(String type) {
	DeploymentBuilder createDeployment = repositoryService.createDeployment();
	createDeployment.addClasspathResource("processes/"+type+".bpmn");
	createDeployment.addClasspathResource("processes/"+type+".png");
	Deployment deploy = createDeployment.deploy();
	return deploy.getId();
}
 
Example 4
Source File: DeploymentPersistenceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testDeploymentPersistence() {
  Deployment deployment = repositoryService
    .createDeployment()
    .name("strings")
    .addString("org/activiti5/test/HelloWorld.string", "hello world")
    .addString("org/activiti5/test/TheAnswer.string", "42")
    .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
    .deploy();
  
  List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
  assertEquals(1, deployments.size());
  deployment = deployments.get(0);
  
  assertEquals("strings", deployment.getName());
  assertNotNull(deployment.getDeploymentTime());
  
  String deploymentId = deployment.getId();
  List<String> resourceNames = repositoryService.getDeploymentResourceNames(deploymentId);
  Set<String> expectedResourceNames = new HashSet<String>();
  expectedResourceNames.add("org/activiti5/test/HelloWorld.string");
  expectedResourceNames.add("org/activiti5/test/TheAnswer.string");
  assertEquals(expectedResourceNames, new HashSet<String>(resourceNames));
  
  InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, "org/activiti5/test/HelloWorld.string");
  assertTrue(Arrays.equals("hello world".getBytes(), IoUtil.readInputStream(resourceStream, "test")));
  
  resourceStream = repositoryService.getResourceAsStream(deploymentId, "org/activiti5/test/TheAnswer.string");
  assertTrue(Arrays.equals("42".getBytes(), IoUtil.readInputStream(resourceStream, "test")));

  repositoryService.deleteDeployment(deploymentId);
}
 
Example 5
Source File: ActivitiTest.java    From herd with Apache License 2.0 4 votes vote down vote up
private String deployWorkflow() throws Exception
{
    Deployment deployment = repositoryService.createDeployment().addClasspathResource(ACTIVITI_XML_HERD_WORKFLOW).deploy();
    assertNotNull(deployment.getId());
    return deployment.getId();
}