Hi,I want to write a unittest (junit) for testing a webscript that uploads a file (alfresco 3.4.7 enterprise). I use the BaseWebScriptTest as in the documentation. I don't know how i can upload the file with the PostRequest. Is it even possible to do this? It would be nice if we could just use the methods from httpclient to compose our requests for the tests (ex. org.apache.commons.httpclient.methods.PostMethod)Now i'm getting the next excepiton : Caused by: org.alfresco.scripts.ScriptException: 01020002 Failed to execute script 'classpath*:alfresco/extension/templates/webscripts/com/amplexor/dsd/process.post.js': 01020001 ReferenceError: "formdata" is not defined. (file:/home/bart/workspace/dsd/alfresco/target/classes/alfresco/extension/templates/webscripts/com/amplexor/dsd/process.post.js#4)
// start class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:system-test-context.xml")
public class UploadWebscriptTest extends BaseWebScriptTest{
// test code
PostRequest post = new PostRequest("/dsd/sd/process", FileUtils.readFileToByteArray(f), "application/octet-stream");
Map<String, String> map = new HashMap<String, String>();
map.put("Content-Disposition", "form-data; name=\"file\"; filename=\"dsd\"");
map.put("Content-Transfer-Encoding", "binary");
post.setHeaders(map);
post.setEncoding("multipart/form-data");
sendRequest(post, 200);
grtz,Bart