本文整理汇总了Java中org.opennms.netmgt.model.OnmsNode.setPathElement方法的典型用法代码示例。如果您正苦于以下问题:Java OnmsNode.setPathElement方法的具体用法?Java OnmsNode.setPathElement怎么用?Java OnmsNode.setPathElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.netmgt.model.OnmsNode
的用法示例。
在下文中一共展示了OnmsNode.setPathElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSaveWithNullPathElement
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Test
@Transactional
public void testSaveWithNullPathElement() {
OnmsDistPoller distPoller = getDistPollerDao().get("localhost");
OnmsNode node = new OnmsNode(distPoller);
node.setLabel("MyFirstNode");
PathElement p = new PathElement("192.168.7.7", "ICMP");
node.setPathElement(p);
getNodeDao().save(node);
OnmsNode myNode = getNodeDao().get(node.getId());
assertNotNull(myNode);
myNode.setPathElement(null);
getNodeDao().save(myNode);
getNodeDao().flush();
}
示例2: testSaveWithPathElement
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Test
@Transactional
public void testSaveWithPathElement() {
OnmsDistPoller distPoller = getDistPollerDao().get("localhost");
OnmsNode node = new OnmsNode(distPoller);
node.setLabel("MyFirstNode");
PathElement p = new PathElement("192.168.7.7", "ICMP");
node.setPathElement(p);
getNodeDao().save(node);
getNodeDao().flush();
}
示例3: testCreate
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Test
@Transactional
public void testCreate() throws InterruptedException {
OnmsDistPoller distPoller = getDistPoller();
OnmsNode node = new OnmsNode(distPoller);
node.setLabel("MyFirstNode");
node.getAssetRecord().setDisplayCategory("MyCategory");
PathElement p = new PathElement("192.168.7.7", "ICMP");
node.setPathElement(p);
getNodeDao().save(node);
System.out.println("BEFORE GET");
OnmsDistPoller dp = getDistPoller();
assertSame(distPoller, dp);
System.out.println("AFTER GET");
Collection<OnmsNode> nodes = getNodeDao().findNodes(dp);
assertEquals(7, nodes.size());
System.out.println("AFTER GETNODES");
for (OnmsNode retrieved : nodes) {
System.out.println("category for "+retrieved.getId()+" = "+retrieved.getAssetRecord().getDisplayCategory());
if (node.getId().intValue() == 5) {
assertEquals("MyFirstNode", retrieved.getLabel());
assertEquals("MyCategory", retrieved.getAssetRecord().getDisplayCategory());
assertEquals("192.168.7.7", retrieved.getPathElement().getIpAddress());
}
}
System.out.println("AFTER Loop");
}
示例4: setPathDependency
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void setPathDependency(final OnmsNode node, final OnmsNode parent) {
if (node == null) return;
OnmsIpInterface critIface = null;
if (parent != null) {
critIface = parent.getCriticalInterface();
}
infof(this, "Setting criticalInterface of node: %s to: %s", node, critIface);
node.setPathElement(critIface == null ? null : new PathElement(str(critIface.getIpAddress()), "ICMP"));
}