use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class GenericIndexResourceTypeTest method getNodeResource.
private OnmsResource getNodeResource(int nodeId) {
final NodeResourceType nodeResourceType = new NodeResourceType(m_resourceDao, m_nodeDao);
OnmsNode node = new OnmsNode();
node.setId(nodeId);
node.setLabel("Node" + nodeId);
return nodeResourceType.createResourceForNode(node);
}
use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class DefaultResourceDaoTest method testGetResourceByIdNewTopLevelOnly.
@Test
public void testGetResourceByIdNewTopLevelOnly() throws Exception {
OnmsNode node = createNode();
expect(m_nodeDao.get(node.getId().toString())).andReturn(node).times(1);
File responseDir = m_fileAnticipator.tempDir("snmp");
File nodeDir = m_fileAnticipator.tempDir(responseDir, node.getId().toString());
m_fileAnticipator.tempFile(nodeDir, "foo" + m_rrdFileExtension);
m_easyMockUtils.replayAll();
OnmsResource resource = m_resourceDao.getResourceById(ResourceId.get("node", "1"));
m_easyMockUtils.verifyAll();
assertNotNull("resource should not be null", resource);
}
use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class DefaultResourceDaoTest method testGetTopLevelResourceNodeExists.
@Test
public void testGetTopLevelResourceNodeExists() throws Exception {
OnmsNode node = createNode();
expect(m_nodeDao.get(node.getId().toString())).andReturn(node).times(1);
File responseDir = m_fileAnticipator.tempDir("snmp");
File nodeDir = m_fileAnticipator.tempDir(responseDir, node.getId().toString());
m_fileAnticipator.tempFile(nodeDir, "foo" + m_rrdFileExtension);
m_easyMockUtils.replayAll();
OnmsResource resource = m_resourceDao.getResourceById(ResourceId.get("node", Integer.toString(node.getId())));
m_easyMockUtils.verifyAll();
assertNotNull("Resource should not be null", resource);
}
use of org.opennms.netmgt.model.OnmsNode 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>());
}
use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.
the class GenericInfoPanelItemProviderTest method setUp.
@Before
public void setUp() throws IllegalAccessException, InstantiationException {
m_nodeDao = EasyMock.createMock(NodeDao.class);
m_measurementsService = EasyMock.createMock(MeasurementsService.class);
m_genericInfoPanelItemProvider = new GenericInfoPanelItemProvider(m_nodeDao, m_measurementsService);
m_onmsNode = new OnmsNode();
m_onmsNode.setLabel("nodeLabel");
m_onmsNode.setId(10);
}
Aggregations