GraphName { public static String getFullName(final String nameSpace, final String nodeName) { String result = nodeName; String ns = nameSpace; if (ns == null || ns.length() == 0) { ns = EMPTY; } else if (!ns.startsWith(SEPARATOR)){ ns = String.format(FORMAT_TOPIC, EMPTY, ns); } if (nodeName.startsWith(SEPARATOR)) { result = nodeName; } else { result = String.format(FORMAT_TOPIC, ns, nodeName); } return result; } private  GraphName(); static void addNode(final Node node); static void removeNode(final Node node); static void dispose(); static String getFullName(final String nameSpace, final String nodeName); static String getFullName(final Node node, final String name, final List<String> options); static boolean isValidTopic(final String name); static boolean isValidSubstitution(final String substitution); static boolean isValidFQDN(final String fqn);  }
@Test public final void testGetFullName() { logger.debug(new Object(){}.getClass().getEnclosingMethod().getName()); Node node = RCLJava.createNode("my_node"); Assert.assertEquals("/ping", GraphName.getFullName(node, "ping", null)); Assert.assertEquals("/ping", GraphName.getFullName(node, "/ping", null)); Assert.assertEquals("/my_node", GraphName.getFullName(node, "~", null)); Assert.assertEquals("/my_node/ping", GraphName.getFullName(node, "~/ping", null)); node.dispose(); node = RCLJava.createNode("my_ns", "my_node"); Assert.assertEquals("/my_ns/ping", GraphName.getFullName(node, "ping", null)); Assert.assertEquals("/ping", GraphName.getFullName(node, "/ping", null)); Assert.assertEquals("/my_ns/my_node", GraphName.getFullName(node, "~", null)); Assert.assertEquals("/my_ns/my_node/ping", GraphName.getFullName(node, "~/ping", null)); node.dispose(); node = RCLJava.createNode("/my_ns/my_subns", "my_node"); Assert.assertEquals("/my_ns/my_subns/ping", GraphName.getFullName(node, "ping", null)); Assert.assertEquals("/ping", GraphName.getFullName(node, "/ping", null)); Assert.assertEquals("/my_ns/my_subns/my_node", GraphName.getFullName(node, "~", null)); Assert.assertEquals("/my_ns/my_subns/my_node/ping", GraphName.getFullName(node, "~/ping", null)); node.dispose(); }