Package org.jboss.test.thread

Examples of org.jboss.test.thread.TestThread


         field.set(null, new Long(1));
        
         final CountDownLatch startALatch = new CountDownLatch(1);
         final CountDownLatch startBLatch = new CountDownLatch(1);
        
         TestThread threadA = new TestThread("A")
         {
            public void run()
            {
               try
               {
                  startBLatch.await();
               }
               catch (InterruptedException ignored)
               {
               }
               startALatch.countDown();
               Class<?> testAbstractFactoryClass = assertLoadClass(TestAbstractFactory.class, a);
               try
               {
                  Method method = testAbstractFactoryClass.getMethod("getInstance", (Class[]) null);
                  method.invoke(null, (Object[]) null);
               }
               catch (Exception e)
               {
                  throw new Error("Error", e);
               }
            }
         };
        
         TestThread threadB = new TestThread("B")
         {
            public void run()
            {
               startBLatch.countDown();
               try
               {
                  startALatch.await();
               }
               catch (InterruptedException ignored)
               {
               }
               assertLoadClass(TestFactoryImplementation.class, b);
            }
         };
        
         threadA.start();
         threadB.start();
        
         threadA.doJoin();
         threadB.doJoin();
      }
   }
View Full Code Here


      super(name);
   }
  
   public void testThread()
   {
      TestThread thread = new TestThread("TestThread")
      {
         public void run()
         {
            throw new Error();
         }
      };
      thread.start();
     
      try
      {
         thread.doJoin();
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         if (t instanceof AssertionFailedError == false)
View Full Code Here

      }
   }
  
   public void testThreadWithException() throws Exception
   {
      TestThread thread = new TestThread("TestThreadWithException")
      {
         public void run()
         {
            throw new Error();
         }
      };
      thread.start();
      thread.doJoinExpectError(Error.class);
   }
View Full Code Here

         field.set(null, new Long(1));
        
         final CountDownLatch startALatch = new CountDownLatch(1);
         final CountDownLatch startBLatch = new CountDownLatch(1);
        
         TestThread threadA = new TestThread("A")
         {
            public void run()
            {
               try
               {
                  startBLatch.await();
               }
               catch (InterruptedException ignored)
               {
               }
               startALatch.countDown();
               Class<?> testAbstractFactoryClass = assertLoadClass(TestAbstractFactory.class, a);
               try
               {
                  Method method = testAbstractFactoryClass.getMethod("getInstance", (Class[]) null);
                  method.invoke(null, (Object[]) null);
               }
               catch (Exception e)
               {
                  throw new Error("Error", e);
               }
            }
         };
        
         TestThread threadB = new TestThread("B")
         {
            public void run()
            {
               startBLatch.countDown();
               try
               {
                  startALatch.await();
               }
               catch (InterruptedException ignored)
               {
               }
               assertLoadClass(TestFactoryImplementation.class, b);
            }
         };
        
         threadA.start();
         threadB.start();
        
         threadA.doJoin();
         threadB.doJoin();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.thread.TestThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.