Java Code Examples for org.kie.internal.runtime.StatefulKnowledgeSession#setGlobal()

The following examples show how to use org.kie.internal.runtime.StatefulKnowledgeSession#setGlobal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EndEventTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testOnEntryExitScript() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-OnEntryExitScriptProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("MyTask",
            new SystemOutWorkItemHandler());
    List<String> myList = new ArrayList<String>();
    ksession.setGlobal("list", myList);
    ProcessInstance processInstance = ksession
            .startProcess("OnEntryExitScriptProcess");
    assertProcessInstanceCompleted(processInstance);
    assertEquals(4, myList.size());
    
}
 
Example 2
Source File: EndEventTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testOnEntryExitNamespacedScript() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-OnEntryExitNamespacedScriptProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("MyTask",
            new SystemOutWorkItemHandler());
    List<String> myList = new ArrayList<String>();
    ksession.setGlobal("list", myList);
    ProcessInstance processInstance = ksession
            .startProcess("OnEntryExitScriptProcess");
    assertProcessInstanceCompleted(processInstance);
    assertEquals(4, myList.size());
    
}
 
Example 3
Source File: EndEventTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testOnEntryExitMixedNamespacedScript() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-OnEntryExitMixedNamespacedScriptProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("MyTask",
            new SystemOutWorkItemHandler());
    List<String> myList = new ArrayList<String>();
    ksession.setGlobal("list", myList);
    ProcessInstance processInstance = ksession
            .startProcess("OnEntryExitScriptProcess");
    assertProcessInstanceCompleted(processInstance);
    assertEquals(4, myList.size());
    
}
 
Example 4
Source File: EndEventTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testOnEntryExitScriptDesigner() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-OnEntryExitDesignerScriptProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("MyTask",
            new SystemOutWorkItemHandler());
    List<String> myList = new ArrayList<String>();
    ksession.setGlobal("list", myList);
    ProcessInstance processInstance = ksession
            .startProcess("OnEntryExitScriptProcess");
    assertProcessInstanceCompleted(processInstance);
    assertEquals(4, myList.size());
    
}