KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > system > controller > instantiate > standard > test > StandardMBeanTest


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, 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.system.controller.instantiate.standard.test;
23
24 import javax.management.NotCompliantMBeanException JavaDoc;
25 import javax.management.ObjectName JavaDoc;
26
27 import org.jboss.system.ConfigurationException;
28 import org.jboss.test.system.controller.AbstractControllerTest;
29 import org.jboss.test.system.controller.support.SimpleMBean;
30
31 /**
32  * StandardMBeanTest.
33  *
34  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
35  * @version $Revision: 1.1 $
36  */

37 public abstract class StandardMBeanTest extends AbstractControllerTest
38 {
39    public StandardMBeanTest(String JavaDoc name)
40    {
41       super(name);
42    }
43    
44    public void testStandardMBean() throws Exception JavaDoc
45    {
46       ObjectName JavaDoc name = SimpleMBean.OBJECT_NAME;
47       assertInstall(name);
48       assertUninstall(name);
49    }
50    
51    public void testStandardMBeanInterface() throws Exception JavaDoc
52    {
53       ObjectName JavaDoc name = SimpleMBean.OBJECT_NAME;
54       assertInstall(name);
55       String JavaDoc result = (String JavaDoc) getServer().invoke(name, "echoReverse", new Object JavaDoc[] { "12345" }, new String JavaDoc[] { String JavaDoc.class.getName() });
56       assertEquals("54321", result);
57       assertUninstall(name);
58    }
59
60    public void testStandardMBeanInterfaceNotFound() throws Exception JavaDoc
61    {
62       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException JavaDoc.class);
63    }
64
65    public void testStandardMBeanInterfaceNotImplemented() throws Exception JavaDoc
66    {
67       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NotCompliantMBeanException JavaDoc.class);
68    }
69    
70    public void testStandardMBeanCodeMissing() throws Exception JavaDoc
71    {
72       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class);
73    }
74    
75    public void testStandardMBeanCodeEmpty() throws Exception JavaDoc
76    {
77       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class);
78    }
79
80    public void testStandardMBeanCodeClassNotFound() throws Exception JavaDoc
81    {
82       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException JavaDoc.class);
83    }
84    
85    public void testStandardMBeanAbstractClass() throws Exception JavaDoc
86    {
87       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, InstantiationException JavaDoc.class);
88    }
89
90    public void testStandardMBeanConstructorError() throws Exception JavaDoc
91    {
92       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, Error JavaDoc.class);
93    }
94    
95    public void testStandardMBeanConstructorException() throws Exception JavaDoc
96    {
97       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, RuntimeException JavaDoc.class);
98    }
99    
100    public void testStandardMBeanConstructorTypeNotFound() throws Exception JavaDoc
101    {
102       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException JavaDoc.class);
103    }
104    
105    public void testStandardMBeanConstructorInvalidType() throws Exception JavaDoc
106    {
107       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class);
108    }
109
110    public void testStandardMBeanConstructorInvalidValue() throws Exception JavaDoc
111    {
112       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NumberFormatException JavaDoc.class);
113    }
114 }
115
Popular Tags