commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject What is PersistenceHandlerFactory? Was Re: [Digester]How do you populate a map?
Date Tue, 11 Feb 2003 10:19:40 GMT
Hi,

On Tuesday 11 February 2003 12:57 am, pgarvie wrote:
> Embarrassed? Awww man forget it. Your example was well worth it and then
> some. Base on it, here's one way:
>
> public void testLibraryBook() throws SAXException, IOException
>      {
>          Digester digester = new Digester();
>          ClassLoader classLoader =
> PersistenceHandlerFactory.class.getClassLoader();
>          URL resource = classLoader.getResource("library.xml");
>          assertNotNull("Resource should not be null!!", resource);
>
>          digester.addObjectCreate("Library", HashMap.class);
>          digester.addCallMethod("Library/Book", "put", 2);
>          digester.addRule("Library/Book", new
> StringObjectCreateRule(String.class, "title"));
>          digester.addCallParam("Library/Book", 0, true);
>          digester.addRule("Library/Book", new
> LibraryBookCreateRule(LibraryBook.class, "title"));
>          digester.addCallParam("Library/Book", 1, true);
>          HashMap map = (HashMap)digester.parse(resource.toString());
>          assertNotNull("Hash map should not be null!!", map);
>          assertEquals("Based on the xml file, map should have size of 6",
> 6, map.size());
>      }
>

I looked around but couldn't work out for myself where 
PersistenceHandlerFactory comes from. Is it a junit class or a JDK 1.4 class 
or something else?

Thanks,
Janek

Mime
View raw message