use of org.springframework.core.io.FileSystemResource in project opennms by OpenNMS.
the class DefaultSnmpHwInventoryAdapterConfigDaoTest method initDao.
/**
* Initialized the DAO
*
* @param configFile the configuration file
* @return the configuration
* @throws Exception the exception
*/
private void initDao(String configFile) throws Exception {
File file = new File(configFile);
Assert.assertTrue(file.exists());
dao = new DefaultSnmpHwInventoryAdapterConfigDao();
dao.setConfigResource(new FileSystemResource(file));
dao.afterPropertiesSet();
}
use of org.springframework.core.io.FileSystemResource in project opennms by OpenNMS.
the class DefaultSnmpHwInventoryAdapterConfigDaoTest method emulateReload.
/**
* Emulate reload.
*
* @param fileName the file name
*/
private void emulateReload(String fileName) {
boolean exception = false;
try {
dao.setConfigResource(new FileSystemResource(new File(fileName)));
dao.afterPropertiesSet();
} catch (Exception e) {
System.err.println(e);
exception = true;
}
Assert.assertTrue(exception);
}
use of org.springframework.core.io.FileSystemResource in project opennms by OpenNMS.
the class EventFormTest method setUp.
/**
* Sets the up.
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
File config = new File(ConfigurationTestUtils.getDaemonEtcDirectory(), "events/MPLS.events.xml");
Assert.assertTrue(config.exists());
dao = new DefaultEventConfDao();
dao.setConfigResource(new FileSystemResource(config));
dao.afterPropertiesSet();
}
use of org.springframework.core.io.FileSystemResource in project opennms by OpenNMS.
the class AbstractVTDXmlCollectorTest method setUp.
/**
* Sets the up.
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
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_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_eventProxy);
}
use of org.springframework.core.io.FileSystemResource in project opennms by OpenNMS.
the class BSFNorthbounderConfigDaoIT method setUp.
/**
* Sets up the test..
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
FileUtils.copyDirectory(new File("src/test/resources/etc"), tempFolder.newFolder("etc"));
System.setProperty("opennms.home", tempFolder.getRoot().getAbsolutePath());
// Setup the configuration DAO
FileSystemResource resource = new FileSystemResource(new File(tempFolder.getRoot(), "etc/bsf-northbounder-config.xml"));
configDao = new BSFNorthbounderConfigDao();
configDao.setConfigResource(resource);
configDao.afterPropertiesSet();
}
Aggregations