use of org.kie.internal.task.api.UserGroupCallback in project jbpm by kiegroup.
the class HumanTaskResolver method getRuntimeManager.
private RuntimeManager getRuntimeManager(String process, int i) {
Properties properties = new Properties();
properties.setProperty("krisv", "");
properties.setProperty("sales-rep", "sales");
properties.setProperty("john", "PM");
KnowledgeBuilder knowledgeBuilder = createKBuilder(process, ResourceType.BPMN2);
KieBase kieBase = knowledgeBuilder.newKieBase();
UserGroupCallback userGroupCallback = new JBossUserGroupCallbackImpl(properties);
// load up the knowledge base
TimerServiceRegistry.getInstance();
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(userGroupCallback).persistence(true).entityManagerFactory(emf).knowledgeBase(kieBase).get();
return RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment, "id-" + i);
}
use of org.kie.internal.task.api.UserGroupCallback in project jbpm by kiegroup.
the class JaxbTaskSerializationTest method setTaskPropertyCommandTest.
@Test
public void setTaskPropertyCommandTest() throws Exception {
SetTaskPropertyCommand cmd;
int taskId = 1;
String userId = "user";
FaultDataImpl faultData = new FaultDataImpl();
faultData.setAccessType(AccessType.Inline);
faultData.setContent("skinned shins".getBytes());
faultData.setFaultName("Whoops!");
faultData.setType("skates");
List<I18NText> textList = new ArrayList<I18NText>();
I18NText text = new I18NTextImpl("nl-NL", "Stroopwafel!");
textList.add(text);
Object[][] testData = { { FAULT_PROPERTY, faultData }, { OUTPUT_PROPERTY, new Object() }, { PRIORITY_PROPERTY, 23 }, { TASK_NAMES_PROPERTY, textList }, { EXPIRATION_DATE_PROPERTY, new Date() }, { DESCRIPTION_PROPERTY, new ArrayList<I18NText>() }, { SKIPPABLE_PROPERTY, false }, { SUB_TASK_STRATEGY_PROPERTY, SubTasksStrategy.EndParentOnAllSubTasksEnd } };
TaskContext mockContext = mock(TaskContext.class);
TaskInstanceService mockTaskService = mock(TaskInstanceService.class);
UserGroupCallback mockUserGroupCallback = mock(UserGroupCallback.class);
when(mockContext.getTaskInstanceService()).thenReturn(mockTaskService);
when(mockContext.getUserGroupCallback()).thenReturn(mockUserGroupCallback);
when(mockUserGroupCallback.existsUser(anyString())).thenReturn(false);
for (Object[] data : testData) {
int property = (Integer) data[0];
cmd = new SetTaskPropertyCommand(taskId, userId, property, data[1]);
try {
cmd.execute(mockContext);
} catch (IllegalArgumentException e) {
// expected for fault and output
assertTrue(e.getMessage().startsWith("User user was not found in callback "));
}
}
}
Aggregations