int maxResults = 1000;
Map<String, String[]> queryParams = new HashMap<String, String[]>();
// simple (everything)
JaxbQueryTaskResult result = queryTaskHelper.queryTaskOrProcInstAndAssociatedVariables(USER_ID, queryParams, pageInfo, maxResults);
assertNotNull( "null result", result );
assertFalse( "empty result", result.getTaskInfoList().isEmpty() );
assertTrue( "empty result", result.getTaskInfoList().size() > 2 );
for( JaxbQueryTaskInfo taskInfo : result.getTaskInfoList() ) {
long procInstId = taskInfo.getProcessInstanceId();
assertEquals( procInstId, taskInfo.getTaskSummaries().get(0).getProcessInstanceId().longValue() );
}
roundTripJson(result);
roundTripXml(result);
// complicated
long procInstId = result.getTaskInfoList().get(0).getProcessInstanceId();
long taskId = result.getTaskInfoList().get(0).getTaskSummaries().get(0).getId();
addParams(queryParams, "processinstanceid", procInstId + "");
addParams(queryParams, "processid_re", PROCESS_STRING_VAR_ID.substring(0, 10) + "*");
addParams(queryParams, "taskid_min", taskId + "");
addParams(queryParams, "taskid_max", taskId + "");
addParams(queryParams, "taskowner", USER_ID );
addParams(queryParams, "tst", "Completed" );
Calendar cal = GregorianCalendar.getInstance();
cal.roll(Calendar.DAY_OF_YEAR, +2);
String tomorowStr = QUERY_PARAM_DATE_FORMAT.format(cal.getTime()).substring(0, 8);
addParams(queryParams, "edt_max", tomorowStr);
String yesterdayStr = "00:00:01";
addParams(queryParams, "startdate_min", yesterdayStr);
addParams(queryParams, "vid", "inputStr");
addParams(queryParams, "vv_re", "check*");
result = queryTaskHelper.queryTaskOrProcInstAndAssociatedVariables(USER_ID, queryParams, pageInfo, maxResults);
assertNotNull( "null result", result );
assertFalse( "empty result", result.getTaskInfoList().isEmpty() );
assertTrue( "more than 1 result", result.getTaskInfoList().size() == 1 );
JaxbQueryTaskInfo taskInfo = result.getTaskInfoList().get(0);
assertEquals( "more than 1 task sum", 1, taskInfo.getTaskSummaries().size() );
assertEquals( "more than 1 variable", 1, taskInfo.getVariables().size() );
TaskSummary taskSum = taskInfo.getTaskSummaries().get(0);
assertNotNull( taskSum );
assertEquals( taskId, taskSum.getId().longValue() );