tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r547949 [2/2] - in /tapestry/tapestry5/trunk/tapestry-upload: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tapestry/ src/main/java/org/apache/tapestry/upload/ src/main/java/org/apach...
Date Sat, 16 Jun 2007 16:34:07 GMT
Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/data/upload.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/data/upload.txt?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/data/upload.txt (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/data/upload.txt Sat Jun 16 09:34:04 2007
@@ -0,0 +1,99 @@
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras at nisi. Nullam lobortis mi at dolor. Maecenas sit amet eros eu purus rhoncus suscipit. Quisque ipsum dolor, placerat eu, sagittis sed, viverra tristique, lectus. Nunc ultricies libero laoreet elit pharetra sodales. Praesent bibendum auctor odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nulla rhoncus facilisis diam. Mauris tincidunt consectetuer lectus. Curabitur fermentum sem sagittis magna. Suspendisse aliquet euismod sapien. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut pede nibh, congue non, laoreet fermentum, rutrum condimentum, ligula. Nulla lorem magna, semper vitae, pharetra vel, tempus ac, lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam semper ipsum non justo. Fusce placerat risus. Quisque nisi lectus, bibendum vel, tempus ac, hendrerit in, nunc. Int
 eger sed nunc.
+
+Donec ac est. Vivamus egestas consequat eros. Praesent vehicula quam nec est. Aenean id ante ac quam sodales molestie. Duis hendrerit tellus vitae nulla. Sed nulla lectus, faucibus eu, eleifend vel, consectetuer vel, nulla. Vestibulum gravida ornare magna. Duis nunc dolor, iaculis ut, dapibus in, tincidunt eu, felis. Nam et libero. Donec aliquam magna id mi. Duis congue ligula non tortor. Vivamus luctus turpis. Pellentesque tristique aliquam tortor. Pellentesque auctor ullamcorper metus. Integer convallis pharetra quam. Duis bibendum ornare purus. Vivamus condimentum justo at orci.
+
+Pellentesque in dolor id elit suscipit pulvinar. Duis venenatis elementum lorem. Cras fermentum tellus vel justo. Aliquam molestie nunc a dui. Curabitur enim lorem, sollicitudin ut, euismod ac, gravida sit amet, diam. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla tortor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Fusce porttitor, elit nec mattis fringilla, ligula risus faucibus urna, non lobortis risus ipsum eu urna. Ut risus nisl, consectetuer non, ullamcorper eu, euismod in, metus. Sed sem. Nulla lectus. Donec dolor arcu, tincidunt aliquam, sollicitudin eu, dapibus vel, tortor. Aenean arcu orci, tempor et, dictum ut, cursus ullamcorper, justo. Nulla molestie, nunc vitae facilisis laoreet, diam libero adipiscing nulla, sagittis dapibus lacus tortor non lacus. Etiam nonummy, est quis vulputate semper, mauris mauris scelerisque urna, eget venenatis enim risus a quam. Etiam vehicula lectus nec augue rutrum adip
 iscing. Donec suscipit quam commodo augue. Quisque scelerisque lorem ac turpis.
+
+Praesent ultricies, ipsum venenatis auctor gravida, enim nulla tempus urna, ac accumsan lacus diam id felis. Praesent vel nunc tincidunt pede placerat scelerisque. Donec justo. Sed nonummy. Donec rhoncus. Maecenas congue iaculis lorem. Morbi molestie risus vitae lacus. Nulla condimentum gravida dui. Nunc vestibulum, libero eget ultricies sagittis, dolor sem sollicitudin pede, vitae lobortis quam justo eget diam. Pellentesque neque ligula, interdum ut, cursus et, faucibus sit amet, nisi. Duis fermentum. Quisque odio. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Cras eget enim in ipsum facilisis sagittis. Donec pellentesque, orci vel pharetra luctus, neque orci laoreet sem, a pellentesque risus nibh vel velit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec nulla. Nulla luctus nonummy metus. Nam in arcu. Praesent ut augue at tellus scelerisque aliquam.
+
+Vivamus imperdiet molestie urna. Ut condimentum mauris vel risus. Donec dui leo, consequat in, luctus vitae, tristique sit amet, libero. Nunc pede. Nam et libero non erat laoreet tempus. Curabitur rhoncus pellentesque velit. Etiam condimentum ligula semper urna. Sed ipsum risus, ultrices vel, mattis nec, laoreet tristique, libero. Curabitur pretium venenatis pede. In vestibulum. Nunc in nulla nec elit laoreet iaculis. Proin scelerisque, eros eu auctor accumsan, ligula pede porttitor lorem, sed adipiscing mi nisl et lorem. Proin at erat.
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis varius. Duis vitae sem. Duis eu pede. Nulla vitae risus. Mauris molestie tellus quis ipsum. Cras facilisis vestibulum arcu. Cras at turpis eu odio lacinia cursus. Nulla a dolor. Cras vulputate urna eu mauris sodales porta. Quisque non metus. Suspendisse odio mi, ullamcorper vitae, lobortis in, lacinia eget, pede. Integer cursus leo nec ligula. Etiam ultricies massa eget lorem. Sed eget quam at eros gravida imperdiet. Phasellus libero. Aenean eros magna, luctus at, fringilla id, ultricies a, mauris. Sed non neque ac libero cursus luctus.
+
+Pellentesque dui ante, scelerisque vitae, luctus molestie, blandit sit amet, eros. Curabitur condimentum. Mauris eget leo a massa eleifend egestas. Proin neque quam, pellentesque eget, tempor at, rutrum sed, nunc. Vivamus hendrerit volutpat ipsum. Sed imperdiet pulvinar ligula. Aliquam mattis. Praesent aliquam molestie orci. Suspendisse nec lacus non mi consequat volutpat. Fusce felis. Phasellus ac elit. Aliquam erat volutpat. Vivamus tristique.
+
+Phasellus blandit. Integer tortor est, auctor non, hendrerit sit amet, aliquam dignissim, nibh. Aenean eleifend pede in metus pulvinar euismod. Morbi vitae nibh. Morbi sit amet sem et sapien condimentum adipiscing. Sed ligula nunc, molestie quis, elementum non, dapibus non, nulla. Suspendisse ultrices. Proin sed eros sit amet nisi auctor ornare. Nullam mattis. Sed vulputate. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin justo massa, dapibus non, rutrum at, eleifend vitae, metus. Maecenas porta varius mauris. Mauris mollis congue mi. Nunc sit amet ligula. Donec at est.
+
+Cras luctus sapien et arcu. Aenean purus erat, accumsan ac, placerat id, congue nec, urna. Proin lobortis tincidunt purus. Praesent tincidunt dui quis neque. Donec urna. Sed euismod, ligula ut sollicitudin faucibus, lorem neque suscipit enim, at dictum purus pede quis nisi. Aliquam vitae turpis. Sed pede nunc, commodo a, congue eget, lobortis quis, justo. Proin elementum ante sit amet purus. Nulla facilisi. Sed vel massa. Nam ornare.
+
+Aliquam erat volutpat. Vivamus non nulla a mi interdum interdum. Proin rutrum vestibulum odio. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec adipiscing, dolor eu faucibus iaculis, odio lorem condimentum lorem, feugiat rutrum enim urna vitae nisl. Vestibulum vehicula vehicula quam. Proin vehicula ante nec magna. Curabitur elementum odio in mi. Aenean ac urna vel turpis cursus tempor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent tempor consectetuer sem. In aliquam metus sed nunc. Fusce libero felis, iaculis at, convallis nec, sagittis nec, mauris. Curabitur pharetra facilisis ligula. Proin sollicitudin velit id erat.
+
+Fusce nec ipsum in nunc cursus pellentesque. Cras bibendum tellus non magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam viverra lacinia est. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi facilisis dignissim pede. Sed odio arcu, ullamcorper vel, malesuada non, condimentum a, risus. Proin sed lacus quis ante convallis imperdiet. Nulla elementum, augue non ornare accumsan, felis purus imperdiet ipsum, a vulputate mauris turpis et nisl. Nunc mattis gravida enim. Donec nisl quam, ornare quis, congue vitae, fermentum a, massa. Duis sollicitudin sapien. Cras laoreet, nunc sed condimentum tristique, est orci egestas odio, eu feugiat risus metus facilisis dui. Nam faucibus. Sed lectus libero, nonummy nec, auctor in, tempor eleifend, massa. Duis orci. Quisque justo odio, dictum id, imperdiet quis, semper a, risus.
+
+Nam ut diam eget felis fermentum accumsan. Praesent congue auctor arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam pede. Maecenas dictum dignissim arcu. Nulla tristique, ante nec nonummy tincidunt, ipsum tortor lobortis nisl, ac fringilla magna ipsum a ipsum. Sed justo. Nunc ante. Quisque lectus sapien, bibendum a, varius consequat, congue sit amet, nisi. Sed pharetra. Vivamus dignissim convallis tellus. Fusce lobortis. Nulla lacinia suscipit velit. Duis tristique diam tristique tellus. Cras eget dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.
+
+Nullam scelerisque pede sit amet lacus. Aliquam pulvinar, magna sed tincidunt sagittis, justo neque mollis lectus, nec aliquet sem neque egestas enim. Aenean velit. Sed facilisis lectus in magna. Aliquam rutrum hendrerit odio. Vivamus consectetuer risus in justo. Sed lobortis augue nec nisi. Pellentesque adipiscing sapien vitae dolor. Integer libero massa, aliquam eu, pharetra ac, posuere in, mi. Fusce faucibus. Aliquam erat volutpat. Donec massa. Phasellus condimentum pede a nisl gravida aliquam. Praesent nisl felis, pretium a, egestas et, faucibus nec, arcu. Suspendisse condimentum odio quis nunc. Nullam auctor. Nulla facilisi. Integer orci diam, tristique sed, condimentum ac, fermentum vitae, nunc. Suspendisse dapibus eros. Nam cursus lectus vitae eros.
+
+Nullam auctor arcu sollicitudin ligula. Morbi rhoncus quam sit amet nulla ullamcorper vulputate. Integer vel mauris. Duis iaculis consectetuer massa. Praesent mollis, sapien eu facilisis dapibus, elit mi vestibulum justo, eget rhoncus dolor orci vel augue. Mauris rhoncus. Nulla facilisi. Etiam ullamcorper molestie justo. Aliquam aliquam, diam quis iaculis tincidunt, nulla orci ultrices nisl, ac elementum nisi lorem at magna. Aenean vel lorem. Proin sapien libero, congue ac, placerat vel, luctus id, lectus. Donec eu tortor vitae urna faucibus sodales. Phasellus at nulla. Mauris laoreet rutrum risus. Vestibulum dictum semper justo. Mauris lobortis, pede sed luctus molestie, nibh sem imperdiet mauris, ac tempus lacus lacus dapibus sapien. Vestibulum semper pellentesque sapien. Cras condimentum nibh quis odio. Donec eget mauris. Proin at dolor.
+
+Curabitur sodales commodo justo. Mauris congue. In in velit vitae lorem mollis semper. Curabitur lectus urna, pulvinar ac, rhoncus at, porttitor eget, pede. Praesent consectetuer. Pellentesque ut libero. Quisque laoreet. Nam rutrum. Suspendisse viverra laoreet est. Nam eu nisi nec mauris viverra adipiscing. Sed quis massa tincidunt metus dictum porttitor. Proin id est. Ut hendrerit, ipsum quis molestie viverra, tellus nibh scelerisque orci, eu dictum arcu augue eget neque.
+
+Ut ut erat. Suspendisse dapibus. Aenean pretium, dolor eget ullamcorper faucibus, massa magna mollis nibh, in sagittis turpis neque porttitor neque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam leo orci, fringilla nec, aliquam consequat, rutrum eu, pede. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Fusce sem. Maecenas in leo non mauris tincidunt suscipit. Fusce euismod metus sit amet diam. Donec pulvinar interdum lectus.
+
+Mauris feugiat, ante non tincidunt euismod, purus nisi tincidunt diam, quis rhoncus augue justo id lorem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In mattis, dolor vitae tempor gravida, sem erat sollicitudin arcu, vitae placerat ante quam nec tortor. Donec in nisi. Quisque a nisl. Proin venenatis. Mauris nec erat id odio rutrum bibendum. In feugiat faucibus quam. Donec venenatis, pede quis lobortis tincidunt, sapien turpis eleifend eros, eu tincidunt ligula metus non tellus. Nunc a mauris ut leo vestibulum egestas. Fusce laoreet feugiat est. Curabitur dignissim risus sit amet leo. Nulla sit amet est. Cras ipsum. Aliquam a augue. Morbi a nisl. Sed vel ligula sit amet tortor congue tincidunt. Mauris commodo, dui sit amet pharetra eleifend, odio mi posuere felis, ut lobortis leo felis et metus.
+
+Vestibulum interdum faucibus ante. Morbi posuere iaculis risus. Proin ac ante vel eros mattis pharetra. Nullam nulla enim, imperdiet nec, condimentum nec, consequat in, mi. Quisque imperdiet quam malesuada metus euismod elementum. Aliquam vestibulum massa in arcu. Suspendisse aliquet gravida arcu. Maecenas quam. Integer porta. Proin sed erat. Suspendisse mauris. Pellentesque eleifend mauris ut dui. Donec vitae augue. Cras congue, urna ut blandit laoreet, magna nisl vehicula nunc, non eleifend nisl turpis non sapien. Aenean eget enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque et sapien eget elit tincidunt semper. Nam placerat aliquam massa. Donec at nisl eget odio fermentum semper. Fusce ante enim, fringilla eget, bibendum id, posuere et, massa.
+
+Donec in ligula vitae turpis suscipit suscipit. Vestibulum ultrices. Duis nulla orci, aliquam in, pellentesque eget, condimentum in, mauris. Quisque vulputate vulputate tellus. Sed magna. Nulla sit amet massa et pede pretium sollicitudin. Duis sed mauris tincidunt tellus adipiscing scelerisque. Suspendisse bibendum nunc a nibh. Aliquam tincidunt pulvinar purus. Nam eget libero. Proin molestie.
+
+Curabitur semper orci at mi. Vestibulum tincidunt pede vitae nibh. Nunc metus. Ut mattis placerat nibh. Nulla facilisi. Maecenas tempor metus eget augue. Quisque a dolor porttitor erat placerat volutpat. In tellus. Phasellus pretium. Donec viverra, tellus sit amet sollicitudin consectetuer, orci leo consequat ipsum, in blandit augue leo ut ligula. In hac habitasse platea dictumst. Cras nibh ante, suscipit eu, fermentum non, eleifend vitae, purus. Aliquam ac massa eu mi lacinia porta. Suspendisse ultrices scelerisque ante. Praesent eget tortor. Nunc justo. Duis venenatis, justo eget sollicitudin malesuada, pede risus tempus ante, et sollicitudin nisl ligula at quam. In mauris eros, egestas vel, fringilla ut, interdum vitae, orci. Cras vitae tellus eu sem ornare facilisis.
+
+Nulla non nisl eget urna interdum suscipit. Aliquam eget libero. Duis ac metus. Vestibulum iaculis nisi in est. In sem tellus, ultricies in, hendrerit quis, ultrices ut, justo. Aliquam erat volutpat. Sed gravida, turpis vitae consequat viverra, risus ante dignissim pede, vel tristique dolor pede non urna. Duis a elit. Aliquam accumsan condimentum tellus. Quisque dui. Nullam nibh. Cras accumsan dignissim tortor. Morbi ac magna vitae est feugiat congue. Proin in felis.
+
+Nam ut purus. Donec interdum, quam nec blandit volutpat, enim velit vulputate mauris, sit amet tristique lorem erat non orci. Vivamus at enim. Morbi in odio. Aenean quam. Suspendisse commodo erat vitae lectus. Vestibulum rhoncus. Nam ullamcorper auctor metus. Quisque auctor, mauris non tincidunt sollicitudin, libero nisl venenatis libero, a adipiscing ipsum erat nec metus. Sed turpis. Aenean sem quam, tempor at, ultricies in, facilisis et, nisl. Cras laoreet.
+
+Mauris ut pede et velit egestas venenatis. Mauris tincidunt tortor sit amet erat. Phasellus imperdiet consequat lorem. Donec luctus odio ut felis. Curabitur non nunc id pede porta malesuada. Nunc nunc tortor, tempor sit amet, porttitor eu, fermentum ut, urna. Nulla vulputate. Pellentesque congue rhoncus risus. Phasellus semper convallis nisl. Ut accumsan interdum dolor. Nulla metus quam, porta non, fringilla quis, fringilla at, leo. Cras laoreet vestibulum diam. Donec et nisl et nulla ornare ultrices. Nullam fringilla. Vivamus erat. Morbi vehicula suscipit ipsum. Vestibulum sodales lectus quis nunc. Maecenas fringilla consectetuer neque.
+
+Nullam interdum vulputate orci. Etiam fringilla lacus. Suspendisse eu nisl sit amet libero dignissim aliquet. Ut nonummy malesuada lorem. Praesent cursus posuere urna. Nulla pharetra adipiscing nisl. Cras euismod pretium risus. Sed accumsan nisl ut diam. Maecenas et odio vel neque congue dictum. Nam varius pharetra dui. Pellentesque ligula. Curabitur sollicitudin pede at lorem. Quisque massa sapien, accumsan sed, condimentum a, ullamcorper ut, leo. Sed lectus. Nulla sem tortor, ornare sed, ultrices at, euismod non, purus. Maecenas ultricies nibh in mauris pulvinar suscipit. Fusce in eros id nulla hendrerit egestas. Morbi pellentesque. Quisque dolor tortor, faucibus ac, vehicula elementum, commodo dignissim, sem. Vivamus auctor ornare nunc.
+
+In consequat. Integer lectus turpis, ullamcorper et, scelerisque ac, lobortis quis, nisi. Nullam venenatis. Aliquam et leo. Vivamus felis. Pellentesque vestibulum suscipit lacus. Vivamus placerat rhoncus tellus. Integer sodales erat nec lectus. Integer et dolor. In hac habitasse platea dictumst. Suspendisse suscipit rhoncus arcu. Nullam sit amet erat. Nam elementum gravida magna.
+
+In a risus vitae ante rhoncus fermentum. Nulla facilisi. Maecenas suscipit venenatis sapien. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam nulla. Etiam lectus nisl, dignissim a, nonummy nec, bibendum vel, erat. Aenean volutpat diam eu sem. Fusce lobortis, velit id lacinia ultricies, velit purus ullamcorper ligula, sit amet imperdiet mi lacus vitae erat. Phasellus ultricies ligula a nulla tincidunt aliquam. In hac habitasse platea dictumst. Cras congue porttitor diam. Mauris vel lacus eu lorem eleifend porta. Duis aliquam libero id tortor.
+
+Vivamus vel nibh eu lectus volutpat congue. Cras volutpat tristique sem. Nullam facilisis adipiscing enim. Quisque quam justo, feugiat ut, mattis vel, aliquam laoreet, dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas interdum neque ac sapien. In odio nulla, posuere ut, porta ut, commodo sit amet, mi. Integer nisi. Nunc sagittis interdum tortor. Etiam tristique adipiscing massa. Nullam pede. Quisque nisl. Cras ac tortor. Phasellus pulvinar, massa id vestibulum varius, eros quam ornare urna, sit amet lacinia nisl urna a elit. Donec luctus. In hac habitasse platea dictumst. Aenean eu odio at metus consectetuer adipiscing. Sed laoreet nisl in urna. Donec vel justo sed arcu interdum vestibulum.
+
+Vivamus nec urna a mauris dictum nonummy. Maecenas ultrices cursus urna. Suspendisse potenti. Aliquam erat volutpat. Proin quam. Sed euismod orci auctor lacus. Vivamus ornare tellus et elit. Nunc volutpat sagittis nisi. Suspendisse dui massa, volutpat id, tincidunt eget, ullamcorper id, magna. Sed sapien nisi, tristique ac, tempor non, hendrerit non, libero. Integer justo quam, vestibulum vehicula, aliquet nec, interdum in, elit. Ut ac enim eu ipsum lacinia scelerisque. Donec vitae eros non nisi blandit euismod. Fusce eget orci. Proin vitae dolor ut nulla rutrum viverra.
+
+Aliquam fringilla aliquam sapien. Donec elementum adipiscing mi. Nulla facilisi. Nullam commodo interdum justo. Vestibulum vulputate sem a nulla. Donec leo metus, rhoncus sit amet, scelerisque mattis, placerat et, odio. Donec hendrerit urna sed eros. In condimentum adipiscing mi. Suspendisse eleifend, velit eget vehicula semper, nunc urna adipiscing diam, sed egestas tortor velit eu lectus. Ut sed mi. Morbi est mi, mollis nec, faucibus a, sodales non, eros. Nullam enim nunc, dapibus sed, semper cursus, aliquam vel, lacus. Quisque ultricies magna quis ligula.
+
+Pellentesque non urna. Nam vel ante. Donec nonummy, elit blandit imperdiet vehicula, ligula nisl pharetra erat, nec varius arcu felis at augue. Maecenas laoreet posuere mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Suspendisse iaculis dignissim ante. Ut et est. Phasellus interdum. Aliquam varius odio eget lorem. Nunc dapibus justo non dolor. Vivamus posuere, ante vitae lacinia condimentum, libero tortor viverra magna, nec placerat ipsum sem condimentum orci. Sed augue ligula, tempus sed, vulputate ac, bibendum a, lacus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed a mauris. Integer ante. Fusce et orci sit amet mi lacinia posuere. Proin non tellus quis mauris facilisis volutpat. Nullam tincidunt. Pellentesque accumsan.
+
+Aliquam erat volutpat. Vestibulum a tortor quis felis sagittis pharetra. Sed aliquam sapien vel metus. Maecenas dapibus, lorem sed vestibulum pharetra, nisi justo faucibus justo, id congue nisi felis at nulla. Maecenas est ante, placerat consequat, ultricies tempor, vulputate quis, ligula. Praesent sollicitudin, nulla ut vulputate tempor, diam nunc mattis nisi, eget rutrum nisi diam sed tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Morbi ultrices sapien non metus pretium lacinia. Suspendisse ligula. Suspendisse fermentum dapibus enim. Mauris tincidunt magna eu lorem. Praesent nunc dui, tempor nec, pulvinar pharetra, semper ac, libero. Morbi placerat interdum ante. Proin molestie, lorem ac elementum luctus, ligula enim venenatis risus, eget mattis ante pede vitae pede. In fermentum. Donec lobortis, magna eu rutrum accumsan, augue pede eleifend tortor, in posuere velit magna ut velit. Suspendisse ac metus in nisl commodo in
 terdum. Duis ornare elit in pede.
+
+Duis ut elit ut velit tempus bibendum. Nulla pretium vulputate tortor. Vestibulum interdum. Integer id pede. Vivamus sem augue, elementum vel, commodo a, fringilla elementum, sapien. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur nec enim. Vivamus facilisis, metus eget pharetra tincidunt, augue lacus elementum diam, in placerat tortor tortor ut risus. Aenean elementum eleifend magna. Nullam nibh tortor, elementum vitae, vestibulum quis, mattis nec, augue. Phasellus a diam at orci porta molestie. Quisque quis purus. Fusce sed dui. Donec tempus. Etiam tincidunt, risus non aliquam tincidunt, ligula est bibendum mauris, sed dapibus libero magna vitae massa. In hac habitasse platea dictumst. Cras ultrices risus ac justo. Fusce pellentesque, justo quis suscipit vestibulum, sapien libero viverra risus, ut condimentum eros purus sed lectus. Nullam id pede. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per incep
 tos hymenaeos.
+
+Quisque blandit luctus diam. Sed posuere. Donec mattis. Etiam bibendum rutrum sapien. Aliquam nec leo vitae mi porttitor aliquet. Nulla metus justo, semper vel, vehicula et, placerat eu, mi. Etiam neque ante, gravida eu, posuere eu, posuere sed, dolor. Nunc et nunc. Suspendisse enim eros, interdum nec, porta at, gravida in, velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed quis ligula eget massa gravida dignissim. Suspendisse nonummy.
+
+Proin pellentesque aliquet neque. Sed porta urna ornare ligula. In hac habitasse platea dictumst. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse a nisl. Curabitur in eros sit amet nisi blandit vehicula. Aliquam rutrum pulvinar augue. Vestibulum tellus sem, convallis eu, eleifend vitae, sagittis nec, nisl. Pellentesque leo. Nam pulvinar tristique est. Praesent volutpat iaculis ligula. Suspendisse potenti.
+
+Etiam ut arcu eget libero rutrum mollis. Cras egestas, ipsum at mattis euismod, purus lectus ultrices nulla, et malesuada urna felis eget sem. Aenean id massa vitae elit commodo cursus. Nam odio massa, nonummy ut, pellentesque suscipit, sollicitudin eget, mi. Nam sagittis. Proin iaculis justo sit amet risus. Nunc eu odio. Suspendisse eget nulla. Donec ut lorem vel risus lacinia tristique. Ut egestas leo bibendum dolor. Duis enim mi, lobortis id, varius id, mollis in, eros. Etiam sapien diam, commodo at, porta sit amet, aliquam id, enim. Sed vel orci eget sapien rhoncus gravida. Nunc nibh. Maecenas facilisis. In hac habitasse platea dictumst. Aenean interdum, tellus a placerat pellentesque, arcu magna lacinia massa, id pulvinar turpis turpis non nisi. Pellentesque elementum. Nunc ut nunc.
+
+Maecenas tincidunt sagittis neque. Maecenas ac magna. Donec lobortis, tellus quis nonummy semper, odio massa accumsan ipsum, vel tincidunt nibh magna eu mi. In quis tortor non tellus consequat accumsan. Quisque molestie ligula et tortor. Fusce porttitor sodales odio. Maecenas at justo id lacus mollis semper. Proin tincidunt volutpat felis. Sed nec nibh a nibh convallis molestie. Sed porta magna eget odio. Aliquam ipsum arcu, commodo in, imperdiet ut, ultrices commodo, velit. Etiam tincidunt congue sem. Proin convallis lacus.
+
+Donec urna. Quisque aliquet suscipit arcu. Donec sit amet leo quis elit convallis venenatis. Pellentesque auctor tellus vel tellus. Suspendisse consectetuer, purus ut fringilla placerat, felis metus rutrum justo, non blandit arcu libero at odio. Mauris euismod, enim vitae tempor accumsan, dui lacus placerat dolor, nec rhoncus est augue non tortor. Sed quis urna in dolor dignissim hendrerit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus convallis lacus commodo libero. Phasellus ornare erat. Donec quis est eget augue posuere varius. Phasellus auctor. Maecenas vitae lectus. Aliquam pulvinar. Maecenas vitae magna eget mauris nonummy nonummy. Fusce libero nisl, nonummy non, dignissim ac, blandit non, dui.
+
+Pellentesque nec ligula vel lorem vehicula dictum. Cras vitae risus id diam congue congue. Nam dapibus ultrices nisi. In diam. Nullam velit. Maecenas risus. Nullam in sem. Fusce tincidunt ornare felis. In laoreet massa sed urna. Vestibulum lobortis ullamcorper arcu. Sed feugiat varius justo. Fusce scelerisque. Donec sit amet eros. Curabitur ullamcorper diam ac odio. Duis pharetra ultrices urna.
+
+Maecenas mauris. Integer fermentum, pede at laoreet interdum, lectus dolor laoreet erat, in egestas est lacus mollis erat. Duis hendrerit mauris ac nunc. Maecenas condimentum sem a odio. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed ac nisi et leo malesuada auctor. Cras vestibulum. Quisque dui metus, viverra at, sodales vitae, tincidunt quis, massa. Nunc mauris. Suspendisse enim lorem, tincidunt suscipit, pharetra eget, egestas ac, lectus. Maecenas scelerisque. Nulla dapibus, massa sit amet tempor facilisis, quam sem semper quam, vitae euismod turpis enim in diam.
+
+Donec dignissim. Ut feugiat tincidunt orci. Praesent bibendum venenatis elit. Curabitur accumsan. Quisque ultrices magna. Nam in nisl. Aliquam ac ipsum. Aliquam enim orci, iaculis ut, ultrices id, ultrices ut, massa. Phasellus hendrerit mauris. Praesent feugiat, leo quis molestie luctus, erat massa egestas enim, non posuere velit dui eu felis. Praesent varius fringilla risus.
+
+Sed lacus sem, tempus dictum, convallis sit amet, placerat a, velit. Vestibulum sit amet lacus. Curabitur molestie. Suspendisse nec mauris. Praesent in diam vitae quam iaculis condimentum. Nam fringilla. Sed sollicitudin eros a enim. Curabitur dictum nunc sit amet lorem. Mauris odio purus, adipiscing vitae, porta ut, euismod rhoncus, risus. Pellentesque sit amet diam id urna rutrum nonummy. Morbi velit est, aliquet hendrerit, aliquet in, vestibulum quis, orci. Integer sed felis vitae quam venenatis malesuada. Curabitur scelerisque, massa sed eleifend sagittis, enim magna condimentum eros, a lacinia nisi ante ut nibh. Proin suscipit consectetuer nisl. Donec interdum, nisl eget vestibulum ultricies, massa purus elementum mi, in egestas lacus est at risus. Nunc a nibh vehicula lorem vulputate tincidunt. Cras est ligula, ullamcorper a, pulvinar et, ullamcorper eu, libero. Praesent et tortor id augue pretium condimentum. Pellentesque viverra, orci at placerat sodales, dolor risus
  dictum velit, sit amet ultrices nisl sapien id felis.
+
+Morbi vel turpis. Cras ut enim eget nisi volutpat nonummy. Sed iaculis. Maecenas metus mauris, fermentum eget, nonummy id, vulputate id, purus. Phasellus egestas lacus ac erat. Nullam sed metus. Morbi nunc pede, lobortis ut, pulvinar lacinia, accumsan quis, pede. Donec posuere rutrum mauris. Mauris cursus, nisl a venenatis congue, sapien tellus commodo magna, id fermentum sapien massa quis dui. Proin dignissim dui in odio.
+
+Mauris sit amet augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras eget eros sed augue faucibus malesuada. Pellentesque adipiscing iaculis orci. Integer id augue in neque convallis condimentum. Donec tristique, dolor id facilisis fermentum, tortor est vehicula turpis, et convallis sapien turpis vel est. Cras et lectus. Nam iaculis. Suspendisse eleifend nibh a nulla. Donec sit amet diam. Fusce porttitor lorem in velit. Maecenas egestas ante nec elit. Suspendisse dui nulla, consequat nec, feugiat sit amet, porta sed, urna. Nullam pellentesque purus non elit.
+
+Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris orci massa, imperdiet nec, pulvinar feugiat, varius at, leo. Pellentesque nec velit ac velit consectetuer iaculis. Etiam nonummy. Quisque et ligula. In ac dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus porta sagittis nulla. Suspendisse et risus.
+
+In in mauris nec libero egestas vehicula. Cras tincidunt blandit lorem. Phasellus facilisis urna vitae nisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus gravida sem nec nisi. Nam magna est, tempor sed, venenatis eget, dictum sit amet, diam. Fusce elementum tincidunt enim. Integer tortor orci, lobortis nec, vehicula vitae, laoreet vitae, augue. Nullam fringilla aliquet ligula. Suspendisse vehicula nisi non dolor. Quisque nonummy urna et velit. Integer egestas commodo libero. Phasellus in sapien ac mi ornare pretium. In quis lorem vel dolor commodo ultricies.
+
+Mauris dolor. Nunc venenatis. Donec ullamcorper sapien ac est. Integer laoreet, magna nec scelerisque egestas, enim velit cursus dolor, nec pulvinar ligula odio non odio. Proin sit amet nisi eu erat rutrum viverra. Nullam tempus quam quis mi. Quisque tincidunt odio nec tortor. Nulla orci. Mauris sapien sapien, malesuada placerat, elementum bibendum, rhoncus eu, risus. Integer lectus. Curabitur velit magna, congue id, imperdiet id, lobortis in, nisl. Integer ultricies est quis sapien. Suspendisse vitae est.
+
+Quisque lacinia sapien ac diam. Morbi ornare ante ac elit. Quisque viverra. Aliquam erat volutpat. Quisque erat turpis, hendrerit vel, aliquam vel, vulputate tincidunt, ligula. Ut molestie molestie nulla. Vestibulum vitae dui. Etiam tellus. Suspendisse ligula. Maecenas cursus ornare tortor. In placerat consectetuer sem. Mauris quis risus et odio nonummy scelerisque. Aliquam venenatis. Etiam tempor. Sed arcu.
+
+Duis justo. Proin porta mattis nunc. Etiam posuere, arcu nec porta imperdiet, magna lorem interdum purus, vitae congue nisi lacus a est. Duis eu leo quis tortor congue lobortis. Vestibulum eu lorem. Integer bibendum. Integer et mi. Fusce venenatis. Aliquam erat volutpat. Nullam mi massa, dictum vel, ultricies ac, tempus non, leo. Aenean vitae ante. Suspendisse velit lacus, volutpat in, lacinia a, malesuada id, sapien. Duis blandit.
+
+In commodo lorem in leo. Curabitur turpis. Fusce nec odio. Nunc ac augue vel eros faucibus consectetuer. Pellentesque porta. Etiam blandit. Aliquam eget dolor. Curabitur ac elit eget arcu luctus pulvinar. Quisque molestie. Donec fermentum. Aenean pharetra eros a eros. Nam sagittis urna ut libero. Aliquam faucibus tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam justo mauris, posuere vel, vestibulum vel, laoreet at, dolor. Maecenas neque tellus, faucibus a, aliquet sed, varius vel, nisi. Sed commodo, purus quis hendrerit pulvinar, risus lectus ultrices pede, in rhoncus neque libero eu purus. Praesent vel risus. Nulla pharetra nibh a urna imperdiet congue. Sed suscipit laoreet magna.
+
+Phasellus pharetra leo. Vivamus sit amet dui sit amet urna convallis sollicitudin. Duis tempor placerat massa. Nulla dapibus. Nullam rutrum nulla non mi. Curabitur at sapien in risus pretium aliquam. Mauris vel erat sed enim porttitor dapibus. Nulla tincidunt. Etiam non nisl. Pellentesque in dolor. Praesent placerat quam et orci. Donec euismod orci ut ipsum. Quisque mollis porta velit. Suspendisse potenti. Duis accumsan lacus at ante. Etiam tortor justo, dictum ac, viverra quis, ultrices in, odio. In sit amet libero.

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/data/upload.txt
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/StubValidationDecorator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/StubValidationDecorator.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/StubValidationDecorator.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/StubValidationDecorator.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,38 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.components;
+
+import org.apache.tapestry.Field;
+import org.apache.tapestry.ValidationDecorator;
+import org.apache.tapestry.dom.Element;
+
+public class StubValidationDecorator implements ValidationDecorator
+{
+    public void insideLabel(Field field, Element labelElement)
+    {
+    }
+
+    public void beforeField(Field field)
+    {
+    }
+
+    public void insideField(Field field)
+    {
+    }
+
+    public void afterField(Field field)
+    {
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/StubValidationDecorator.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,285 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.components;
+
+import static org.easymock.EasyMock.expectLastCall;
+
+import org.apache.tapestry.Binding;
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.Field;
+import org.apache.tapestry.FieldValidator;
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.ValidationDecorator;
+import org.apache.tapestry.ValidationException;
+import org.apache.tapestry.ValidationTracker;
+import org.apache.tapestry.dom.Element;
+import org.apache.tapestry.services.DefaultComponentParameterBindingSource;
+import org.apache.tapestry.services.FormSupport;
+import org.apache.tapestry.test.TapestryTestCase;
+import org.apache.tapestry.upload.services.MultipartDecoder;
+import org.apache.tapestry.upload.services.UploadedFile;
+import org.testng.annotations.Test;
+
+public class UploadTest extends TapestryTestCase
+{
+
+    @Test
+    public void upload_is_field() throws Exception
+    {
+        assertTrue(Field.class.isAssignableFrom(Upload.class));
+    }
+
+    @Test
+    public void begin_render_writes_input_tag() throws Exception
+    {
+        MarkupWriter writer = createMarkupWriter();
+        writer.element("form");
+        FormSupport formSupport = mockFormSupport();
+
+        formSupport.setEncodingType(Upload.MULTIPART_ENCTYPE);
+
+        replay();
+
+        Upload component = new Upload();
+
+        setValidationDecorator(component, new StubValidationDecorator());
+
+        setFormSupport(component, formSupport);
+
+        component.beginRender(writer);
+
+        Element element = writer.getElement();
+        assertNotNull(element);
+        assertEquals(element.getName(), "input");
+        assertEquals(element.getAttribute("type"), "file");
+        // assertEquals(element.getAttribute("name"),null);
+        // assertEquals(element.getAttribute("id"),null);
+
+        verify();
+
+    }
+
+    protected final FormSupport mockFormSupport()
+    {
+        return newMock(FormSupport.class);
+    }
+
+    private void setFormSupport(Upload component, FormSupport formSupport)
+            throws IllegalAccessException
+    {
+        setField(component, "_formSupport", formSupport);
+    }
+
+    @Test
+    public void validation_decorator_invoked_inside_begin_render() throws Exception
+    {
+        Upload component = new Upload();
+        MarkupWriter writer = createMarkupWriter();
+        writer.element("form");
+
+        FormSupport formSupport = mockFormSupport();
+        formSupport.setEncodingType(Upload.MULTIPART_ENCTYPE);
+        setField(component, "_formSupport", formSupport);
+
+        ValidationDecorator decorator = mockValidationDecorator();
+
+        setValidationDecorator(component, decorator);
+
+        decorator.insideField(component);
+
+        replay();
+
+        component.beginRender(writer);
+
+        verify();
+    }
+
+    private ValidationDecorator mockValidationDecorator()
+    {
+        return newMock(ValidationDecorator.class);
+    }
+
+    @Test
+    public void begin_render_invokes_field_validator() throws Exception
+    {
+        FieldValidator<Object> validate = mockFieldValidator();
+        Upload component = new Upload(null, validate, null, null);
+        MarkupWriter writer = createMarkupWriter();
+        writer.element("form");
+
+        FormSupport formSupport = mockFormSupport();
+        formSupport.setEncodingType(Upload.MULTIPART_ENCTYPE);
+        setField(component, "_formSupport", formSupport);
+
+        ValidationDecorator decorator = mockValidationDecorator();
+
+        setValidationDecorator(component, decorator);
+
+        validate.render(writer);
+        decorator.insideField(component);
+
+        replay();
+
+        component.beginRender(writer);
+
+        verify();
+    }
+
+    @Test
+    public void after_render_closes_element() throws Exception
+    {
+        Upload component = new Upload();
+        MarkupWriter writer = mockMarkupWriter();
+
+        expect(writer.end()).andReturn(null);
+
+        replay();
+
+        component.afterRender(writer);
+
+        verify();
+
+    }
+
+    @Test
+    public void process_submission_extracts_value_from_decoder() throws Exception
+    {
+        FormSupport formSupport = mockFormSupport();
+        MultipartDecoder decoder = mockMultipartDecoder();
+        UploadedFile uploadedFile = mockUploadedFile();
+
+        Upload component = new Upload(null, null, decoder, null);
+
+        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
+        expect(uploadedFile.getFileName()).andReturn("foo").anyTimes();
+
+        replay();
+
+        component.processSubmission(formSupport, "test");
+
+        verify();
+
+        assertSame(component.getValue(), uploadedFile);
+    }
+
+    @Test
+    public void process_submission_ignores_null_value() throws Exception
+    {
+        FormSupport formSupport = mockFormSupport();
+        MultipartDecoder decoder = mockMultipartDecoder();
+        UploadedFile uploadedFile = mockUploadedFile();
+
+        Upload component = new Upload(null, null, decoder, null);
+
+        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
+        expect(uploadedFile.getFileName()).andReturn("").atLeastOnce();
+
+        replay();
+
+        component.processSubmission(formSupport, "test");
+
+        verify();
+
+        assertNull(component.getValue());
+    }
+
+    @Test
+    public void process_submission_calls_validator() throws Exception
+    {
+        FormSupport formSupport = mockFormSupport();
+        MultipartDecoder decoder = mockMultipartDecoder();
+        UploadedFile uploadedFile = mockUploadedFile();
+        FieldValidator<Object> validate = mockFieldValidator();
+
+        Upload component = new Upload(null, validate, decoder, null);
+
+        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
+        expect(uploadedFile.getFileName()).andReturn("test").atLeastOnce();
+        validate.validate(uploadedFile);
+        replay();
+
+        component.processSubmission(formSupport, "test");
+
+        verify();
+    }
+
+    @Test
+    public void process_submission_tracks_validator_errors() throws Exception
+    {
+        FormSupport formSupport = mockFormSupport();
+        MultipartDecoder decoder = mockMultipartDecoder();
+        UploadedFile uploadedFile = mockUploadedFile();
+        FieldValidator<Object> validate = mockFieldValidator();
+        ValidationTracker tracker = mockValidationTracker();
+
+        Upload component = new Upload(null, validate, decoder, tracker);
+
+        expect(decoder.getFileUpload("test")).andReturn(uploadedFile);
+        expect(uploadedFile.getFileName()).andReturn("test").atLeastOnce();
+        validate.validate(uploadedFile);
+        expectLastCall().andThrow(new ValidationException("an error"));
+        tracker.recordError(component, "an error");
+        replay();
+
+        component.processSubmission(formSupport, "test");
+
+        verify();
+    }
+
+    protected final UploadedFile mockUploadedFile()
+    {
+        return newMock(UploadedFile.class);
+    }
+
+    protected final MultipartDecoder mockMultipartDecoder()
+    {
+        return newMock(MultipartDecoder.class);
+    }
+
+    protected final DefaultComponentParameterBindingSource newDefaultComponentParameterBindingSource()
+    {
+        return newMock(DefaultComponentParameterBindingSource.class);
+    }
+
+    private void setValidationDecorator(Upload component, ValidationDecorator decorator)
+            throws IllegalAccessException
+    {
+        setField(component, "_decorator", decorator);
+    }
+
+    private void setField(Object bean, String name, Object value) throws IllegalAccessException
+    {
+        Class clazz = bean.getClass();
+        java.lang.reflect.Field field = null;
+
+        while (field == null && clazz != null)
+        {
+            try
+            {
+                field = clazz.getDeclaredField(name);
+            }
+            catch (NoSuchFieldException e)
+            {
+                field = null;
+            }
+            clazz = clazz.getSuperclass();
+        }
+        if (field != null)
+        {
+            field.setAccessible(true);
+            field.set(bean, value);
+        }
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/components/UploadTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/UploadIntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/UploadIntegrationTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/UploadIntegrationTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/UploadIntegrationTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,60 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.integration;
+
+import org.apache.tapestry.test.AbstractIntegrationTestSuite;
+import org.example.upload.pages.Start;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * . TODO: These tests wont work because Selenium cannot enter values for input type="file'
+ */
+public class UploadIntegrationTest extends AbstractIntegrationTestSuite
+{
+
+    @BeforeTest
+    public void setupTargetFolder() throws IOException
+    {
+        File target = new File(Start.TARGET_DIR);
+        if (!target.exists())
+        {
+            target.mkdirs();
+        }
+        else
+        {
+            for (File file : target.listFiles())
+            {
+                file.delete();
+            }
+        }
+    }
+
+    @Test(enabled = false)
+    public void integration_test() throws Exception
+    {
+
+        open(BASE_URL);
+
+        File source = new File("test/data/upload.txt");
+
+        type("file", source.getCanonicalPath());
+        clickAndWait("//input[@value='Upload']");
+
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/integration/UploadIntegrationTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartDecoderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartDecoderImplTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartDecoderImplTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartDecoderImplTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,177 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.tapestry.test.TapestryTestCase;
+import org.apache.tapestry.upload.services.MultipartDecoderImpl;
+import org.testng.annotations.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public class MultipartDecoderImplTest extends TapestryTestCase
+{
+
+    @Test
+    public void createFileUploadGetsConfigurationFromSymbols() throws Exception
+    {
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, 7777, 6666);
+
+        replay();
+
+        ServletFileUpload servletFileUpload = decoder.createFileUpload();
+        assertNotNull(servletFileUpload);
+        verify();
+
+        assertEquals(servletFileUpload.getFileSizeMax(), 6666);
+        assertEquals(servletFileUpload.getSizeMax(), 7777);
+    }
+
+    @Test
+    public void processFileItemsDoesNothingWhenNullFileItems() throws Exception
+    {
+        HttpServletRequest request = mockHttpServletRequest();
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, -1, -1);
+
+        replay();
+        HttpServletRequest decodedRequest = decoder.processFileItems(request, null);
+        verify();
+
+        assertSame(request, decodedRequest);
+    }
+
+    @Test
+    public void processFileItemsDoesNothingWhenEmptyFileItems() throws Exception
+    {
+        HttpServletRequest request = mockHttpServletRequest();
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, -1, -1);
+        List<FileItem> fileItems = Collections.emptyList();
+        replay();
+
+        HttpServletRequest decodedRequest = decoder.processFileItems(request, fileItems);
+        verify();
+
+        assertSame(request, decodedRequest);
+    }
+
+    @Test
+    public void processFileItemsCreatesWrappedRequestAndSetsNonFileParameters() throws Exception
+    {
+        HttpServletRequest request = mockHttpServletRequest();
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, -1, -1);
+        List<FileItem> fileItems = Arrays.asList(createValueItem("one", "first"), createValueItem(
+                "two",
+                "second"));
+        replay();
+
+        HttpServletRequest decodedRequest = decoder.processFileItems(request, fileItems);
+
+        assertNotSame(decodedRequest, request);
+
+        assertEquals(decodedRequest.getParameter("one"), "first");
+        assertEquals(decodedRequest.getParameter("two"), "second");
+
+        verify();
+    }
+
+    @Test
+    public void processFileItemsSetsFileParametersWithFileName() throws Exception
+    {
+        HttpServletRequest request = mockHttpServletRequest();
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, -1, -1);
+        List<FileItem> fileItems = Arrays.asList(
+                createFileItem("one", "first.txt"),
+                createFileItem("two", "second.txt"));
+        replay();
+
+        HttpServletRequest decodedRequest = decoder.processFileItems(request, fileItems);
+
+        assertNotSame(decodedRequest, request);
+
+        assertEquals(decodedRequest.getParameter("one"), "first.txt");
+        assertEquals(decodedRequest.getParameter("two"), "second.txt");
+
+        verify();
+    }
+
+    @Test
+    public void processFileItemsStoresUploadedFile() throws Exception
+    {
+        HttpServletRequest request = mockHttpServletRequest();
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, -1, -1);
+        List<FileItem> fileItems = Arrays.asList(
+                createFileItem("one", "first.txt"),
+                createFileItem("two", "second.txt"));
+        replay();
+
+        decoder.processFileItems(request, fileItems);
+
+        verify();
+        assertNotNull(decoder.getFileUpload("one"));
+        assertEquals(decoder.getFileUpload("one").getFileName(), "first.txt");
+        assertNotNull(decoder.getFileUpload("two"));
+        assertEquals(decoder.getFileUpload("two").getFileName(), "second.txt");
+    }
+
+    @Test
+    public void threadDidCleanupDeletesAllFileItems() throws Exception
+    {
+        HttpServletRequest request = mockHttpServletRequest();
+        MultipartDecoderImpl decoder = new MultipartDecoderImpl("/tmp", 888, -1, -1);
+        StubFileItem firstItem = new StubFileItem("one");
+        firstItem.setFormField(false);
+        StubFileItem secondItem = new StubFileItem("two");
+        secondItem.setFormField(false);
+
+        List<FileItem> fileItems = new ArrayList<FileItem>();
+        fileItems.add(firstItem);
+        fileItems.add(secondItem);
+        replay();
+
+        decoder.processFileItems(request, fileItems);
+
+        assertFalse(firstItem.isDeleted());
+        assertFalse(secondItem.isDeleted());
+        decoder.threadDidCleanup();
+        assertTrue(firstItem.isDeleted());
+        assertTrue(secondItem.isDeleted());
+
+        verify();
+    }
+
+    private FileItem createValueItem(String name, String value)
+    {
+        StubFileItem item = new StubFileItem();
+        item.setFieldName(name);
+        item.setValue(value);
+        item.setFormField(true);
+        return item;
+    }
+
+    private FileItem createFileItem(String name, String fileName)
+    {
+        StubFileItem item = new StubFileItem();
+        item.setFieldName(name);
+        item.setFileName(fileName);
+        item.setFormField(false);
+        return item;
+    }
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartDecoderImplTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartServletRequestFilterTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartServletRequestFilterTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartServletRequestFilterTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartServletRequestFilterTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,73 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import org.apache.tapestry.services.HttpServletRequestHandler;
+import org.apache.tapestry.test.TapestryTestCase;
+import org.apache.tapestry.upload.services.MultipartDecoder;
+import org.apache.tapestry.upload.services.MultipartServletRequestFilter;
+import org.testng.annotations.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class MultipartServletRequestFilterTest extends TapestryTestCase
+{
+
+    @Test
+    public void normalRequestDoesNothing() throws Exception
+    {
+        MultipartDecoder decoder = newMock(MultipartDecoder.class);
+        HttpServletRequest request = mockHttpServletRequest();
+        HttpServletResponse response = mockHttpServletResponse();
+        HttpServletRequestHandler handler = newMock(HttpServletRequestHandler.class);
+
+        MultipartServletRequestFilter filter = new MultipartServletRequestFilter(decoder);
+
+        expect(request.getMethod()).andReturn("get");
+
+        expect(handler.service(request, response)).andReturn(true);
+
+        replay();
+
+        boolean isHandled = filter.service(request, response, handler);
+        assertTrue(isHandled);
+        verify();
+    }
+
+    @Test
+    public void multipartRequestIsDecoded() throws Exception
+    {
+        MultipartDecoder decoder = newMock(MultipartDecoder.class);
+        HttpServletRequest request = mockHttpServletRequest();
+        HttpServletRequest decodedRequest = mockHttpServletRequest();
+        HttpServletResponse response = mockHttpServletResponse();
+        HttpServletRequestHandler handler = newMock(HttpServletRequestHandler.class);
+
+        MultipartServletRequestFilter filter = new MultipartServletRequestFilter(decoder);
+
+        expect(request.getMethod()).andReturn("post");
+        expect(request.getContentType()).andReturn("multipart/form");
+        expect(decoder.decode(request)).andReturn(decodedRequest);
+
+        expect(handler.service(decodedRequest, response)).andReturn(true);
+
+        replay();
+
+        boolean isHandled = filter.service(request, response, handler);
+        assertTrue(isHandled);
+        verify();
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/MultipartServletRequestFilterTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParameterValueTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParameterValueTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParameterValueTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParameterValueTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,82 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+
+public class ParameterValueTest
+{
+
+    @Test
+    public void singleGivesConstructedParameterByDefault() throws Exception
+    {
+        ParameterValue value = new ParameterValue("foo");
+        assertEquals(value.single(), "foo");
+    }
+
+    @Test
+    public void multiReturnsArrayWithConstructedParameterByDefault() throws Exception
+    {
+        ParameterValue value = new ParameterValue("foo");
+        assertEquals(value.multi(), new String[]
+        { "foo" });
+    }
+
+    @Test
+    public void singleGivesFirstValueOfMultiValue() throws Exception
+    {
+        ParameterValue value = new ParameterValue("foo", "blah");
+        assertEquals(value.single(), "foo");
+    }
+
+    @Test
+    public void multiGivesAllValuesOfMultiValue() throws Exception
+    {
+        ParameterValue value = new ParameterValue("foo");
+        value.add("blah");
+        assertEquals(value.multi(), new String[]
+        { "foo", "blah" });
+    }
+
+    @Test
+    public void isMultiIsFalseForSingleValue() throws Exception
+    {
+        ParameterValue value = new ParameterValue("foo");
+        assertFalse(value.isMulti());
+    }
+
+    @Test
+    public void isMultiIsTrueForMultiValue() throws Exception
+    {
+        ParameterValue value = new ParameterValue("foo");
+        value.add("blah");
+        assertTrue(value.isMulti());
+    }
+
+    @Test
+    public void nullObjectGivesNullForSingleAndMulti() throws Exception
+    {
+        ParameterValue value = ParameterValue.NULL;
+        assertNull(value.single());
+        assertNull(value.multi());
+        assertFalse(value.isMulti());
+    }
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParameterValueTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapperTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapperTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapperTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapperTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,177 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import static org.easymock.EasyMock.*;
+import static org.testng.Assert.*;
+
+import org.apache.tapestry.upload.services.ParametersServletRequestWrapper;
+import org.testng.annotations.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class ParametersServletRequestWrapperTest
+{
+    @Test
+    public void getParameterNamesIsNotDelegated() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+
+        replay(request);
+
+        Enumeration names = wrapper.getParameterNames();
+
+        verify(request);
+
+        assertNotNull(names);
+        assertFalse(names.hasMoreElements());
+    }
+
+    @Test
+    public void getParameterMapIsNotDelegated() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+
+        replay(request);
+
+        Map parameters = wrapper.getParameterMap();
+
+        verify(request);
+        assertNotNull(parameters);
+        assertTrue(parameters.isEmpty());
+    }
+
+    @Test
+    public void getParameterIsNotDelegated() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+
+        replay(request);
+
+        String value = wrapper.getParameter("foo");
+
+        verify(request);
+        assertNull(value);
+    }
+
+    @Test
+    public void getParameterValuesIsNotDelegated() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+
+        replay(request);
+
+        String[] values = wrapper.getParameterValues("foo");
+
+        verify(request);
+        assertNull(values);
+    }
+
+    @Test
+    public void getParameterForSingleValue() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+        replay(request);
+
+        wrapper.addParameter("foo", "blah");
+
+        assertEquals(wrapper.getParameter("foo"), "blah");
+        verify(request);
+    }
+
+    @Test
+    public void getParameterForMultiValueGivesFirstValue() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+        replay(request);
+
+        wrapper.addParameter("foo", "blah");
+        wrapper.addParameter("foo", "another");
+
+        assertEquals(wrapper.getParameter("foo"), "blah");
+        verify(request);
+    }
+
+    @Test
+    public void getParameterValuesForMultiValueGivesAll() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+        replay(request);
+
+        wrapper.addParameter("foo", "blah");
+        wrapper.addParameter("foo", "another");
+
+        assertEquals(wrapper.getParameterValues("foo"), new String[]
+        { "blah", "another" });
+        verify(request);
+    }
+
+    @Test
+    public void getParameterNamesHasAllNames() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+        replay(request);
+
+        wrapper.addParameter("one", "blah");
+        wrapper.addParameter("two", "another");
+
+        Enumeration nameEnumerator = wrapper.getParameterNames();
+        Set<String> names = new HashSet<String>();
+        assertTrue(nameEnumerator.hasMoreElements());
+        names.add((String) nameEnumerator.nextElement());
+        assertTrue(nameEnumerator.hasMoreElements());
+        names.add((String) nameEnumerator.nextElement());
+
+        assertTrue(names.contains("one"));
+        assertTrue(names.contains("two"));
+        verify(request);
+    }
+
+    @Test
+    public void getParameterMapHasAllValues() throws Exception
+    {
+        HttpServletRequest request = createMock(HttpServletRequest.class);
+        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
+        replay(request);
+
+        wrapper.addParameter("single", "blah");
+        wrapper.addParameter("multi", "one");
+        wrapper.addParameter("multi", "two");
+
+        Map parameters = wrapper.getParameterMap();
+        assertEquals(parameters.size(), 2);
+        assertEquals(parameters.get("single"), "blah");
+        assertEquals((String[]) parameters.get("multi"), new String[]
+        { "one", "two" });
+
+        verify(request);
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/ParametersServletRequestWrapperTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/StubFileItem.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/StubFileItem.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/StubFileItem.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/StubFileItem.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,136 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.fileupload.FileItem;
+
+public class StubFileItem implements FileItem
+{
+    private String fileName;
+
+    private String value;
+
+    private String fieldName;
+
+    private boolean formField;
+
+    private boolean isDeleted;
+
+    public StubFileItem()
+    {
+    }
+
+    public StubFileItem(String fieldName)
+    {
+        this.fieldName = fieldName;
+    }
+
+    public InputStream getInputStream() throws IOException
+    {
+        return null;
+    }
+
+    public String getContentType()
+    {
+        return null;
+    }
+
+    public String getName()
+    {
+        return fileName;
+    }
+
+    public boolean isInMemory()
+    {
+        return true;
+    }
+
+    public long getSize()
+    {
+        return 10;
+    }
+
+    public byte[] get()
+    {
+        return new byte[0]; // To change body of implemented methods use File | Settings | File
+        // Templates.
+    }
+
+    public String getString(String string) throws UnsupportedEncodingException
+    {
+        return getString();
+    }
+
+    public String getString()
+    {
+        return value;
+    }
+
+    public void write(File file) throws Exception
+    {
+    }
+
+    public void delete()
+    {
+        isDeleted = true;
+    }
+
+    public String getFieldName()
+    {
+        return fieldName; // To change body of implemented methods use File | Settings | File
+        // Templates.
+    }
+
+    public void setFieldName(String fieldName)
+    {
+        this.fieldName = fieldName;
+    }
+
+    public boolean isFormField()
+    {
+        return formField;
+    }
+
+    public void setFormField(boolean formField)
+    {
+        this.formField = formField;
+    }
+
+    public OutputStream getOutputStream() throws IOException
+    {
+        return null;
+    }
+
+    public void setFileName(String fileName)
+    {
+        this.fileName = fileName;
+    }
+
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+
+    public boolean isDeleted()
+    {
+        return isDeleted;
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/StubFileItem.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/UploadedFileItemTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/UploadedFileItemTest.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/UploadedFileItemTest.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/UploadedFileItemTest.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,147 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.upload.services;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.io.input.NullInputStream;
+import org.apache.tapestry.test.TapestryTestCase;
+import org.testng.annotations.Test;
+
+public class UploadedFileItemTest extends TapestryTestCase
+{
+    @Test
+    public void contentTypeIsFileItemContentType() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        expect(item.getContentType()).andReturn("foo");
+
+        replay();
+
+        assertEquals(uploadedFile.getContentType(), "foo");
+
+        verify();
+    }
+
+    @Test
+    public void fileNameExtractedFromFileItemName() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        expect(item.getName()).andReturn("foo/blah.txt");
+
+        replay();
+
+        assertEquals(uploadedFile.getFileName(), "blah.txt");
+
+        verify();
+    }
+
+    @Test
+    public void filePathIsFileItemName() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        expect(item.getName()).andReturn("foo/blah.txt");
+
+        replay();
+
+        assertEquals(uploadedFile.getFilePath(), "foo/blah.txt");
+
+        verify();
+    }
+
+    @Test
+    public void sizeIsFileItemSize() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        expect(item.getSize()).andReturn(66l);
+
+        replay();
+
+        assertEquals(uploadedFile.getSize(), 66);
+
+        verify();
+    }
+
+    @Test
+    public void inMemoryIsFileItemInMemory() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        expect(item.isInMemory()).andReturn(true);
+
+        replay();
+
+        assertTrue(uploadedFile.isInMemory());
+
+        verify();
+    }
+
+    @Test
+    public void streamIsFileItemStream() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        InputStream stream = new NullInputStream(3);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        expect(item.getInputStream()).andReturn(stream);
+
+        replay();
+
+        assertSame(uploadedFile.getStream(), stream);
+
+        verify();
+    }
+
+    @Test
+    public void writeUsesFileItemWrite() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        File out = new File("");
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+
+        item.write(out);
+
+        replay();
+
+        uploadedFile.write(out);
+
+        verify();
+
+    }
+
+    @Test
+    public void cleanupCallsFileItemDelete() throws Exception
+    {
+        FileItem item = newMock(FileItem.class);
+        UploadedFileItem uploadedFile = new UploadedFileItem(item);
+        item.delete();
+
+        replay();
+        uploadedFile.cleanup();
+        verify();
+    }
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/apache/tapestry/upload/services/UploadedFileItemTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/Start.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/Start.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/Start.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/Start.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,45 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.example.upload.pages;
+
+import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.upload.services.UploadedFile;
+
+import java.io.File;
+
+public class Start
+{
+    public static final String TARGET_DIR = "target/tmp/";
+
+    @Persist
+    private UploadedFile _file;
+
+    public UploadedFile getFile()
+    {
+        return _file;
+    }
+
+    public void setFile(UploadedFile file)
+    {
+        _file = file;
+    }
+
+    public void onSuccess()
+    {
+        File copied = new File(TARGET_DIR + _file.getFileName());
+
+        _file.write(copied);
+    }
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/pages/Start.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java Sat Jun 16 09:34:04 2007
@@ -0,0 +1,29 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.example.upload.services;
+
+import org.apache.tapestry.ioc.annotations.SubModule;
+import org.apache.tapestry.upload.services.UploadModule;
+
+/**
+ * The SubModule is not normally needed, except that during tests of tapestry-upload, the necessary
+ * JAR Manifest does not yet exist, so we force the tapestry.upload module into the registry
+ * explicitly.
+ */
+@SubModule(UploadModule.class)
+public class AppModule
+{
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/Start.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/Start.html?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/Start.html (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/Start.html Sat Jun 16 09:34:04 2007
@@ -0,0 +1,36 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<!--
+   Copyright 2007 The Apache Software Foundation
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<head>
+    <title>Start Page</title>
+</head>
+<body>
+<p>
+    This test of the upload component
+</p>
+<t:form>
+    <t:errors/>
+    <t:label for="file"/>
+    <input t:type="upload" t:id="file" validate="required"/>
+    <br/>
+    <input type="submit" value="Upload"/>
+</t:form>
+<t:if test="file">
+    <p>File: ${file.filePath}</p>
+    <p>Size: ${file.size}</p>
+</t:if>
+</body>
+</html>
\ No newline at end of file

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/Start.html
------------------------------------------------------------------------------
    svn:executable = *

Added: tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/web.xml?view=auto&rev=547949
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/web.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/web.xml Sat Jun 16 09:34:04 2007
@@ -0,0 +1,33 @@
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">      
+<!-- 
+   Copyright 2007 The Apache Software Foundation
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<web-app>
+  <display-name>Tapestry-Upload Integration Test Application</display-name>
+  <context-param>
+    <param-name>tapestry.app-package</param-name>
+    <param-value>org.example.upload</param-value>
+  </context-param>
+  <filter>
+    <filter-name>app</filter-name>
+    <filter-class>org.apache.tapestry.TapestryFilter</filter-class>
+  </filter>
+  <filter-mapping>
+    <filter-name>app</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+    
+</web-app>

Propchange: tapestry/tapestry5/trunk/tapestry-upload/src/test/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message