当前位置: 首页>>代码示例>>Java>>正文


Java CollectdConfigFactory.setInstance方法代码示例

本文整理汇总了Java中org.opennms.netmgt.config.CollectdConfigFactory.setInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CollectdConfigFactory.setInstance方法的具体用法?Java CollectdConfigFactory.setInstance怎么用?Java CollectdConfigFactory.setInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opennms.netmgt.config.CollectdConfigFactory的用法示例。


在下文中一共展示了CollectdConfigFactory.setInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.opennms.netmgt.config.CollectdConfigFactory; //导入方法依赖的package包/类
private CollectorConfigDao initialize() throws IOException, MarshalException, ValidationException, Exception {
    System.setProperty("opennms.home", ConfigurationTestUtils.getDaemonEtcDirectory().getParentFile().getAbsolutePath());
    RrdUtils.setStrategy(new JRobinRrdStrategy());

    InputStream stream = null;

    stream = getInputStreamForFile("/org/opennms/netmgt/config/test-database-schema.xml");
    DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(stream));
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/jmx-datacollection-testdata.xml");
    JMXDataCollectionConfigFactory.setInstance(new JMXDataCollectionConfigFactory(stream));
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/snmp-config.xml");
    SnmpPeerFactory.setInstance(new SnmpPeerFactory(stream));
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/datacollection-config.xml");
    DefaultDataCollectionConfigDao dataCollectionDao = new DefaultDataCollectionConfigDao();
    dataCollectionDao.setConfigResource(new InputStreamResource(stream));
    dataCollectionDao.afterPropertiesSet();
    DataCollectionConfigFactory.setInstance(dataCollectionDao);
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/collectd-testdata.xml");
    CollectdConfigFactory.setInstance(new CollectdConfigFactory(stream, "localhost", false));
    stream.close();

    return new CollectorConfigDaoImpl();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:32,代码来源:CollectorConfigDaoImplTest.java

示例2: testPersistApacheStatsViaCapsd

