Search in sources :

Example 1 with UploadFileResponse

use of org.apache.camel.component.bonita.api.model.UploadFileResponse in project camel by apache.

the class BonitaAPIUtilPrepareInputsTest method testPrepareInputsOneFile.

@Test
public void testPrepareInputsOneFile() throws Exception {
    Map<String, Serializable> rawInputs = new HashMap<String, Serializable>();
    FileInput file = new FileInput("filename", "String".getBytes());
    rawInputs.put("myVariable", 1);
    rawInputs.put("filename", file);
    BonitaAPIUtil bonitaApiUtilMod = Mockito.spy(bonitaApiUtil);
    UploadFileResponse uploadFileResponse = new UploadFileResponse();
    uploadFileResponse.setTempPath("temp");
    Mockito.doReturn(uploadFileResponse).when(bonitaApiUtilMod).uploadFile(Matchers.any(), Matchers.any());
    Map<String, Serializable> inputs = bonitaApiUtilMod.prepareInputs(processDefinition, rawInputs);
    assertEquals(rawInputs.size(), inputs.size());
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) FileInput(org.apache.camel.component.bonita.api.model.FileInput) UploadFileResponse(org.apache.camel.component.bonita.api.model.UploadFileResponse) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with UploadFileResponse

use of org.apache.camel.component.bonita.api.model.UploadFileResponse in project camel by apache.

the class BonitaAPIUtilPrepareInputsTest method testPrepareInputsFileType.

@Test
public void testPrepareInputsFileType() throws Exception {
    Map<String, Serializable> rawInputs = new HashMap<String, Serializable>();
    FileInput file = new FileInput("filename", "String".getBytes());
    rawInputs.put("filename", file);
    BonitaAPIUtil bonitaApiUtilMod = Mockito.spy(bonitaApiUtil);
    UploadFileResponse uploadFileResponse = new UploadFileResponse();
    uploadFileResponse.setTempPath("temp");
    Mockito.doReturn(uploadFileResponse).when(bonitaApiUtilMod).uploadFile(Matchers.any(), Matchers.any());
    Map<String, Serializable> inputs = bonitaApiUtilMod.prepareInputs(processDefinition, rawInputs);
    assertTrue(Map.class.isInstance(inputs.get("filename")));
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) FileInput(org.apache.camel.component.bonita.api.model.FileInput) UploadFileResponse(org.apache.camel.component.bonita.api.model.UploadFileResponse) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with UploadFileResponse

use of org.apache.camel.component.bonita.api.model.UploadFileResponse in project camel by apache.

the class BonitaAPIUtilPrepareInputsTest method testPrepareInputsTempFilePath.

@Test
public void testPrepareInputsTempFilePath() throws Exception {
    Map<String, Serializable> rawInputs = new HashMap<String, Serializable>();
    FileInput file = new FileInput("filename", "String".getBytes());
    rawInputs.put("filename", file);
    BonitaAPIUtil bonitaApiUtilMod = Mockito.spy(bonitaApiUtil);
    UploadFileResponse uploadFileResponse = new UploadFileResponse();
    uploadFileResponse.setTempPath("temp");
    Mockito.doReturn(uploadFileResponse).when(bonitaApiUtilMod).uploadFile(Matchers.any(), Matchers.any());
    Map<String, Serializable> inputs = bonitaApiUtilMod.prepareInputs(processDefinition, rawInputs);
    Map<String, Serializable> fileMap = (Map<String, Serializable>) inputs.get("filename");
    assertEquals("temp", fileMap.get("tempPath"));
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) FileInput(org.apache.camel.component.bonita.api.model.FileInput) UploadFileResponse(org.apache.camel.component.bonita.api.model.UploadFileResponse) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

Serializable (java.io.Serializable)3 HashMap (java.util.HashMap)3 FileInput (org.apache.camel.component.bonita.api.model.FileInput)3 UploadFileResponse (org.apache.camel.component.bonita.api.model.UploadFileResponse)3 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 Map (java.util.Map)2