Source Code Cross Referenced for TestComponentStatistics.java in  » ESB » open-esb » com » sun » jbi » framework » 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 » ESB » open esb » com.sun.jbi.framework 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)TestComponentStatistics.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.framework;
030:
031:        /**
032:         * Tests for ComponentStatistics.
033:         *
034:         * @author Sun Microsystems, Inc.
035:         */
036:        public class TestComponentStatistics extends junit.framework.TestCase {
037:            /**
038:             * Instance of ComponentStatistics.
039:             */
040:            private ComponentStatistics mStats;
041:
042:            /**
043:             * The constructor for this testcase, forwards the test name to
044:             * the jUnit TestCase base class.
045:             * @param aTestName String with the name of this test.
046:             */
047:            public TestComponentStatistics(String aTestName) {
048:                super (aTestName);
049:            }
050:
051:            /**
052:             * Setup for the test. This creates the ComponentStatistics instance
053:             * and other objects needed for the tests.
054:             * @throws Exception when set up fails for any reason.
055:             */
056:            public void setUp() throws Exception {
057:                super .setUp();
058:
059:                mStats = new ComponentStatistics("TestComponent");
060:            }
061:
062:            /**
063:             * Cleanup for the test.
064:             * @throws Exception when tearDown fails for any reason.
065:             */
066:            public void tearDown() throws Exception {
067:                super .tearDown();
068:            }
069:
070:            // =============================  test methods ================================
071:
072:            /**
073:             * Tests get/setLastRestartTime.
074:             * @throws Exception if an unexpected error occurs.
075:             */
076:            public void testLastRestartTime() {
077:                java.util.Date d = new java.util.Date();
078:                mStats.setLastRestartTime(d);
079:                assertEquals("Failure on set/getLastRestartTime: ", d, mStats
080:                        .getLastRestartTime());
081:            }
082:
083:            /**
084:             * Tests get/incrementInitRequests.
085:             * @throws Exception if an unexpected error occurs.
086:             */
087:            public void testInitRequests() throws Exception {
088:                int n = 0;
089:                assertEquals("Failure on getInitRequests: ", new Integer(n),
090:                        new Integer(mStats.getInitRequests()));
091:                mStats.incrementInitRequests();
092:                ++n;
093:                assertEquals("Failure on incrementInitRequests: ", new Integer(
094:                        n), new Integer(mStats.getInitRequests()));
095:            }
096:
097:            /**
098:             * Tests get/incrementStartRequests.
099:             * @throws Exception if an unexpected error occurs.
100:             */
101:            public void testStartRequests() throws Exception {
102:                int n = 0;
103:                assertEquals("Failure on getStartRequests: ", new Integer(n),
104:                        new Integer(mStats.getStartRequests()));
105:                mStats.incrementStartRequests();
106:                ++n;
107:                assertEquals("Failure on incrementStartRequests: ",
108:                        new Integer(n), new Integer(mStats.getStartRequests()));
109:            }
110:
111:            /**
112:             * Tests get/incrementStopRequests.
113:             * @throws Exception if an unexpected error occurs.
114:             */
115:            public void testStopRequests() throws Exception {
116:                int n = 0;
117:                assertEquals("Failure on getStopRequests: ", new Integer(n),
118:                        new Integer(mStats.getStopRequests()));
119:                mStats.incrementStopRequests();
120:                ++n;
121:                assertEquals("Failure on incrementStopRequests: ", new Integer(
122:                        n), new Integer(mStats.getStopRequests()));
123:            }
124:
125:            /**
126:             * Tests get/incrementShutDownRequests.
127:             * @throws Exception if an unexpected error occurs.
128:             */
129:            public void testShutDownRequests() throws Exception {
130:                int n = 0;
131:                assertEquals("Failure on getShutDownRequests: ",
132:                        new Integer(n), new Integer(mStats
133:                                .getShutDownRequests()));
134:                mStats.incrementShutDownRequests();
135:                ++n;
136:                assertEquals("Failure on incrementShutDownRequests: ",
137:                        new Integer(n), new Integer(mStats
138:                                .getShutDownRequests()));
139:            }
140:
141:            /**
142:             * Tests get/incrementFailedRequests.
143:             * @throws Exception if an unexpected error occurs.
144:             */
145:            public void testFailedRequests() throws Exception {
146:                int n = 0;
147:                assertEquals("Failure on getFailedRequests: ", new Integer(n),
148:                        new Integer(mStats.getFailedRequests()));
149:                mStats.incrementFailedRequests();
150:                ++n;
151:                assertEquals("Failure on incrementFailedRequests: ",
152:                        new Integer(n), new Integer(mStats.getFailedRequests()));
153:            }
154:
155:            /**
156:             * Tests get/incrementTimedOutRequests.
157:             * @throws Exception if an unexpected error occurs.
158:             */
159:            public void testTimedOutRequests() throws Exception {
160:                int n = 0;
161:                assertEquals("Failure on getTimedOutRequests: ",
162:                        new Integer(n), new Integer(mStats
163:                                .getTimedOutRequests()));
164:                mStats.incrementTimedOutRequests();
165:                ++n;
166:                assertEquals("Failure on incrementTimedOutRequests: ",
167:                        new Integer(n), new Integer(mStats
168:                                .getTimedOutRequests()));
169:            }
170:
171:            /**
172:             * Tests get/increment/decrementDeployedSUs.
173:             * @throws Exception if an unexpected error occurs.
174:             */
175:            public void testDeployedSUs() throws Exception {
176:                short n = 0;
177:                assertEquals("Failure on getDeployedSUs: ", new Short(n),
178:                        new Short(mStats.getDeployedSUs()));
179:                mStats.incrementDeployedSUs();
180:                ++n;
181:                assertEquals("Failure on incrementDeployedSUs: ", new Short(n),
182:                        new Short(mStats.getDeployedSUs()));
183:                mStats.decrementDeployedSUs();
184:                --n;
185:                assertEquals("Failure on decrementDeployedSUs: ", new Short(n),
186:                        new Short(mStats.getDeployedSUs()));
187:            }
188:
189:            /**
190:             * Tests get/incrementDeploySURequests.
191:             * @throws Exception if an unexpected error occurs.
192:             */
193:            public void testDeploySURequests() throws Exception {
194:                int n = 0;
195:                assertEquals("Failure on getDeploySURequests: ",
196:                        new Integer(n), new Integer(mStats
197:                                .getDeploySURequests()));
198:                mStats.incrementDeploySURequests();
199:                ++n;
200:                assertEquals("Failure on incrementDeploySURequests: ",
201:                        new Integer(n), new Integer(mStats
202:                                .getDeploySURequests()));
203:            }
204:
205:            /**
206:             * Tests get/incrementUndeploySURequests.
207:             * @throws Exception if an unexpected error occurs.
208:             */
209:            public void testUndeploySURequests() throws Exception {
210:                int n = 0;
211:                assertEquals("Failure on getUndeploySURequests: ", new Integer(
212:                        n), new Integer(mStats.getUndeploySURequests()));
213:                mStats.incrementUndeploySURequests();
214:                ++n;
215:                assertEquals("Failure on incrementUndeploySURequests: ",
216:                        new Integer(n), new Integer(mStats
217:                                .getUndeploySURequests()));
218:            }
219:
220:            /**
221:             * Tests get/incrementInitSURequests.
222:             * @throws Exception if an unexpected error occurs.
223:             */
224:            public void testInitSURequests() throws Exception {
225:                int n = 0;
226:                assertEquals("Failure on getInitSURequests: ", new Integer(n),
227:                        new Integer(mStats.getInitSURequests()));
228:                mStats.incrementInitSURequests();
229:                ++n;
230:                assertEquals("Failure on incrementInitSURequests: ",
231:                        new Integer(n), new Integer(mStats.getInitSURequests()));
232:            }
233:
234:            /**
235:             * Tests get/incrementStartSURequests.
236:             * @throws Exception if an unexpected error occurs.
237:             */
238:            public void testStartSURequests() throws Exception {
239:                int n = 0;
240:                assertEquals("Failure on getStartSURequests: ", new Integer(n),
241:                        new Integer(mStats.getStartSURequests()));
242:                mStats.incrementStartSURequests();
243:                ++n;
244:                assertEquals("Failure on incrementStartSURequests: ",
245:                        new Integer(n),
246:                        new Integer(mStats.getStartSURequests()));
247:            }
248:
249:            /**
250:             * Tests get/incrementStopSURequests.
251:             * @throws Exception if an unexpected error occurs.
252:             */
253:            public void testStopSURequests() throws Exception {
254:                int n = 0;
255:                assertEquals("Failure on getStopSURequests: ", new Integer(n),
256:                        new Integer(mStats.getStopSURequests()));
257:                mStats.incrementStopSURequests();
258:                ++n;
259:                assertEquals("Failure on incrementStopSURequests: ",
260:                        new Integer(n), new Integer(mStats.getStopSURequests()));
261:            }
262:
263:            /**
264:             * Tests get/incrementShutDownSURequests.
265:             * @throws Exception if an unexpected error occurs.
266:             */
267:            public void testShutDownSURequests() throws Exception {
268:                int n = 0;
269:                assertEquals("Failure on getShutDownSURequests: ", new Integer(
270:                        n), new Integer(mStats.getShutDownSURequests()));
271:                mStats.incrementShutDownSURequests();
272:                ++n;
273:                assertEquals("Failure on incrementShutDownSURequests: ",
274:                        new Integer(n), new Integer(mStats
275:                                .getShutDownSURequests()));
276:            }
277:
278:            /**
279:             * Test resetAllStatistics.
280:             * @throws Exception if an unexpected error occurs.
281:             */
282:            public void testResetAllStatistics() {
283:                // First, populate one field in the framework statistics and one in
284:                // the message statistics. This is all that is necessary to verify
285:                // that both resetFrameworkStatistics() and resetMessagingStatistics()
286:                // were called.
287:
288:                mStats.incrementInitRequests();
289:
290:                // Now reset all statistics.
291:
292:                mStats.resetAllStatistics();
293:
294:                // Verify that both sets were reset.
295:
296:                Integer expected = new Integer(0);
297:                assertEquals("framework statistics not reset", expected,
298:                        new Integer(mStats.getInitRequests()));
299:            }
300:
301:            /**
302:             * Test resetFrameworkStatistics.
303:             * @throws Exception if an unexpected error occurs.
304:             */
305:            public void testResetFrameworkStatistics() {
306:                // First, populate all the fields with values. These methods are all
307:                // tested in other junit tests so they are assumed to work here.
308:
309:                mStats.incrementInitRequests();
310:                mStats.incrementStartRequests();
311:                mStats.incrementStopRequests();
312:                mStats.incrementShutDownRequests();
313:                mStats.incrementFailedRequests();
314:                mStats.incrementTimedOutRequests();
315:                mStats.incrementDeployedSUs();
316:                mStats.incrementDeploySURequests();
317:                mStats.incrementInitSURequests();
318:                mStats.incrementStartSURequests();
319:                mStats.incrementStopSURequests();
320:                mStats.incrementShutDownSURequests();
321:                mStats.incrementUndeploySURequests();
322:                mStats.incrementFailedSURequests();
323:                mStats.incrementTimedOutSURequests();
324:                mStats.incrementRegisteredServicesOrEndpoints();
325:
326:                // Now reset all the fields, then check to see if they all got reset.
327:
328:                mStats.resetFrameworkStatistics();
329:                Integer expected = new Integer(0);
330:                assertEquals("InitRequests not reset", expected, new Integer(
331:                        mStats.getInitRequests()));
332:                assertEquals("StartRequests not reset", expected, new Integer(
333:                        mStats.getStartRequests()));
334:                assertEquals("StopRequests not reset", expected, new Integer(
335:                        mStats.getStopRequests()));
336:                assertEquals("ShutDownRequests not reset", expected,
337:                        new Integer(mStats.getShutDownRequests()));
338:                assertEquals("FailedRequests not reset", expected, new Integer(
339:                        mStats.getFailedRequests()));
340:                assertEquals("TimedOutRequests not reset", expected,
341:                        new Integer(mStats.getTimedOutRequests()));
342:                assertEquals("DeployedSUs not reset", expected, new Integer(
343:                        mStats.getDeployedSUs()));
344:                assertEquals("DeploySURequests not reset", expected,
345:                        new Integer(mStats.getDeploySURequests()));
346:                assertEquals("InitSURequests not reset", expected, new Integer(
347:                        mStats.getInitSURequests()));
348:                assertEquals("StartSURequests not reset", expected,
349:                        new Integer(mStats.getStartSURequests()));
350:                assertEquals("StopSURequests not reset", expected, new Integer(
351:                        mStats.getStopSURequests()));
352:                assertEquals("ShutDownSURequests not reset", expected,
353:                        new Integer(mStats.getShutDownSURequests()));
354:                assertEquals("UndeploySURequests not reset", expected,
355:                        new Integer(mStats.getUndeploySURequests()));
356:                assertEquals("FailedSURequests not reset", expected,
357:                        new Integer(mStats.getFailedSURequests()));
358:                assertEquals("TimedOutSURequests not reset", expected,
359:                        new Integer(mStats.getTimedOutSURequests()));
360:                assertEquals("RegisteredServiceOrEndpoints not reset",
361:                        expected, new Integer(mStats
362:                                .getRegisteredServicesOrEndpoints()));
363:            }
364:
365:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.