@Deployment public void testLocalizeVariables(){
  Map<String,Object> variables=new HashMap<String,Object>();
  variables.put("stringVar","coca-cola");
  ProcessInstance processInstance=runtimeService.startProcessInstanceByKey("localizeVariables",variables);
  Map<String,VariableInstance> variableInstances=runtimeService.getVariableInstances(processInstance.getId());
  assertEquals(1,variableInstances.size());
  assertEquals("stringVar",variableInstances.get("stringVar").getName());
  assertEquals("coca-cola",variableInstances.get("stringVar").getValue());
  List<String> variableNames=new ArrayList<String>();
  variableNames.add("stringVar");
  variableInstances=runtimeService.getVariableInstances(processInstance.getId(),variableNames);
  assertEquals(1,variableInstances.size());
  assertEquals("stringVar",variableInstances.get("stringVar").getName());
  assertEquals("coca-cola",variableInstances.get("stringVar").getValue());
  variableInstances=runtimeService.getVariableInstancesLocal(processInstance.getId(),variableNames);
  assertEquals(1,variableInstances.size());
  assertEquals("stringVar",variableInstances.get("stringVar").getName());
  assertEquals("coca-cola",variableInstances.get("stringVar").getValue());
  VariableInstance variableInstance=runtimeService.getVariableInstance(processInstance.getId(),"stringVar");
  assertNotNull(variableInstance);
  assertEquals("stringVar",variableInstance.getName());
  assertEquals("coca-cola",variableInstance.getValue());
  variableInstance=runtimeService.getVariableInstanceLocal(processInstance.getId(),"stringVar");
  assertNotNull(variableInstance);
  assertEquals("stringVar",variableInstance.getName());
  assertEquals("coca-cola",variableInstance.getValue());
  Task task=taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  variableInstances=taskService.getVariableInstances(task.getId());
  assertEquals(2,variableInstances.size());
  assertEquals("stringVar",variableInstances.get("stringVar").getName());
  assertEquals("coca-cola",variableInstances.get("stringVar").getValue());
  assertEquals("intVar",variableInstances.get("intVar").getName());
  assertEquals(null,variableInstances.get("intVar").getValue());
  variableNames=new ArrayList<String>();
  variableNames.add("stringVar");
  variableInstances=taskService.getVariableInstances(task.getId(),variableNames);
  assertEquals(1,variableInstances.size());
  assertEquals("stringVar",variableInstances.get("stringVar").getName());
  assertEquals("coca-cola",variableInstances.get("stringVar").getValue());
  taskService.setVariableLocal(task.getId(),"stringVar","pepsi-cola");
  variableInstances=taskService.getVariableInstancesLocal(task.getId(),variableNames);
  assertEquals(1,variableInstances.size());
  assertEquals("stringVar",variableInstances.get("stringVar").getName());
  assertEquals("pepsi-cola",variableInstances.get("stringVar").getValue());
  variableInstance=taskService.getVariableInstance(task.getId(),"stringVar");
  assertNotNull(variableInstance);
  assertEquals("stringVar",variableInstance.getName());
  assertEquals("pepsi-cola",variableInstance.getValue());
  variableInstance=taskService.getVariableInstanceLocal(task.getId(),"stringVar");
  assertNotNull(variableInstance);
  assertEquals("stringVar",variableInstance.getName());
  assertEquals("pepsi-cola",variableInstance.getValue());
}
