axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jal...@apache.org
Subject svn commit: r193132 - in /webservices/axis/trunk/java/modules/core/test/org/apache/axis/util: ./ threadpool/ threadpool/TestThreadPool.java
Date Thu, 23 Jun 2005 11:01:43 GMT
Author: jaliya
Date: Thu Jun 23 04:01:39 2005
New Revision: 193132

URL: http://svn.apache.org/viewcvs?rev=193132&view=rev
Log:
Test case for the thread pool

Added:
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/threadpool/
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/threadpool/TestThreadPool.java

Added: webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/threadpool/TestThreadPool.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/threadpool/TestThreadPool.java?rev=193132&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/threadpool/TestThreadPool.java
(added)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/util/threadpool/TestThreadPool.java
Thu Jun 23 04:01:39 2005
@@ -0,0 +1,56 @@
+package org.apache.axis.util.threadpool;
+
+import junit.framework.TestCase;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.AbstractTestCase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 23, 2005
+ * Time: 3:58:45 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestThreadPool extends AbstractTestCase {
+    /**
+     * @param testName
+     */
+    public TestThreadPool(String testName) {
+        super(testName);
+    }
+
+    class TestWorker implements AxisWorker {
+        private boolean workDone;
+
+        public void doWork() {
+            workDone = true;
+        }
+
+        public boolean isWorkDone() {
+            return workDone;
+        }
+    }
+
+
+    public void testPool() throws AxisFault {
+        ThreadPool tPool = ThreadPool.getInstance();
+        List workerList = new ArrayList();
+
+        for (int i = 0; i < 5; i++) {
+            TestWorker worker = new TestWorker();
+            workerList.add(worker);
+            tPool.addWorker(worker);
+        }
+
+        tPool.safeShutDown();
+
+        for (int i = 0; i < 5; i++) {
+            assertEquals(true, ((TestWorker) workerList.get(i)).isWorkDone());
+        }
+
+    }
+
+}



Mime
View raw message