01-04-2013 02:20 AM
<exclusiveGateway id="XORAProjectOrNot" name="" />
<sequenceFlow id="flow63" name="Project" sourceRef="XORAProjectOrNot"
targetRef="sendInformationsFromTheProfessors">
<conditionExpression xsi:type="tFormalExpression">${StudentAppInfo.project == true}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow69" name="No Project" sourceRef="XORAProjectOrNot"
targetRef="XORBProjectOrNot">
<conditionExpression xsi:type="tFormalExpression">${StudentAppInfo.project == false}</conditionExpression>
</sequenceFlow>
I want to get the project value from:
<startEvent id="start">
<extensionElements>
<activiti:formProperty id="studentName" name="Studenten Name"
required="true" type="string" />
<activiti:formProperty id="emailAddress" name="Email address"
required="true" type="string" />
<activiti:formProperty id="dateFrom" name="Date from"
required="true" type="long" />
<activiti:formProperty id="dateToo" name="Date too"
required="true" type="long" />
<activiti:formProperty id="homeCountry" name="Home Country"
required="true" type="string" />
<activiti:formProperty id="homeUniversity"
name="Home University" required="true" type="string" />
<activiti:formProperty id="homeDepartment"
name="Home Department" required="true" type="string" />
<activiti:formProperty id="targetUniversity"
name="Target University" required="true" type="string" />
<activiti:formProperty id="targetDepartment"
name="Target Department" required="true" type="string" />
<activiti:formProperty id="research" name="Research"
required="true" type="string" />
<activiti:formProperty id="courseEnrollment"
name="Course Enrollment" required="true" type="string" />
<activiti:formProperty id="project" name="With project"
required="true" type="boolean" />
</extensionElements>
</startEvent>
<sequenceFlow id="flow114" sourceRef="start" targetRef="createRequest"></sequenceFlow>
<serviceTask id="createRequest" name="Create Request"
activiti:class="org.process1.CreateStudentApp"></serviceTask>
…
public class StudentAppInfo implements Serializable {
private static final long serialVersionUID = 1L;
private String studentName;
private String emailAddress;
private long dateFrom;
private long dateToo;
private long month;
private String homeCountry;
private String homeUniversity;
private String homeDepartment;
private String targetUniversity;
private String targetDepartment;
private String research;
private String courseEnrollment;
private Boolean project;
public Boolean getProject() {
return project;
}
}
@Deployment(resources = { "Part1Application.bpmn20.xml" })
public void startFormSubmit() {
ProcessDefinition definition = activitiRule.getRepositoryService()
.createProcessDefinitionQuery()
.processDefinitionKey("part1Application").singleResult();
assertNotNull(definition);
// call the FormService interface
FormService formService = activitiRule.getFormService();
List<FormProperty> formList = formService.getStartFormData(
definition.getId()).getFormProperties();
assertEquals(12, formList.size());
Map<String, String> formProperties = new HashMap<String, String>();
formProperties.put("studentName", "Toni Muller");
formProperties.put("emailAddress", "toni@localhost");
formProperties.put("dateFrom", "1234");
formProperties.put("dateToo", "2345");
formProperties.put("homeCountry", "usa");
formProperties.put("homeUniversity", "univbersityy");
formProperties.put("homeDepartment", "Computer Science");
formProperties.put("targetUniversity", "Universityaaa");
formProperties.put("targetDepartment", "Communication Engineering");
formProperties.put("research", "Enrollment Process");
formProperties.put("courseEnrollment", "UML");
formProperties.put("project", "true");
// submit form properties
formService.submitStartFormData(definition.getId(), formProperties);
// view history query for form properties
List<HistoricDetail> historyVariables = activitiRule
.getHistoryService().createHistoricDetailQuery()
.formProperties().list();
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.*;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.test.ActivitiRule;
import org.activiti.engine.test.Deployment;
import org.junit.Rule;
import org.junit.Test;
Map<String, Object> variables = new HashMap<String, Object>();
// Test with input == true
variables.put("input", true);
ProcessInstance pi = runtimeService.startProcessInstanceByKey("XORAProjectOrNot", variables);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("send informations from the professors", task.getName());
// Test with input == false
variables.put("input", false);
pi = runtimeService.startProcessInstanceByKey("XORAProjectOrNot", variables);
task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("XOR B Project Or Not", task.getName());
01-04-2013 02:44 AM
01-04-2013 04:28 AM
@Rule
public ActivitiRule activitiRule = new ActivitiRule("activiti.cfg-mem.xml");
@Test
// deploys process with form properties
@Deployment(resources = { "Part1Application.bpmn20.xml" })
public void testProjectDecision() {
StudentAppInfo studentAppInfo=new StudentAppInfo();
Map<String, Object> variables = new HashMap<String, Object>();
// Test with input == true
studentAppInfo.setProject(true);
variables.put("input", studentAppInfo.getProject());
ProcessInstance pi = runtimeService.startProcessInstanceByKey("XORAProjectOrNot", variables);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("send informations from the professors", task.getName());
// Test with input == false
studentAppInfo.setProject(false);
variables.put("input", studentAppInfo.getProject());
pi = runtimeService.startProcessInstanceByKey("XORAProjectOrNot", variables);
task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("XOR B Project Or Not", task.getName());
}
Is this was you mean ?01-04-2013 05:45 AM
01-04-2013 06:23 AM
Is this was you mean ?No
variables.put("input", studentAppInfo.getProject());
here you set a variable named input, not a variable named 'StudentAppInfo', while here<conditionExpression xsi:type="tFormalExpression">${StudentAppInfo.project == true}</conditionExpression>
and here<conditionExpression xsi:type="tFormalExpression">${StudentAppInfo.project == false}</conditionExpression>
You reference the StudentAppInfo variable or object variables.put("StudentAppInfo", studentAppInfo);
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.