@Deployment(resources={"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void testQueryIntegerVariable(){
  Map<String,Object> vars=new HashMap<String,Object>();
  vars.put("integerVar",12345);
  ProcessInstance processInstance1=runtimeService.startProcessInstanceByKey("oneTaskProcess",vars);
  vars=new HashMap<String,Object>();
  vars.put("integerVar",12345);
  vars.put("integerVar2",67890);
  ProcessInstance processInstance2=runtimeService.startProcessInstanceByKey("oneTaskProcess",vars);
  vars=new HashMap<String,Object>();
  vars.put("integerVar",55555);
  ProcessInstance processInstance3=runtimeService.startProcessInstanceByKey("oneTaskProcess",vars);
  ProcessInstanceQuery query=runtimeService.createProcessInstanceQuery().variableValueEquals("integerVar",12345);
  List<ProcessInstance> processInstances=query.list();
  assertNotNull(processInstances);
  assertEquals(2,processInstances.size());
  query=runtimeService.createProcessInstanceQuery().variableValueEquals("integerVar",12345).variableValueEquals("integerVar2",67890);
  ProcessInstance resultInstance=query.singleResult();
  assertNotNull(resultInstance);
  assertEquals(processInstance2.getId(),resultInstance.getId());
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueEquals("integerVar",9999).singleResult();
  assertNull(resultInstance);
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueNotEquals("integerVar",12345).singleResult();
  assertNotNull(resultInstance);
  assertEquals(processInstance3.getId(),resultInstance.getId());
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueGreaterThan("integerVar",44444).singleResult();
  assertNotNull(resultInstance);
  assertEquals(processInstance3.getId(),resultInstance.getId());
  assertEquals(0,runtimeService.createProcessInstanceQuery().variableValueGreaterThan("integerVar",55555).count());
  assertEquals(3,runtimeService.createProcessInstanceQuery().variableValueGreaterThan("integerVar",1).count());
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueGreaterThanOrEqual("integerVar",44444).singleResult();
  assertNotNull(resultInstance);
  assertEquals(processInstance3.getId(),resultInstance.getId());
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueGreaterThanOrEqual("integerVar",55555).singleResult();
  assertNotNull(resultInstance);
  assertEquals(processInstance3.getId(),resultInstance.getId());
  assertEquals(3,runtimeService.createProcessInstanceQuery().variableValueGreaterThanOrEqual("integerVar",1).count());
  processInstances=runtimeService.createProcessInstanceQuery().variableValueLessThan("integerVar",55555).list();
  assertEquals(2,processInstances.size());
  List<String> expectedIds=Arrays.asList(processInstance1.getId(),processInstance2.getId());
  List<String> ids=new ArrayList<String>(Arrays.asList(processInstances.get(0).getId(),processInstances.get(1).getId()));
  ids.removeAll(expectedIds);
  assertTrue(ids.isEmpty());
  assertEquals(0,runtimeService.createProcessInstanceQuery().variableValueLessThan("integerVar",12345).count());
  assertEquals(3,runtimeService.createProcessInstanceQuery().variableValueLessThan("integerVar",66666).count());
  processInstances=runtimeService.createProcessInstanceQuery().variableValueLessThanOrEqual("integerVar",55555).list();
  assertEquals(3,processInstances.size());
  assertEquals(0,runtimeService.createProcessInstanceQuery().variableValueLessThanOrEqual("integerVar",12344).count());
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueEquals(55555).singleResult();
  assertNotNull(resultInstance);
  assertEquals(processInstance3.getId(),resultInstance.getId());
  processInstances=runtimeService.createProcessInstanceQuery().variableValueEquals(12345).list();
  assertEquals(2,processInstances.size());
  expectedIds=Arrays.asList(processInstance1.getId(),processInstance2.getId());
  ids=new ArrayList<String>(Arrays.asList(processInstances.get(0).getId(),processInstances.get(1).getId()));
  ids.removeAll(expectedIds);
  assertTrue(ids.isEmpty());
  resultInstance=runtimeService.createProcessInstanceQuery().variableValueEquals(9999).singleResult();
  assertNull(resultInstance);
  runtimeService.deleteProcessInstance(processInstance1.getId(),"test");
  runtimeService.deleteProcessInstance(processInstance2.getId(),"test");
  runtimeService.deleteProcessInstance(processInstance3.getId(),"test");
}
