KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.management.ObjectName JavaDoc;
25 import javax.naming.InitialContext JavaDoc;
26
27 import org.jboss.test.JBossTestCase;
28 import org.jboss.test.jmx.eardeployment.a.interfaces.SessionAHome;
29 import org.jboss.test.jmx.eardeployment.a.interfaces.SessionA;
30
31
32 /** Tests of Manifest ClassPath behavior.
33  *
34  * @author <a HREF="mailto:julien_viet@yahoo.fr">Julien Viet</a>
35  * @author Scott.Stark@jboss.org
36  * @version $Revision: 41301 $
37  */

38 public class CPManifestUnitTestCase extends JBossTestCase
39 {
40
41    public CPManifestUnitTestCase(String JavaDoc name)
42    {
43       super(name);
44    }
45
46    /** Test that an ear with the following structure:
47       cpmanifest.ear
48         -+ abstract.jar
49         -+ concrete.jar, -> ClassPath: abstract.jar
50     whose application.xml only refers to concrete.jar is able to deploy
51     because abstract.jar is loaded due to the concrete.jar manifest ClassPath.
52     */

53    public void testEarJarManifest() throws Exception JavaDoc
54    {
55       getLog().info("+++ testEarJarManifest");
56       deploy("cpmanifest.ear");
57       Object JavaDoc home = getInitialContext().lookup("Concrete");
58       getLog().info("Found Concrete home="+home);
59       undeploy("cpmanifest.ear");
60    }
61
62    /** Test that an ear with the following structure:
63       cpcircular-manifest.ear
64         -+ abstract2.jar, -> ClassPath: concrete2.jar
65         -+ concrete2.jar, -> ClassPath: abstract2.jar
66     whose application.xml only refers to concrete.jar does not cause the
67     server to spin due to the circular ClassPath references.
68     */

69    public void testCircularManifest() throws Exception JavaDoc
70    {
71       getLog().info("+++ testCircularManifest");
72       deploy("cpcircular-manifest.ear");
73       Object JavaDoc home = getInitialContext().lookup("Concrete");
74       getLog().info("Found Concrete home="+home);
75       undeploy("cpcircular-manifest.ear");
76    }
77
78    /** Test that an ear with the following structure:
79       external.ear
80         -+ external.sar, -> ClassPath: external-util.jar
81         -+ external-util.jar
82     whose jboss-app.xml only refers to external.sar is able to
83     load the mbean service in the external.sar
84     */

85    public void testSARManifest() throws Exception JavaDoc
86    {
87       getLog().info("+++ testSARManifest");
88       deploy("external.ear");
89       ObjectName JavaDoc serviceName = new ObjectName JavaDoc("test:name=ExternalClass");
90       boolean isRegisterd = getServer().isRegistered(serviceName);
91       assertTrue("ExternalClass service is registered", isRegisterd);
92       undeploy("external.ear");
93    }
94
95    /** Test that an ear with the following structure:
96       cpejbs-manifest.ear
97         -+ ejbjar1.jar, -> ClassPath: ejbjar2.jar
98         -+ ejbjar2.jar, -> ClassPath: ejbjar1.jar lib/cpm-util.jar
99     loads the ejbs.
100     */

101    public void testEJBJarManifest() throws Exception JavaDoc
102    {
103       getLog().info("+++ testEJBJarManifest");
104       deploy("cpejbs-manifest.ear");
105       ObjectName JavaDoc ejb1Name = new ObjectName JavaDoc("jboss.j2ee:service=EJB,jndiName=eardeployment/SessionA");
106       boolean isRegisterd = getServer().isRegistered(ejb1Name);
107       assertTrue("eardeployment/SessionA is registered", isRegisterd);
108       ObjectName JavaDoc ejb2Name = new ObjectName JavaDoc("jboss.j2ee:service=EJB,jndiName=eardeployment/SessionB");
109       isRegisterd = getServer().isRegistered(ejb2Name);
110       assertTrue("eardeployment/SessionB is registered", isRegisterd);
111
112         InitialContext JavaDoc ctx = new InitialContext JavaDoc();
113         SessionAHome home = (SessionAHome) ctx.lookup("eardeployment/SessionA");
114         SessionA bean = home.create();
115         bean.callB();
116         bean.remove();
117       undeploy("cpejbs-manifest.ear");
118    }
119 }
120
121
Popular Tags