use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleMailWorkitemHandlerTest method testSendEmailWithAttachment.
@Test
public void testSendEmailWithAttachment() throws Exception {
DocumentImpl attachmentDoc = new DocumentImpl();
attachmentDoc.setContent(new String("Attachment sources").getBytes());
attachmentDoc.setName("attachmentFileName.txt");
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("To", "someone@gmail.com");
workItem.setParameter("From", "me@gmail.com");
workItem.setParameter("Subject", "Hello!");
workItem.setParameter("BodyText", "Hello from me!");
workItem.setParameter("Attachment", attachmentDoc);
SendMailWorkitemHandler handler = new SendMailWorkitemHandler("myAppName", "{}");
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 DropboxWorkitemHandlerTest method testDownloadFile.
@Test
public void testDownloadFile() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("DocumentPath", "/testpath/testDocName.txt");
DownloadFileWorkitemHandler handler = new DownloadFileWorkitemHandler("testClientID", "{}");
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("testDocName.txt", downloadedDoc.getName());
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 DropboxWorkitemHandlerTest method testUploadFile.
@Test
public void testUploadFile() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("Path", "/testpath");
workItem.setParameter("Document", testDoc);
UploadFileWorkitemHandler handler = new UploadFileWorkitemHandler("testClientID", "{}");
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 EthereumWorkitemHandlerTest method testGetBalance.
@Test
public void testGetBalance() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("ServiceURL", "http://localhost:8545/");
GetBalanceWorkitemHandler handler = new GetBalanceWorkitemHandler(TEST_WALLET_PASSWORD, "wallet/testwallet.json");
handler.setWeb3j(web3j);
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("Balance") instanceof BigDecimal);
BigDecimal balanceResult = (BigDecimal) manager.getResults().get(workItem.getId()).get("Balance");
assertNotNull(balanceResult);
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class EthereumWorkitemHandlerTest method testTransactExistingContract.
@Test
public void testTransactExistingContract() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("ServiceURL", "http://localhost:8545/");
workItem.setParameter("ContractAddress", "0x00211e7e");
workItem.setParameter("MethodName", "testQuery");
workItem.setParameter("MethodInputType", null);
workItem.setParameter("WaitForReceipt", "false");
workItem.setParameter("DepositAmount", "10");
TransactExistingContractWorkitemHandler handler = new TransactExistingContractWorkitemHandler(TEST_WALLET_PASSWORD, "wallet/testwallet.json");
handler.setWeb3j(web3j);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
}
Aggregations