Source Code Cross Referenced for InheritanceTestCase.java in  » EJB-Server-JBoss-4.2.1 » testsuite » org » jboss » test » jbossmx » compliance » standard » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » testsuite » org.jboss.test.jbossmx.compliance.standard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jboss.test.jbossmx.compliance.standard;
023:
024:        import junit.framework.Test;
025:        import junit.framework.TestSuite;
026:
027:        import org.jboss.test.jbossmx.compliance.TestCase;
028:
029:        import org.jboss.test.jbossmx.compliance.standard.support.StandardDerived1;
030:        import org.jboss.test.jbossmx.compliance.standard.support.StandardDerived2;
031:        import org.jboss.test.jbossmx.compliance.standard.support.DynamicDerived1;
032:        import org.jboss.test.jbossmx.compliance.standard.support.StandardDerived3;
033:
034:        import javax.management.MBeanInfo;
035:        import javax.management.MBeanOperationInfo;
036:
037:        /**
038:         * Beat the heck out of the server's standard MBeanInfo inheritance handling
039:         *
040:         * @author  <a href="mailto:trevor@protocool.com">Trevor Squires</a>.
041:         */
042:        public class InheritanceTestCase extends TestCase {
043:            private static int attributeTestCount = 0;
044:            private static int operationTestCount = 0;
045:            private static int constructorTestCount = 0;
046:
047:            public InheritanceTestCase(String s) {
048:                super (s);
049:            }
050:
051:            public static Test suite() {
052:                TestSuite testSuite = new TestSuite(
053:                        "All MBeanInfo Torture Tests for Standard MBeans");
054:
055:                Object mbean = new StandardDerived1();
056:                MBeanInfo info = InfoUtil.getMBeanInfo(mbean,
057:                        "test:type=mbeaninfo");
058:
059:                addConstructorTest(testSuite, info, StandardDerived1.class
060:                        .getName(), new String[0]);
061:                testSuite.addTest(new TestCoverageTEST(
062:                        "StandardDerived1 constructor list length",
063:                        constructorTestCount, info.getConstructors().length));
064:                addAttributeTest(testSuite, info, "ParentValue", String.class
065:                        .getName(), false, true, false);
066:                addAttributeTest(testSuite, info, "Available", boolean.class
067:                        .getName(), false, true, false);
068:                testSuite.addTest(new TestCoverageTEST(
069:                        "StandardDerived1 attribute list length",
070:                        attributeTestCount, info.getAttributes().length));
071:                testSuite.addTest(new TestCoverageTEST(
072:                        "StandardDerived1 operation list length",
073:                        operationTestCount, info.getOperations().length));
074:
075:                resetCounters();
076:
077:                mbean = new StandardDerived2();
078:                info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
079:
080:                addConstructorTest(testSuite, info, StandardDerived2.class
081:                        .getName(), new String[0]);
082:                testSuite.addTest(new TestCoverageTEST(
083:                        "StandardDerived2 constructor list length",
084:                        constructorTestCount, info.getConstructors().length));
085:                addAttributeTest(testSuite, info, "DerivedValue", String.class
086:                        .getName(), false, true, false);
087:                addAttributeTest(testSuite, info, "ParentValue", String.class
088:                        .getName(), true, false, false);
089:                addSpuriousAttributeTest(testSuite, info, "Available");
090:                testSuite.addTest(new TestCoverageTEST(
091:                        "StandardDerived2 attribute list length",
092:                        attributeTestCount, info.getAttributes().length));
093:                testSuite.addTest(new TestCoverageTEST(
094:                        "StandardDerived2 operation list length",
095:                        operationTestCount, info.getOperations().length));
096:
097:                resetCounters();
098:
099:                mbean = new StandardDerived3();
100:                info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
101:
102:                addConstructorTest(testSuite, info, StandardDerived3.class
103:                        .getName(), new String[0]);
104:                testSuite.addTest(new TestCoverageTEST(
105:                        "StandardDerived3 constructor list length",
106:                        constructorTestCount, info.getConstructors().length));
107:                addAttributeTest(testSuite, info, "ArbitraryValue",
108:                        String.class.getName(), false, true, false);
109:                testSuite.addTest(new TestCoverageTEST(
110:                        "StandardDerived3 attribute list length",
111:                        attributeTestCount, info.getAttributes().length));
112:                testSuite.addTest(new TestCoverageTEST(
113:                        "StandardDerived3 operation list length",
114:                        operationTestCount, info.getOperations().length));
115:
116:                resetCounters();
117:
118:                mbean = new DynamicDerived1();
119:                info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
120:
121:                testSuite.addTest(new TestCoverageTEST(
122:                        "DynamicDerived1 constructor list length",
123:                        constructorTestCount, info.getConstructors().length));
124:                testSuite.addTest(new TestCoverageTEST(
125:                        "DynamicDerived1 attribute list length",
126:                        attributeTestCount, info.getAttributes().length));
127:                testSuite.addTest(new TestCoverageTEST(
128:                        "DynamicDerived1 operation list length",
129:                        operationTestCount, info.getOperations().length));
130:
131:                return testSuite;
132:            }
133:
134:            public static void resetCounters() {
135:                constructorTestCount = 0;
136:                attributeTestCount = 0;
137:                operationTestCount = 0;
138:            }
139:
140:            public static void addConstructorTest(TestSuite testSuite,
141:                    MBeanInfo info, String name, String[] signature) {
142:                testSuite.addTest(new ConstructorInfoTEST(
143:                        "InheritanceSUITE constructor", info, name, signature));
144:                constructorTestCount++;
145:            }
146:
147:            public static void addSpuriousAttributeTest(TestSuite testSuite,
148:                    MBeanInfo info, String name) {
149:                testSuite.addTest(new SpuriousAttributeTEST(
150:                        "InheritanceSUITE spuriousAttribute", info, name));
151:            }
152:
153:            public static void addAttributeTest(TestSuite testSuite,
154:                    MBeanInfo info, String name, String type, boolean read,
155:                    boolean write, boolean is) {
156:                testSuite.addTest(new AttributeInfoTEST(
157:                        "InheritanceSUITE attribute", info, name, type, read,
158:                        write, is));
159:                attributeTestCount++;
160:            }
161:
162:            public static void addOperationTest(TestSuite testSuite,
163:                    MBeanInfo info, String name, int impact, String returnType,
164:                    String[] signature) {
165:                testSuite.addTest(new OperationInfoTEST(
166:                        "InheritanceSUITE operation", info, name, impact,
167:                        returnType, signature));
168:                operationTestCount++;
169:            }
170:
171:            public static class TestCoverageTEST extends TestCase {
172:                private String msg;
173:                private int expected;
174:                private int got;
175:
176:                public TestCoverageTEST(String msg, int expected, int got) {
177:                    super ("testAdequateCoverage");
178:                    this .msg = msg;
179:                    this .expected = expected;
180:                    this .got = got;
181:                }
182:
183:                public void testAdequateCoverage() {
184:                    assertEquals(msg, expected, got);
185:                }
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.