Search in sources :

Example 21 with FileAnticipator

use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.

the class GenericIndexResourceTypeTest method setUp.

@Before
public void setUp() throws IOException {
    m_fileAnticipator = new FileAnticipator();
    m_resourceStorageDao = new FilesystemResourceStorageDao();
    m_resourceStorageDao.setRrdDirectory(m_fileAnticipator.getTempDir());
    m_resourceStorageDao.setRrdStrategy(new NullRrdStrategy());
}
Also used : NullRrdStrategy(org.opennms.netmgt.rrd.NullRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator) Before(org.junit.Before)

Example 22 with FileAnticipator

use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.

the class JRobinRrdStrategyTest method setUp.

@Before
public void setUp() throws Exception {
    Locale.setDefault(Locale.US);
    // Make sure that AWT headless mode is enabled
    System.setProperty("java.awt.headless", "true");
    MockLogAppender.setupLogging(true, "DEBUG");
    m_strategy = new JRobinRrdStrategy();
    // Don't initialize by default since not all tests need it.
    m_fileAnticipator = new FileAnticipator(false);
}
Also used : FileAnticipator(org.opennms.test.FileAnticipator) Before(org.junit.Before)

Example 23 with FileAnticipator

use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.

the class CollectableServiceTest method setUp.

@Before
public void setUp() throws Exception {
    MockLogAppender.setupLogging();
    rrdStrategy = new JRobinRrdStrategy();
    fileAnticipator = new FileAnticipator();
    MockEventIpcManager mockEventIpcManager = new MockEventIpcManager();
    EventIpcManagerFactory.setIpcManager(mockEventIpcManager);
}
Also used : MockEventIpcManager(org.opennms.netmgt.dao.mock.MockEventIpcManager) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator) Before(org.junit.Before)

Example 24 with FileAnticipator

use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.

the class FindTopLevelResourcesTest method setUp.

@Before
public void setUp() throws Exception {
    m_fileAnticipator = new FileAnticipator();
    m_easyMockUtils = new EasyMockUtils();
    m_nodeDao = m_easyMockUtils.createMock(NodeDao.class);
    m_locationMonitorDao = m_easyMockUtils.createMock(LocationMonitorDao.class);
    m_resourceTypesDao = m_easyMockUtils.createMock(ResourceTypesDao.class);
    m_filterDao = m_easyMockUtils.createMock(FilterDao.class);
    FilterDaoFactory.setInstance(m_filterDao);
    expect(m_filterDao.getActiveIPAddressList("IPADDR IPLIKE *.*.*.*")).andReturn(new ArrayList<InetAddress>(0)).anyTimes();
    RrdStrategy<?, ?> rrdStrategy = new JRobinRrdStrategy();
    m_rrdFileExtension = rrdStrategy.getDefaultFileExtension();
    m_resourceStorageDao.setRrdDirectory(m_fileAnticipator.getTempDir());
    m_resourceStorageDao.setRrdStrategy(rrdStrategy);
    m_easyMockUtils.replayAll();
    InputStream stream = ConfigurationTestUtils.getInputStreamForResource(this, "/collectdconfiguration-testdata.xml");
    m_collectdConfig = new CollectdConfigFactory(stream, "localhost", false);
    m_easyMockUtils.verifyAll();
    m_resourceDao = new DefaultResourceDao();
    m_resourceDao.setNodeDao(m_nodeDao);
    m_resourceDao.setLocationMonitorDao(m_locationMonitorDao);
    m_resourceDao.setCollectdConfig(m_collectdConfig);
    m_resourceDao.setResourceTypesDao(m_resourceTypesDao);
    m_resourceDao.setResourceStorageDao(m_resourceStorageDao);
}
Also used : NodeDao(org.opennms.netmgt.dao.api.NodeDao) FilterDao(org.opennms.netmgt.filter.api.FilterDao) ResourceTypesDao(org.opennms.netmgt.config.api.ResourceTypesDao) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) CollectdConfigFactory(org.opennms.netmgt.config.CollectdConfigFactory) EasyMockUtils(org.opennms.test.mock.EasyMockUtils) JRobinRrdStrategy(org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy) FileAnticipator(org.opennms.test.FileAnticipator) LocationMonitorDao(org.opennms.netmgt.dao.api.LocationMonitorDao) Before(org.junit.Before)

Aggregations

FileAnticipator (org.opennms.test.FileAnticipator)24 Before (org.junit.Before)15 File (java.io.File)7 JRobinRrdStrategy (org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy)6 FilterDao (org.opennms.netmgt.filter.api.FilterDao)4 ArrayList (java.util.ArrayList)3 IpInterfaceDao (org.opennms.netmgt.dao.api.IpInterfaceDao)3 FilesystemResourceStorageDao (org.opennms.netmgt.dao.support.FilesystemResourceStorageDao)3 EasyMockUtils (org.opennms.test.mock.EasyMockUtils)3 FileSystemResource (org.springframework.core.io.FileSystemResource)3 FileWriter (java.io.FileWriter)2 InputStream (java.io.InputStream)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 PollOutagesConfigFactory (org.opennms.netmgt.config.PollOutagesConfigFactory)2 ResourceTypesDao (org.opennms.netmgt.config.api.ResourceTypesDao)2 LocationMonitorDao (org.opennms.netmgt.dao.api.LocationMonitorDao)2 NodeDao (org.opennms.netmgt.dao.api.NodeDao)2 MockEventIpcManager (org.opennms.netmgt.dao.mock.MockEventIpcManager)2