@Test
  public void testNodeGainedDynamicService() throws Exception {
    m_pollerConfig.setNodeOutageProcessingEnabled(true);

    startDaemons();

    TestCapsdConfigManager capsdConfig = new TestCapsdConfigManager(CAPSD_CONFIG);

    InputStream configStream =
        ConfigurationTestUtils.getInputStreamForConfigFile("opennms-server.xml");
    OpennmsServerConfigFactory onmsSvrConfig = new OpennmsServerConfigFactory(configStream);
    configStream.close();

    configStream = ConfigurationTestUtils.getInputStreamForConfigFile("database-schema.xml");
    DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(configStream));
    configStream.close();

    configStream =
        ConfigurationTestUtils.getInputStreamForResource(
            this, "/org/opennms/netmgt/capsd/collectd-configuration.xml");
    CollectdConfigFactory collectdConfig =
        new CollectdConfigFactory(
            configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer());
    configStream.close();

    JdbcTemplate jdbcTemplate = new JdbcTemplate(m_db);

    JdbcCapsdDbSyncer syncer = new JdbcCapsdDbSyncer();
    syncer.setJdbcTemplate(jdbcTemplate);
    syncer.setOpennmsServerConfig(onmsSvrConfig);
    syncer.setCapsdConfig(capsdConfig);
    syncer.setPollerConfig(m_pollerConfig);
    syncer.setCollectdConfig(collectdConfig);
    syncer.setNextSvcIdSql(m_db.getNextServiceIdStatement());
    syncer.afterPropertiesSet();

    OpenNMSProvisioner provisioner = new OpenNMSProvisioner();
    provisioner.setPollerConfig(m_pollerConfig);
    provisioner.setCapsdConfig(capsdConfig);
    provisioner.setCapsdDbSyncer(syncer);

    provisioner.setEventManager(m_eventMgr);
    provisioner.addServiceDNS("MyDNS", 3, 100, 1000, 500, 3000, 53, "www.opennms.org");

    assertNotNull("The service id for MyDNS is null", m_db.getServiceID("MyDNS"));
    MockUtil.println("The service id for MyDNS is: " + m_db.getServiceID("MyDNS").toString());

    m_anticipator.reset();

    testSendNodeGainedService("MyDNS", "HTTP");
  }
 private void resetAnticipated() {
   m_anticipator.reset();
   m_outageAnticipator.reset();
 }