KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > ejb > test > packaging > JarVisitorTest


1 //$Id: JarVisitorTest.java,v 1.5 2005/08/04 00:46:05 epbernard Exp $
2
package org.hibernate.ejb.test.packaging;
3
4 import java.util.Set JavaDoc;
5
6 import junit.framework.TestCase;
7 import org.hibernate.ejb.packaging.ExplodedJarVisitor;
8 import org.hibernate.ejb.packaging.JarVisitor;
9 import org.hibernate.ejb.packaging.ZippedJarVisitor;
10 import org.hibernate.ejb.test.pack.defaultpar.ApplicationServer;
11 import org.hibernate.ejb.test.pack.defaultpar.Mouse;
12 import org.hibernate.ejb.test.pack.explodedpar.Carpet;
13
14 /**
15  * @author Emmanuel Bernard
16  */

17 public class JarVisitorTest extends TestCase {
18     public void testZippedJar() throws Exception JavaDoc {
19         String JavaDoc jarFileName = "./build/testresources/defaultpar.par";
20         JarVisitor jarVisitor = new ZippedJarVisitor( jarFileName, true, true );
21         assertEquals( "defaultpar", jarVisitor.getName() );
22         Set JavaDoc<String JavaDoc> classes = jarVisitor.getClassNames();
23         assertEquals( 3, classes.size() );
24         assertTrue( classes.contains( ApplicationServer.class.getName() ) );
25         assertTrue( classes.contains( Mouse.class.getName() ) );
26         assertTrue( classes.contains( org.hibernate.ejb.test.pack.defaultpar.Version.class.getName() ) );
27     }
28
29     public void testExplodedJar() throws Exception JavaDoc {
30         String JavaDoc jarFileName = "./build/testresources/explodedpar.par";
31         JarVisitor jarVisitor = new ExplodedJarVisitor( jarFileName, true, true );
32         assertEquals( "explodedpar", jarVisitor.getName() );
33         Set JavaDoc<String JavaDoc> classes = jarVisitor.getClassNames();
34         assertEquals( 2, classes.size() );
35         assertEquals( 1, jarVisitor.getPackageNames().size() );
36         assertEquals( 1, jarVisitor.getHbmFiles().size() );
37         assertTrue( classes.contains( Carpet.class.getName() ) );
38     }
39 }
40
Popular Tags