@@ -0,0 +1,2097 @@
+package org.activiti.engine.test.api.history;%0A%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.activiti.engine.history.HistoricData;%0Aimport org.activiti.engine.history.HistoricVariableInstance;%0Aimport org.activiti.engine.history.ProcessInstanceHistoryLog;%0Aimport org.activiti.engine.impl.history.HistoryLevel;%0Aimport org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity;%0Aimport org.activiti.engine.impl.test.PluggableActivitiTestCase;%0Aimport org.activiti.engine.task.Task;%0A%0A/**%0A * @author Daisuke Yoshimoto%0A */%0Apublic class ProcessInstanceLogQueryAndByteArrayTypeVariableTest extends PluggableActivitiTestCase %7B%0A%09%0A%09protected String processInstanceId;%0A%09%0A%09private static String LARGE_STRING_VALUE;%0A%09%0A%09static %7B%0A%09%09StringBuilder sb = new StringBuilder(%22a%22);%0A%09%09for(int i = 0; i %3C 4001; i++) %7B%0A%09%09     sb.append(%22a%22);%0A%09%09%7D%0A%09%09LARGE_STRING_VALUE = sb.toString();%0A%09%7D%0A%09%0A%09@Override%0A%09protected void setUp() throws Exception %7B%0A%09  super.setUp();%0A%09  %0A%09  // Deploy test process%0A%09  deployTwoTasksTestProcess();%0A%09  %0A%09  // Start process instance%0A%09  Map%3CString, Object%3E vars = new HashMap%3CString, Object%3E();%0A%09  // ByteArrayType Variable%0A%09  vars.put(%22var%22, LARGE_STRING_VALUE);%0A%09  this.processInstanceId = runtimeService.startProcessInstanceByKey(%22twoTasksProcess%22, vars).getId();%0A%09  %0A%09  // Finish tasks%0A%09  for (Task task : taskService.createTaskQuery().list()) %7B%0A%09  %09taskService.complete(task.getId());%0A%09  %7D%0A%09%7D%0A%09%0A%09@Override%0A%09protected void tearDown() throws Exception %7B%0A%09  super.tearDown();%0A%09%7D%0A%0A%09public void testIncludeVariables() %7B%0A%09%09if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) %7B%0A%09%09%09ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId)%0A%09%09%09%09.includeVariables()%0A%09%09%09%09.singleResult();%0A%09%09%09List%3CHistoricData%3E events = log.getHistoricData();%0A%09%09%09assertEquals(1, events.size());%0A%09%09%09%0A%09%09%09for (HistoricData event : events) %7B%0A%09%09%09%09assertTrue(event instanceof HistoricVariableInstance);%0A%09%09%09%09assertEquals(((HistoricVariableInstanceEntity) event).getValue(), LARGE_STRING_VALUE);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add Test Case