/** * Creates the RRD repository. * * @return the RRD repository * @throws IOException Signals that an I/O exception has occurred. */ private RrdRepository createRrdRepository(String collection) throws IOException { XmlRrd rrd = m_xmlCollectionDao.getDataCollectionByName(collection).getXmlRrd(); RrdRepository repository = new RrdRepository(); repository.setRrdBaseDir(new File(TEST_SNMP_DIRECTORY)); repository.setHeartBeat(rrd.getStep() * 2); repository.setStep(rrd.getStep()); repository.setRraList(rrd.getXmlRras()); return repository; }
/** * Sets the up. * * @throws Exception the exception */ @Before public void setUp() throws Exception { MockLogAppender.setupLogging(); initializeRrdStrategy(); initializeDocumentBuilder(); m_collectionAgent = EasyMock.createMock(CollectionAgent.class); EasyMock.expect(m_collectionAgent.getNodeId()).andReturn(1).anyTimes(); EasyMock.expect(m_collectionAgent.getHostAddress()).andReturn("127.0.0.1").anyTimes(); EasyMock.expect(m_collectionAgent.getStorageDir()).andReturn(new File("1")).anyTimes(); m_eventProxy = EasyMock.createMock(EventProxy.class); m_xmlCollectionDao = new XmlDataCollectionConfigDaoJaxb(); Resource resource = new FileSystemResource(getConfigFileName()); m_xmlCollectionDao.setConfigResource(resource); m_xmlCollectionDao.afterPropertiesSet(); EasyMock.replay(m_collectionAgent, m_eventProxy); }
/** * Sets the up. * * @throws Exception the exception */ @Before public void setUp() throws Exception { FileUtils.deleteDirectory(new File(TEST_SNMP_DIRECTORY)); MockLogAppender.setupLogging(); System.setProperty("org.opennms.rrd.usetcp", "false"); System.setProperty("org.opennms.rrd.usequeue", "false"); RrdUtils.setStrategy(new JRobinRrdStrategy()); m_collectionAgent = EasyMock.createMock(CollectionAgent.class); EasyMock.expect(m_collectionAgent.getNodeId()).andReturn(1).anyTimes(); EasyMock.expect(m_collectionAgent.getHostAddress()).andReturn("127.0.0.1").anyTimes(); EasyMock.expect(m_collectionAgent.getStorageDir()).andReturn(new File("1")).anyTimes(); m_eventProxy = EasyMock.createMock(EventProxy.class); m_xmlCollectionDao = new XmlDataCollectionConfigDaoJaxb(); Resource resource = new FileSystemResource(getXmlConfigFileName()); m_xmlCollectionDao.setConfigResource(resource); m_xmlCollectionDao.afterPropertiesSet(); MockDocumentBuilder.setXmlFileName(getXmlSampleFileName()); EasyMock.replay(m_collectionAgent, m_eventProxy); }