public void onMessage(Message o) {
      super.onMessage(o);
      NetarkivetMessage nmsg = received.get(received.size() - 1);
      if (nmsg instanceof IndexRequestMessage) {
        IndexRequestMessage irm = (IndexRequestMessage) nmsg;

        irm.setFoundJobs(irm.getRequestedJobs());
        irm.setResultFile(RemoteFileFactory.getCopyfileInstance(TestInfo.CACHE_ZIP_FILE));

        JMSConnectionFactory.getInstance().reply(irm);
      } else {
        nmsg.setNotOk("Not instance of IndexRequestMessage as required!");
        JMSConnectionFactory.getInstance().reply(nmsg);
      }
    }
 @After
 public void tearDown() {
   pse.tearDown();
   pss.tearDown();
   mtf.tearDown();
   JMSConnectionFactory.getInstance().removeListener(Channels.getTheIndexServer(), listener);
   mjms.tearDown();
   rs.tearDown();
 }
 @Before
 public void setUp() {
   rs.setUp();
   mjms.setUp();
   listener = new CreateIndexListener();
   JMSConnectionFactory.getInstance().setListener(Channels.getTheIndexServer(), listener);
   Settings.set(
       CommonSettings.REMOTE_FILE_CLASS, "dk.netarkivet.common.distribute.NullRemoteFile");
   Settings.set(CommonSettings.CACHE_DIR, TestInfo.CACHE_DIR.getPath());
   mtf.setUp();
   pss.setUp();
   pse.setUp();
 }
  /**
   * Creates the components handling the harvest job management and hooks them up to the <code>
   * HarvestJobManager</code>s lifecycle.
   */
  public HarvestJobManager() {
    jmsConnection = JMSConnectionFactory.getInstance();
    JobDispatcher jobDispather =
        new JobDispatcher(jmsConnection, HarvestDefinitionDAO.getInstance(), JobDAO.getInstance());
    HarvestChannelRegistry harvestChannelRegistry = new HarvestChannelRegistry();

    addChild(
        new HarvesterStatusReceiver(
            jobDispather, jmsConnection, HarvestChannelDAO.getInstance(), harvestChannelRegistry));

    addChild(new HarvestJobGenerator(harvestChannelRegistry));

    addChild(new HarvestSchedulerMonitorServer());

    addChild(new JobSupervisor());
  }