예제 #1
0
  private void setupCollector(String svcName, boolean successfulInit)
      throws CollectionInitializationException {
    ServiceCollector svcCollector = m_easyMockUtils.createMock(ServiceCollector.class);
    if (successfulInit) {
      svcCollector.initialize(isA(CollectionAgent.class), isAMap(String.class, Object.class));
    }
    svcCollector.initialize(Collections.<String, String>emptyMap());
    MockServiceCollector.setDelegate(svcCollector);

    // Tell the config to use the MockServiceCollector for the specified service
    Collector collector = new Collector();
    collector.setService(svcName);
    collector.setClassName(MockServiceCollector.class.getName());

    m_collectdConfigFactory = m_easyMockUtils.createMock(CollectdConfigFactory.class);
    m_collectdConfig = m_easyMockUtils.createMock(CollectdConfiguration.class);
    expect(m_collectdConfigFactory.getCollectdConfig()).andReturn(m_collectdConfig).anyTimes();
    expect(m_collectdConfig.getCollectors())
        .andReturn(Collections.singletonList(collector))
        .anyTimes();
    expect(m_collectdConfig.getThreads()).andReturn(1).anyTimes();

    m_collectd.setCollectdConfigFactory(m_collectdConfigFactory);
  }
예제 #2
0
 @Override
 public void initialize(CollectionAgent agent, Map<String, Object> parameters)
     throws CollectionInitializationException {
   s_delegate.initialize(agent, parameters);
 }
예제 #3
0
 @Override
 public void initialize(Map<String, String> parameters)
     throws CollectionInitializationException {
   s_delegate.initialize(parameters);
 }