Hi On 7/31/07, mperham <[EMAIL PROTECTED]> wrote: > > > 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); > } >
Sounds weird. I didn't actually test it with a binary file back when I did this. Can I get you to open an issue[1] and perhaps actually append a testcase patch for FormTesterTest[2], which shows that it fails? - Frank p.s. Please subscribe to our new user mailing list: [EMAIL PROTECTED] Or use the new list on nabble[3]. This list is being shut down. [1]: https://issues.apache.org/jira/browse/WICKET [2]: https://svn.apache.org/repos/asf/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/FormTesterTest.java [3]: http://www.nabble.com/Wicket---User-f25133.html ------------------------------------------------------------------------- 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