use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm by kiegroup.
the class RestWorkitemHandlerClientCreationTest method testSingleClientCreationOnMultipleCalls.
@Test
public void testSingleClientCreationOnMultipleCalls() {
RESTWorkItemHandler handler = spy(RESTWorkItemHandler.class);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("Url", serverURL);
workItem.setParameter("Method", "GET");
workItem.setParameter("ConnectTimeout", "4000");
workItem.setParameter("ReadTimeout", "3000");
WorkItemManager manager = new TestWorkItemManager();
handler.executeWorkItem(workItem, manager);
workItem.setParameter("ConnectTimeout", "5000");
workItem.setParameter("ReadTimeout", "4000");
// second call to executeWorkItem
handler.executeWorkItem(workItem, manager);
verify(handler, times(2)).getHttpClient(anyInt(), anyInt());
verify(handler, times(0)).getNewPooledHttpClient(anyInt(), anyInt());
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleCalendarWorkitemHandlerTest method testGetCalendarsHandler.
@Test
public void testGetCalendarsHandler() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
GetCalendarsWorkitemHandler handler = new GetCalendarsWorkitemHandler("myAppName", "{}");
handler.setAuth(auth);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
assertTrue((manager.getResults().get(workItem.getId())).get("AllCalendars") instanceof com.google.api.services.calendar.model.CalendarList);
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleCalendarWorkitemHandlerTest method testAddCalendarHandler.
@Test
public void testAddCalendarHandler() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("CalendarSummary", "mycalendarsummary");
AddCalendarWorkitemHandler handler = new AddCalendarWorkitemHandler("myAppName", "{}");
handler.setAuth(auth);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
assertTrue((manager.getResults().get(workItem.getId())).get("Calendar") instanceof com.google.api.services.calendar.model.Calendar);
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleCalendarWorkitemHandlerTest method testGetEventsHandler.
@Test
public void testGetEventsHandler() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("CalendarSummary", "mycalendarsummary");
GetEventsWorkitemHandler handler = new GetEventsWorkitemHandler("myAppName", "{}");
handler.setAuth(auth);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
assertTrue((manager.getResults().get(workItem.getId())).get("AllEvents") instanceof com.google.api.services.calendar.model.Events);
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleDriveWorkitemHandlerTest method testUpload.
@Test
public void testUpload() throws Exception {
DocumentImpl testUploadDoc = new DocumentImpl();
testUploadDoc.setContent(new String("Test file to upload").getBytes());
testUploadDoc.setName("testFileToUpload.txt");
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("DocToUpload", testUploadDoc);
workItem.setParameter("DocMimeType", "text/plain");
workItem.setParameter("UploadPath", "/some/upload/path");
MediaUploadWorkitemHandler handler = new MediaUploadWorkitemHandler("myAppName", "{}");
handler.setAuth(auth);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
}
Aggregations