@Deployment(resources = {"org/camunda/bpm/engine/test/db/processOne.bpmn20.xml"})
  public void testActivateAlreadyActiveProcessDefinition() {

    ProcessDefinition processDefinition =
        repositoryService.createProcessDefinitionQuery().singleResult();
    assertFalse(processDefinition.isSuspended());

    try {
      repositoryService.activateProcessDefinitionById(processDefinition.getId());
      processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
      assertFalse(processDefinition.isSuspended());
    } catch (Exception e) {
      fail("Should be successful");
    }
  }
  @Deployment(resources = {"org/camunda/bpm/engine/test/db/processOne.bpmn20.xml"})
  public void testSuspendActivateProcessDefinitionByKey() {

    ProcessDefinition processDefinition =
        repositoryService.createProcessDefinitionQuery().singleResult();
    assertFalse(processDefinition.isSuspended());

    // suspend
    repositoryService.suspendProcessDefinitionByKey(processDefinition.getKey());
    processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    assertTrue(processDefinition.isSuspended());

    // activate
    repositoryService.activateProcessDefinitionByKey(processDefinition.getKey());
    processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    assertFalse(processDefinition.isSuspended());
  }
  @Deployment(resources = {"org/camunda/bpm/engine/test/db/processOne.bpmn20.xml"})
  public void testProcessDefinitionActiveByDefault() {

    ProcessDefinition processDefinition =
        repositoryService.createProcessDefinitionQuery().singleResult();

    assertFalse(processDefinition.isSuspended());
  }