use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class InterfaceToNodeCacheDaoImplIT method setUp.
@Before
public void setUp() throws Exception {
m_databasePopulator.populateDatabase();
m_cache.dataSourceSync();
OnmsNode n = new OnmsNode(m_databasePopulator.getMonitoringLocationDao().getDefaultLocation(), "my-new-node");
n.setForeignSource("junit");
n.setForeignId("10001");
OnmsIpInterface iface = new OnmsIpInterface(InetAddress.getByName("192.168.1.3"), n);
iface.setIsManaged("M");
iface.setIsSnmpPrimary(PrimaryType.PRIMARY);
OnmsSnmpInterface snmpIf = new OnmsSnmpInterface(n, 1001);
iface.setSnmpInterface(snmpIf);
snmpIf.getIpInterfaces().add(iface);
n.addIpInterface(iface);
m_databasePopulator.getNodeDao().save(n);
m_testNodeId = n.getId();
}
use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class HibernateCriteriaConverterIT method testNodeIlikeQuery.
@Test
@JUnitTemporaryDatabase
public void testNodeIlikeQuery() {
final CriteriaBuilder cb = new CriteriaBuilder(OnmsNode.class);
cb.isNotNull("id").eq("label", "node1").alias("ipInterfaces", "iface").ilike("iface.ipAddress", "1%");
final List<OnmsNode> nodes = m_nodeDao.findMatching(cb.toCriteria());
assertEquals(3, nodes.size());
}
use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class OutageDaoIT method testDuplicateOutages.
@Test
@Transactional
public void testDuplicateOutages() {
for (final OnmsNode node : m_nodeDao.findAll()) {
m_nodeDao.delete(node);
}
OnmsNode node = new OnmsNode(m_locationDao.getDefaultLocation(), "shoes");
m_nodeDao.save(node);
insertEntitiesAndOutage("172.16.1.1", "ICMP", node);
insertEntitiesAndOutage("192.0.2.1", "ICMP", node);
node = new OnmsNode(m_locationDao.getDefaultLocation(), "megaphone");
m_nodeDao.save(node);
insertEntitiesAndOutage("172.16.1.2", "ICMP", node);
insertEntitiesAndOutage("172.17.1.2", "ICMP", node);
insertEntitiesAndOutage("172.18.1.2", "ICMP", node);
node = new OnmsNode(m_locationDao.getDefaultLocation(), "grunties");
m_nodeDao.save(node);
insertEntitiesAndOutage("172.16.1.3", "ICMP", node);
List<OutageSummary> outages = m_outageDao.getNodeOutageSummaries(0);
System.err.println(outages);
assertEquals(3, outages.size());
}
use of org.opennms.netmgt.model.OnmsNode 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.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class MeasurementsRestServiceITCase method setUp.
public void setUp() {
BeanUtils.assertAutowiring(this);
OnmsNode node = new OnmsNode(m_locationDao.getDefaultLocation(), "node1");
node.setId(1);
m_nodeDao.save(node);
m_nodeDao.flush();
}
Aggregations