* This tests the retrieval operation using a GET request
*/
public void testRetrieve() throws Exception {
ServletRunner runner = new ServletRunner(createDefaultWebXML());
ServletUnitClient client = runner.newClient();
WebRequest request = createPostRequest(VALID_TEST_XML, READER_TEST_URL);
WebResponse response = client.getResponse(request);
String id = response.getHeaderField(
MessageStoreServlet.MESSAGE_RESPONSE_HEADER_NAME);
// Check the ID has been returned OK
assertNotNull("ID should exist in the headers", id);
// Use a fake servlet class to avoid the need to initialise and run
// an entire MCS session.
request = new GetMethodWebRequest(PARTIAL_TEST_URL);
request.setHeaderField("User-Agent", "Mozilla/5.0 Firefox...");
request.setParameter(MessageStoreServlet.MESSAGE_RETRIEVE_PARAM_NAME,
id);
client = runner.newClient();
response = client.getResponse(request);
assertEquals("The response code should indicate success",
MessageStoreMessageEnumeration.SUCCESS.getValue(),
response.getResponseCode());
String message = response.getText();
assertEquals("The response XML should match the supplied",