Re: JDBC test script error" The result of 'TestRunner()' is not callable"
Marc Holden <[email protected]> Wed, 14 Oct 2015 13:06:25 +0000
| Newsgroups | gmane.comp.java.grinder.user |
|---|---|
| Message-ID | <CADV_OVX0_Zht0rdFZ9cWsCu8qQhK=cH_nEz=VCkJx7-7p=X-Zw@mail.gmail.com> |
--===============4265684709911712282== Content-Type: multipart/alternative; boundary=089e013d0bba6f0fe40522103b42 --089e013d0bba6f0fe40522103b42 Content-Type: text/plain; charset=UTF-8 Hi Gang, You need to uncomment out the __call__ method definition (line 189). Grinder uses that method as the entry point for the worker processes. -Marc On Wed, Oct 14, 2015 at 6:57 AM Gang Yan <[email protected]> wrote: > Hi all : > > > > I use JDBC.py script run performance testing . grinder log info: > > > > 2015-10-14 18:42:40,132 ERROR com-0 thread-24: aborting thread - {}The > result of 'TestRunner()' is not callable > > net.grinder.scriptengine.jython.JythonScriptExecutionException: The result > of 'TestRunner()' is not callable > > at > net.grinder.scriptengine.jython.JythonScriptEngine.createWorkerRunnable(JythonScriptEngine.java:183) > ~[grinder-core-3.11.jar:na] > > at > net.grinder.engine.process.GrinderProcess$ThreadStarterImplementation$2.create(GrinderProcess.java:784) > ~[grinder-core-3.11.jar:na] > > at > net.grinder.engine.process.GrinderThread.run(GrinderThread.java:90) > ~[grinder-core-3.11.jar:na] > > at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45] > > 2015-10-14 18:42:40,132 ERROR com-0 thread-3: aborting thread - {}The > result of 'TestRunner()' is not callable > > net.grinder.scriptengine.jython.JythonScriptExecutionException: The result > of 'TestRunner()' is not callable > > at > net.grinder.scriptengine.jython.JythonScriptEngine.createWorkerRunnable(JythonScriptEngine.java:183) > ~[grinder-core-3.11.jar:na] > > at > net.grinder.engine.process.GrinderProcess$ThreadStarterImplementation$2.create(GrinderProcess.java:784) > ~[grinder-core-3.11.jar:na] > > at > net.grinder.engine.process.GrinderThread.run(GrinderThread.java:90) > ~[grinder-core-3.11.jar:na] > > at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45] > > > > I modify script, but still error. Please help check it. > > > > I test script : > > > > # The sorting tes supports a configurable array length. > > # It runs the JavaTest.sort method of the JavaTest class. > > > > from net.grinder.script.Grinder import grinder > > from net.grinder.script import Test > > from datetime import datetime > > from datetime import timedelta > > from java.sql import DriverManager > > from oracle.jdbc import OracleDriver > > > > ######################################## > > # > > # main body of test script starts here > > # > > ######################################## > > > > # Get the propeties to access test configuration information > > properties = grinder.getProperties() > > > > # The description is a property (instead of a hardcoded string in this > script) > > #test = Test(1, properties.get("javatest.description")) > > test = Test(2, properties.get("javatest.description")) > > > > # select the method for which to collect information > > # test.record(WriteMulitpleLittleFile.write) > > > > # initialize data for compressing > > # fileName = properties.get("javatest.fileToCompress") > > # grinder.logger.info("data file to compress is " + fileName) > > # JavaTest.initializeCompression(fileName) > > > > # If the run mode is runOnce, the TestRunner class will > > # run once. Otherwise, if the run mode is continuous, > > # the TestRunner class will run the test for at least > > # the specified duration (but possibly longer) > > runMode = properties.get("javatest.runMode") > > #WriteMulitpleLittleFile.setParameters(dir, fileSize...) > > if runMode == "continuous": > > # figure out how long to run the test > > m = int(properties.getProperty("javatest.durationMinutes", "0")) > > h = int(properties.getProperty("javatest.durationHours", "0")) > > d = int(properties.getProperty("javatest.durationDays", "0")) > > duration = timedelta(minutes=m,hours=h,days=d) > > grinder.logger.info("run mode is continuous, duration is " + > str(duration)) > > elif runMode == "runOnce": > > grinder.logger.info("run mode is run once") > > duration = timedelta(minutes=0) > > else: > > grinder.logger.info("run mode not set or not recongized, default to run > once") > > duration = timedelta(minutes=0) > > > > ######################################## > > # > > # The TestRunner class is used by The Grinder to perform the test > > # > > ######################################## > > > > #test1 = Test(1, "Database insert") > > test2 = Test(2, "Database query") > > > > # Load the Oracle JDBC driver. > > DriverManager.registerDriver(OracleDriver()) > > > > def getConnection(): > > return DriverManager.getConnection( > > "jdbc:oracle:thin:@den00bvr.us.oracle.com:1521:orcl", "PBPUBLIC", > "PBPUBLIC") > > > > def ensureClosed(object): > > try: object.close() > > except: pass > > > > # One time initialisation that cleans out old data. > > connection = getConnection() > > statement = connection.createStatement() > > > > #try: statement.execute("drop table grinder_test1126") > > #except: pass > > > > #statement.execute("create table grinder_test1126(thread number, run > number)") > > > > ensureClosed(statement) > > ensureClosed(connection) > > > > class TestRunner: > > def __init__(self): > > # tid = grinder.threadNumber > > > > # if (grinder.threadNumber % 2 == 0): > > # Even threadNumber > > # Do insertStatement > > # else: > > # Odd threadNumber > > # Do queryStatement > > > > # def __call__(self): > > # self.testRunner() > > > > endTime = datetime.now() + duration > > notDone = True > > while notDone: > > connection = None > > insertStatement = None > > queryStatement = None > > notDone = datetime.now() < endTime > > > > try: > > connection = getConnection() > > # insertStatement = connection.createStatement() > > queryStatement = connection.createStatement() > > > > # test1.record(insertStatement) > > # insertStatement.execute("insert into grinder_test1126 > values(%d, %d)" % > > # (grinder.threadNumber, > grinder.runNumber)) > > > > test2.record(queryStatement) > > queryStatement.execute("select * from employee") > > > > finally: > > # ensureClosed(insertStatement) > > ensureClosed(queryStatement) > > ensureClosed(connection) > > > > ------------------------------------------------------------------------------ > _______________________________________________ > grinder-use mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/grinder-use > --089e013d0bba6f0fe40522103b42 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi Gang,<div><br></div><div>You need to uncomment out the = __call__ method definition (line 189).=C2=A0 Grinder uses that method as th= e entry point for the worker processes.</div><div><br></div><div>-Marc</div= ></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Wed, Oct 14, 2015= at 6:57 AM Gang Yan <<a href=3D"mailto:[email protected]">yan.gang@or= acle.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D= "margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang= =3D"ZH-CN" link=3D"blue" vlink=3D"purple"><div><div><div><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">Hi all :<u></u><u></u></span= ></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;= font-family:"Calibri","sans-serif";color:#1f497d"><u></= u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style= =3D"font-size:10.5pt;font-family:"Calibri","sans-serif"= ;color:#1f497d">I use JDBC.py script run=C2=A0 performance testing . grinde= r log info:<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN= -US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-s= erif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">2015-10-14 18:42:40,132 ERRO= R com-0 thread-24: aborting thread - {}The result of 'TestRunner()'= is not callable<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang= =3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","= sans-serif";color:#1f497d">net.grinder.scriptengine.jython.JythonScrip= tExecutionException: The result of 'TestRunner()' is not callable<u= ></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D= "font-size:10.5pt;font-family:"Calibri","sans-serif";co= lor:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at net.grinder.scri= ptengine.jython.JythonScriptEngine.createWorkerRunnable(JythonScriptEngine.= java:183) ~[grinder-core-3.11.jar:na]<u></u><u></u></span></p><p class=3D"M= soNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= Calibri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 at net.grinder.engine.process.GrinderProcess$ThreadSt= arterImplementation$2.create(GrinderProcess.java:784) ~[grinder-core-3.11.j= ar:na]<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" = style=3D"font-size:10.5pt;font-family:"Calibri","sans-serif&= quot;;color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at net.grin= der.engine.process.GrinderThread.run(GrinderThread.java:90) ~[grinder-core-= 3.11.jar:na]<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"E= N-US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-= serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at ja= va.lang.Thread.run(Thread.java:744) [na:1.7.0_45]<u></u><u></u></span></p><= p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-f= amily:"Calibri","sans-serif";color:#1f497d">2015-10-14 = 18:42:40,132 ERROR com-0 thread-3: aborting thread - {}The result of 'T= estRunner()' is not callable<u></u><u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">net.grinder.scriptengine.jyt= hon.JythonScriptExecutionException: The result of 'TestRunner()' is= not callable<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"= EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","sans= -serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at n= et.grinder.scriptengine.jython.JythonScriptEngine.createWorkerRunnable(Jyth= onScriptEngine.java:183) ~[grinder-core-3.11.jar:na]<u></u><u></u></span></= p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;fon= t-family:"Calibri","sans-serif";color:#1f497d">=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at net.grinder.engine.process.GrinderP= rocess$ThreadStarterImplementation$2.create(GrinderProcess.java:784) ~[grin= der-core-3.11.jar:na]<u></u><u></u></span></p><p class=3D"MsoNormal"><span = lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&q= uot;sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 at net.grinder.engine.process.GrinderThread.run(GrinderThread.java:90) = ~[grinder-core-3.11.jar:na]<u></u><u></u></span></p><p class=3D"MsoNormal">= <span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&qu= ot;,"sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]<u></u><u><= /u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-siz= e:10.5pt;font-family:"Calibri","sans-serif";color:#1f49= 7d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-= US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-se= rif";color:#1f497d">I modify script, but still =C2=A0error. Please hel= p check it.<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN= -US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-s= erif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">I =C2=A0test script :<u></u>= <u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font= -size:10.5pt;font-family:"Calibri","sans-serif";color:#= 1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D= "EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","san= s-serif";color:#1f497d"># The sorting tes=C2=A0 supports a configurabl= e array length.<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang= =3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","= sans-serif";color:#1f497d"># It runs the JavaTest.sort method of the J= avaTest class.<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D= "EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","san= s-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"Mso= Normal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Ca= libri","sans-serif";color:#1f497d">from net.grinder.script.G= rinder import grinder<u></u><u></u></span></p><p class=3D"MsoNormal"><span = lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&q= uot;sans-serif";color:#1f497d">from net.grinder.script import Test<u><= /u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"f= ont-size:10.5pt;font-family:"Calibri","sans-serif";colo= r:#1f497d">from datetime import datetime<u></u><u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">from datetime impo= rt timedelta<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"E= N-US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-= serif";color:#1f497d">from java.sql import DriverManager<u></u><u></u>= </span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:1= 0.5pt;font-family:"Calibri","sans-serif";color:#1f497d"= >from oracle.jdbc import OracleDriver<u></u><u></u></span></p><p class=3D"M= soNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= Calibri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></s= pan></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5= pt;font-family:"Calibri","sans-serif";color:#1f497d">##= ######################################<u></u><u></u></span></p><p class=3D"= MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= ;Calibri","sans-serif";color:#1f497d">#<u></u><u></u></span>= </p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;f= ont-family:"Calibri","sans-serif";color:#1f497d"># main= body of test script starts here<u></u><u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">#<u></u><u></u></span></p><p= class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fa= mily:"Calibri","sans-serif";color:#1f497d">############= ############################<u></u><u></u></span></p><p class=3D"MsoNormal"= ><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&q= uot;,"sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><= p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-f= amily:"Calibri","sans-serif";color:#1f497d"># Get the p= ropeties to access test configuration information<u></u><u></u></span></p><= p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-f= amily:"Calibri","sans-serif";color:#1f497d">properties = =3D grinder.getProperties()<u></u><u></u></span></p><p class=3D"MsoNormal">= <span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&qu= ot;,"sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p= class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fa= mily:"Calibri","sans-serif";color:#1f497d"># The descri= ption is a property (instead of a hardcoded string in this script)<u></u><u= ></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-s= ize:10.5pt;font-family:"Calibri","sans-serif";color:#1f= 497d">#test =3D Test(1, properties.get("javatest.description"))<u= ></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D= "font-size:10.5pt;font-family:"Calibri","sans-serif";co= lor:#1f497d">test =3D Test(2, properties.get("javatest.description&quo= t;))<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" st= yle=3D"font-size:10.5pt;font-family:"Calibri","sans-serif&qu= ot;;color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><s= pan lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri"= ;,"sans-serif";color:#1f497d"># select the method for which to co= llect information<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang= =3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","= sans-serif";color:#1f497d"># test.record(WriteMulitpleLittleFile.write= )<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style= =3D"font-size:10.5pt;font-family:"Calibri","sans-serif"= ;color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span= lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&= quot;sans-serif";color:#1f497d"># initialize data for compressing<u></= u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"fo= nt-size:10.5pt;font-family:"Calibri","sans-serif";color= :#1f497d"># fileName =3D properties.get("javatest.fileToCompress"= )<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style= =3D"font-size:10.5pt;font-family:"Calibri","sans-serif"= ;color:#1f497d"># <a href=3D"http://grinder.logger.info" target=3D"_blank">= grinder.logger.info</a>("data file to compress is " + fileName)<u= ></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D= "font-size:10.5pt;font-family:"Calibri","sans-serif";co= lor:#1f497d"># JavaTest.initializeCompression(fileName)<u></u><u></u></span= ></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;= font-family:"Calibri","sans-serif";color:#1f497d"><u></= u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style= =3D"font-size:10.5pt;font-family:"Calibri","sans-serif"= ;color:#1f497d"># If the run mode is runOnce, the TestRunner class will<u><= /u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"f= ont-size:10.5pt;font-family:"Calibri","sans-serif";colo= r:#1f497d"># run once.=C2=A0 Otherwise, if the run mode is continuous,<u></= u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"fo= nt-size:10.5pt;font-family:"Calibri","sans-serif";color= :#1f497d"># the TestRunner class will run the test for at least<u></u><u></= u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size= :10.5pt;font-family:"Calibri","sans-serif";color:#1f497= d"># the specified duration (but possibly longer)<u></u><u></u></span></p><= p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-f= amily:"Calibri","sans-serif";color:#1f497d">runMode =3D= properties.get("javatest.runMode")<u></u><u></u></span></p><p cl= ass=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-famil= y:"Calibri","sans-serif";color:#1f497d">#WriteMulitpleL= ittleFile.setParameters(dir, fileSize...)<u></u><u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">if runMode =3D=3D = "continuous":<u></u><u></u></span></p><p class=3D"MsoNormal"><spa= n lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",= "sans-serif";color:#1f497d">=C2=A0 # figure out how long to run t= he test<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US"= style=3D"font-size:10.5pt;font-family:"Calibri","sans-serif= ";color:#1f497d">=C2=A0 m =3D int(properties.getProperty("javates= t.durationMinutes", "0"))<u></u><u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">=C2=A0 h =3D int(p= roperties.getProperty("javatest.durationHours", "0"))<u= ></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D= "font-size:10.5pt;font-family:"Calibri","sans-serif";co= lor:#1f497d">=C2=A0 d =3D int(properties.getProperty("javatest.duratio= nDays", "0"))<u></u><u></u></span></p><p class=3D"MsoNormal"= ><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&q= uot;,"sans-serif";color:#1f497d">=C2=A0 duration =3D timedelta(mi= nutes=3Dm,hours=3Dh,days=3Dd)<u></u><u></u></span></p><p class=3D"MsoNormal= "><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&= quot;,"sans-serif";color:#1f497d">=C2=A0 <a href=3D"http://grinde= r.logger.info" target=3D"_blank">grinder.logger.info</a>("run mode is = continuous, duration is " + str(duration))<u></u><u></u></span></p><p = class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fam= ily:"Calibri","sans-serif";color:#1f497d">elif runMode = =3D=3D "runOnce":<u></u><u></u></span></p><p class=3D"MsoNormal">= <span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&qu= ot;,"sans-serif";color:#1f497d">=C2=A0 <a href=3D"http://grinder.= logger.info" target=3D"_blank">grinder.logger.info</a>("run mode is ru= n once")<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"= EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","sans= -serif";color:#1f497d">=C2=A0 duration =3D timedelta(minutes=3D0)<u></= u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"fo= nt-size:10.5pt;font-family:"Calibri","sans-serif";color= :#1f497d">else:<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang= =3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","= sans-serif";color:#1f497d">=C2=A0 <a href=3D"http://grinder.logger.inf= o" target=3D"_blank">grinder.logger.info</a>("run mode not set or not = recongized, default to run once")<u></u><u></u></span></p><p class=3D"= MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= ;Calibri","sans-serif";color:#1f497d">=C2=A0 duration =3D ti= medelta(minutes=3D0)<u></u><u></u></span></p><p class=3D"MsoNormal"><span l= ang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&qu= ot;sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">##################= ######################<u></u><u></u></span></p><p class=3D"MsoNormal"><span= lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&= quot;sans-serif";color:#1f497d">#<u></u><u></u></span></p><p class=3D"= MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= ;Calibri","sans-serif";color:#1f497d"># The TestRunner class= is used by The Grinder to perform the test<u></u><u></u></span></p><p clas= s=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:= "Calibri","sans-serif";color:#1f497d">#<u></u><u></u></= span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.= 5pt;font-family:"Calibri","sans-serif";color:#1f497d">#= #######################################<u></u><u></u></span></p><p class=3D= "MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&quo= t;Calibri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u><= /span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10= .5pt;font-family:"Calibri","sans-serif";color:#1f497d">= #test1 =3D Test(1, "Database insert")<u></u><u></u></span></p><p = class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fam= ily:"Calibri","sans-serif";color:#1f497d">test2 =3D Tes= t(2, "Database query")<u></u><u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span><= /p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;fo= nt-family:"Calibri","sans-serif";color:#1f497d"># Load = the Oracle JDBC driver.<u></u><u></u></span></p><p class=3D"MsoNormal"><spa= n lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",= "sans-serif";color:#1f497d">DriverManager.registerDriver(OracleDr= iver())<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US"= style=3D"font-size:10.5pt;font-family:"Calibri","sans-serif= ";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"= ><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&q= uot;,"sans-serif";color:#1f497d">def getConnection():<u></u><u></= u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size= :10.5pt;font-family:"Calibri","sans-serif";color:#1f497= d">=C2=A0=C2=A0=C2=A0 return DriverManager.getConnection(<u></u><u></u></sp= an></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5p= t;font-family:"Calibri","sans-serif";color:#1f497d">=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "jdbc:oracle:thin:@den00bvr.us= .oracle.com:1521:orcl", "PBPUBLIC", "PBPUBLIC")<u>= </u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"= font-size:10.5pt;font-family:"Calibri","sans-serif";col= or:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lan= g=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","= ;sans-serif";color:#1f497d">def ensureClosed(object):<u></u><u></u></s= pan></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5= pt;font-family:"Calibri","sans-serif";color:#1f497d">= =C2=A0=C2=A0=C2=A0 try: object.close()<u></u><u></u></span></p><p class=3D"= MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= ;Calibri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0 exc= ept: pass<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-U= S" style=3D"font-size:10.5pt;font-family:"Calibri","sans-ser= if";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNorma= l"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri= ","sans-serif";color:#1f497d"># One time initialisation that= cleans out old data.<u></u><u></u></span></p><p class=3D"MsoNormal"><span = lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&q= uot;sans-serif";color:#1f497d">connection =3D getConnection()<u></u><u= ></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-s= ize:10.5pt;font-family:"Calibri","sans-serif";color:#1f= 497d">statement =3D connection.createStatement()<u></u><u></u></span></p><p= class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fa= mily:"Calibri","sans-serif";color:#1f497d"><u></u>=C2= =A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"f= ont-size:10.5pt;font-family:"Calibri","sans-serif";colo= r:#1f497d">#try: statement.execute("drop table grinder_test1126")= <u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style= =3D"font-size:10.5pt;font-family:"Calibri","sans-serif"= ;color:#1f497d">#except: pass<u></u><u></u></span></p><p class=3D"MsoNormal= "><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&= quot;,"sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p>= <p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-= family:"Calibri","sans-serif";color:#1f497d">#statement= .execute("create table grinder_test1126(thread number, run number)&quo= t;)<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" sty= le=3D"font-size:10.5pt;font-family:"Calibri","sans-serif&quo= t;;color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><sp= an lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri"= ,"sans-serif";color:#1f497d">ensureClosed(statement)<u></u><u></u= ></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:= 10.5pt;font-family:"Calibri","sans-serif";color:#1f497d= ">ensureClosed(connection)<u></u><u></u></span></p><p class=3D"MsoNormal"><= span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&quo= t;,"sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p = class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fam= ily:"Calibri","sans-serif";color:#1f497d">class TestRun= ner:<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" st= yle=3D"font-size:10.5pt;font-family:"Calibri","sans-serif&qu= ot;;color:#1f497d">=C2=A0=C2=A0 def __init__(self):<u></u><u></u></span></p= ><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font= -family:"Calibri","sans-serif";color:#1f497d">#=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tid =3D grinder.threadNumber<u></u><u>= </u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-si= ze:10.5pt;font-family:"Calibri","sans-serif";color:#1f4= 97d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN= -US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-s= erif";color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (g= rinder.threadNumber % 2 =3D=3D 0):<u></u><u></u></span></p><p class=3D"MsoN= ormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Cal= ibri","sans-serif";color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Even threadNumber<u></u><u= ></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-s= ize:10.5pt;font-family:"Calibri","sans-serif";color:#1f= 497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Do insertStatement<u></u><u></u></span></p><p class=3D"MsoNormal"><s= pan lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri"= ;,"sans-serif";color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 else:<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang= =3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","= sans-serif";color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Odd threadNumber<u></u><u></u></span></p><p = class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-fam= ily:"Calibri","sans-serif";color:#1f497d">#=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Do queryStatem= ent<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" sty= le=3D"font-size:10.5pt;font-family:"Calibri","sans-serif&quo= t;;color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><sp= an lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri"= ,"sans-serif";color:#1f497d">#=C2=A0=C2=A0 def __call__(self):<u>= </u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"= font-size:10.5pt;font-family:"Calibri","sans-serif";col= or:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.testRunner()<u></u><= u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-= size:10.5pt;font-family:"Calibri","sans-serif";color:#1= f497d"><u></u>=C2=A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"= EN-US" style=3D"font-size:10.5pt;font-family:"Calibri","sans= -serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 endT= ime =3D datetime.now() + duration<u></u><u></u></span></p><p class=3D"MsoNo= rmal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Cali= bri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 notDone =3D True<u></u><u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 while notDone:<u></u><u></u></span></p><p class=3D"MsoNorma= l"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri= ","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 connection =3D None<u></u><u></u></span></p><p class=3D"= MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"= ;Calibri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 insertStatement =3D None<u></u><u></u></span></= p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;fon= t-family:"Calibri","sans-serif";color:#1f497d">=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 queryStatement =3D None<u></u><u= ></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-s= ize:10.5pt;font-family:"Calibri","sans-serif";color:#1f= 497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 notDone =3D datetime= .now() < endTime<u></u><u></u></span></p><p class=3D"MsoNormal"><span la= ng=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&quo= t;sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 try:<u></u><u></u></span></p><p class=3D"MsoNormal= "><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&= quot;,"sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 connection =3D getConnection()<u></u><= u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-= size:10.5pt;font-family:"Calibri","sans-serif";color:#1= f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 insert= Statement =3D connection.createStatement()<u></u><u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 queryStatement =3D connect= ion.createStatement()<u></u><u></u></span></p><p class=3D"MsoNormal"><span = lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",&q= uot;sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p class= =3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:&= quot;Calibri","sans-serif";color:#1f497d">#=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 test1.record(insertStatement)= <u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style= =3D"font-size:10.5pt;font-family:"Calibri","sans-serif"= ;color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 insertStatement.execute("insert into grinder_test1126 values(%d, %= d)" %<u></u><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-= US" style=3D"font-size:10.5pt;font-family:"Calibri","sans-se= rif";color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (grinder.threadNumber, grinder.runNumber))<u></u><u></u></span></p><= p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-f= amily:"Calibri","sans-serif";color:#1f497d"><u></u>=C2= =A0<u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"f= ont-size:10.5pt;font-family:"Calibri","sans-serif";colo= r:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 test2.record(queryStatement)<u></u><u></u></span></p><p class=3D"MsoNor= mal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calib= ri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 queryStatement.execute("select= * from employee")<u></u><u></u></span></p><p class=3D"MsoNormal"><spa= n lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri",= "sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></span></p><p cla= ss=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family= :"Calibri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 finally:<u></u><u></u></span></p><p class=3D"Ms= oNormal"><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"C= alibri","sans-serif";color:#1f497d">#=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ensureClosed(insertStatement)<u></u= ><u></u></span></p><p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"fon= t-size:10.5pt;font-family:"Calibri","sans-serif";color:= #1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ensureClosed(queryStatement)<u></u><u></u></span></p><p class=3D"MsoNormal= "><span lang=3D"EN-US" style=3D"font-size:10.5pt;font-family:"Calibri&= quot;,"sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ensureClosed(connection)<u></u><u></u>= </span></p></div><div><p class=3D"MsoNormal"><span lang=3D"EN-US"><u></u>= =C2=A0<u></u></span></p></div></div></div></div>---------------------------= ---------------------------------------------------<br> _______________________________________________<br> grinder-use mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">grin= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/grinder-use" rel=3D= "noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo= /grinder-use</a><br> </blockquote></div> --089e013d0bba6f0fe40522103b42-- --===============4265684709911712282== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============4265684709911712282== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ grinder-use mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/grinder-use --===============4265684709911712282==--