use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.
the class PersistenceSerializationTest method setUp.
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
fa = new FileAnticipator();
fsr = new MockForeignSourceRepository();
fsr.save(new ForeignSource("cheese"));
fsr.flush();
fs = fsr.getForeignSource("cheese");
// fs.setScanInterval(scanInterval)
XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar("2009-02-25T12:45:38.800-05:00");
fs.setDateStamp(cal);
List<PluginConfig> detectors = new ArrayList<PluginConfig>();
final PluginConfig detector = new PluginConfig("food", "org.opennms.netmgt.provision.persist.detectors.FoodDetector");
detector.addParameter("type", "cheese");
detector.addParameter("density", "soft");
detector.addParameter("sharpness", "mild");
detectors.add(detector);
fs.setDetectors(detectors);
List<PluginConfig> policies = new ArrayList<PluginConfig>();
PluginConfig policy = new PluginConfig("lower-case-node", "org.opennms.netmgt.provision.persist.policies.NodeCategoryPolicy");
policy.addParameter("label", "~^[a-z]$");
policy.addParameter("category", "Lower-Case-Nodes");
policies.add(policy);
policy = new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy");
policies.add(policy);
policy = new PluginConfig("10-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.MatchingInterfacePolicy");
policy.addParameter("ipaddress", "~^10\\..*$");
policies.add(policy);
policy = new PluginConfig("cisco-snmp-interfaces", "org.opennms.netmgt.provision.persist.policies.MatchingSnmpInterfacePolicy");
policy.addParameter("ifdescr", "~^(?i:LEC).*$");
policies.add(policy);
fs.setPolicies(policies);
fsw = new ForeignSourceCollection();
fsw.getForeignSources().addAll(fsr.getForeignSources());
c = JAXBContext.newInstance(ForeignSourceCollection.class, ForeignSource.class);
m = c.createMarshaller();
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setNormalize(true);
}
use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.
the class TcaDataCollectionConfigTest method setUp.
/**
* Sets the up.
*
* @throws Exception the exception
*/
@Before
public void setUp() throws Exception {
fileAnticipator = new FileAnticipator();
context = JAXBContext.newInstance(TcaDataCollectionConfig.class);
marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller();
TcaRrd rrd = new TcaRrd();
rrd.addRra("RRA:AVERAGE:0.5:1:3600");
rrd.addRra("RRA:AVERAGE:0.5:300:288");
rrd.addRra("RRA:MIN:0.5:300:288");
rrd.addRra("RRA:MAX:0.5:300:288");
rrd.addRra("RRA:AVERAGE:0.5:900:2880");
rrd.addRra("RRA:MIN:0.5:900:2880");
rrd.addRra("RRA:MAX:0.5:900:2880");
rrd.addRra("RRA:AVERAGE:0.5:3600:4300");
rrd.addRra("RRA:MIN:0.5:3600:4300");
rrd.addRra("RRA:MAX:0.5:3600:4300");
TcaDataCollection tcadc = new TcaDataCollection();
tcadc.setName("default");
tcadc.setRrd(rrd);
tcadcc = new TcaDataCollectionConfig();
tcadcc.addDataCollection(tcadc);
tcadcc.setRrdRepository("target/snmp/");
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setNormalize(true);
}
use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.
the class RrdPersistOperationBuilderTest method setUp.
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
m_rrdStrategy = new JRobinRrdStrategy();
m_fileAnticipator = new FileAnticipator();
m_intf = new OnmsIpInterface();
m_node = new OnmsNode();
m_node.setId(1);
m_intf.setNode(m_node);
m_intf.setIpAddress(InetAddressUtils.addr("1.1.1.1"));
m_intf.setId(27);
m_ifDao = EasyMock.createMock(IpInterfaceDao.class);
EasyMock.expect(m_ifDao.load(m_intf.getId())).andReturn(m_intf).anyTimes();
EasyMock.replay(m_ifDao);
}
use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.
the class DefaultRrdDaoIntegrationTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
m_rrdStrategy = new JRobinRrdStrategy();
m_fileAnticipator = new FileAnticipator();
m_dao = new DefaultRrdDao();
m_dao.setRrdStrategy(m_rrdStrategy);
m_dao.setRrdBaseDirectory(m_fileAnticipator.getTempDir());
m_dao.setRrdBinaryPath("/bin/true");
m_dao.afterPropertiesSet();
}
use of org.opennms.test.FileAnticipator in project opennms by OpenNMS.
the class BasePersisterTest method setUp.
@Before
public void setUp() throws Exception {
MockUtil.println("------------ Begin Test " + m_testName.getMethodName() + " --------------------------");
MockLogAppender.setupLogging();
m_fileAnticipator = new FileAnticipator();
m_rrdStrategy = new JRobinRrdStrategy();
m_resourceStorageDao = new FilesystemResourceStorageDao();
m_resourceStorageDao.setRrdDirectory(m_fileAnticipator.getTempDir());
m_intf = new OnmsIpInterface();
m_node = new OnmsNode();
m_node.setId(1);
m_intf.setId(25);
m_intf.setNode(m_node);
m_intf.setIpAddress(InetAddressUtils.addr("1.1.1.1"));
m_ifDao = m_easyMockUtils.createMock(IpInterfaceDao.class);
m_serviceParams = new ServiceParameters(new HashMap<String, Object>());
}
Aggregations