assertEquals("This process to test JMX", pdList.get(0).get(4));
assertEquals("This process to test JMX", pdList.get(1).get(4));
//suspend the one with version == 2
mbsc.invoke(deploymentsBeanName, "suspendProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
RepositoryService repositoryService = processEngine.getRepositoryService();
// test if it is realy suspended and not the other one
assertTrue(repositoryService.getProcessDefinition(pidV2).isSuspended());
assertFalse(repositoryService.getProcessDefinition(pidV1).isSuspended());
// test if it is reported as suspended and not the other one
List<String> pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
assertNotNull(pd);
assertEquals(5, pd.size());
assertEquals("true", pd.get(3));
pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV1}, new String[]{String.class.getName()});
assertNotNull(pd);
assertEquals(5, pd.size());
assertEquals("false", pd.get(3));
// now reactivate the same suspended process
mbsc.invoke(deploymentsBeanName, "activatedProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
// test if both processes are active again
assertFalse(repositoryService.getProcessDefinition(pidV2).isSuspended());
assertFalse(repositoryService.getProcessDefinition(pidV1).isSuspended());
// test if they are properly reported as activated
pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
assertNotNull(pd);
assertEquals(5, pd.size());
assertEquals("false", pd.get(3));
pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV1}, new String[]{String.class.getName()});
assertNotNull(pd);
assertEquals(5, pd.size());
assertEquals("false", pd.get(3));
// now undeploy the one with version == 1
mbsc.invoke(deploymentsBeanName, "deleteDeployment", new String[]{firstDeploymentId}, new String[]{String.class.getName()});
// now there should be only one deployment and only one process definition with version 2, first check it with API
assertEquals(1, repositoryService.createDeploymentQuery().count());
assertTrue(!repositoryService.createDeploymentQuery().singleResult().getId().equals(firstDeploymentId));
// check if it is also affected in returned results.
deployments = (List<List<String>>) mbsc.getAttribute(deploymentsBeanName, "Deployments");