1 package org.hibernate.ejb.test.packaging; 3 4 import java.util.Set ; 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 17 public class JarVisitorTest extends TestCase { 18 public void testZippedJar() throws Exception { 19 String jarFileName = "./build/testresources/defaultpar.par"; 20 JarVisitor jarVisitor = new ZippedJarVisitor( jarFileName, true, true ); 21 assertEquals( "defaultpar", jarVisitor.getName() ); 22 Set <String > 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 { 30 String jarFileName = "./build/testresources/explodedpar.par"; 31 JarVisitor jarVisitor = new ExplodedJarVisitor( jarFileName, true, true ); 32 assertEquals( "explodedpar", jarVisitor.getName() ); 33 Set <String > 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 |