/**
 * ToolManager::run()
 * Main entry point for tests. Tests are cycled through tools.
 *
 **/
void
ToolManager::run()
{
   ToolBase *pToolBase;

   cout << "ToolManager::StartTask::run(), starting..." << endl;
   while (true)
   {
      Test *pTest(get());
      if (pTest != NULL)
      {
         pTest->nextTest(); //move past kBegin
         pToolBase = getTool(pTest->getActiveTest());
         if (pToolBase != NULL)
         {
            pToolBase->put(pTest);
         }
         else
         {
            delete pTest;
         }
      }
      else
      {
         cout << "event is null..." << endl;
      }
   }
}

/**
 * ToolManager::CompleteTask::run()
 * Competed tests are either returned to the main test processing
 * thread, or completed tests are dispatched to action processing
 * block.
 *
 **/
void
ToolManager::CompleteTask::run()
{
   while (true)
   {
      Test *pTest(get());
      //      cout << "receiving a test result..." << endl;
      if (pTest != NULL)
      {
         if (pTest->isLastTest() == true)
         {
            m_pToolManager->m_pActionManager->put(pTest); //done
         }
         else
         {
            //put up into parent queue
            m_pToolManager->put(pTest);
         }
      }
   }
}

