//
// Add test wgt file to POST
//
Part[] parts = { new FilePart(uploadFile.getName(), uploadFile) };
post.setRequestEntity(new MultipartRequestEntity(parts, post
.getParams()));
//
// POST the file to /widgets and check we get 201 (Created)
//
client.executeMethod(post);
int code = post.getStatusCode();
assertEquals(201,code);
post.releaseConnection();
//
// Now, upload a new widget, with the same filename
// We'll use the WARP widget
//
uploadFile = new File("src-tests/testdata/upload-policies-test.wgt");
assertTrue(uploadFile.exists());
File tempFolder = createTempDirectory();
File newFile = new File(tempFolder+File.separator+"upload-test.wgt");
FileUtils.copyFile(uploadFile, newFile);
assertTrue(newFile.exists());
System.out.println(newFile.getPath());
//
// Add test wgt file to POST
//
post = new PostMethod(TEST_WIDGETS_SERVICE_URL_VALID);
Part[] newParts = { new FilePart(newFile.getName(), newFile) };
post.setRequestEntity(new MultipartRequestEntity(newParts, post
.getParams()));
//
// POST the file to /widgets and check we get 201 (Created)
//