KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > system > controller > instantiate > plain > test > PlainMBeanTest


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.plain.test;
23
24 import java.util.Collections JavaDoc;
25
26 import javax.management.NotCompliantMBeanException JavaDoc;
27 import javax.management.ObjectName JavaDoc;
28
29 import org.jboss.system.ConfigurationException;
30 import org.jboss.test.system.controller.AbstractControllerTest;
31 import org.jboss.test.system.controller.support.BrokenDynamicMBean;
32 import org.jboss.test.system.controller.support.PostDeregisterError;
33 import org.jboss.test.system.controller.support.PostRegisterError;
34 import org.jboss.test.system.controller.support.PreDeregisterError;
35 import org.jboss.test.system.controller.support.PreRegisterError;
36 import org.jboss.test.system.controller.support.SimpleMBean;
37
38 /**
39  * PlainMBeanTest.
40  *
41  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
42  * @version $Revision: 1.1 $
43  */

44 public abstract class PlainMBeanTest extends AbstractControllerTest
45 {
46    public PlainMBeanTest(String JavaDoc name)
47    {
48       super(name);
49    }
50    
51    public void testPlainMBean() throws Exception JavaDoc
52    {
53       ObjectName JavaDoc name = SimpleMBean.OBJECT_NAME;
54       assertInstall(name);
55       assertUninstall(name);
56    }
57    
58    public void testPlainMBeanCodeMissing() throws Exception JavaDoc
59    {
60       assertMaybeParseFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class);
61    }
62    
63    public void testPlainMBeanCodeEmpty() throws Exception JavaDoc
64    {
65       assertMaybeParseFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class);
66    }
67    
68    public void testPlainMBeanCodeClassNotFound() throws Exception JavaDoc
69    {
70       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException JavaDoc.class);
71    }
72    
73    public void testPlainMBeanNotMBean() throws Exception JavaDoc
74    {
75       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NotCompliantMBeanException JavaDoc.class);
76    }
77    
78    public void testPlainMBeanAbstractClass() throws Exception JavaDoc
79    {
80       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NotCompliantMBeanException JavaDoc.class);
81    }
82    
83    public void testPlainMBeanConstructorError() throws Exception JavaDoc
84    {
85       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, Error JavaDoc.class);
86    }
87    
88    public void testPlainMBeanConstructorException() throws Exception JavaDoc
89    {
90       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, RuntimeException JavaDoc.class);
91    }
92    
93    public void testPlainMBeanConstructorTypeNotFound() throws Exception JavaDoc
94    {
95       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException JavaDoc.class);
96    }
97    
98    public void testPlainMBeanConstructorInvalidType() throws Exception JavaDoc
99    {
100       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class);
101    }
102    
103    public void testPlainMBeanConstructorInvalidValue() throws Exception JavaDoc
104    {
105       assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NumberFormatException JavaDoc.class);
106    }
107    
108    public void testPlainMBeanGetMBeanInfoError() throws Exception JavaDoc
109    {
110       assertMaybeDeployFailure(BrokenDynamicMBean.OBJECT_NAME, Error JavaDoc.class);
111    }
112    
113    public void testPlainMBeanPreRegisterError() throws Exception JavaDoc
114    {
115       assertMaybeDeployFailure(PreRegisterError.OBJECT_NAME, Error JavaDoc.class);
116    }
117    
118    public void testPlainMBeanPostRegisterError() throws Exception JavaDoc
119    {
120       assertMaybeDeployFailure(PostRegisterError.OBJECT_NAME, Error JavaDoc.class);
121    }
122    
123    public void testPlainMBeanPreDeregisterError() throws Exception JavaDoc
124    {
125       ObjectName JavaDoc name = PreDeregisterError.OBJECT_NAME;
126       assertInstall(name);
127       uninstall(Collections.singletonList(name));
128       assertNoService(name);
129       assertRegistered(name);
130    }
131    
132    public void testPlainMBeanPostDeregisterError() throws Exception JavaDoc
133    {
134       ObjectName JavaDoc name = PostDeregisterError.OBJECT_NAME;
135       assertInstall(name);
136       assertUninstall(name);
137    }
138 }
139
Popular Tags