KickJava   Java API By Example, From Geeks To Geeks.

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


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
25 import javax.management.ObjectName JavaDoc;
26 import junit.framework.*;
27 import org.jboss.test.JBossTestCase;
28
29
30
31 /**
32  * JarInSarJSR77UnitTestCase.java
33  *
34  *
35  * Created: Sat Mar 2 23:54:55 2002
36  *
37  * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
38  * @version
39  */

40
41 public class JarInSarJSR77UnitTestCase extends JBossTestCase
42 {
43    public JarInSarJSR77UnitTestCase(String JavaDoc name)
44    {
45       super(name);
46    }
47
48    /**
49     * The <code>testFakeParentCreatedAndRemoved</code> method tests if a package
50     * consisting of a sar (which has no jsr-77 representation as of this writing)
51     * containing a jar (which does) gets deployed successfully with jsr-77 mbeans.
52     * in particular, a fake Application parent for the jar should be created.
53     * if and when the jsr77 support is extended to sars, this test should be reexamined.
54     *
55     *
56     * @exception Exception if an error occurs
57     */

58    public void testFakeParentCreatedAndRemoved() throws Exception JavaDoc
59    {
60       String JavaDoc testUrl = "jarinsar.sar";
61       getLog().debug("testUrl is : " + testUrl);
62       ObjectName JavaDoc fakeApp = new ObjectName JavaDoc("jboss.management.local:J2EEServer=Local,name=jarinsar.sar,j2eeType=J2EEApplication");
63       ObjectName JavaDoc ejbModule = new ObjectName JavaDoc("jboss.management.local:name=jarinsar.jar,J2EEServer=Local,J2EEApplication=jarinsar.sar,j2eeType=EJBModule");
64       ObjectName JavaDoc bean = new ObjectName JavaDoc("jboss.management.local:J2EEServer=Local,name=TestDataSource,J2EEApplication=jarinsar.sar,EJBModule=jarinsar.jar,j2eeType=StatelessSessionBean");
65
66       //deploy the test package.
67
deploy(testUrl);
68       try
69       {
70          assertTrue("fakeApp jsr-77 mbean is missing", getServer().isRegistered(fakeApp));
71          assertTrue("ejbModule jsr-77 mbean is missing", getServer().isRegistered(ejbModule));
72          assertTrue("bean jsr-77 mbean is missing", getServer().isRegistered(bean));
73       }
74       finally
75       {
76          undeploy(testUrl);
77          assertTrue("fakeApp jsr-77 mbean is still present", !getServer().isRegistered(fakeApp));
78          assertTrue("ejbModule jsr-77 mbean is still present", !getServer().isRegistered(ejbModule));
79          assertTrue("bean jsr-77 mbean is still present", !getServer().isRegistered(bean));
80
81       } // end of try-catch
82

83    }
84
85
86    
87 }// JarInSarJSR77UnitTestCase
88
Popular Tags