@Test public void testcreateConfigurationResolver() { HashMap<String, String> env = getDefaultEnv(); CommandLineLoader loader = new CommandLineLoader(emptyArgv, env); NodeConfiguration nodeConfiguration = loader.build(); nodeConfiguration.getParentResolver().getRemappings(); nodeConfiguration = loader.build(); List<String> args = Lists.newArrayList("Foo", "foo", "--bar"); loader = new CommandLineLoader(args, env); nodeConfiguration = loader.build(); NameResolver resolver = nodeConfiguration.getParentResolver(); assertTrue(resolver.getRemappings().isEmpty()); List<String> tests = Lists.newArrayList("--help name:=/my/name -i foo:=/my/foo", "name:=/my/name --help -i foo:=/my/foo", "name:=/my/name foo:=/my/foo --help -i"); for (String test : tests) { args = Lists.newArrayList(("Foo " + test).split("\\s+")); loader = new CommandLineLoader(args, env); nodeConfiguration = loader.build(); NameResolver r = nodeConfiguration.getParentResolver(); GraphName n = r.resolve("name"); assertGraphNameEquals("/my/name", n); assertGraphNameEquals("/name", r.resolve("/name")); assertGraphNameEquals("/my/foo", r.resolve("foo")); assertGraphNameEquals("/my/name", r.resolve("/my/name")); } }
public NodeConfiguration build() { parseRemappingArguments(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getHost()); nodeConfiguration.setParentResolver(buildParentResolver()); nodeConfiguration.setRosRoot(getRosRoot()); nodeConfiguration.setRosPackagePath(getRosPackagePath()); nodeConfiguration.setMasterUri(getMasterUri()); if (specialRemappings.containsKey(CommandLineVariables.NODE_NAME)) { nodeConfiguration.setNodeName(specialRemappings.get(CommandLineVariables.NODE_NAME)); } return nodeConfiguration; }
CommandLineLoader { public NodeConfiguration build() { parseRemappingArguments(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getHost()); nodeConfiguration.setParentResolver(buildParentResolver()); nodeConfiguration.setRosRoot(getRosRoot()); nodeConfiguration.setRosPackagePath(getRosPackagePath()); nodeConfiguration.setMasterUri(getMasterUri()); if (specialRemappings.containsKey(CommandLineVariables.NODE_NAME)) { nodeConfiguration.setNodeName(specialRemappings.get(CommandLineVariables.NODE_NAME)); } return nodeConfiguration; } }
CommandLineLoader { public NodeConfiguration build() { parseRemappingArguments(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getHost()); nodeConfiguration.setParentResolver(buildParentResolver()); nodeConfiguration.setRosRoot(getRosRoot()); nodeConfiguration.setRosPackagePath(getRosPackagePath()); nodeConfiguration.setMasterUri(getMasterUri()); if (specialRemappings.containsKey(CommandLineVariables.NODE_NAME)) { nodeConfiguration.setNodeName(specialRemappings.get(CommandLineVariables.NODE_NAME)); } return nodeConfiguration; } CommandLineLoader(List<String> argv);  CommandLineLoader(List<String> argv, Map<String, String> environment); }
CommandLineLoader { public NodeConfiguration build() { parseRemappingArguments(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getHost()); nodeConfiguration.setParentResolver(buildParentResolver()); nodeConfiguration.setRosRoot(getRosRoot()); nodeConfiguration.setRosPackagePath(getRosPackagePath()); nodeConfiguration.setMasterUri(getMasterUri()); if (specialRemappings.containsKey(CommandLineVariables.NODE_NAME)) { nodeConfiguration.setNodeName(specialRemappings.get(CommandLineVariables.NODE_NAME)); } return nodeConfiguration; } CommandLineLoader(List<String> argv);  CommandLineLoader(List<String> argv, Map<String, String> environment); String getNodeClassName(); List<String> getNodeArguments(); NodeConfiguration build(); NodeMain loadClass(String name); }
CommandLineLoader { public NodeConfiguration build() { parseRemappingArguments(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getHost()); nodeConfiguration.setParentResolver(buildParentResolver()); nodeConfiguration.setRosRoot(getRosRoot()); nodeConfiguration.setRosPackagePath(getRosPackagePath()); nodeConfiguration.setMasterUri(getMasterUri()); if (specialRemappings.containsKey(CommandLineVariables.NODE_NAME)) { nodeConfiguration.setNodeName(specialRemappings.get(CommandLineVariables.NODE_NAME)); } return nodeConfiguration; } CommandLineLoader(List<String> argv);  CommandLineLoader(List<String> argv, Map<String, String> environment); String getNodeClassName(); List<String> getNodeArguments(); NodeConfiguration build(); NodeMain loadClass(String name);  }