here's the example usage (ProcessDefinitionStartFormTest):
public void testFormInUnnamedStartActivity() {
| String deploymentDbid =
| repositoryService.createDeployment()
| .addResourceFromString("xmlstring.jpdl.xml",
| "<process name='make print'>" +
| " <start
form='org/jbpm/test/process/ProcessDefinitionStartForm.form' />" +
| "</process>"
| )
|
.addResourceFromClasspath("org/jbpm/test/process/ProcessDefinitionStartForm.form")
| .deploy();
|
| registerDeployment(deploymentDbid);
|
| ProcessDefinition processDefinition =
| repositoryService
| .createProcessDefinitionQuery()
| .processDefinitionName("make print")
| .uniqueResult();
|
| String processDefinitionId = processDefinition.getId();
|
| List<String> startActivityNames =
repositoryService.getStartActivityNames(processDefinitionId );
| List<String> expectedStartActivityNames = new ArrayList<String>();
| expectedStartActivityNames.add(null);
|
| assertEquals(expectedStartActivityNames, startActivityNames);
|
| String startFormResourceName =
repositoryService.getStartFormResourceName(processDefinitionId, null);
|
| assertEquals("org/jbpm/test/process/ProcessDefinitionStartForm.form",
startFormResourceName);
|
| InputStream formInputStream =
repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
startFormResourceName);
|
| String formContents = new String(IoUtil.readBytes(formInputStream));
| assertEquals("start task form", formContents);
| }
|
| public void testFormInNamedStartActivity() {
| String deploymentDbid =
| repositoryService.createDeployment()
| .addResourceFromString("xmlstring.jpdl.xml",
| "<process name='make print'>" +
| " <start name='start'
form='org/jbpm/test/process/ProcessDefinitionStartForm.form' />" +
| "</process>"
| )
|
.addResourceFromClasspath("org/jbpm/test/process/ProcessDefinitionStartForm.form")
| .deploy();
|
| registerDeployment(deploymentDbid);
|
| ProcessDefinition processDefinition =
| repositoryService
| .createProcessDefinitionQuery()
| .processDefinitionName("make print")
| .uniqueResult();
|
| String processDefinitionId = processDefinition.getId();
|
| List<String> startActivityNames =
repositoryService.getStartActivityNames(processDefinitionId );
| List<String> expectedStartActivityNames = new ArrayList<String>();
| expectedStartActivityNames.add("start");
|
| assertEquals(expectedStartActivityNames, startActivityNames);
|
| String startFormResourceName =
repositoryService.getStartFormResourceName(processDefinitionId, "start");
|
| assertEquals("org/jbpm/test/process/ProcessDefinitionStartForm.form",
startFormResourceName);
|
| InputStream formInputStream =
repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
startFormResourceName);
|
| String formContents = new String(IoUtil.readBytes(formInputStream));
| assertEquals("start task form", formContents);
| }
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240511#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...