assertTrue(file.exists());
//
// Add test wgt file to POST
//
Part[] parts = { new FilePart(file.getName(), file) };
post.setRequestEntity(new MultipartRequestEntity(parts, post
.getParams()));
//
// POST the file to /widgets
//
client.executeMethod(post);
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(post.getResponseBodyAsStream());
String id = doc.getRootElement().getAttributeValue("id");
post.releaseConnection();
//
// Now we'll update it
//
PutMethod put = new PutMethod(TEST_WIDGETS_SERVICE_URL_VALID + encodeString("/" + id));
//
// Add test wgt file to PUT
//
Part[] updateparts = { new FilePart(file.getName(), file) };
put.setRequestEntity(new MultipartRequestEntity(updateparts, put
.getParams()));
//
// PUT the file to /widgets and check we get 200 (Updated)