KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jmx > test > DeployJarUnitTestCase


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.test.jmx.test;
23
24 import org.jboss.test.JBossTestCase;
25
26 /**
27  * Test deployments that should be accepted/rejected by the JARDeployer
28  *
29  * @author <a HREF="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
30  * @version $Revision: 43453 $
31  */

32 public class DeployJarUnitTestCase extends JBossTestCase
33 {
34    /**
35     * CTOR
36     */

37    public DeployJarUnitTestCase(String JavaDoc name)
38    {
39       super(name);
40    }
41
42    /**
43     * Deploy a valid jar file
44     */

45    public void testDeployValidJar() throws Exception JavaDoc
46    {
47       String JavaDoc module = "deployjar-valid.jar";
48       try
49       {
50          deploy(module);
51       }
52       finally
53       {
54          undeploy(module);
55       }
56    }
57
58    /**
59     * Deploy a valid jar file with a META-INF/subdir/empty-jboss-service.xml file
60     * see JBAS-2949
61     */

62    public void testDeployValidNestedJar() throws Exception JavaDoc
63    {
64       String JavaDoc module = "deployjar-valid-nested.jar";
65       try
66       {
67          deploy(module);
68       }
69       finally
70       {
71          undeploy(module);
72       }
73    }
74    
75    /**
76     * Deploy an invalid jar file with a META-INF/empty-jboss-service.xml file
77     *
78     * This should be rejected as a non-jar deployment (thus waiting for a deployer)
79     * because empty-jboss-service.xml matches either the default ".xml" or "jboss-service.xml"
80     * defined in in conf/xmdesc/org.jboss.deployment.JARDeployer-xmbean.xml, DescriptorNames.
81     */

82    public void testDeployInvalidJar() throws Exception JavaDoc
83    {
84       String JavaDoc module = "deployjar-invalid.jar";
85       try
86       {
87          deploy(module);
88          
89          // shouldn't reach this point
90
fail("Deployed invalid module: " + module);
91       }
92       catch (Exception JavaDoc e)
93       {
94          // expected
95
}
96    }
97 }
98
Popular Tags