Search in sources :

Example 16 with DocumentImpl

use of org.jbpm.document.service.impl.DocumentImpl in project jbpm-work-items by kiegroup.

the class TwitterWorkitemHandlerTest method testUpdateStatusWithMedia.

@Test
public void testUpdateStatusWithMedia() throws Exception {
    DocumentImpl testMediaDoc = new DocumentImpl();
    testMediaDoc.setContent(new String("Test media to send").getBytes());
    testMediaDoc.setName("testMediaToSend.txt");
    TestWorkItemManager manager = new TestWorkItemManager();
    WorkItemImpl workItem = new WorkItemImpl();
    workItem.setParameter("StatusUpdate", "testUpdateStatus");
    workItem.setParameter("Media", testMediaDoc);
    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());
}
Also used : StatusUpdate(twitter4j.StatusUpdate) TestWorkItemManager(org.jbpm.process.workitem.core.TestWorkItemManager) WorkItemImpl(org.drools.core.process.instance.impl.WorkItemImpl) Matchers.anyString(org.mockito.Matchers.anyString) DocumentImpl(org.jbpm.document.service.impl.DocumentImpl) AbstractBaseTest(org.jbpm.test.AbstractBaseTest) Test(org.junit.Test)

Aggregations

DocumentImpl (org.jbpm.document.service.impl.DocumentImpl)16 Date (java.util.Date)10 Test (org.junit.Test)10 Document (org.jbpm.document.Document)9 WorkItemImpl (org.drools.core.process.instance.impl.WorkItemImpl)6 TestWorkItemManager (org.jbpm.process.workitem.core.TestWorkItemManager)6 HashMap (java.util.HashMap)5 Matchers.anyString (org.mockito.Matchers.anyString)5 AbstractBaseTest (org.jbpm.test.AbstractBaseTest)4 InputStream (java.io.InputStream)3 DocumentData (org.kie.workbench.common.forms.dynamic.model.document.DocumentData)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)2 WriteMode (com.dropbox.core.v2.files.WriteMode)1 Drive (com.google.api.services.drive.Drive)1 File (java.io.File)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Map (java.util.Map)1