@Deployment(resources={"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void testLocalizeTasks() throws Exception {
  ProcessInstance processInstance=runtimeService.startProcessInstanceByKey("oneTaskProcess");
  List<HistoricTaskInstance> tasks=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).list();
  assertEquals(1,tasks.size());
  assertEquals("my task",tasks.get(0).getName());
  assertNull(tasks.get(0).getDescription());
  ObjectNode infoNode=dynamicBpmnService.changeLocalizationName("en-GB","theTask","My localized name");
  dynamicBpmnService.changeLocalizationDescription("en-GB".toString(),"theTask","My localized description",infoNode);
  dynamicBpmnService.saveProcessDefinitionInfo(processInstance.getProcessDefinitionId(),infoNode);
  tasks=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).list();
  assertEquals(1,tasks.size());
  assertEquals("my task",tasks.get(0).getName());
  assertNull(tasks.get(0).getDescription());
  tasks=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).locale("en-GB").list();
  assertEquals(1,tasks.size());
  assertEquals("My localized name",tasks.get(0).getName());
  assertEquals("My localized description",tasks.get(0).getDescription());
  tasks=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).listPage(0,10);
  assertEquals(1,tasks.size());
  assertEquals("my task",tasks.get(0).getName());
  assertNull(tasks.get(0).getDescription());
  tasks=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).locale("en-GB").listPage(0,10);
  assertEquals(1,tasks.size());
  assertEquals("My localized name",tasks.get(0).getName());
  assertEquals("My localized description",tasks.get(0).getDescription());
  HistoricTaskInstance task=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult();
  assertEquals("my task",task.getName());
  assertNull(task.getDescription());
  task=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).locale("en-GB").singleResult();
  assertEquals("My localized name",task.getName());
  assertEquals("My localized description",task.getDescription());
  task=historyService.createHistoricTaskInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult();
  assertEquals("my task",task.getName());
  assertNull(task.getDescription());
}
