KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > db > ContextSessionDbTest


1 package org.jbpm.db;
2
3
4 public class ContextSessionDbTest extends AbstractDbTestCase {
5
6   public void testOne() {
7     /*
8     ProcessDefinition processDefinition = new ProcessDefinition();
9     processDefinition.addDefinition(new ContextDefinition());
10     graphSession.saveProcessDefinition(processDefinition);
11     
12     ProcessInstance processInstance = new ProcessInstance(processDefinition);
13     ContextInstance contextInstance = processInstance.getContextInstance();
14     contextInstance.setVariable("a", new Integer(5));
15     graphSession.saveProcessInstance(processInstance);
16     
17     newTransaction();
18     
19     Map variables = new HashMap();
20     variables.put("a", new Integer(5));
21     
22     List tokens = findTokensByVariables(variables);
23     assertEquals(1, tokens.size());
24     */

25   }
26 /*
27   private List findTokensByVariables(Map variables) {
28     
29     // create the variable instances
30     Map variableInstances = new HashMap();
31     Iterator iter = variables.keySet().iterator();
32     while (iter.hasNext()) {
33       String variableName = (String) iter.next();
34       Object value = variables.get(variableName);
35       VariableInstance variableInstance = VariableInstance.createVariableInstance(value.getClass(), jbpmSession);
36       variableInstance.setValue(value);
37       variableInstances.put(variableName, variableInstance);
38     }
39
40     // build the from clause
41     String query = "select t \n"+
42                    "from org.jbpm.graph.exe.Token as t";
43     
44     iter = variables.keySet().iterator();
45     int i = 0;
46     while (iter.hasNext()) {
47       VariableInstance variableInstance = (VariableInstance) variableInstances.get(iter.next());
48       String alias = "vi_"+i;
49       query += ",\n "+variableInstance.getClass().getName()+" as "+alias;
50       i++;
51     }
52     
53     // build the where clause
54
55     // set the variables
56
57     return null;
58   }
59 */

60 }
61
62   
Popular Tags