1 17 18 package org.apache.geronimo.deployment.tools; 19 20 import java.net.URL ; 21 import java.util.Collections ; 22 import java.util.HashSet ; 23 import java.util.Set ; 24 import java.io.InputStream ; 25 import javax.enterprise.deploy.shared.ModuleType ; 26 import javax.enterprise.deploy.model.DDBeanRoot ; 27 28 import org.apache.geronimo.deployment.tools.loader.ClientDeployable; 29 import junit.framework.TestCase; 30 31 36 public class ClientDeployableTest extends TestCase { 37 private ClassLoader classLoader; 38 39 public void testLoadClient() throws Exception { 40 URL resource = classLoader.getResource("deployables/app-client1.jar"); 41 ClientDeployable deployable = new ClientDeployable(resource); 42 assertEquals(ModuleType.CAR, deployable.getType()); 43 Set entrySet = new HashSet (Collections.list(deployable.entries())); 44 Set resultSet = new HashSet (); 45 resultSet.add("META-INF/"); 46 resultSet.add("META-INF/MANIFEST.MF"); 47 resultSet.add("META-INF/application-client.xml"); 48 resultSet.add("Main.java"); 49 resultSet.add("Main.class"); 50 assertEquals(resultSet, entrySet); 51 InputStream entry = deployable.getEntry("META-INF/application-client.xml"); 52 assertNotNull(entry); 53 entry.close(); 54 Class main = deployable.getClassFromScope("Main"); 55 assertEquals("Main", main.getName()); 56 57 DDBeanRoot root = deployable.getDDBeanRoot(); 58 assertNotNull(root); 59 assertEquals(ModuleType.CAR, root.getType()); 60 assertEquals(deployable, root.getDeployableObject()); 61 } 62 63 protected void setUp() throws Exception { 64 classLoader = Thread.currentThread().getContextClassLoader(); 65 } 66 } 67 | Popular Tags |