Search in sources :

Example 1 with SendEtherWorkitemHandler

use of org.jbpm.process.workitem.ethereum.SendEtherWorkitemHandler 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);
}
Also used : TestWorkItemManager(org.jbpm.process.workitem.core.TestWorkItemManager) WorkItemImpl(org.drools.core.process.instance.impl.WorkItemImpl) TransactionReceipt(org.web3j.protocol.core.methods.response.TransactionReceipt) EthGetTransactionReceipt(org.web3j.protocol.core.methods.response.EthGetTransactionReceipt) SendEtherWorkitemHandler(org.jbpm.process.workitem.ethereum.SendEtherWorkitemHandler) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

WorkItemImpl (org.drools.core.process.instance.impl.WorkItemImpl)1 TestWorkItemManager (org.jbpm.process.workitem.core.TestWorkItemManager)1 SendEtherWorkitemHandler (org.jbpm.process.workitem.ethereum.SendEtherWorkitemHandler)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 EthGetTransactionReceipt (org.web3j.protocol.core.methods.response.EthGetTransactionReceipt)1 TransactionReceipt (org.web3j.protocol.core.methods.response.TransactionReceipt)1