Source Code Cross Referenced for AnagramsMBeanTest.java in  » IDE-Netbeans » jmx » com » toy » anagrams » mbeans » 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 » IDE Netbeans » jmx » com.toy.anagrams.mbeans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * AnagramsMBeanTest.java
003:         *
004:         * Created on Wed May 11 09:37:26 MEST 2005
005:         */package com.toy.anagrams.mbeans;
006:
007:        import junit.framework.*;
008:        import javax.management.*;
009:        import java.lang.management.ManagementFactory;
010:        import javax.management.NotCompliantMBeanException;
011:
012:        public class AnagramsMBeanTest extends TestCase {
013:            public AnagramsMBeanTest(String testName) {
014:                super (testName);
015:            }
016:
017:            /**
018:             * Test of MaxThinkingTime Attribute
019:             */
020:            public void testMaxThinkingTimeAttribute() throws Exception {
021:                System.out.println("testMaxThinkingTimeAttribute");
022:
023:                // Get JMX MBean Attribute.
024:                Integer val = (Integer) getAttribute("MaxThinkingTime");
025:
026:                assertTrue("MaxThinkingTime is equals to 0", val == 0);
027:            }
028:
029:            /**
030:             * Test of MinThinkingTime Attribute
031:             */
032:            public void testMinThinkingTimeAttribute() throws Exception {
033:                System.out.println("testMinThinkingTimeAttribute");
034:
035:                // Get JMX MBean Attribute.
036:                Integer val = (Integer) getAttribute("MinThinkingTime");
037:
038:                assertTrue("MinThinkingTime is equals to 0", val == 0);
039:            }
040:
041:            /**
042:             * Test of CurrentAnagram Attribute
043:             */
044:            public void testCurrentAnagramAttribute() throws Exception {
045:                System.out.println("testCurrentAnagramAttribute");
046:
047:                // Get JMX MBean Attribute.
048:                String val = (String) getAttribute("CurrentAnagram");
049:
050:                assertTrue("CurrentAnagram is null", val == null);
051:            }
052:
053:            /**
054:             * Test of resetThinkingTimes() Operation
055:             */
056:            public void testResetThinkingTimesOperation() throws Exception {
057:                System.out.println("testresetThinkingTimesOperation");
058:
059:                // Operation signature.
060:                String[] signature = new String[] {};
061:
062:                Object[] params = new Object[] {};
063:
064:                // Invoke JMX MBean Operation.
065:                Object val = (Object) invoke("resetThinkingTimes", params,
066:                        signature);
067:
068:                assertTrue("reset returns value is void", val == null);
069:            }
070:
071:            public Object createMBean() throws NotCompliantMBeanException {
072:                return new AnagramsStats();
073:            }
074:
075:            protected void setUp() throws Exception {
076:                //JMX initialization
077:                jmxInit();
078:                //TODO add your own init code here
079:            }
080:
081:            protected void tearDown() throws Exception {
082:                //JMX termination
083:                jmxTerminate();
084:                //TODO add your own terminate code here
085:            }
086:
087:            public static Test suite() {
088:                TestSuite suite = new TestSuite(AnagramsMBeanTest.class);
089:                return suite;
090:            }
091:
092:            /** JMX Initialization methods.
093:             * WARNING: Do NOT modify this code.
094:             */
095:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
096:            //GEN-BEGIN:generatedCode 
097:            private Object getAttribute(String attName) throws Exception {
098:                return getMBeanServer().getAttribute(mbeanName, attName);
099:            }
100:
101:            private void setAttribute(Attribute att) throws Exception {
102:                getMBeanServer().setAttribute(mbeanName, att);
103:            }
104:
105:            private Object invoke(String opName, Object params[],
106:                    String signature[]) throws Exception {
107:                return getMBeanServer().invoke(mbeanName, opName, params,
108:                        signature);
109:            }
110:
111:            private void jmxInit() throws Exception {
112:                mbeanName = new ObjectName(":type=AnagramsMBean");
113:                Object mbean = createMBean();
114:                server = ManagementFactory.getPlatformMBeanServer();
115:                server.registerMBean(mbean, mbeanName);
116:            }
117:
118:            private void jmxTerminate() throws Exception {
119:                server.unregisterMBean(mbeanName);
120:            }
121:
122:            private MBeanServer getMBeanServer() {
123:                return server;
124:            }
125:
126:            private MBeanServer server;
127:            private ObjectName mbeanName;
128:            // </editor-fold> 
129:            //GEN-END:generatedCode 
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.