KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > ejtools > management > test > ConnectivityTestCase


1 package net.sourceforge.ejtools.management.test;
2
3 import javax.management.j2ee.Management JavaDoc;
4 import javax.management.j2ee.ManagementHome JavaDoc;
5
6 import net.sourceforge.ejtools.management.util.MEJB;
7
8 import org.apache.log4j.Category;
9
10 /**
11  * @author laurent
12  *
13  * To change this generated comment edit the template variable "typecomment":
14  * Window>Preferences>Java>Templates.
15  * To enable and disable the creation of type comments go to
16  * Window>Preferences>Java>Code Generation.
17  */

18 public class ConnectivityTestCase extends ReportTestCase
19 {
20    /** Description of the Field */
21    private static Category logger = Category.getInstance(ConnectivityTestCase.class);
22
23     /**
24      * Constructor for ConnectivityTestCase.
25      */

26     public ConnectivityTestCase()
27     {
28         this("NONE");
29     }
30
31     /**
32      * Constructor for ConnectivityTestCase.
33      * @param arg0
34      */

35     public ConnectivityTestCase(String JavaDoc name)
36     {
37         super(name);
38       super.setFatal(false);
39     }
40
41    /** A unit test for JUnit */
42    public void testManagementEJB()
43    {
44       this.addInfo("mejb.binding", MEJB.getMEJBBinding());
45         
46       ManagementHome JavaDoc home = MEJB.lookupMEJB();
47       
48       this.vassert("Lookup of MEJB is OK", "Can't look up MEJB", (home != null));
49       
50       Management JavaDoc mejb = null;
51       try
52       {
53          mejb = home.create();
54       }
55       catch (Exception JavaDoc e)
56       {
57       }
58
59       this.vassert("Creation of MEJB is OK", "Can't create up MEJB", (mejb != null));
60       
61       if(mejb != null) {
62           this.addInfo("mejb.class.name", mejb.getClass().getName());
63           this.addInfo("mejb.default.domain", MEJB.getDefaultDomain());
64           this.addInfo("mejb.mbean.count", ""+ MEJB.getMBeanCount());
65       }
66    }
67 }
68
Popular Tags