use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class TwitterWorkitemHandlerTest method testUpdateStatus.
@Test
public void testUpdateStatus() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("StatusUpdate", "testUpdateStatus");
UpdateStatusWorkitemHandler handler = new UpdateStatusWorkitemHandler("testConsumerKey", "testConsumerSecret", "testAccessKey", "testAccessSecret");
handler.setAuth(auth);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
StatusUpdate handlerStatusUpdate = handler.getStatusUpdate();
assertNotNull(handlerStatusUpdate);
assertEquals("testUpdateStatus", handlerStatusUpdate.getStatus());
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class TwitterWorkitemHandlerTest method testSendDirectMessage.
@Test
public void testSendDirectMessage() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("Message", "hello there");
workItem.setParameter("ScreenName", "testScreenName");
SendDirectMessageWorkitemHandler handler = new SendDirectMessageWorkitemHandler("testConsumerKey", "testConsumerSecret", "testAccessKey", "testAccessSecret");
handler.setAuth(auth);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleDriveWorkitemHandlerTest method testDownload.
@Test
public void testDownload() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("DocumentPath", "/some/download/path/testdoc.txt");
MediaDownloadWorkitemHandler handler = new MediaDownloadWorkitemHandler("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("Document") instanceof Document);
Document downloadedDoc = (Document) manager.getResults().get(workItem.getId()).get("Document");
assertNotNull(downloadedDoc);
assertEquals("testdoc.txt", downloadedDoc.getName());
assertEquals("/some/download/path/testdoc.txt", downloadedDoc.getIdentifier());
assertEquals("test doc content", new String(downloadedDoc.getContent()));
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleSheetsWorkitemHandlerTest method testReadSheetValues.
@Test
public void testReadSheetValues() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("SheetId", "testSheetId");
workItem.setParameter("Range", "Class Data!A2:E");
ReadSheetValuesWorkitemHandler handler = new ReadSheetValuesWorkitemHandler("testAppName", "{}");
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("SheetValues") instanceof List);
List<List<Object>> returnValues = (List<List<Object>>) (manager.getResults().get(workItem.getId())).get("SheetValues");
assertNotNull(returnValues);
assertEquals("testValueOne", returnValues.get(0).get(0));
assertEquals("testValueTwo", returnValues.get(0).get(1));
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class EthereumWorkitemHandlerTest method testObserveContractUpdates.
@Test
public void testObserveContractUpdates() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("ServiceURL", "http://localhost:8545/");
workItem.setParameter("ContractAddress", "0x00211e7e");
workItem.setParameter("EventName", "AmountUpdatedEvent");
workItem.setParameter("EventReturnType", "int256");
workItem.setParameter("SignalName", "mysignal");
workItem.setParameter("AbortOnUpdate", "true");
ObserveContractEventWorkitemHandler handler = new ObserveContractEventWorkitemHandler(kieSession);
handler.setWeb3j(web3j);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
}
Aggregations