[jbpm-commits] JBoss JBPM SVN: r2432 - in jbpm3/trunk/modules/examples/src/test: java/org/jbpm/examples/rulesaction and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Sep 29 06:23:49 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-09-29 06:23:49 -0400 (Mon, 29 Sep 2008)
New Revision: 2432

Added:
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java
Removed:
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java
   jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java
Modified:
   jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl
   jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml
Log:
[JBPM-1748] Fix examples/rulesaction

Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction (from rev 2423, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction)

Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Customer.java	2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */ 
-package org.jbpm.examples.rulesAction;
-
-import java.io.Serializable;
-
-
-public class Customer
-     implements Serializable
-{
-	long    id;
-
-	String 	name;
-    Integer region;
-    Integer age;
-    Long    income;
-
-    public Customer() {
-    }
-    
-    public Customer(String name, Integer region, Integer age, Long income) {
-    	setName(name);
-    	setRegion(region);
-    	setAge(age);
-    	setIncome(income);
-    }
-
-    public String getName() {
-        return name;
-    }
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Integer getRegion() {
-        return region;
-    }
-    public void setRegion(Integer region) {
-        this.region = region;
-    }
- 
-    public Integer getAge() {
-        return age;
-    }
-    public void setAge(Integer age) {
-        this.age = age;
-    }
-
-    public Long getIncome() {
-        return income;
-    }
-    public void setIncome(Long income) {
-        this.income = income;
-    }
-
-}

Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Customer.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java	                        (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */ 
+package org.jbpm.examples.rulesaction;
+
+import java.io.Serializable;
+
+
+public class Customer
+     implements Serializable
+{
+	long    id;
+
+	String 	name;
+    Integer region;
+    Integer age;
+    Long    income;
+
+    public Customer() {
+    }
+    
+    public Customer(String name, Integer region, Integer age, Long income) {
+    	setName(name);
+    	setRegion(region);
+    	setAge(age);
+    	setIncome(income);
+    }
+
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getRegion() {
+        return region;
+    }
+    public void setRegion(Integer region) {
+        this.region = region;
+    }
+ 
+    public Integer getAge() {
+        return age;
+    }
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    public Long getIncome() {
+        return income;
+    }
+    public void setIncome(Long income) {
+        this.income = income;
+    }
+
+}

Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Order.java	2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */ 
-package org.jbpm.examples.rulesAction;
-
-import java.io.Serializable;
-
-
-public class Order
-    implements Serializable
-{
-    long    id;
-
-    Long totalAmount;
-    
-	private static final long serialVersionUID = 1L;
-
- 
-    public Order() {
-    	
-    }
-    
-    public Order(long totalAmount) {
-
-    	setTotalAmount(new Long(totalAmount));
-    }
-    public long getId() {
-        return id;
-    }                    
-    public void setId(long id) {
-        this.id = id;
-    }     
-
-    public Long getTotalAmount() {
-        return totalAmount;
-    }
-    public void setTotalAmount(Long totalAmount) {
-        this.totalAmount = totalAmount;
-    }
-
-
-}

Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Order.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java	                        (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */ 
+package org.jbpm.examples.rulesaction;
+
+import java.io.Serializable;
+
+
+public class Order
+    implements Serializable
+{
+    long    id;
+
+    Long totalAmount;
+    
+	private static final long serialVersionUID = 1L;
+
+ 
+    public Order() {
+    	
+    }
+    
+    public Order(long totalAmount) {
+
+    	setTotalAmount(new Long(totalAmount));
+    }
+    public long getId() {
+        return id;
+    }                    
+    public void setId(long id) {
+        this.id = id;
+    }     
+
+    public Long getTotalAmount() {
+        return totalAmount;
+    }
+    public void setTotalAmount(Long totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+
+}

Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionHandler.java	2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,94 +0,0 @@
-package org.jbpm.examples.rulesAction;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.PackageIntegrationException;
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.RuleIntegrationException;
-import org.drools.WorkingMemory;
-import org.drools.compiler.DroolsParserException;
-import org.drools.compiler.PackageBuilder;
-import org.drools.rule.InvalidPatternException;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-
-public class RulesActionHandler implements ActionHandler {
-
-  private static final long serialVersionUID = 1L;
-
-  public List objectNames;
-
-  public String ruleFile;
-
-  public List queryStrings;
-
-  /**
-   * The RulesActionHandler gets variables from the ContextInstance, and asserts
-   * them into the Rules Engine and invokes the rules.
-   */
-  public void execute(ExecutionContext executionContext) throws Exception {
-
-    // load up the rulebase
-    RuleBase ruleBase = readRule(ruleFile);
-    WorkingMemory workingMemory = ruleBase.newWorkingMemory();
-
-    // final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(
-    // workingMemory );
-    // logger.setFileName( "jpdl/examples/rulesActionHandler/log/rulesAction" );
-
-    // load the data
-    System.out.println(objectNames.toString());
-
-    // get an iterator of fully qualified object names
-    Iterator iter = objectNames.iterator();
-    String objectName = "";
-    ContextInstance ci = executionContext.getContextInstance();
-
-    while (iter.hasNext()) {
-      objectName = (String) iter.next();
-
-      // assume the objects are stored as process variables
-      // workingMemory.assertObject(ci.getVariable(objectName));
-      Object object = ci.getVariable(objectName);
-      workingMemory.assertObject(object);
-
-      // alternately the objects could be returned with a query
-      // to Hibernate or an EJB3 entity manager
-
-    }
-
-    // now assert the context instance as a global, so that the rules
-    // can update the process, and fire the rules
-    workingMemory.setGlobal("ci", ci);
-
-    workingMemory.fireAllRules();
-
-    workingMemory.dispose();
-
-    // logger.writeToDisk();
-
-    // propagate the token so that the process continues
-    executionContext.getToken().signal();
-
-  }
-
-  /**
-   * Please note that this is the "low level" rule assembly API.
-   */
-  private static RuleBase readRule(String ruleFileName) throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException,
-      InvalidPatternException, Exception {
-
-    PackageBuilder builder = new PackageBuilder();
-    builder.addPackageFromDrl(new InputStreamReader(RulesActionHandler.class.getResourceAsStream(ruleFileName)));
-
-    RuleBase ruleBase = RuleBaseFactory.newRuleBase();
-    ruleBase.addPackage(builder.getPackage());
-    return ruleBase;
-  }
-
-}

Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionHandler.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java	                        (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,94 @@
+package org.jbpm.examples.rulesaction;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.PackageIntegrationException;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.RuleIntegrationException;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.InvalidPatternException;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+public class RulesActionHandler implements ActionHandler
+{
+
+  private static final long serialVersionUID = 1L;
+
+  public List objectNames;
+
+  public String ruleFile;
+
+  public List queryStrings;
+
+  /**
+   * The RulesActionHandler gets variables from the ContextInstance, and asserts them into the Rules Engine and invokes the rules.
+   */
+  public void execute(ExecutionContext executionContext) throws Exception
+  {
+
+    // load up the rulebase
+    RuleBase ruleBase = readRule(ruleFile);
+    WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+    // final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(
+    // workingMemory );
+    // logger.setFileName( "jpdl/examples/rulesActionHandler/log/rulesAction" );
+
+    // get an iterator of fully qualified object names
+    Iterator iter = objectNames.iterator();
+    String objectName = "";
+    ContextInstance ci = executionContext.getContextInstance();
+
+    while (iter.hasNext())
+    {
+      objectName = (String)iter.next();
+
+      // assume the objects are stored as process variables
+      // workingMemory.assertObject(ci.getVariable(objectName));
+      Object object = ci.getVariable(objectName);
+      workingMemory.insert(object);
+
+      // alternately the objects could be returned with a query
+      // to Hibernate or an EJB3 entity manager
+
+    }
+
+    // now assert the context instance as a global, so that the rules
+    // can update the process, and fire the rules
+    workingMemory.setGlobal("ci", ci);
+
+    workingMemory.fireAllRules();
+
+    workingMemory.clearAgenda();
+
+    // logger.writeToDisk();
+
+    // propagate the token so that the process continues
+    executionContext.getToken().signal();
+
+  }
+
+  /**
+   * Please note that this is the "low level" rule assembly API.
+   */
+  private static RuleBase readRule(String ruleFileName) throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException,
+      InvalidPatternException, Exception
+  {
+
+    PackageBuilder builder = new PackageBuilder();
+    builder.addPackageFromDrl(new InputStreamReader(RulesActionHandler.class.getResourceAsStream(ruleFileName)));
+
+    RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+    ruleBase.addPackage(builder.getPackage());
+    return ruleBase;
+  }
+
+}

Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionTest.java	2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,118 +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.examples.rulesAction;
-
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.persistence.db.DbPersistenceServiceFactory;
-import org.jbpm.svc.Services;
-import org.jbpm.graph.exe.Token;
-
-/**
- * This example shows how to invoke JBoss Drools from an ActionHandler.
- */
-public class RulesActionTest extends TestCase {
-
-	JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
-
-	DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration
-			.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
-
-	JbpmContext jbpmContext;
-	long processInstanceId;
-
-	public void setUp() {
-		dbPersistenceServiceFactory.createSchema();
-		deployProcess();
-		jbpmContext = jbpmConfiguration.createJbpmContext();
-	}
-
-	public void tearDown() {
-		jbpmContext.close();
-		dbPersistenceServiceFactory.dropSchema();
-		jbpmContext = null;
-	}
-
-	public void newTransaction() {
-		jbpmContext.close();
-		jbpmContext = jbpmConfiguration.createJbpmContext();
-	}
-
-	public void deployProcess() {
-		JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-		try {
-			ProcessDefinition processDefinition = ProcessDefinition
-					.parseXmlResource("RulesAction/processdefinition.xml");
-			jbpmContext.deployProcessDefinition(processDefinition);
-		} finally {
-			jbpmContext.close();
-		}
-	}
-
-
-	public void testRulesAssignment() {
-		// start process
-		newTransaction();
-		processInstanceId = createNewProcessInstance();
-		assertNotNull(processInstanceId);
-
-		newTransaction();
-		ProcessInstance processInstance = getProcessInstance(processInstanceId);
-		
-		assertNotNull(processInstance);
-		
-		Date processEnd = processInstance.getEnd();
-		assertNotNull(processEnd);
-		String shipper = (String) processInstance.getContextInstance().getVariable("shipper"); 
-		assertEquals("shipper is FEDX", shipper, "FEDX");
-
-	}
-
-	public long createNewProcessInstance() {
-		String processDefinitionName = "RulesAction";
-		ProcessInstance processInstance = jbpmContext
-				.newProcessInstanceForUpdate(processDefinitionName);
-		long id = processInstance.getId();
-		ContextInstance contextInstance = processInstance.getContextInstance();
-		contextInstance.setVariable("processDefinitionName",
-				processDefinitionName);
-		Order order = new Order(300);
-		Customer customer = new Customer("Fred", new Integer(5), new Integer(25), new Long (100000));
-		contextInstance.setVariable("order", order);
-		contextInstance.setVariable("customer", customer);
-		Token token = processInstance.getRootToken();
-		token.signal();
-		return id;
-	}
-
-	public ProcessInstance getProcessInstance(long processInstanceId) {
-		ProcessInstance processInstance = (ProcessInstance) jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
-		return processInstance;
-	}
-}

Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionTest.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java	                        (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java	2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,124 @@
+/*
+ * 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.examples.rulesaction;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.svc.Services;
+import org.jbpm.graph.exe.Token;
+
+/**
+ * This example shows how to invoke JBoss Drools from an ActionHandler.
+ */
+public class RulesActionTest extends TestCase
+{
+
+  JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+
+  DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+
+  JbpmContext jbpmContext;
+  long processInstanceId;
+
+  public void setUp()
+  {
+    dbPersistenceServiceFactory.createSchema();
+    deployProcess();
+    jbpmContext = jbpmConfiguration.createJbpmContext();
+  }
+
+  public void tearDown()
+  {
+    jbpmContext.close();
+    dbPersistenceServiceFactory.dropSchema();
+    jbpmContext = null;
+  }
+
+  public void newTransaction()
+  {
+    jbpmContext.close();
+    jbpmContext = jbpmConfiguration.createJbpmContext();
+  }
+
+  public void deployProcess()
+  {
+    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+    try
+    {
+      ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("rulesaction/processdefinition.xml");
+      jbpmContext.deployProcessDefinition(processDefinition);
+    }
+    finally
+    {
+      jbpmContext.close();
+    }
+  }
+
+  public void testRulesAssignment()
+  {
+    // start process
+    newTransaction();
+    processInstanceId = createNewProcessInstance();
+    assertNotNull(processInstanceId);
+
+    newTransaction();
+    ProcessInstance processInstance = getProcessInstance(processInstanceId);
+
+    assertNotNull(processInstance);
+
+    Date processEnd = processInstance.getEnd();
+    assertNotNull(processEnd);
+    String shipper = (String)processInstance.getContextInstance().getVariable("shipper");
+    assertEquals("shipper is FEDX", shipper, "FEDX");
+
+  }
+
+  public long createNewProcessInstance()
+  {
+    String processDefinitionName = "RulesAction";
+    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(processDefinitionName);
+    long id = processInstance.getId();
+    ContextInstance contextInstance = processInstance.getContextInstance();
+    contextInstance.setVariable("processDefinitionName", processDefinitionName);
+    Order order = new Order(300);
+    Customer customer = new Customer("Fred", new Integer(5), new Integer(25), new Long(100000));
+    contextInstance.setVariable("order", order);
+    contextInstance.setVariable("customer", customer);
+    Token token = processInstance.getRootToken();
+    token.signal();
+    return id;
+  }
+
+  public ProcessInstance getProcessInstance(long processInstanceId)
+  {
+    ProcessInstance processInstance = (ProcessInstance)jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
+    return processInstance;
+  }
+}

Modified: jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl	2008-09-29 10:17:43 UTC (rev 2431)
+++ jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl	2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,7 +1,7 @@
 package org.jbpm.action
  
-import org.jbpm.action.Customer;
-import org.jbpm.action.Order;
+import org.jbpm.examples.rulesaction.Customer;
+import org.jbpm.examples.rulesaction.Order;
 import org.jbpm.context.exe.ContextInstance;
 
 global ContextInstance ci
@@ -10,9 +10,6 @@
 	when
 		Customer( region >= 1 )
 		Order( totalAmount >= 0 )
-		
 	then
 		ci.setVariable("shipper", "FEDX"); 
-		System.out.println("ship via FEDX " );
-		
 end
\ No newline at end of file

Modified: jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml	2008-09-29 10:17:43 UTC (rev 2431)
+++ jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml	2008-09-29 10:23:49 UTC (rev 2432)
@@ -3,12 +3,12 @@
 <process-definition
   xmlns="urn:jbpm.org:jpdl-3.2"  name="RulesAction">
    <node name="Ship Product">
-   		<action name="Execute Shipping Rules" class="org.jbpm.action.RulesActionHandler">
+   		<action name="Execute Shipping Rules" class="org.jbpm.examples.rulesaction.RulesActionHandler">
            				<objectNames>
 							<element>order</element>
 							<element>customer</element>
 						</objectNames>
-           <ruleFile>/Shipper.drl</ruleFile>
+           <ruleFile>/rulesaction/Shipper.drl</ruleFile>
         </action>
         <transition name="" to="end1"></transition>
    </node>




More information about the jbpm-commits mailing list