02-01-2013 01:36 AM
<userTask id="chooseAddName" name="Choose add Name" activiti:candidateGroups="st">
<extensionElements>
<activiti:formProperty id="addName" name="Add name" expression="#{stAppInfo.addName}" required="true" />
</extensionElements>
</userTask>
StAppInfo stInfo= new StAppInfo ();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("stAppInfo ", stInfo);
variables.put("addName", "Bernd Hauch");
02-01-2013 03:11 AM
02-01-2013 04:19 AM
StAppInfo stInfo= new StAppInfo ();
Map<String, Object> variables = new HashMap<String, Object>();
stInfo.setStName("June Muller");
variables.put("stAppInfo ", stInfo);
variables.put("addName", "Bernd Hauch");
formService.submitStartFormData(definition.getId(), variables);
But how can I submit this now ?02-01-2013 04:52 AM
02-01-2013 05:27 AM
If I ask which addName is inside it gives me null:How can I fix that now, when the method submitStartFormData(String, Map<String,String>) says that I can't use my variables to submit it?
assertEquals("Bernd Hauch", stInfo.getAddName());
StAppInfo stInfo= new StAppInfo ();
Map<String, Object> variables = new HashMap<String, Object>();
stInfo.setStName("June Muller");
variables.put("stAppInfo ", stInfo);
variables.put("addName", "Bernd Hauch");
02-02-2013 01:46 AM
FormService formService = activitiRule.getFormService();
TaskService taskService = activitiRule.getTaskService();
RuntimeService runtimeService = activitiRule.getRuntimeService();
Map<String, Object> variables = new HashMap<String, Object>();
StAppInfo stInfo= new StAppInfo ();
variables.put("stAppInfo ", stInfo);
runtimeService.startProcessInstanceByKey("part1XorAdvisor", variables); //NullPointerException
Task task = taskService.createTaskQuery().singleResult();
Map<String, String> formProperties = new HashMap<String, String>();
formProperties.put("addName", "Bernd Hauch");
formProperties.put("addEmail", "addr@email.de");
formProperties.put("requestAccepted", "true"); // Test with input == true
formService.submitTaskFormData(task.getId(), formProperties);
assertEquals("searchANameAsAdd", task.getTaskDefinitionKey());
System.out.println("should be Bernd Hauch: " + studentInfo.getAdvisorName()); //but is null
02-04-2013 03:30 AM
02-05-2013 03:19 AM
<process id="part1ChooseAdd">
<startEvent id="start"></startEvent>
<sequenceFlow id="flow129" sourceRef="start"
targetRef="searchAPrAsAdd"></sequenceFlow>
<userTask id="searchAPrAsAdd" name="search a pr as add"
activiti:candidateGroups="student">
<extensionElements>
<activiti:formProperty id="addName" name="Add name"
expression="#{stAppInfo.addName}" required="true" />
<activiti:formProperty id="addEmail" name="Add Email"
expression="#{stAppInfo.addEmail}" required="true" />
</extensionElements>
</userTask>
<sequenceFlow id="flow2" name="" sourceRef="searchAPrAsAdd"
targetRef="theEnd"></sequenceFlow>
<endEvent id="theEnd"></endEvent>
public class ChooseAddTest {
@Rule
public ActivitiRule activitiRule = new ActivitiRule("activiti.cfg-mem.xml");
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
private FormService formService;
@Test
// deploys process with form properties
@Deployment(resources = { "part1Application/chooseAdd.bpmn20.xml" })
public void testChooseAdd() {
Map<String, Object> variables = new HashMap<String, Object>();
stAppInfo studentInfo = new stAppInfo();
variables.put("stAppInfo", studentInfo);
runtimeService.startProcessInstanceByKey("part1ChooseAdd", variables);
Task task = taskService.createTaskQuery().singleResult();
Map<String, String> formProperties = new HashMap<String, String>();
formProperties.put("addName", "Bernd Hauch");
formProperties.put("addEmail", "advisorATemail.com");
formService.submitTaskFormData(task.getId(), formProperties);
System.out.println("sould be Bernd Hauch: " + studentInfo.getaddName());
}
}
java.lang.NullPointerException
at org.bpmwithactiviti.part1ApplicationTest.ChooseAddTest.testChooseAdd(ChooseAddTest.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
02-05-2013 07:46 AM
02-05-2013 07:47 AM
error message: (ChooseAddTest.java:66) is runtimeService.startProcessInstanceByKey("part1ChooseAdd", variables);
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.