From ebfdd9a2ba48e77bdf0309c4dae20053c96a1b61 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Tue, 13 Jan 2009 18:19:00 +0000 Subject: 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/qpid@734205 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/thread/ThreadFactoryTest.java | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java (limited to 'java/common/src/test') diff --git a/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java b/java/common/src/test/java/org/apache/qpid/thread/ThreadFactoryTest.java new file mode 100644 index 0000000000..9932633cb9 --- /dev/null +++ b/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()); + } +} -- cgit v1.2.1