I'm trying to unit test a page that accepts a binary upload.  I've got a unit
test which works fine for a page that accepts an XML (i.e. text) file but
the binary data seems to cause problems.  Does anyone have an example of how
to upload binary data?  FYI, here's the XML upload method that works fine:

    public void testUpload() throws URISyntaxException {
        // Upload a tiny changelist which contains a single ApplicationSuite
object
        int before =
getClient().getApplicationSuiteAdmin().getAllApplicationSuites().size();
        
        FormTester form = tester.newFormTester("theForm");
        File file = new File(new
URI(getClass().getResource("simple-change.xml").toString()));
        tester.getServletRequest().addFile("fileUpload", file, "text/xml;
charset=utf-8");
        form.submit("submitButton");
        tester.assertRenderedPage(SearchChanges.class);
        tester.assertNoErrorMessage();

        // verify the change was NOT published to the repository
        int after =
getClient().getApplicationSuiteAdmin().getAllApplicationSuites().size();
        assertEquals(before, after);
    }

-- 
View this message in context: 
http://www.nabble.com/Uploading-binary-files-via-MockHttpServletRequest-tf4192893.html#a11923796
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user 
list. Send a message to: "users-subscribe at wicket.apache.org" and follow the 
instructions.
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to