use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class EthereumWorkitemHandlerTest method testQueryExistingContract.
@Test
public void testQueryExistingContract() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("ServiceURL", "http://localhost:8545/");
workItem.setParameter("ContractAddress", "0x00211e7e");
workItem.setParameter("ContractMethodName", "testQuery");
workItem.setParameter("MethodOutputType", null);
QueryExistingContractWorkitemHandler handler = new QueryExistingContractWorkitemHandler(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()));
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class EthereumWorkitemHandlerTest method testSendEther.
@Test
public void testSendEther() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("ServiceURL", "http://localhost:8545/");
workItem.setParameter("Amount", "10");
workItem.setParameter("ToAddress", "0x00211e7e");
SendEtherWorkitemHandler handler = new SendEtherWorkitemHandler(TEST_WALLET_PASSWORD, "wallet/testwallet.json");
handler.setWeb3j(web3j);
handler.setTransfer(transfer);
handler.executeWorkItem(workItem, manager);
assertNotNull(manager.getResults());
assertEquals(1, manager.getResults().size());
assertTrue(manager.getResults().containsKey(workItem.getId()));
TransactionReceipt receipt = (TransactionReceipt) manager.getResults().get(workItem.getId()).get("Receipt");
assertNotNull(receipt);
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class GoogleCalendarWorkitemHandlerTest method testAddEventHandler.
@Test
public void testAddEventHandler() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("CalendarSummary", "mycalendarsummary");
workItem.setParameter("EventSummary", "myeventsummary");
workItem.setParameter("EventStart", "Tue, 6 Aug 2017 01:19:39 +0530");
workItem.setParameter("EventEnd", "Tue, 6 Aug 2017 06:19:39 +0530");
workItem.setParameter("EventAttendees", "myeventattendees");
workItem.setParameter("EventCreator", "myeventcreator");
AddEventWorkitemHandler handler = new AddEventWorkitemHandler("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("Event") instanceof com.google.api.services.calendar.model.Event);
}
use of org.jbpm.process.workitem.core.TestWorkItemManager in project jbpm-work-items by kiegroup.
the class FTPUploadWorkItemHandlerTest method testFTPUpload.
@Test
public void testFTPUpload() throws Exception {
doNothing().when(client).connect("abc", 123);
when(client.getReplyCode()).thenReturn(200);
when(client.login(anyString(), anyString())).thenReturn(true);
when(client.setFileType(anyInt())).thenReturn(true);
when(client.storeFile(anyString(), anyObject())).thenReturn(true);
when(client.logout()).thenReturn(true);
when(connection.getHost()).thenReturn("abc");
when(connection.getPort()).thenReturn("123");
File tempFile = tempFolder.newFile("tempFile1.txt");
FileUtils.writeStringToFile(tempFile, "temp file content", "UTF-8");
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setId(123L);
workItem.setParameter("File", tempFile);
workItem.setParameter("User", "someuser");
workItem.setParameter("Password", "somepassword");
FTPUploadWorkItemHandler handler = new FTPUploadWorkItemHandler();
handler.setLogThrownException(true);
handler.setFTPClient(client);
handler.setConnection(connection);
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 GithubWorkitemHandlerTest method testListRepositories.
@Test
public void testListRepositories() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter("User", "testUser");
ListRepositoriesWorkitemHandler handler = new ListRepositoriesWorkitemHandler("testusername", "testpassword");
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("RepoListInfo") instanceof List);
}
Aggregations