public void testGetProcessDefinitions(){
  List<String> deploymentIds=new ArrayList<String>();
  deploymentIds.add(deployProcessString(("<definitions " + NAMESPACE + " "+ TARGET_NAMESPACE+ ">"+ "  <process id='IDR' name='Insurance Damage Report 1' />"+ "</definitions>")));
  deploymentIds.add(deployProcessString(("<definitions " + NAMESPACE + " "+ TARGET_NAMESPACE+ ">"+ "  <process id='IDR' name='Insurance Damage Report 2' />"+ "</definitions>")));
  deploymentIds.add(deployProcessString(("<definitions " + NAMESPACE + " "+ TARGET_NAMESPACE+ ">"+ "  <process id='IDR' name='Insurance Damage Report 3' />"+ "</definitions>")));
  deploymentIds.add(deployProcessString(("<definitions " + NAMESPACE + " "+ TARGET_NAMESPACE+ ">"+ "  <process id='EN' name='Expense Note 1' />"+ "</definitions>")));
  deploymentIds.add(deployProcessString(("<definitions " + NAMESPACE + " "+ TARGET_NAMESPACE+ ">"+ "  <process id='EN' name='Expense Note 2' />"+ "</definitions>")));
  List<ProcessDefinition> processDefinitions=repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionKey().asc().orderByProcessDefinitionVersion().desc().list();
  assertNotNull(processDefinitions);
  assertEquals(5,processDefinitions.size());
  ProcessDefinition processDefinition=processDefinitions.get(0);
  assertEquals("EN",processDefinition.getKey());
  assertEquals("Expense Note 2",processDefinition.getName());
  assertTrue(processDefinition.getId().startsWith("EN:2"));
  assertEquals(2,processDefinition.getVersion());
  processDefinition=processDefinitions.get(1);
  assertEquals("EN",processDefinition.getKey());
  assertEquals("Expense Note 1",processDefinition.getName());
  assertTrue(processDefinition.getId().startsWith("EN:1"));
  assertEquals(1,processDefinition.getVersion());
  processDefinition=processDefinitions.get(2);
  assertEquals("IDR",processDefinition.getKey());
  assertEquals("Insurance Damage Report 3",processDefinition.getName());
  assertTrue(processDefinition.getId().startsWith("IDR:3"));
  assertEquals(3,processDefinition.getVersion());
  processDefinition=processDefinitions.get(3);
  assertEquals("IDR",processDefinition.getKey());
  assertEquals("Insurance Damage Report 2",processDefinition.getName());
  assertTrue(processDefinition.getId().startsWith("IDR:2"));
  assertEquals(2,processDefinition.getVersion());
  processDefinition=processDefinitions.get(4);
  assertEquals("IDR",processDefinition.getKey());
  assertEquals("Insurance Damage Report 1",processDefinition.getName());
  assertTrue(processDefinition.getId().startsWith("IDR:1"));
  assertEquals(1,processDefinition.getVersion());
  Set<String> queryDeploymentIds=new HashSet<String>();
  queryDeploymentIds.add(processDefinitions.get(0).getDeploymentId());
  queryDeploymentIds.add(processDefinitions.get(1).getDeploymentId());
  List<ProcessDefinition> queryProcessDefinitions=repositoryService.createProcessDefinitionQuery().deploymentIds(queryDeploymentIds).orderByProcessDefinitionKey().asc().orderByProcessDefinitionVersion().desc().list();
  assertEquals(2,queryProcessDefinitions.size());
  processDefinition=queryProcessDefinitions.get(0);
  assertEquals("EN",processDefinition.getKey());
  assertEquals("Expense Note 2",processDefinition.getName());
  processDefinition=queryProcessDefinitions.get(1);
  assertEquals("EN",processDefinition.getKey());
  assertEquals("Expense Note 1",processDefinition.getName());
  queryDeploymentIds=new HashSet<String>();
  queryDeploymentIds.add(processDefinitions.get(0).getDeploymentId());
  queryDeploymentIds.add(processDefinitions.get(3).getDeploymentId());
  queryDeploymentIds.add(processDefinitions.get(4).getDeploymentId());
  queryProcessDefinitions=repositoryService.createProcessDefinitionQuery().deploymentIds(queryDeploymentIds).list();
  assertEquals(3,queryProcessDefinitions.size());
  processDefinition=queryProcessDefinitions.get(0);
  assertEquals("EN",processDefinition.getKey());
  assertEquals("Expense Note 2",processDefinition.getName());
  processDefinition=processDefinitions.get(3);
  assertEquals("IDR",processDefinition.getKey());
  assertEquals("Insurance Damage Report 2",processDefinition.getName());
  processDefinition=processDefinitions.get(4);
  assertEquals("IDR",processDefinition.getKey());
  assertEquals("Insurance Damage Report 1",processDefinition.getName());
  deleteDeployments(deploymentIds);
}
