From: Dave H. <hel...@us...> - 2015-06-21 22:07:29
|
Update of /cvsroot/sblim/jsr48-client/smpl/org/sblim/cimclient/samples In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23805/smpl/org/sblim/cimclient/samples Modified Files: Jsr48IndicationTester.java Log Message: 2736 Add indication flood test options Index: Jsr48IndicationTester.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/smpl/org/sblim/cimclient/samples/Jsr48IndicationTester.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Jsr48IndicationTester.java 21 Jun 2015 21:57:58 -0000 1.4 +++ Jsr48IndicationTester.java 21 Jun 2015 22:07:27 -0000 1.5 @@ -16,6 +16,7 @@ * 3529066 2012-07-06 hellerda Add Jsr48IndicationTester (initial version) * 2734 2014-05-16 hellerda Support file:// URL in destination handler * 2735 2014-05-16 hellerda Add configurable --wait time option + * 2736 2014-05-16 hellerda Add indication flood test options */ package org.sblim.cimclient.samples; @@ -401,6 +402,11 @@ System.out.println(" --wait WAIT Time to wait before shutting down and deleting the"); System.out.println(" subscription. A value of 0 means wait indefinitely"); System.out.println(" (register mode only. default: 0s)"); + System.out.println(" --count COUNT Number of indication triggers to send. A value of 0"); + System.out.println(" means send continously."); + System.out.println(" (trigger mode only. default: 1)"); + System.out.println(" --delay DELAY Delay between indication triggers"); + System.out.println(" (trigger mode only. default: 1s)"); } /** @@ -563,18 +569,31 @@ return; } + // Trigger the CIMOM to send a test indication to be caught by the listener if (trigger) { + int count = doubleDashOpts.containsKey("--count") ? Integer.parseInt(doubleDashOpts + .get("--count")) : 1; + int delay = doubleDashOpts.containsKey("--delay") ? Integer.parseInt(doubleDashOpts + .get("--delay")) : 1; + + if (count == 0) count = Integer.MAX_VALUE; + if (count == 1) delay = 0; + // SendTestIndication does not use any in/out parameters CIMArgument<?>[] input = new CIMArgument[0]; CIMArgument<?>[] output = new CIMArgument[0]; - // This will trigger a TestIndication that is caught by the - // remote listener - Object obj = client.invokeMethod(new CIMObjectPath(null, null, null, indicationNS, - indClassName, null), "SendTestIndication", input, output); - if (obj.toString().equals("0")) System.out - .println("Indication generated successfully."); - else System.out.println("Indication not generated successfully!"); + for (int i = 1;; i++) { + System.out.println("Sending indication" + + (count > 1 ? (" " + Integer.valueOf(i)) : "") + "..."); + Object obj = client.invokeMethod(new CIMObjectPath(null, null, null, + indicationNS, indClassName, null), "SendTestIndication", input, output); + if (obj.toString().equals("0")) System.out + .println("Indication generated successfully."); + else System.out.println("Indication not generated successfully!"); + if (i >= count) break; + Thread.sleep(1000 * delay); + } System.exit(0); } |