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: * @(#)TestJbiListStatisticsTask.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.ui.ant;
030:
031: import java.util.ArrayList;
032: import java.util.Iterator;
033: import java.util.List;
034: import java.util.Vector;
035: import junit.framework.TestCase;
036: import javax.management.openmbean.ArrayType;
037: import javax.management.openmbean.CompositeData;
038: import javax.management.openmbean.CompositeDataSupport;
039: import javax.management.openmbean.CompositeType;
040: import javax.management.openmbean.TabularData;
041: import javax.management.openmbean.TabularDataSupport;
042: import javax.management.openmbean.TabularType;
043: import javax.management.openmbean.OpenType;
044: import javax.management.openmbean.SimpleType;
045: import javax.management.openmbean.ArrayType;
046: import java.lang.Long;
047:
048: /**
049: * test class
050: * @author Sun Microsystems, Inc.
051: */
052: public class TestJbiListStatisticsTask extends TestCase {
053:
054: /**
055: * Creates a new instance of TestJbiListStatisticsTask
056: * @param aTestName name
057: */
058: public TestJbiListStatisticsTask(String aTestName) {
059: super (aTestName);
060: }
061:
062: /**
063: * Test the code for framework
064: */
065: public void testJbiListStatsForFramework() throws Exception {
066: JbiListStatisticsTask theTask = new JbiListStatisticsTask();
067: Class clazz = theTask.getClass();
068:
069: java.lang.reflect.Method mtd = clazz.getDeclaredMethod(
070: "printStatsForFramework", new Class[] {
071: javax.management.openmbean.TabularData.class,
072: java.lang.String.class,
073: java.io.PrintWriter.class });
074: mtd.setAccessible(true);
075:
076: String[] sItemNames = new String[] { "InstanceName",
077: "UpTime (ms)", "StartupTime (ms)" };
078:
079: String[] itemDesc = { "Instance Name", "Up Time",
080: "Startup Time" };
081:
082: OpenType[] rowAttrTypes = { SimpleType.STRING, SimpleType.LONG,
083: SimpleType.LONG };
084:
085: String[] rowIndex = new String[] { "InstanceName" };
086:
087: CompositeType fwkStatsCompositeType = new CompositeType(
088: "Framework Stats Compiste Data", "Name and value pair",
089: sItemNames, itemDesc, rowAttrTypes);
090:
091: TabularType fwkTabularTable = new TabularType(
092: "FrameworkStatsType", "List of framework stats",
093: fwkStatsCompositeType, rowIndex);
094:
095: TabularDataSupport tData = new TabularDataSupport(
096: fwkTabularTable);
097: // Add one entry
098: CompositeDataSupport cd = new CompositeDataSupport(
099: fwkStatsCompositeType, sItemNames, new Object[] {
100: "instance1", new Long(100000), new Long(100) });
101: CompositeDataSupport cd1 = new CompositeDataSupport(
102: fwkStatsCompositeType, sItemNames, new Object[] {
103: "instance2", new Long(200000), new Long(200) });
104: tData.put(cd);
105: tData.put(cd1);
106:
107: java.io.StringWriter stringWriter = new java.io.StringWriter();
108: java.io.PrintWriter msgWriter = new java.io.PrintWriter(
109: stringWriter);
110:
111: mtd.invoke(theTask,
112: new Object[] { tData, "target1", msgWriter });
113:
114: msgWriter.close();
115: java.lang.System.out.println(stringWriter.getBuffer()
116: .toString());
117: }
118:
119: /**
120: * Test the code for MNR
121: */
122: public void testJbiListStatsForNMR() throws Exception {
123: JbiListStatisticsTask theTask = new JbiListStatisticsTask();
124: Class clazz = theTask.getClass();
125:
126: java.lang.reflect.Method mtd = clazz.getDeclaredMethod(
127: "printStatsForNMR", new Class[] {
128: javax.management.openmbean.TabularData.class,
129: java.lang.String.class,
130: java.io.PrintWriter.class });
131: mtd.setAccessible(true);
132:
133: String[] sItemNames = new String[] { "InstanceName",
134: "ListActiveChannels", "ListActiveEndpoints" };
135:
136: String[] itemDesc = { "Instance Name", "List Active Channels",
137: "List Active Endpoints" };
138:
139: ArrayType stringArrayType = new ArrayType(1, SimpleType.STRING);
140: OpenType[] rowAttrTypes = { SimpleType.STRING, stringArrayType,
141: stringArrayType };
142:
143: String[] rowIndex = new String[] { "InstanceName" };
144:
145: CompositeType nmrStatsCompositeType = new CompositeType(
146: "NMR Stats Compiste Data", "Name and value pair",
147: sItemNames, itemDesc, rowAttrTypes);
148:
149: TabularType nmrTabularTable = new TabularType(
150: "FrameworkStatsType", "List of framework stats",
151: nmrStatsCompositeType, rowIndex);
152:
153: TabularDataSupport tData = new TabularDataSupport(
154: nmrTabularTable);
155: // Add one entry
156: CompositeDataSupport cd = new CompositeDataSupport(
157: nmrStatsCompositeType,
158: sItemNames,
159: new Object[] {
160: "instance1",
161: new String[] { "sun-http-binding",
162: "sun-http-binding", "sun-javaee-engine" },
163: new String[] {
164: "http://localhost/SynchronousSample,service1,endpoint1",
165: "http://localhost/New,service1,endpoint2",
166: "http://localhost/New,service1,endpoint2" } });
167:
168: CompositeDataSupport cd1 = new CompositeDataSupport(
169: nmrStatsCompositeType,
170: sItemNames,
171: new Object[] {
172: "instance2",
173: new String[] { "sun-http-binding",
174: "sun-http-binding", "sun-javaee-engine" },
175: new String[] {
176: "http://localhost/SynchronousSample,service1,endpoint1",
177: "http://localhost/New,service1,endpoint2",
178: "http://localhost/New,service1,endpoint2" } });
179: tData.put(cd);
180: tData.put(cd1);
181:
182: java.io.StringWriter stringWriter = new java.io.StringWriter();
183: java.io.PrintWriter msgWriter = new java.io.PrintWriter(
184: stringWriter);
185:
186: mtd.invoke(theTask,
187: new Object[] { tData, "target1", msgWriter });
188:
189: msgWriter.close();
190: java.lang.System.out.println(stringWriter.getBuffer()
191: .toString());
192:
193: }
194:
195: /**
196: * Test the code for component
197: */
198: public void testJbiListStatsForComponents() throws Exception {
199: JbiListStatisticsTask theTask = new JbiListStatisticsTask();
200: Class clazz = theTask.getClass();
201:
202: java.lang.reflect.Method mtd = clazz.getDeclaredMethod(
203: "printStatsForComponent", new Class[] {
204: java.lang.String.class,
205: javax.management.openmbean.TabularData.class,
206: java.lang.String.class,
207: java.io.PrintWriter.class,
208: java.lang.String.class });
209: mtd.setAccessible(true);
210:
211: String[] sItemNames = new String[] { "InstanceName",
212: "ComponentUpTime (ms)", "NumActivatedEndpoints",
213: "NumReceivedRequests", "NumSentRequests",
214: "NumReceivedReplies", "NumSentReplies",
215: "NumReceivedDONEs", "NumSentDONEs",
216: "NumReceivedFaults", "NumSentFaults",
217: "NumReceivedErrors", "NumSentErrors",
218: "NumCompletedExchanges", "NumActiveExchanges",
219: "NumErrorExchanges",
220: "MessageExchangeResponseTime Avg (ns)",
221: "MessageExchangeComponentTime Avg (ns)",
222: "MessageExchangeDeliveryTime Avg (ns)",
223: "MessageExchangeNMRTime Avg (ns)",
224: "ComponentExtensionStats" };
225:
226: String[] itemDesc = new String[] { "ComponentName",
227: "ComponentUpTime", "NumActivatedEndpoints",
228: "NumReceivedRequests", "NumSentRequests",
229: "NumReceivedReplies", "NumSentReplies",
230: "NumReceivedDONEs", "NumSentDONEs",
231: "NumReceivedFaults", "NumSentFaults",
232: "NumReceivedErrors", "NumSentErrors",
233: "NumCompletedExchanges", "NumActiveExchanges",
234: "NumErrorExchanges", "MEResponseTime",
235: "MEComponentTime", "MEDeliveryChannelTime",
236: "MEMessageServiceTime", "ComponentExtensionStats" };
237:
238: ArrayType stringArrayType = new ArrayType(1, SimpleType.STRING);
239:
240: String[] cpExtItemNames = new String[] { "ReceivedRequest",
241: "ListOfConsumingEndpoints",
242: "ListOfProvisioningEnpoints" };
243:
244: String[] cpExtItemDesc = new String[] { "ReceivedRequest",
245: "ListOfConsumingEndpoints",
246: "ListOfProvisioningEnpoints" };
247:
248: OpenType[] cpExtRowAttrTypes = { SimpleType.LONG,
249: stringArrayType, stringArrayType };
250:
251: CompositeType cpExtStatsCompositeType = new CompositeType(
252: "Component Ext. Stats Compiste Data",
253: "Name and value pair", cpExtItemNames, cpExtItemDesc,
254: cpExtRowAttrTypes);
255:
256: OpenType[] rowAttrTypes = { SimpleType.STRING, SimpleType.LONG,
257: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
258: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
259: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
260: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
261: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
262: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
263: cpExtStatsCompositeType };
264:
265: String[] rowIndex = new String[] { "InstanceName" };
266:
267: CompositeType cpStatsCompositeType = new CompositeType(
268: "Component Stats Compiste Data", "Name and value pair",
269: sItemNames, itemDesc, rowAttrTypes);
270:
271: TabularType cpTabularTable = new TabularType(
272: "ComponentStatsType", "List of compoent stats",
273: cpStatsCompositeType, rowIndex);
274:
275: TabularDataSupport tData = new TabularDataSupport(
276: cpTabularTable);
277:
278: CompositeDataSupport extCd = new CompositeDataSupport(
279: cpExtStatsCompositeType,
280: cpExtItemNames,
281: new Object[] {
282: new Long(10),
283: new String[] {
284: "http://localhost/SynchronousSample,service1,endpoint1",
285: "http://localhost/SynchronousSample,service1,endpoint2" },
286: new String[] { "http://localhost/SynchronousSample,service1,endpoint1" } });
287: // Add one entry
288: CompositeDataSupport cd = new CompositeDataSupport(
289: cpStatsCompositeType, sItemNames, new Object[] {
290: "component1", new Long(10), new Long(5),
291: new Long(5), new Long(10), new Long(10),
292: new Long(10), new Long(10), new Long(10),
293: new Long(10), new Long(10), new Long(10),
294: new Long(10), new Long(10), new Long(10),
295: new Long(10), new Long(10), new Long(10),
296: new Long(10), new Long(10), extCd });
297:
298: tData.put(cd);
299:
300: java.io.StringWriter stringWriter = new java.io.StringWriter();
301: java.io.PrintWriter msgWriter = new java.io.PrintWriter(
302: stringWriter);
303:
304: mtd.invoke(theTask, new Object[] { "Component1", tData,
305: "target1", msgWriter,
306: "----------------------------------" });
307:
308: msgWriter.close();
309: java.lang.System.out.println(stringWriter.getBuffer()
310: .toString());
311: }
312:
313: /**
314: * Test the code for service assembly
315: */
316: public void testJbiListStatsForServiceAssemblies() throws Exception {
317: JbiListStatisticsTask theTask = new JbiListStatisticsTask();
318: Class clazz = theTask.getClass();
319:
320: java.lang.reflect.Method mtd = clazz.getDeclaredMethod(
321: "printStatsForServiceAssembly", new Class[] {
322: javax.management.openmbean.TabularData.class,
323: java.lang.String.class,
324: java.io.PrintWriter.class,
325: java.lang.String.class });
326: mtd.setAccessible(true);
327:
328: String[] suItemNames = new String[] { "ServiceUnitName",
329: "ServiceUnitShutdownTime Avg (ms)",
330: "ServiceUnitStartupTime Avg (ms)",
331: "ServiceUnitStopTime Avg (ms)" };
332:
333: String[] suItemDesc = new String[] { "ServiceUnitName",
334: "ServiceUnitShutdownTime Avg (ms)",
335: "ServiceUnitStartupTime Avg (ms)",
336: "ServiceUnitStopTime Avg (ms)" };
337:
338: ArrayType stringArrayType = new ArrayType(1, SimpleType.STRING);
339:
340: OpenType[] suRowAttrTypes = { SimpleType.STRING,
341: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG };
342:
343: String[] suRowIndex = new String[] { "ServiceUnitName" };
344:
345: CompositeType suStatsCompositeType = new CompositeType(
346: "SU Stats Composite Data", "Name and value pair",
347: suItemNames, suItemDesc, suRowAttrTypes);
348:
349: String[] saItemNames = new String[] { "ServiceAssemblyName",
350: "LastStartupTime", "ShutdownTime Avg (ms)",
351: "StartupTime Avg (ms)", "StopTime Avg (ms)",
352: "ServiceUnitStatistics" };
353:
354: String[] saItemDesc = new String[] { "ServiceAssemblyName",
355: "LastStartupTime", "ShutdownTime Avg (ms)",
356: "StartupTime Avg (ms)", "StopTime Avg (ms)",
357: "ServiceUnitStatistics" };
358:
359: ArrayType suCompositeArrayType = new ArrayType(1,
360: suStatsCompositeType);
361:
362: OpenType[] saRowAttrTypes = { SimpleType.STRING,
363: SimpleType.DATE, SimpleType.LONG, SimpleType.LONG,
364: SimpleType.LONG, suCompositeArrayType };
365:
366: String[] saRowIndex = new String[] { "ServiceAssemblyName" };
367:
368: CompositeType saStatsCompositeType = new CompositeType(
369: "SA Stats Compiste Data", "Name and value pair",
370: saItemNames, saItemDesc, saRowAttrTypes);
371:
372: TabularType saTabularTable = new TabularType("SAStatsType",
373: "List of SA stats", saStatsCompositeType, saRowIndex);
374:
375: TabularDataSupport tData = new TabularDataSupport(
376: saTabularTable);
377: // Add one entry
378: CompositeDataSupport su1 = new CompositeDataSupport(
379: suStatsCompositeType, suItemNames, new Object[] {
380: "CompositeApp1-SU1", new Long(8), new Long(7),
381: new Long(6) });
382:
383: CompositeDataSupport su2 = new CompositeDataSupport(
384: suStatsCompositeType, suItemNames, new Object[] {
385: "CompositeApp1-SU2", new Long(0), new Long(0),
386: new Long(0) });
387:
388: CompositeDataSupport[] sus = new CompositeDataSupport[] { su1,
389: su2 };
390:
391: CompositeDataSupport sa = new CompositeDataSupport(
392: saStatsCompositeType, saItemNames, new Object[] {
393: "CompositeApp1",
394: java.util.Calendar.getInstance().getTime(),
395: new Long(1), new Long(47), new Long(39),
396: new CompositeDataSupport[] { su1, su2 } });
397:
398: tData.put(sa);
399:
400: java.io.StringWriter stringWriter = new java.io.StringWriter();
401: java.io.PrintWriter msgWriter = new java.io.PrintWriter(
402: stringWriter);
403:
404: mtd
405: .invoke(
406: theTask,
407: new Object[] { tData, "target1", msgWriter,
408: "---------------------------------------------------" });
409:
410: msgWriter.close();
411: java.lang.System.out.println(stringWriter.getBuffer()
412: .toString());
413: }
414:
415: /**
416: * Test the code for endpoint
417: */
418: public void testJbiListStatsForProviderEndpoints() throws Exception {
419: JbiListStatisticsTask theTask = new JbiListStatisticsTask();
420: Class clazz = theTask.getClass();
421:
422: java.lang.reflect.Method mtd = clazz.getDeclaredMethod(
423: "printStatsForEndpoint", new Class[] {
424: java.lang.String.class,
425: javax.management.openmbean.TabularData.class,
426: java.lang.String.class,
427: java.io.PrintWriter.class,
428: java.lang.String.class });
429: mtd.setAccessible(true);
430:
431: String[] providerEndpointItemNames = new String[] {
432: "InstanceName", "ActivationTime",
433: "EndpointUpTime (ms)", "NumActiveExchanges",
434: "NumReceivedRequests", "NumSentReplies",
435: "NumReceivedDONEs", "NumSentDONEs",
436: "NumReceivedFaults", "NumSentFaults",
437: "NumReceivedErrors", "NumSentErrors", "ComponentName",
438: "MessageExchangeResponseTime Avg (ns)",
439: "MessageExchangeComponentTime Avg (ns)",
440: "MessageExchangeDeliveryTime Avg (ns)",
441: "MessageExchangeNMRTime Avg (ns)",
442: "PerformanceMeasurements" };
443:
444: String[] providerEndpointItemDesc = new String[] {
445: "InstanceName", "ActivationTime", "UpTime",
446: "NumActiveExchanges", "NumReceivedRequests",
447: "NumSentReplies", "NumReceivedDONEs", "NumSentDONEs",
448: "NumReceivedFaults", "NumSentFaults",
449: "NumReceivedErrors", "NumSentErrors", "ComponentName",
450: "ME-ResponseTime-Avg", "ME-ComponentTime-Avg",
451: "ME-DeliveryChannelTime-Avg",
452: "ME-MessageServiceTime-Avg", "PerformanceMeasurements" };
453:
454: ArrayType stringArrayType = new ArrayType(1, SimpleType.STRING);
455:
456: String[] perfItemNames = new String[] { "MedianTime",
457: "FirstTime", "SubTopic" };
458:
459: String[] perfItemDesc = new String[] { "MedianTime",
460: "FirstTime", "SubTopic" };
461:
462: OpenType[] perfRowAttrTypes = { SimpleType.LONG,
463: SimpleType.LONG, SimpleType.STRING };
464:
465: CompositeType perfStatsCompositeType = new CompositeType(
466: "Performance Stats Compiste Data",
467: "Name and value pair", perfItemNames, perfItemDesc,
468: perfRowAttrTypes);
469:
470: String[] perfRowIndex = new String[] { "SubTopic" };
471:
472: TabularType perfTabularTable = new TabularType("PerfStatsType",
473: "List of SA stats", perfStatsCompositeType,
474: perfRowIndex);
475:
476: OpenType[] endpointRowAttrTypes = { SimpleType.STRING,
477: SimpleType.DATE, SimpleType.LONG, SimpleType.LONG,
478: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
479: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
480: SimpleType.LONG, SimpleType.LONG, SimpleType.STRING,
481: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
482: SimpleType.LONG, perfTabularTable };
483:
484: String[] endpointRowIndex = new String[] { "InstanceName" };
485:
486: CompositeType endpointStatsCompositeType = new CompositeType(
487: "ProviderEndpointStats", "Name and value pair",
488: providerEndpointItemNames, providerEndpointItemDesc,
489: endpointRowAttrTypes);
490:
491: TabularDataSupport perfTbData = new TabularDataSupport(
492: perfTabularTable);
493: // Add one entry
494: CompositeDataSupport perfData = new CompositeDataSupport(
495: perfStatsCompositeType, perfItemNames, new Object[] {
496: new Long(100), new Long(50), "Documentation" });
497: perfTbData.put(perfData);
498:
499: CompositeDataSupport endpointData = new CompositeDataSupport(
500: endpointStatsCompositeType,
501: providerEndpointItemNames,
502: new Object[] {
503: "http://localhost/SynchronousSample,service1,endpoint1 statistics",
504: java.util.Calendar.getInstance().getTime(),
505: new Long(10), new Long(10), new Long(10),
506: new Long(5), new Long(10), new Long(10),
507: new Long(5), new Long(10), new Long(10),
508: new Long(10), "sun-bpel-engine", new Long(10),
509: new Long(10), new Long(10), new Long(10),
510: perfTbData });
511:
512: TabularType endpointTabularTable = new TabularType(
513: "EndpointStatsType", "List of endpoint stats",
514: endpointStatsCompositeType, endpointRowIndex);
515:
516: TabularDataSupport endpointTbData = new TabularDataSupport(
517: endpointTabularTable);
518: endpointTbData.put(endpointData);
519:
520: java.io.StringWriter stringWriter = new java.io.StringWriter();
521: java.io.PrintWriter msgWriter = new java.io.PrintWriter(
522: stringWriter);
523:
524: mtd
525: .invoke(
526: theTask,
527: new Object[] {
528: "http://localhost/SynchronousSample,service1,endpoint1 statistics",
529: endpointTbData, "target1", msgWriter,
530: "-------------------------------------------------" });
531:
532: msgWriter.close();
533: java.lang.System.out.println(stringWriter.getBuffer()
534: .toString());
535: }
536:
537: /**
538: * Test the code for endpoint
539: */
540: public void testJbiListStatsForConsumerEndpoints() throws Exception {
541: JbiListStatisticsTask theTask = new JbiListStatisticsTask();
542: Class clazz = theTask.getClass();
543:
544: java.lang.reflect.Method mtd = clazz.getDeclaredMethod(
545: "printStatsForEndpoint", new Class[] {
546: java.lang.String.class,
547: javax.management.openmbean.TabularData.class,
548: java.lang.String.class,
549: java.io.PrintWriter.class,
550: java.lang.String.class });
551: mtd.setAccessible(true);
552:
553: String[] consumerEndpointItemNames = new String[] {
554: "InstanceName", "NumSentRequests",
555: "NumReceivedReplies", "NumReceivedDONEs",
556: "NumSentDONEs", "NumReceivedFaults", "NumSentFaults",
557: "NumReceivedErrors", "NumSentErrors",
558: "ME-ResponseTime-Avg", "ME-ComponentTime-Avg",
559: "ME-DeliveryChannelTime-Avg",
560: "ME-MessageServiceTime-Avg", "PerformanceMeasurements" };
561:
562: String[] consumerEndpointItemDesc = new String[] {
563: "InstanceName", "NumSentRequests",
564: "NumReceivedReplies", "NumReceivedDONEs",
565: "NumSentDONEs", "NumReceivedFaults", "NumSentFaults",
566: "NumReceivedErrors", "NumSentErrors",
567: "ME-ResponseTime-Avg", "ME-ComponentTime-Avg",
568: "ME-DeliveryChannelTime-Avg",
569: "ME-MessageServiceTime-Avg", "PerformanceMeasurements" };
570:
571: ArrayType stringArrayType = new ArrayType(1, SimpleType.STRING);
572:
573: String[] perfItemNames = new String[] { "MedianTime",
574: "FirstTime", "SubTopic" };
575:
576: String[] perfItemDesc = new String[] { "MedianTime",
577: "FirstTime", "SubTopic" };
578:
579: OpenType[] perfRowAttrTypes = { SimpleType.LONG,
580: SimpleType.LONG, SimpleType.STRING };
581:
582: CompositeType perfStatsCompositeType = new CompositeType(
583: "Performance Stats Compiste Data",
584: "Name and value pair", perfItemNames, perfItemDesc,
585: perfRowAttrTypes);
586:
587: String[] perfRowIndex = new String[] { "SubTopic" };
588:
589: TabularType perfTabularTable = new TabularType("PerfStatsType",
590: "List of SA stats", perfStatsCompositeType,
591: perfRowIndex);
592:
593: OpenType[] endpointRowAttrTypes = { SimpleType.STRING,
594: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
595: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
596: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
597: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
598: perfTabularTable };
599:
600: String[] endpointRowIndex = new String[] { "InstanceName" };
601:
602: CompositeType endpointStatsCompositeType = new CompositeType(
603: "ConsumerEndpointStats", "Name and value pair",
604: consumerEndpointItemNames, consumerEndpointItemDesc,
605: endpointRowAttrTypes);
606:
607: TabularDataSupport perfTbData = new TabularDataSupport(
608: perfTabularTable);
609: // Add one entry
610: CompositeDataSupport perfData = new CompositeDataSupport(
611: perfStatsCompositeType, perfItemNames, new Object[] {
612: new Long(100), new Long(50), "Documentation" });
613: perfTbData.put(perfData);
614:
615: CompositeDataSupport endpointData = new CompositeDataSupport(
616: endpointStatsCompositeType,
617: consumerEndpointItemNames,
618: new Object[] {
619: "http://localhost/SynchronousSample,service1,endpoint1 statistics",
620: new Long(10), new Long(10), new Long(10),
621: new Long(10), new Long(5), new Long(10),
622: new Long(10), new Long(5), new Long(10),
623: new Long(10), new Long(10), new Long(10),
624: perfTbData });
625:
626: TabularType endpointTabularTable = new TabularType(
627: "EndpointStatsType", "List of endpoint stats",
628: endpointStatsCompositeType, endpointRowIndex);
629:
630: TabularDataSupport endpointTbData = new TabularDataSupport(
631: endpointTabularTable);
632: endpointTbData.put(endpointData);
633:
634: java.io.StringWriter stringWriter = new java.io.StringWriter();
635: java.io.PrintWriter msgWriter = new java.io.PrintWriter(
636: stringWriter);
637:
638: mtd
639: .invoke(
640: theTask,
641: new Object[] {
642: "http://localhost/SynchronousSample,service1,endpoint1 statistics",
643: endpointTbData, "target1", msgWriter,
644: "------------------------------------------" });
645:
646: msgWriter.close();
647: java.lang.System.out.println(stringWriter.getBuffer()
648: .toString());
649: }
650:
651: /**
652: * main
653: /**
654: * main
655: * @param args the command line arguments
656: */
657: public static void main(String[] args) {
658: // TODO code application logic here
659: try {
660: TestJbiListStatisticsTask testInstance = new TestJbiListStatisticsTask(
661: "test");
662: // testInstance.testJbiListStatsForFramework();
663: // testInstance.testJbiListStatsForNMR();
664: // testInstance.testJbiListStatsForComponents();
665: } catch (Exception ex) {
666: ex.printStackTrace();
667: }
668: }
669: }
|