Search in sources :

Example 1 with RrdPersisterFactory

use of org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory in project opennms by OpenNMS.

the class CollectorTestUtils method persistCollectionSet.

public static void persistCollectionSet(RrdStrategy<?, ?> rrdStrategy, ResourceStorageDao resourceStorageDao, CollectionSpecification spec, CollectionSet collectionSet) {
    RrdRepository repository = spec.getRrdRepository("default");
    System.err.println("repository = " + repository);
    ServiceParameters params = spec.getServiceParameters();
    System.err.println("service parameters = " + params);
    RrdPersisterFactory persisterFactory = new RrdPersisterFactory();
    persisterFactory.setRrdStrategy(rrdStrategy);
    persisterFactory.setResourceStorageDao(resourceStorageDao);
    CollectionSetVisitor persister = persisterFactory.createPersister(params, repository);
    System.err.println("persister = " + persister);
    collectionSet.visit(persister);
}
Also used : CollectionSetVisitor(org.opennms.netmgt.collection.api.CollectionSetVisitor) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 2 with RrdPersisterFactory

use of org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory in project opennms by OpenNMS.

the class CollectorTestUtils method persistCollectionSet.

public static void persistCollectionSet(RrdStrategy<?, ?> rrdStrategy, ResourceStorageDao resourceStorageDao, CollectionSpecification spec, CollectionSet collectionSet) {
    RrdRepository repository = spec.getRrdRepository("default");
    System.err.println("repository = " + repository);
    ServiceParameters params = spec.getServiceParameters();
    System.err.println("service parameters = " + params);
    RrdPersisterFactory persisterFactory = new RrdPersisterFactory();
    persisterFactory.setRrdStrategy(rrdStrategy);
    persisterFactory.setResourceStorageDao(resourceStorageDao);
    CollectionSetVisitor persister = persisterFactory.createPersister(params, repository);
    System.err.println("persister = " + persister);
    collectionSet.visit(persister);
}
Also used : CollectionSetVisitor(org.opennms.netmgt.collection.api.CollectionSetVisitor) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 3 with RrdPersisterFactory

use of org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory in project opennms by OpenNMS.

the class NMS7963IT method setUp.

/**
 * Sets the up.
 *
 * @throws Exception the exception
 */
@Before
public void setUp() throws Exception {
    MockLogAppender.setupLogging();
    DefaultDataCollectionConfigDao dao = new DefaultDataCollectionConfigDao();
    dao.setConfigDirectory("src/test/resources/etc/datacollection");
    dao.setConfigResource(new FileSystemResource("src/test/resources/etc/datacollection-config.xml"));
    dao.afterPropertiesSet();
    DataCollectionConfigFactory.setInstance(dao);
    m_rrdStrategy = new JRobinRrdStrategy();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    m_resourceStorageDao.setRrdDirectory(m_temporaryFolder.getRoot());
    m_temporaryFolder.newFolder("snmp");
    m_persisterFactory = new RrdPersisterFactory();
    m_persisterFactory.setResourceStorageDao(m_resourceStorageDao);
    m_persisterFactory.setRrdStrategy(m_rrdStrategy);
    m_collectionAgent = new MockCollectionAgent(1, "mynode.local", InetAddrUtils.addr("127.0.0.1"));
    m_nodeDao = EasyMock.createMock(NodeDao.class);
    OnmsNode node = new OnmsNode();
    node.setId(1);
    node.setLabel("mynode.local");
    node.setAssetRecord(new OnmsAssetRecord());
    EasyMock.expect(m_nodeDao.get(1)).andReturn(node).anyTimes();
    EasyMock.replay(m_nodeDao);
}
Also used : NodeDao(org.opennms.netmgt.dao.api.NodeDao) OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsAssetRecord(org.opennms.netmgt.model.OnmsAssetRecord) FilesystemResourceStorageDao(org.opennms.netmgt.dao.support.FilesystemResourceStorageDao) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) MockCollectionAgent(org.opennms.core.collection.test.MockCollectionAgent) FileSystemResource(org.springframework.core.io.FileSystemResource) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) DefaultDataCollectionConfigDao(org.opennms.netmgt.config.DefaultDataCollectionConfigDao) Before(org.junit.Before)

Example 4 with RrdPersisterFactory

use of org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory in project opennms by OpenNMS.

the class XmlCollectorITCase method initializeRrdStrategy.

/**
 * Initialize RRD strategy.
 *
 * @throws Exception the exception
 */
protected void initializeRrdStrategy() throws Exception {
    m_rrdStrategy = new JRobinRrdStrategy();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    m_resourceStorageDao.setRrdDirectory(m_temporaryFolder.getRoot());
    m_temporaryFolder.newFolder("snmp");
    m_persisterFactory = new RrdPersisterFactory();
    m_persisterFactory.setResourceStorageDao(m_resourceStorageDao);
    m_persisterFactory.setRrdStrategy(m_rrdStrategy);
}
Also used : FilesystemResourceStorageDao(org.opennms.netmgt.dao.support.FilesystemResourceStorageDao) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy)

Example 5 with RrdPersisterFactory

use of org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory in project opennms by OpenNMS.

the class LatencyStoringServiceMonitorAdaptorPersistenceTest method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    MockLogAppender.setupLogging();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    m_resourceStorageDao.setRrdDirectory(m_tempFolder.newFolder("response"));
    m_persisterFactory = new RrdPersisterFactory();
    m_persisterFactory.setResourceStorageDao(m_resourceStorageDao);
    m_rrdStrategy = EasyMock.createMock(RrdStrategy.class);
    m_persisterFactory.setRrdStrategy(m_rrdStrategy);
}
Also used : FilesystemResourceStorageDao(org.opennms.netmgt.dao.support.FilesystemResourceStorageDao) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) RrdStrategy(org.opennms.netmgt.rrd.RrdStrategy) Before(org.junit.Before)

Aggregations

RrdPersisterFactory (org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory)10 FilesystemResourceStorageDao (org.opennms.netmgt.dao.support.FilesystemResourceStorageDao)6 Before (org.junit.Before)5 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)4 JRobinRrdStrategy (org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy)4 FileSystemResource (org.springframework.core.io.FileSystemResource)4 MockCollectionAgent (org.opennms.core.collection.test.MockCollectionAgent)3 CollectionSetVisitor (org.opennms.netmgt.collection.api.CollectionSetVisitor)3 OnmsNode (org.opennms.netmgt.model.OnmsNode)3 RrdRepository (org.opennms.netmgt.rrd.RrdRepository)3 HashMap (java.util.HashMap)2 DefaultDataCollectionConfigDao (org.opennms.netmgt.config.DefaultDataCollectionConfigDao)2 NodeDao (org.opennms.netmgt.dao.api.NodeDao)2 EventProxy (org.opennms.netmgt.events.api.EventProxy)2 OnmsAssetRecord (org.opennms.netmgt.model.OnmsAssetRecord)2 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)2 XmlDataCollectionConfigDaoJaxb (org.opennms.protocols.xml.dao.jaxb.XmlDataCollectionConfigDaoJaxb)2 Resource (org.springframework.core.io.Resource)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Ignore (org.junit.Ignore)1