use of org.kie.api.runtime.process.CaseAssignment in project drools by kiegroup.
the class ProcessContextTest method testProcessContextGetAssignment.
@Test
public void testProcessContextGetAssignment() {
KieBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
KieSession ksession = kbase.newKieSession();
assertNotNull(ksession);
CaseInformation caseInfo = new CaseInformation();
caseInfo.assign("owner", new OrganizationalEntity() {
@Override
public String getId() {
return "testUser";
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
}
});
ksession.insert(caseInfo);
ProcessContext processContext = new ProcessContext(ksession);
CaseAssignment caseAssignment = processContext.getCaseAssignment();
assertNotNull(caseAssignment);
Collection<OrganizationalEntity> forRole = caseAssignment.getAssignments("owner");
assertNotNull(forRole);
assertEquals(1, forRole.size());
}
use of org.kie.api.runtime.process.CaseAssignment in project drools by kiegroup.
the class ProcessContextTest method testProcessContextGetDataAndAssignmentWithoutInsert.
@Test
public void testProcessContextGetDataAndAssignmentWithoutInsert() {
KieBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
KieSession ksession = kbase.newKieSession();
assertNotNull(ksession);
ProcessContext processContext = new ProcessContext(ksession);
CaseData caseData = processContext.getCaseData();
assertNull(caseData);
CaseAssignment caseAssignment = processContext.getCaseAssignment();
assertNull(caseAssignment);
}
Aggregations