[jbpm-commits] JBoss JBPM SVN: r5211 - in jbpm4/trunk/modules: integration/console/src/main/java/org/jbpm/integration/console and 7 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jul 3 05:47:18 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-07-03 05:47:17 -0400 (Fri, 03 Jul 2009)
New Revision: 5211

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java
Removed:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java
   jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateTaskQueryCmd.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
Log:
JBPM-2383 made process definition query consistent wrt notSuspended() suspended() and updated the console integration query to only show the notSuspended process definitions

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -39,7 +39,9 @@
   ProcessDefinitionQuery processDefinitionNameLike(String name);
   ProcessDefinitionQuery processDefinitionName(String name);
   ProcessDefinitionQuery deploymentId(String deploymentId);
+
   ProcessDefinitionQuery suspended();
+  ProcessDefinitionQuery notSuspended();
 
   ProcessDefinitionQuery orderAsc(String property);
   ProcessDefinitionQuery orderDesc(String property);

Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -59,6 +59,7 @@
 
       // active processes
       List<ProcessDefinition> activePds = repositoryService.createProcessDefinitionQuery()
+          .notSuspended()
           .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
           .list();
      

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateTaskQueryCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateTaskQueryCmd.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateTaskQueryCmd.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -22,8 +22,8 @@
 package org.jbpm.pvm.internal.cmd;
 
 import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.query.TaskQueryImpl;
 import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.TaskQueryImpl;
 
 
 /**

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -46,9 +46,9 @@
 import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
 import org.jbpm.pvm.internal.query.JobQueryImpl;
 import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
+import org.jbpm.pvm.internal.query.TaskQueryImpl;
 import org.jbpm.pvm.internal.session.DbSession;
 import org.jbpm.pvm.internal.task.TaskImpl;
-import org.jbpm.pvm.internal.task.TaskQueryImpl;
 import org.jbpm.pvm.internal.util.Clock;
 
 /**

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -58,7 +58,7 @@
   protected String key;
   protected String nameLike;
   protected String name;
-  protected boolean suspended;
+  protected Boolean suspended;
   protected String deploymentId;
   
   public Object execute(Session session) {
@@ -90,10 +90,12 @@
     hql.append(DeploymentProperty.class.getName());
     hql.append(" as versionProperty ");
 
-    if (suspended) {
-      appendWhereClause("deployment.state = '"+Deployment.STATE_SUSPENDED+"'", hql);
-    } else {
-      appendWhereClause("deployment.state != '"+Deployment.STATE_SUSPENDED+"'", hql);
+    if (suspended!=null) {
+      if (suspended) {
+        appendWhereClause("deployment.state = '"+Deployment.STATE_SUSPENDED+"'", hql);
+      } else {
+        appendWhereClause("deployment.state != '"+Deployment.STATE_SUSPENDED+"'", hql);
+      }
     }
 
     appendWhereClause("idProperty.key = '"+DeploymentImpl.KEY_PROCESS_DEFINITION_ID+"'", hql);
@@ -158,6 +160,11 @@
     return this;
   }
 
+  public ProcessDefinitionQuery notSuspended() {
+    this.suspended = false;
+    return this;
+  }
+
   public ProcessDefinitionQuery processDefinitionNameLike(String name) {
     this.nameLike = name;
     return this;

Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java (from rev 5192, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.identity.Group;
+import org.jbpm.api.task.Task;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+/**
+ * @author Tom Baeyens
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ */
+public class TaskQueryImpl extends AbstractQuery implements TaskQuery {
+
+  private static final long serialVersionUID = 1L;
+  
+  private static Log log = Log.getLog(TaskQueryImpl.class.getName());
+
+  protected boolean unassigned = false;
+  protected String assignee = null;
+  protected String candidate = null;
+  protected Boolean suspended = null;
+  protected String processInstanceId = null;
+  protected String processDefinitionId = null;
+  protected String activityName = null;
+
+  /* groupIds transports the groupIds from the hql to the applyParameters */
+  protected List<String> groupIds; 
+
+  public TaskQuery assignee(String assignee) {
+    if (candidate!=null) {
+      throw new JbpmException("assignee(...) cannot be combined with candidate(...) in one query");
+    }
+    this.assignee = assignee;
+    return this;
+  }
+
+  public TaskQuery candidate(String userId) {
+    this.candidate = userId;
+    unassigned();
+    return this;
+  }
+
+  public TaskQuery processInstanceId(String processInstanceId) {
+    this.processInstanceId = processInstanceId;
+    return this;
+  }
+
+  public TaskQuery processDefinitionId(String processDefinitionId) {
+    this.processDefinitionId = processDefinitionId;
+    return this;
+  }
+
+  public TaskQuery activityName(String activityName) {
+    this.activityName = activityName;
+    return this;
+  }
+
+  public TaskQuery unassigned() {
+    this.assignee = null;
+    this.unassigned = true;
+    return this;
+  }
+
+  public TaskQuery suspended() {
+    this.suspended = true;
+    return this;
+  }
+
+  public TaskQuery notSuspended() {
+    this.suspended = false;
+    return this;
+  }
+
+  public TaskQuery orderAsc(String property) {
+    orderByClause = "task." + property + " asc ";
+    return this;
+  }
+
+  public TaskQuery orderDesc(String property) {
+    orderByClause = "task." + property + " desc ";
+    return this;
+  }
+
+  public TaskQuery page(int firstResult, int maxResults) {
+    page = new Page(firstResult, maxResults);
+    return this;
+  }
+
+  protected void applyParameters(Query query) {
+    if (assignee!=null) {
+      log.debug("setting parameter assignee: "+assignee);
+      query.setString("assignee", assignee);
+    }
+    
+    if (candidate!=null) {
+      log.debug("setting parameter candidateUserId: "+candidate);
+      query.setString("candidateUserId", candidate);
+      
+      if (groupIds!=null) {
+        log.debug("setting parameter candidateGroupIds: "+groupIds);
+        query.setParameterList("candidateGroupIds", groupIds);
+      }
+    }
+  }
+
+  public String hql() {
+  	StringBuilder hql = new StringBuilder();
+    hql.append("select task ");
+    hql.append("from ");
+    hql.append(TaskImpl.class.getName());
+    hql.append(" as task ");
+
+    // participations
+    if (candidate!=null) {
+      hql.append(", ");
+      hql.append(ParticipationImpl.class.getName());
+      hql.append(" as participant ");
+
+      appendWhereClause("participant.task = task ", hql);
+      appendWhereClause("participant.type = 'candidate' ", hql);
+
+      IdentitySession identitySession = Environment.getFromCurrent(IdentitySession.class);
+      List<Group> groups = identitySession.findGroupsByUser(candidate);
+      if (groups.isEmpty()) {
+        groupIds = null;
+        appendWhereClause("participant.userId = :candidateUserId ", hql);
+        
+      } else {
+        groupIds = new ArrayList<String>();
+        for (Group group: groups) {
+          groupIds.add(group.getId());
+        }
+        appendWhereClause("((participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds)))", hql);
+      }
+    }
+    
+    if (suspended!=null) {
+      if (suspended) {
+        appendWhereClause("task.state = '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
+      } else {
+        appendWhereClause("task.state != '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
+      }
+    }
+    
+    if (processInstanceId!=null) {
+      appendWhereClause("task.processInstance.id = '"+processInstanceId+"' ", hql);
+    }
+
+    if (activityName!=null) {
+      appendWhereClause("task.execution.activityName = '"+activityName+"' ", hql);
+    }
+
+    if (processDefinitionId!=null) {
+      appendWhereClause("task.processInstance.processDefinitionId = '"+processDefinitionId+"' ", hql);
+    }
+
+    if (assignee!=null) {
+      appendWhereClause("task.assignee = :assignee ", hql);
+    } else if (unassigned) {
+      appendWhereClause("task.assignee is null ", hql);
+    }
+
+    appendOrderByClause(hql);
+
+    String hqlQuery = hql.toString();
+    
+    log.debug(hqlQuery);
+    
+    return hqlQuery;
+  }
+  
+  public List<Task> list() {
+    return (List<Task>) commandService.execute(this);
+  }
+  
+  public Task uniqueResult() {
+    return (Task)untypedUniqueResult();
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -34,7 +34,7 @@
 import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
 import org.jbpm.pvm.internal.query.JobQueryImpl;
 import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
-import org.jbpm.pvm.internal.task.TaskQueryImpl;
+import org.jbpm.pvm.internal.query.TaskQueryImpl;
 
 
 /**

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -50,8 +50,8 @@
 import org.jbpm.pvm.internal.cmd.RemoveParticipantCmd;
 import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
 import org.jbpm.pvm.internal.cmd.SetTaskVariablesCmd;
+import org.jbpm.pvm.internal.query.TaskQueryImpl;
 import org.jbpm.pvm.internal.task.TaskImpl;
-import org.jbpm.pvm.internal.task.TaskQueryImpl;
 
 /**
  * @author Alejandro Guizar, Tom Baeyens

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -1,210 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.task;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Query;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.TaskQuery;
-import org.jbpm.api.identity.Group;
-import org.jbpm.api.task.Task;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.query.AbstractQuery;
-import org.jbpm.pvm.internal.query.Page;
-
-/**
- * @author Tom Baeyens
- * @author Heiko Braun <heiko.braun at jboss.com>
- */
-public class TaskQueryImpl extends AbstractQuery implements TaskQuery {
-
-  private static final long serialVersionUID = 1L;
-  
-  private static Log log = Log.getLog(TaskQueryImpl.class.getName());
-
-  protected boolean unassigned = false;
-  protected String assignee = null;
-  protected String candidate = null;
-  protected Boolean suspended = null;
-  protected String processInstanceId = null;
-  protected String processDefinitionId = null;
-  protected String activityName = null;
-
-  /* groupIds transports the groupIds from the hql to the applyParameters */
-  protected List<String> groupIds; 
-
-  public TaskQuery assignee(String assignee) {
-    if (candidate!=null) {
-      throw new JbpmException("assignee(...) cannot be combined with candidate(...) in one query");
-    }
-    this.assignee = assignee;
-    return this;
-  }
-
-  public TaskQuery candidate(String userId) {
-    this.candidate = userId;
-    unassigned();
-    return this;
-  }
-
-  public TaskQuery processInstanceId(String processInstanceId) {
-    this.processInstanceId = processInstanceId;
-    return this;
-  }
-
-  public TaskQuery processDefinitionId(String processDefinitionId) {
-    this.processDefinitionId = processDefinitionId;
-    return this;
-  }
-
-  public TaskQuery activityName(String activityName) {
-    this.activityName = activityName;
-    return this;
-  }
-
-  public TaskQuery unassigned() {
-    this.assignee = null;
-    this.unassigned = true;
-    return this;
-  }
-
-  public TaskQuery suspended() {
-    this.suspended = true;
-    return this;
-  }
-
-  public TaskQuery notSuspended() {
-    this.suspended = false;
-    return this;
-  }
-
-  public TaskQuery orderAsc(String property) {
-    orderByClause = "task." + property + " asc ";
-    return this;
-  }
-
-  public TaskQuery orderDesc(String property) {
-    orderByClause = "task." + property + " desc ";
-    return this;
-  }
-
-  public TaskQuery page(int firstResult, int maxResults) {
-    page = new Page(firstResult, maxResults);
-    return this;
-  }
-
-  protected void applyParameters(Query query) {
-    if (assignee!=null) {
-      log.debug("setting parameter assignee: "+assignee);
-      query.setString("assignee", assignee);
-    }
-    
-    if (candidate!=null) {
-      log.debug("setting parameter candidateUserId: "+candidate);
-      query.setString("candidateUserId", candidate);
-      
-      if (groupIds!=null) {
-        log.debug("setting parameter candidateGroupIds: "+groupIds);
-        query.setParameterList("candidateGroupIds", groupIds);
-      }
-    }
-  }
-
-  public String hql() {
-  	StringBuilder hql = new StringBuilder();
-    hql.append("select task ");
-    hql.append("from ");
-    hql.append(TaskImpl.class.getName());
-    hql.append(" as task ");
-
-    // participations
-    if (candidate!=null) {
-      hql.append(", ");
-      hql.append(ParticipationImpl.class.getName());
-      hql.append(" as participant ");
-
-      appendWhereClause("participant.task = task ", hql);
-      appendWhereClause("participant.type = 'candidate' ", hql);
-
-      IdentitySession identitySession = Environment.getFromCurrent(IdentitySession.class);
-      List<Group> groups = identitySession.findGroupsByUser(candidate);
-      if (groups.isEmpty()) {
-        groupIds = null;
-        appendWhereClause("participant.userId = :candidateUserId ", hql);
-        
-      } else {
-        groupIds = new ArrayList<String>();
-        for (Group group: groups) {
-          groupIds.add(group.getId());
-        }
-        appendWhereClause("((participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds)))", hql);
-      }
-    }
-    
-    if (suspended!=null) {
-      if (suspended) {
-        appendWhereClause("task.state = '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
-      } else {
-        appendWhereClause("task.state != '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
-      }
-    }
-    
-    if (processInstanceId!=null) {
-      appendWhereClause("task.processInstance.id = '"+processInstanceId+"' ", hql);
-    }
-
-    if (activityName!=null) {
-      appendWhereClause("task.execution.activityName = '"+activityName+"' ", hql);
-    }
-
-    if (processDefinitionId!=null) {
-      appendWhereClause("task.processInstance.processDefinitionId = '"+processDefinitionId+"' ", hql);
-    }
-
-    if (assignee!=null) {
-      appendWhereClause("task.assignee = :assignee ", hql);
-    } else if (unassigned) {
-      appendWhereClause("task.assignee is null ", hql);
-    }
-
-    appendOrderByClause(hql);
-
-    String hqlQuery = hql.toString();
-    
-    log.debug(hqlQuery);
-    
-    return hqlQuery;
-  }
-  
-  public List<Task> list() {
-    return (List<Task>) commandService.execute(this);
-  }
-  
-  public Task uniqueResult() {
-    return (Task)untypedUniqueResult();
-  }
-}

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java	2009-07-03 09:32:54 UTC (rev 5210)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java	2009-07-03 09:47:17 UTC (rev 5211)
@@ -96,8 +96,6 @@
 
     repositoryService.suspendDeployment(deploymentHireId);
 
-    
-    expectedProcessNames.remove("hire");
 
     processDefinitions = repositoryService
       .createProcessDefinitionQuery()
@@ -177,6 +175,48 @@
     assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
   }
 
+  public void testQueryNonSuspendProcessDefinitions() {
+    deployJpdlXmlString(
+      "<process name='claim'>" +
+      "  <start>" +
+      "    <transition to='c' />" +
+      "  </start>" +
+      "  <state name='c' />" +
+      "</process>"
+    );
+
+    String deploymentHireId = deployJpdlXmlString(
+      "<process name='hire'>" +
+      "  <start>" +
+      "    <transition to='h' />" +
+      "  </start>" +
+      "  <state name='h' />" +
+      "</process>"
+    );
+
+    String deploymentFireId = deployJpdlXmlString(
+      "<process name='fire'>" +
+      "  <start>" +
+      "    <transition to='f' />" +
+      "  </start>" +
+      "  <state name='f' />" +
+      "</process>"
+    );
+    
+    repositoryService.suspendDeployment(deploymentHireId);
+
+    List<ProcessDefinition> processDefinitions = repositoryService
+      .createProcessDefinitionQuery()
+      .notSuspended()
+      .list();
+    
+    Set<String> expectedProcessNames = new HashSet<String>();
+    expectedProcessNames.add("claim");
+    expectedProcessNames.add("fire");
+
+    assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
+  }
+
   int countProcessInstancesFor(List<ProcessInstance> processInstances, String processDefinitionKey) {
     int count = 0;
     for (Execution processInstance: processInstances) {




More information about the jbpm-commits mailing list