[jbpm-commits] JBoss JBPM SVN: r3391 - projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Dec 15 08:45:46 EST 2008
Author: heiko.braun at jboss.com
Date: 2008-12-15 08:45:46 -0500 (Mon, 15 Dec 2008)
New Revision: 3391
Modified:
projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java
Log:
Added signaling test
Modified: projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java
===================================================================
--- projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java 2008-12-15 12:21:18 UTC (rev 3390)
+++ projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java 2008-12-15 13:45:46 UTC (rev 3391)
@@ -33,93 +33,96 @@
*/
public class ProcessManagementTest extends BaseTC
{
- /*
- * Checks the following requirements:<br>
- * <ul>
- * <li> Process deployment
- * <li> Create instance
- * <li> Suspend instance
- * <li> End an instance
- * </ul>
- */
- public void testProcessDefinitionList() throws Exception
- {
- String response = HTTP.get(SERVER_URL + "/process/definitions", DEFAULT_CREDENTIALS);
+ /*
+ * Checks the following requirements:<br>
+ * <ul>
+ * <li> Process deployment
+ * <li> Create instance
+ * <li> Suspend instance
+ * <li> End an instance
+ * </ul>
+ */
+ public void testProcessDefinitionList() throws Exception
+ {
+ String response = HTTP.get(SERVER_URL + "/process/definitions", DEFAULT_CREDENTIALS);
- ProcessDefinitionRefWrapper dto = unmarshallProcessDefinitionList(response);
+ ProcessDefinitionRefWrapper dto = unmarshallProcessDefinitionList(response);
- ProcessDefinitionRef match = null;
- for (ProcessDefinitionRef def : dto.getDefinitions())
- {
- if (def.equals(testDeploymentRef))
- match = def;
- }
+ ProcessDefinitionRef match = null;
+ for (ProcessDefinitionRef def : dto.getDefinitions())
+ {
+ if (def.equals(testDeploymentRef))
+ match = def;
+ }
- assertNotNull(match);
+ assertNotNull(match);
- }
+ }
- /*
- * Test instance creation, suspend, resume and deletion.
- */
- public void testInstanceOperations() throws Exception
- {
- ProcessInstanceRef newInstanceRef = createNewProcessInstance();
+ /*
+ * Test instance creation, suspend, resume and deletion.
+ */
+ public void testInstanceOperations() throws Exception
+ {
+ ProcessInstanceRef newInstanceRef = createNewProcessInstance();
- // ------- Suspend it
+ // ------- Suspend it
- newInstanceRef.setState(ProcessInstanceRef.STATE.SUSPENDED);
- HTTP.post(SERVER_URL + "/process/instances/" + newInstanceRef.getInstanceId() + "/state/" + newInstanceRef.getState(), EMPTY, DEFAULT_CREDENTIALS);
+ newInstanceRef.setState(ProcessInstanceRef.STATE.SUSPENDED);
+ HTTP.post(SERVER_URL + "/process/instances/" + newInstanceRef.getInstanceId() + "/state/" + newInstanceRef.getState(), EMPTY, DEFAULT_CREDENTIALS);
- // ------- Verify
+ // ------- Verify
- ProcessInstanceRefWrapper instanceList = getInstanceList(testDeploymentRef);
- assertFalse(instanceList.getInstances().isEmpty());
- assertTrue(instanceList.getTotalCount() == 1);
+ ProcessInstanceRefWrapper instanceList = getInstanceList(testDeploymentRef);
+ assertFalse(instanceList.getInstances().isEmpty());
+ assertTrue(instanceList.getTotalCount() == 1);
- ProcessInstanceRef match = null;
- for (ProcessInstanceRef ref : instanceList.getInstances())
+ ProcessInstanceRef match = null;
+ for (ProcessInstanceRef ref : instanceList.getInstances())
+ {
+ if (ref.equals(newInstanceRef))
{
- if (ref.equals(newInstanceRef))
- {
- match = ref;
- break;
- }
+ match = ref;
+ break;
}
+ }
- assertNotNull(match);
- assertEquals(ProcessInstanceRef.STATE.SUSPENDED, match.getState());
+ assertNotNull(match);
+ assertEquals(ProcessInstanceRef.STATE.SUSPENDED, match.getState());
- // end and verify
- newInstanceRef.setState(ProcessInstanceRef.STATE.ENDED);
- HTTP.post(SERVER_URL + "/process/instances/" + newInstanceRef.getInstanceId() + "/state/" + newInstanceRef.getState(), EMPTY, DEFAULT_CREDENTIALS);
+ // end and verify
+ newInstanceRef.setState(ProcessInstanceRef.STATE.ENDED);
+ HTTP.post(SERVER_URL + "/process/instances/" + newInstanceRef.getInstanceId() + "/state/" + newInstanceRef.getState(), EMPTY, DEFAULT_CREDENTIALS);
- // refresh instance list
- instanceList = getInstanceList(testDeploymentRef);
- assertTrue(instanceList.getInstances().isEmpty());
+ // refresh instance list
+ instanceList = getInstanceList(testDeploymentRef);
+ assertTrue(instanceList.getInstances().isEmpty());
- }
+ }
- public void testSignaling() throws Exception
- {
- /*
- // signal it to move to task node
- String url = "/jbpm3/tokens/"+newInstanceRef.getRootToken().getId()+"/transition/default";
- HTTP.post(
- SERVER_URL + url, EMPTY, DEFAULT_CREDENTIALS
- );
+ public void testSignaling() throws Exception
+ {
+ ProcessInstanceRef newInstanceRef = createNewProcessInstance();
- // refresh instance ref
- newInstanceRef = getInstance(testDeploymentRef, newInstanceId);
- assertNotNull(newInstanceRef);
+ // signal it to move to task node which in our case is the ned node
+ // which means after that the process shouldn't exist anymore
+ String url = "/jbpm3/tokens/"+newInstanceRef.getRootToken().getId()+"/transition/default";
+ HTTP.post(
+ SERVER_URL + url, EMPTY, DEFAULT_CREDENTIALS
+ );
- // same token?
- assertTrue(previousTokenId == newInstanceRef.getRootToken().getId());
+ ProcessInstanceRefWrapper instanceList = getInstanceList(testDeploymentRef);
+ boolean exists = false;
+ for(ProcessInstanceRef iref : instanceList.getInstances())
+ {
+ if(iref.equals(newInstanceRef))
+ {
+ exists = true;
+ break;
+ }
+ }
- // did it really move?
- assertFalse( previousNodeName.equals( newInstanceRef.getRootToken().getCurrentNodeName()));
-
- */
+ assertFalse(exists);
- }
+ }
}
More information about the jbpm-commits
mailing list