[jboss-svn-commits] JBL Code SVN: r24498 - in labs/jbossrules/branches/mfossati/drools-osworkflow/src: test/java/org/drools and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Dec 29 06:56:13 EST 2008
Author: mfossati
Date: 2008-12-29 06:56:13 -0500 (Mon, 29 Dec 2008)
New Revision: 24498
Added:
labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/core/DoActionCommand.java
Modified:
labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java
labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java
Log:
DoActionCommand and testsCase, to transitionate over StepNodes.
Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/core/DoActionCommand.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/core/DoActionCommand.java (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/core/DoActionCommand.java 2008-12-29 11:56:13 UTC (rev 24498)
@@ -0,0 +1,56 @@
+package org.drools.osworkflow.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.WorkingMemory;
+import org.drools.osworkflow.instance.OSWorkflowProcessInstance;
+import org.drools.process.command.Command;
+import org.drools.process.instance.ProcessInstance;
+
+/*Author: salaboy */
+
+public class DoActionCommand implements Command {
+
+ private int actionId;
+ private long processInstanceId;
+ private Map<String, Object> results = new HashMap<String, Object>();
+
+ public void setActionId(int actionId) {
+ this.actionId = actionId;
+ }
+
+ public int getActionId() {
+ return actionId;
+ }
+
+ public Map<String, Object> getResults() {
+ return results;
+ }
+
+ public void setResults(Map<String, Object> results) {
+ this.results = results;
+ }
+
+ public void setProcessInstanceId(long processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public long getProcessInstanceId() {
+ return processInstanceId;
+ }
+
+ public Object execute(WorkingMemory workingMemory) {
+ ProcessInstance processInstance = ( ProcessInstance ) workingMemory.getProcessInstance(getProcessInstanceId());
+ if (processInstance != null) {
+ ((OSWorkflowProcessInstance)processInstance).doAction(actionId, new HashMap());
+
+ }
+ return null;
+ }
+
+
+
+
+
+}
\ No newline at end of file
Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java 2008-12-26 05:22:32 UTC (rev 24497)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java 2008-12-29 11:56:13 UTC (rev 24498)
@@ -11,20 +11,15 @@
import org.drools.compiler.PackageBuilder;
import org.drools.marshalling.ProcessMarshallerRegistry;
-import org.drools.osworkflow.DroolsWorkflow;
+import org.drools.osworkflow.core.DoActionCommand;
import org.drools.osworkflow.instance.OSWorkflowProcessInstance;
import org.drools.osworkflow.persistence.marshaller.OSWorkflowMarshaller;
import org.drools.persistence.session.SingleSessionCommandService;
-import org.drools.persistence.session.TestWorkItemHandler;
-import org.drools.process.command.CompleteWorkItemCommand;
import org.drools.process.command.GetProcessInstanceCommand;
import org.drools.process.command.StartProcessCommand;
import org.drools.rule.Package;
import org.drools.runtime.process.ProcessInstance;
-import org.drools.runtime.process.WorkItem;
-import com.opensymphony.workflow.Workflow;
-
public class OSWorkFlowPersistenceTestCase extends TestCase {
private EntityManagerFactory emf;
@@ -61,7 +56,14 @@
processInstance = (ProcessInstance) service.execute(getProcessInstanceCommand);
assertNotNull(processInstance);
-// service = new SingleSessionCommandService(ruleBase);
+
+
+ service = new SingleSessionCommandService(ruleBase);
+ DoActionCommand doActionCmd = new DoActionCommand();
+ doActionCmd.setProcessInstanceId(processInstance.getId());
+ doActionCmd.setActionId(3); //Accion que quiero ejecutar sobre el step en el que estoy
+ service.execute(doActionCmd);
+
// CompleteWorkItemCommand completeWorkItemCommand = new CompleteWorkItemCommand();
// completeWorkItemCommand.setWorkItemId(workItem.getId());
// service.execute(completeWorkItemCommand);
Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java 2008-12-26 05:22:32 UTC (rev 24497)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java 2008-12-29 11:56:13 UTC (rev 24498)
@@ -28,7 +28,7 @@
public class Simple2ProcessTest extends TestCase {
public void testSimpleProcess() {
- Workflow workflow = new CompositeWorkflow();
+ Workflow workflow = new DroolsWorkflow();
DefaultConfiguration config = new DefaultConfiguration();
workflow.setConfiguration(config);
try {
More information about the jboss-svn-commits
mailing list