}
public void testNodeData() throws Exception {
{
final NodeEntryImpl nodeentry = new NodeEntryImpl("testhost", "test1");
final Map<String, String> stringMap = DataContextUtils.nodeData(nodeentry);
assertNotNull(stringMap);
assertEquals("wrong size: " + stringMap, 9, stringMap.size());
assertEquals("test1", stringMap.get("name"));
assertEquals("testhost", stringMap.get("hostname"));
assertEquals("", stringMap.get("os-name"));
assertEquals("", stringMap.get("os-family"));
assertEquals("", stringMap.get("os-arch"));
assertEquals("", stringMap.get("os-version"));
assertEquals("", stringMap.get("tags"));
assertEquals("", stringMap.get("username"));
assertEquals("", stringMap.get("description"));
}
{
final NodeEntryImpl nodeentry = new NodeEntryImpl("testhost", "test1");
nodeentry.setDescription("testdesc");
nodeentry.setUsername("username");
nodeentry.setOsArch("osarch");
nodeentry.setOsFamily("osfamily");
nodeentry.setOsName("osname");
nodeentry.setOsVersion("osversion");
nodeentry.setTags(new HashSet());
final Map<String, String> stringMap = DataContextUtils.nodeData(nodeentry);
assertNotNull(stringMap);
assertEquals(9, stringMap.size());
assertEquals("test1", stringMap.get("name"));
assertEquals("testhost", stringMap.get("hostname"));
assertEquals("osname", stringMap.get("os-name"));
assertEquals("osfamily", stringMap.get("os-family"));
assertEquals("osarch", stringMap.get("os-arch"));
assertEquals("osversion", stringMap.get("os-version"));
assertEquals("", stringMap.get("tags"));
assertEquals("username", stringMap.get("username"));
assertEquals("testdesc", stringMap.get("description"));
}
{
final NodeEntryImpl nodeentry = new NodeEntryImpl("testhost", "test1");
final HashSet tags = new HashSet();
tags.add("tag1");
nodeentry.setTags(tags);
final Map<String, String> stringMap = DataContextUtils.nodeData(nodeentry);
assertNotNull(stringMap);
assertEquals(9, stringMap.size());
assertEquals("test1", stringMap.get("name"));
assertEquals("testhost", stringMap.get("hostname"));
assertEquals("tag1", stringMap.get("tags"));
}
{
final NodeEntryImpl nodeentry = new NodeEntryImpl("testhost", "test1");
final TreeSet tags = new TreeSet();
tags.add("tag1");
tags.add("tag2");
tags.add("xyz");
nodeentry.setTags(tags);
final Map<String, String> stringMap = DataContextUtils.nodeData(nodeentry);
assertNotNull(stringMap);
assertEquals(9, stringMap.size());
assertEquals("test1", stringMap.get("name"));