AnsweredAssumed Answered

Semantics of RepositoryService.deleteDeployment()

Question asked by rafael.cordones on Nov 21, 2011
Latest reply on Dec 12, 2011 by rafael.cordones
Hi!

I am in the process (pun intended ;-) ) of getting to know Activiti and I have come across something that I interpret as a bug.

The following methods from the interface org.activiti.engine.RepositoryService:

  /** Deletes the given deployment.
   * @param deploymentId id of the deployment, cannot be null.
   * @throwns RuntimeException if there are still runtime or history process
   * instances or jobs.
   */
  void deleteDeployment(String deploymentId);
 
  /**
   * Deletes the given deployment and cascade deletion to process instances,
   * history process instances and jobs.
   * @param deploymentId id of the deployment, cannot be null.
   * @deprecated use {@link #deleteDeployment(String, boolean)}.  This methods may be deleted from 5.3.
   */
  void deleteDeploymentCascade(String deploymentId);

  /**
   * Deletes the given deployment and cascade deletion to process instances,
   * history process instances and jobs.
   * @param deploymentId id of the deployment, cannot be null.
   */
  void deleteDeployment(String deploymentId, boolean cascade);
do not report any error when you pass them a deploymentId that does not exist.
I would have expected an ActivitiException telling me that no deployment with that id was found (?).

While investigating I modified I added a test case to reproduce the issue
activiti-trunk/modules/activiti-engine/src/test/java/org/activiti/engine/test/api/repository/RepositoryServiceTest.java:


    public void testDeleteDeploymentWithNonExistingDeploymentId() {
      String deploymentId = "NonExistingDeploymentId";
      try {
        repositoryService.deleteDeployment(deploymentId);
        fail("ActivitiException expected");
      } catch (ActivitiException ae) {
        assertTextPresent("Unable to find a deployment with deploymentId '" + deploymentId + "'", ae.getMessage());
      }
    }

Is this a bug or expected behavior? Thanks for your feedback!

Regards,

/rafa

Outcomes