Author: veithen Date: Mon Jul 6 18:44:45 2015 New Revision: 1689474 URL: http://svn.apache.org/r1689474 Log: Make the number of invocations per thread configurable.
Modified: axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/Invoker.java axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/MultithreadTestCase.java Modified: axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/Invoker.java URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/Invoker.java?rev=1689474&r1=1689473&r2=1689474&view=diff ============================================================================== --- axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/Invoker.java (original) +++ axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/Invoker.java Mon Jul 6 18:44:45 2015 @@ -35,12 +35,15 @@ class Invoker implements Runnable { private final CountDownLatch readyLatch; private final CountDownLatch startLatch; private final Report report; + private final int numInvocations; - Invoker(AddressBook binding, CountDownLatch readyLatch, CountDownLatch startLatch, Report report) { + Invoker(AddressBook binding, CountDownLatch readyLatch, CountDownLatch startLatch, Report report, + int numInvocations) { this.binding = binding; this.readyLatch = readyLatch; this.startLatch = startLatch; this.report = report; + this.numInvocations = numInvocations; } public void run() { @@ -50,7 +53,7 @@ class Invoker implements Runnable { readyLatch.countDown(); startLatch.await(); - for (int i = 0; i < 4; ++i) { + for (int i = 0; i < numInvocations; ++i) { Address address = new Address(); Phone phone = new Phone(); address.setStreetNum(i); Modified: axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/MultithreadTestCase.java URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/MultithreadTestCase.java?rev=1689474&r1=1689473&r2=1689474&view=diff ============================================================================== --- axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/MultithreadTestCase.java (original) +++ axis/axis1/java/trunk/integration/src/test/java/test/wsdl/multithread/MultithreadTestCase.java Mon Jul 6 18:44:45 2015 @@ -45,17 +45,18 @@ public class MultithreadTestCase extends private void testMultithreading(StubSupplier stubSupplier) throws Throwable { Report report = new Report(); - int NUM_THREADS = 50; - CountDownLatch readyLatch = new CountDownLatch(NUM_THREADS); + final int numThreads = 50; + final int numInvocations = 4; + CountDownLatch readyLatch = new CountDownLatch(numThreads); CountDownLatch startLatch = new CountDownLatch(1); - Thread[] threads = new Thread[NUM_THREADS]; - for (int i = 0; i < NUM_THREADS; ++i) { - threads[i] = new Thread(new Invoker(stubSupplier.getStub(), readyLatch, startLatch, report)); + Thread[] threads = new Thread[numThreads]; + for (int i = 0; i < numThreads; ++i) { + threads[i] = new Thread(new Invoker(stubSupplier.getStub(), readyLatch, startLatch, report, numInvocations)); threads[i].start(); } readyLatch.await(); startLatch.countDown(); - for (int i = 0; i < NUM_THREADS; ++i) { + for (int i = 0; i < numThreads; ++i) { threads[i].join(30000); StackTraceElement[] stack = threads[i].getStackTrace(); if (stack.length > 0) { @@ -68,7 +69,7 @@ public class MultithreadTestCase extends if (error != null) { throw error; } - assertEquals("number of successes", NUM_THREADS * 4, report.getSuccessCount()); + assertEquals("number of successes", numThreads * numInvocations, report.getSuccessCount()); } // testMultithreading } // class MultithreadTestCase