import org.opennms.netmgt.config.CollectdConfigFactory; //导入方法依赖的package包/类
@Test
@JUnitHttpServer(port=10342, vhosts={"127.0.0.1"})
@JUnitCollector(
    datacollectionConfig="/org/opennms/netmgt/config/http-datacollection-persist-apache-stats.xml", 
    datacollectionType="http",
    anticipateRrds={ 
        "1/TotalAccesses",
        "1/TotalkBytes",
        "1/CPULoad",
        "1/Uptime",
        "1/ReqPerSec",
        "1/BytesPerSec",
        "1/BytesPerReq",
        "1/BusyWorkers",
        "1/IdleWorkers"
    }
)
public void testPersistApacheStatsViaCapsd() throws Exception {
    // TODO: Do we need this init? applicationContext-collectdTest.xml should take care of this
    CollectdConfigFactory collectdConfig = new CollectdConfigFactory(ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/collectd-configuration.xml"), "nms1", false);
    CollectdConfigFactory.setInstance(collectdConfig);
    CollectdConfigFactory.init();

    // Add the HTTP collector to capsd
    m_collectd.setServiceCollector("HTTP", m_collector);
    m_collectd.init();
    m_collectd.start();
    Thread.sleep(10000);
    m_collectd.stop();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:31,代码来源:HttpCollectorTest.java

示例3: initialize

import org.opennms.netmgt.config.CollectdConfigFactory; //导入方法依赖的package包/类
private CollectorConfigDao initialize() throws IOException, MarshalException, ValidationException, Exception {
    System.setProperty("opennms.home", ConfigurationTestUtils.getDaemonEtcDirectory().getParentFile().getAbsolutePath());
    RrdTestUtils.initialize();

    InputStream stream = null;

    stream = getInputStreamForFile("/org/opennms/netmgt/config/test-database-schema.xml");
    DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(stream));
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/jmx-datacollection-testdata.xml");
    JMXDataCollectionConfigFactory.setInstance(new JMXDataCollectionConfigFactory(stream));
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/snmp-config.xml");
    SnmpPeerFactory.setInstance(new SnmpPeerFactory(stream));
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/datacollection-config.xml");
    DefaultDataCollectionConfigDao dataCollectionDao = new DefaultDataCollectionConfigDao();
    dataCollectionDao.setConfigResource(new InputStreamResource(stream));
    dataCollectionDao.afterPropertiesSet();
    DataCollectionConfigFactory.setInstance(dataCollectionDao);
    stream.close();

    stream = getInputStreamForFile("/org/opennms/netmgt/config/collectd-testdata.xml");
    CollectdConfigFactory.setInstance(new CollectdConfigFactory(stream, "localhost", false));
    stream.close();

    return new CollectorConfigDaoImpl();
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:32,代码来源:CollectorConfigDaoImplTest.java

示例4: setUp

import org.opennms.netmgt.config.CollectdConfigFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    MockLogAppender.setupLogging();
    MockDatabase db = new MockDatabase();
    DataSourceFactory.setInstance(db);

    RrdUtils.setStrategy(m_strategy);
    
    m_provisioner = new OpenNMSProvisioner();
    
    m_eventManager = new MockEventIpcManager();
    m_provisioner.setEventManager(m_eventManager);
    
    m_capsdConfig = new TestCapsdConfigManager(CAPSD_CONFIG);
    CapsdConfigFactory.setInstance(m_capsdConfig);

    m_pollerConfig = new TestPollerConfigManager(POLLER_CONFIG, "localhost", false);
    PollerConfigFactory.setInstance(m_pollerConfig);
    
    m_provisioner.setCapsdConfig(m_capsdConfig);
    m_provisioner.setPollerConfig(m_pollerConfig);

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

    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.setInstance(new CollectdConfigFactory(configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
    configStream.close();

    JdbcTemplate jdbcTemplate = new JdbcTemplate(db);

    m_syncer = new JdbcCapsdDbSyncer();
    m_syncer.setJdbcTemplate(jdbcTemplate);
    m_syncer.setOpennmsServerConfig(OpennmsServerConfigFactory.getInstance());
    m_syncer.setCapsdConfig(m_capsdConfig);
    m_syncer.setPollerConfig(m_pollerConfig);
    m_syncer.setCollectdConfig(CollectdConfigFactory.getInstance());
    m_syncer.setNextSvcIdSql(db.getNextServiceIdStatement());
    m_syncer.afterPropertiesSet();

    m_syncer.syncServices();
    m_provisioner.setCapsdDbSyncer(m_syncer);

}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:51,代码来源:OpenNMSProvisionerTest.java

示例5: setUp

import org.opennms.netmgt.config.CollectdConfigFactory; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {

	super.setUp();

    m_agent = MockSnmpAgent.createAgentAndRun(new ClassPathResource("org/opennms/netmgt/snmp/snmpTestData1.properties"), InetAddressUtils.str(this.myLocalHost()) + "/9161");

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

    configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/capsd-configuration.xml");
    DefaultCapsdConfigManager capsdConfig = new DefaultCapsdConfigManager(configStream);
    configStream.close();
    CapsdConfigFactory.setInstance(capsdConfig);
    
    configStream = ConfigurationTestUtils.getInputStreamForConfigFile("opennms-server.xml");
    OpennmsServerConfigFactory onmsSvrConfig = new OpennmsServerConfigFactory(configStream);
    configStream.close();
    OpennmsServerConfigFactory.setInstance(onmsSvrConfig);

    configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/poller-configuration.xml");
    PollerConfigFactory.setInstance(new PollerConfigFactory(System.currentTimeMillis(), configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
    configStream.close();
    RrdTestUtils.initialize();

    configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/collectd-configuration.xml");
    CollectdConfigFactory.setInstance(new CollectdConfigFactory(configStream, onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
    configStream.close();
    
    JdbcTemplate jdbcTemplate = new JdbcTemplate(m_db);
    
    JdbcCapsdDbSyncer syncer = new JdbcCapsdDbSyncer();
    syncer.setJdbcTemplate(jdbcTemplate);
    syncer.setOpennmsServerConfig(OpennmsServerConfigFactory.getInstance());
    syncer.setCapsdConfig(CapsdConfigFactory.getInstance());
    syncer.setPollerConfig(PollerConfigFactory.getInstance());
    syncer.setCollectdConfig(CollectdConfigFactory.getInstance());
    syncer.setNextSvcIdSql(m_db.getNextServiceIdStatement());
    syncer.afterPropertiesSet();

    PluginManager pluginManager = new PluginManager();
    pluginManager.setCapsdConfig(capsdConfig);
    pluginManager.afterPropertiesSet();
    
    DefaultProcessorFactory defaultProcessorFactory = new DefaultProcessorFactory();
    defaultProcessorFactory.setCapsdDbSyncer(syncer);
    defaultProcessorFactory.setPluginManager(pluginManager);
    
    RunnableConsumerThreadPool suspectRunner = 
        new RunnableConsumerThreadPool("SuspectRunner", 0.0f, 0.0f, 1);
    
    RunnableConsumerThreadPool rescanRunner = 
        new RunnableConsumerThreadPool("RescanRunner", 0.0f, 0.0f, 1);
    
    Scheduler scheduler = new Scheduler(rescanRunner.getRunQueue(), defaultProcessorFactory);
    
    BroadcastEventProcessor eventHandler = new BroadcastEventProcessor();
    eventHandler.setSuspectEventProcessorFactory(defaultProcessorFactory);
    eventHandler.setLocalServer("localhost");
    eventHandler.setScheduler(scheduler);
    eventHandler.setSuspectQueue(suspectRunner.getRunQueue());
    eventHandler.afterPropertiesSet();
    
    AnnotationBasedEventListenerAdapter adapter = 
        new AnnotationBasedEventListenerAdapter(eventHandler, m_eventdIpcMgr);

    m_capsd = new Capsd();
    m_capsd.setCapsdDbSyncer(syncer);
    m_capsd.setSuspectEventProcessorFactory(defaultProcessorFactory);
    m_capsd.setCapsdConfig(capsdConfig);
    m_capsd.setSuspectRunner(suspectRunner);
    m_capsd.setRescanRunner(rescanRunner);
    m_capsd.setScheduler(scheduler);
    m_capsd.setEventListener(adapter);
    m_capsd.afterPropertiesSet();
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:78,代码来源:CapsdTest.java

示例6: setUp

import org.opennms.netmgt.config.CollectdConfigFactory; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
	System.setProperty("opennms.db.nextNodeId", "select max(nodeId) + 1 from node");
	super.setUp();

    m_agent = MockSnmpAgent.createAgentAndRun(new ClassPathResource("org/opennms/netmgt/snmp/stonegate.properties"), InetAddressUtils.str(this.myLocalHost()) + "/9161");

    InputStream configStream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/capsd-configuration.xml");
    DefaultCapsdConfigManager capsdConfig = new DefaultCapsdConfigManager(configStream);
    configStream.close();
    CapsdConfigFactory.setInstance(capsdConfig);

    configStream = ConfigurationTestUtils.getInputStreamForConfigFile("database-schema.xml");
    DatabaseSchemaConfigFactory dbConfigFactory = new DatabaseSchemaConfigFactory(configStream);
    configStream.close();
    DatabaseSchemaConfigFactory.setInstance(dbConfigFactory);
    
    OpennmsServerConfigFactory onmsSvrConfig = new OpennmsServerConfigFactory(ConfigurationTestUtils.getInputStreamForConfigFile("opennms-server.xml"));
    OpennmsServerConfigFactory.setInstance(onmsSvrConfig);
    
    PollerConfigFactory.setInstance(new PollerConfigFactory(System.currentTimeMillis(), ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/poller-configuration.xml"), onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));

    RrdTestUtils.initialize();

    CollectdConfigFactory.setInstance(new CollectdConfigFactory(ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/capsd/collectd-configuration.xml"), onmsSvrConfig.getServerName(), onmsSvrConfig.verifyServer()));
  
    JdbcTemplate jdbcTemplate = new JdbcTemplate(m_db);

    JdbcCapsdDbSyncer syncer = new JdbcCapsdDbSyncer();
    syncer.setJdbcTemplate(jdbcTemplate);
    syncer.setOpennmsServerConfig(OpennmsServerConfigFactory.getInstance());
    syncer.setCapsdConfig(CapsdConfigFactory.getInstance());
    syncer.setPollerConfig(PollerConfigFactory.getInstance());
    syncer.setCollectdConfig(CollectdConfigFactory.getInstance());
    syncer.setNextSvcIdSql(m_db.getNextServiceIdStatement());
    syncer.afterPropertiesSet();

    PluginManager pluginManager = new PluginManager();
    pluginManager.setCapsdConfig(capsdConfig);
    pluginManager.afterPropertiesSet();
    
    DefaultProcessorFactory defaultProcessorFactory = new DefaultProcessorFactory();
    defaultProcessorFactory.setCapsdDbSyncer(syncer);
    defaultProcessorFactory.setPluginManager(pluginManager);

    RunnableConsumerThreadPool suspectRunner = 
        new RunnableConsumerThreadPool("SuspectRunner", 0.0f, 0.0f, 1);
    
    RunnableConsumerThreadPool rescanRunner = 
        new RunnableConsumerThreadPool("RescanRunner", 0.0f, 0.0f, 1);
    
    Scheduler scheduler = new Scheduler(rescanRunner.getRunQueue(), defaultProcessorFactory);
    
    BroadcastEventProcessor eventHandler = new BroadcastEventProcessor();
    eventHandler.setSuspectEventProcessorFactory(defaultProcessorFactory);
    eventHandler.setLocalServer("localhost");
    eventHandler.setScheduler(scheduler);
    eventHandler.setSuspectQueue(suspectRunner.getRunQueue());
    eventHandler.afterPropertiesSet();
    
    AnnotationBasedEventListenerAdapter adapter = 
        new AnnotationBasedEventListenerAdapter(eventHandler, m_eventdIpcMgr);

    m_capsd = new Capsd();
    m_capsd.setCapsdDbSyncer(syncer);
    m_capsd.setSuspectEventProcessorFactory(defaultProcessorFactory);
    m_capsd.setCapsdConfig(capsdConfig);
    m_capsd.setSuspectRunner(suspectRunner);
    m_capsd.setRescanRunner(rescanRunner);
    m_capsd.setScheduler(scheduler);
    m_capsd.setEventListener(adapter);
    m_capsd.afterPropertiesSet();

}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:75,代码来源:ScanSuspectTest.java


注:本文中的org.opennms.netmgt.config.CollectdConfigFactory.setInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。