Child pages
  • Thrash Testing
Skip to end of metadata
Go to start of metadata

One can test EOF operations in concurrent threads using the "thrash" test built into Wonder. One uses ant to execute the tests.

See ERXThrashTest.java in the Wonder sources. One can define inner classes in that class. The "SimpleFetchTest" and "SimpleInsertTest" classes are examples. The thrash test will take a "scheme" that can be specified by the user and execute that scheme.

scheme:SimpleInsertTest::0-5,5-10,15-10,20-10

For example, the scheme above will create threads using the "SimpleInsertTest" inner class. There is a string parameter that can be defined after the inner class name, which in this case is "". The ERXThrashTest class will create 5 threads and pass them a "delay" parameter of 0. Then it will create 10 threads and pass them a "delay" parameter of 5. This will cause the thread to start and then sleep for 5 seconds. The scheme above creates a total of 35 threads. There will be 5 that start immediately, 10 that start after 5 seconds, 10 more that start after 15 seconds, and 10 more that start after 20 seconds. The scheme can be arbitrarily long. The inner class can be defined to do some interesting set of operations, whatever is desired.

There is a target defined in ant which will run a pre-defined set of schemes.

One can pass in a string parameter to the tests. This can, of course, be used for any purpose. For example, the SimpleInsertTest inner class can use a subclass of EOEditingContext instead of using EOEditingContext itself. Thus, the same test as above can be run using ERXEC with this command:

scheme:SimpleInsertTest:er.extensions.eof.ERXEC:0-5,5-10,15-10,20-10

This set of commands will compile the tests (the ERXThrashTest class compilation is conditional on having "include.tests=true" defined in the ant build of the ERExtensions project) and run the thrash tests:

cd Wonder
ant tests.all thrash.all

This command will run the same scheme as above, but with 10 times the number of threads.

ant thrash -Dthrash.scheme=scheme:SimpleInsertTest::0-50,5-100,15-100,20-100

The tests rely on a few things. Values need to be set in the ~/Library/wobuild.properties file:

wonder.test.thrash.adaptor=MySQL
wonder.test.thrash.url=jdbc:mysql://localhost/wotesting
wonder.test.thrash.user=ray
wonder.test.thrash.pwd=zekretword

The "SimpleFetchTest" and "SimpleInsertTest" inner classes will load the "BusinessModel" in the ERExtensions framework, based on the defined adaptor. For example, with the information above, the "MySQLBusinessModel.eomodeld" will be loaded by the tests and they rely on that model being available.

  • No labels