summaryrefslogtreecommitdiff
path: root/qpid/java/common/src/test
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2009-01-13 18:19:00 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2009-01-13 18:19:00 +0000
commitdea98703539c212fbb2ac0db304e107f48d237ac (patch)
treec7759bc03af48c708327022cdfc5c6b7df10b74e /qpid/java/common/src/test
parent98dc810358814efe57d331cbc276fb8918dd7e0a (diff)
downloadqpid-python-dea98703539c212fbb2ac0db304e107f48d237ac.tar.gz
This is related to QPID-1479
This commit contains the core classes for adding the thread abstraction patch git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@734205 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/common/src/test')
-rw-r--r--qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java b/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java
new file mode 100644
index 0000000000..9932633cb9
--- /dev/null
+++ b/qpid/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java
@@ -0,0 +1,46 @@
+package org.apache.qpid.thread;
+
+import junit.framework.TestCase;
+
+public class ThreadFactoryTest extends TestCase
+{
+ public void testThreadFactory()
+ {
+ Class threadFactoryClass = null;
+ try
+ {
+ threadFactoryClass = Class.forName(System.getProperty("qpid.thread_factory",
+ "org.apache.qpid.thread.DefaultThreadFactory"));
+ }
+ // If the thread factory class was wrong it will flagged way before it gets here.
+ catch(Exception e)
+ {
+ fail("Invalid thread factory class");
+ }
+
+ assertEquals(threadFactoryClass, Threading.getThreadFactory().getClass());
+ }
+
+ public void testThreadCreate()
+ {
+ Runnable r = new Runnable(){
+
+ public void run(){
+
+ }
+ };
+
+ Thread t = null;
+ try
+ {
+ t = Threading.getThreadFactory().createThread(r,5);
+ }
+ catch(Exception e)
+ {
+ fail("Error creating thread using Qpid thread factory");
+ }
+
+ assertNotNull(t);
+ assertEquals(5,t.getPriority());
+ }
+}