@Override public String toString() { return "script-based mapping with " + getRawMapping().toString(); }
private ScriptBasedMappingWithDependency createMapping(Configuration conf) { ScriptBasedMappingWithDependency mapping = new ScriptBasedMappingWithDependency(); mapping.setConf(conf); return mapping; } }
@Test public void testNoArgsMeansNoResult() { Configuration conf = new Configuration(); conf.setInt(ScriptBasedMapping.SCRIPT_ARG_COUNT_KEY, ScriptBasedMapping.MIN_ALLOWABLE_ARGS - 1); conf.set(ScriptBasedMapping.SCRIPT_FILENAME_KEY, "any-filename-1"); conf.set(ScriptBasedMappingWithDependency.DEPENDENCY_SCRIPT_FILENAME_KEY, "any-filename-2"); conf.setInt(ScriptBasedMapping.SCRIPT_ARG_COUNT_KEY, 10); ScriptBasedMappingWithDependency mapping = createMapping(conf); List<String> names = new ArrayList<String>(); names.add("some.machine.name"); names.add("other.machine.name"); List<String> result = mapping.resolve(names); assertNull("Expected an empty list for resolve", result); result = mapping.getDependency("some.machine.name"); assertNull("Expected an empty list for getDependency", result); }
private ScriptBasedMappingWithDependency createMapping(Configuration conf) { ScriptBasedMappingWithDependency mapping = new ScriptBasedMappingWithDependency(); mapping.setConf(conf); return mapping; } }
@Test public void testNoArgsMeansNoResult() { Configuration conf = new Configuration(); conf.setInt(ScriptBasedMapping.SCRIPT_ARG_COUNT_KEY, ScriptBasedMapping.MIN_ALLOWABLE_ARGS - 1); conf.set(ScriptBasedMapping.SCRIPT_FILENAME_KEY, "any-filename-1"); conf.set(ScriptBasedMappingWithDependency.DEPENDENCY_SCRIPT_FILENAME_KEY, "any-filename-2"); conf.setInt(ScriptBasedMapping.SCRIPT_ARG_COUNT_KEY, 10); ScriptBasedMappingWithDependency mapping = createMapping(conf); List<String> names = new ArrayList<String>(); names.add("some.machine.name"); names.add("other.machine.name"); List<String> result = mapping.resolve(names); assertNull("Expected an empty list for resolve", result); result = mapping.getDependency("some.machine.name"); assertNull("Expected an empty list for getDependency", result); }
/** * Get dependencies in the topology for a given host * @param name - host name for which we are getting dependency * @return a list of hosts dependent on the provided host name */ @Override public List<String> getDependency(String name) { //normalize all input names to be in the form of IP addresses name = NetUtils.normalizeHostName(name); if (name==null) { return Collections.emptyList(); } List<String> dependencies = dependencyCache.get(name); if (dependencies == null) { //not cached dependencies = getRawMapping().getDependency(name); if(dependencies != null) { dependencyCache.put(name, dependencies); } } return dependencies; }
/** * {@inheritDoc} * <p/> * This will get called in the superclass constructor, so a check is needed * to ensure that the raw mapping is defined before trying to relaying a null * configuration. * @param conf */ @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); }
@Override public String toString() { return "script-based mapping with " + getRawMapping().toString(); }
@Override public String toString() { return "script-based mapping with " + getRawMapping().toString(); }
@Override public String toString() { return "script-based mapping with " + getRawMapping().toString(); }
@Override public String toString() { return "script-based mapping with " + getRawMapping().toString(); }
/** * {@inheritDoc} * <p/> * This will get called in the superclass constructor, so a check is needed * to ensure that the raw mapping is defined before trying to relaying a null * configuration. * @param conf */ @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); }
/** * Get dependencies in the topology for a given host * @param name - host name for which we are getting dependency * @return a list of hosts dependent on the provided host name */ @Override public List<String> getDependency(String name) { //normalize all input names to be in the form of IP addresses name = NetUtils.normalizeHostName(name); if (name==null) { return Collections.emptyList(); } List<String> dependencies = dependencyCache.get(name); if (dependencies == null) { //not cached dependencies = getRawMapping().getDependency(name); if(dependencies != null) { dependencyCache.put(name, dependencies); } } return dependencies; }
/** * Get dependencies in the topology for a given host * @param name - host name for which we are getting dependency * @return a list of hosts dependent on the provided host name */ @Override public List<String> getDependency(String name) { //normalize all input names to be in the form of IP addresses name = NetUtils.normalizeHostName(name); if (name==null) { return Collections.emptyList(); } List<String> dependencies = dependencyCache.get(name); if (dependencies == null) { //not cached dependencies = getRawMapping().getDependency(name); if(dependencies != null) { dependencyCache.put(name, dependencies); } } return dependencies; }
/** * Get dependencies in the topology for a given host * @param name - host name for which we are getting dependency * @return a list of hosts dependent on the provided host name */ @Override public List<String> getDependency(String name) { //normalize all input names to be in the form of IP addresses name = NetUtils.normalizeHostName(name); if (name==null) { return Collections.emptyList(); } List<String> dependencies = dependencyCache.get(name); if (dependencies == null) { //not cached dependencies = getRawMapping().getDependency(name); if(dependencies != null) { dependencyCache.put(name, dependencies); } } return dependencies; }
/** * {@inheritDoc} * <p/> * This will get called in the superclass constructor, so a check is needed * to ensure that the raw mapping is defined before trying to relaying a null * configuration. * @param conf */ @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); }
/** * {@inheritDoc} * <p/> * This will get called in the superclass constructor, so a check is needed * to ensure that the raw mapping is defined before trying to relaying a null * configuration. * @param conf */ @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); }
/** * {@inheritDoc} * <p/> * This will get called in the superclass constructor, so a check is needed * to ensure that the raw mapping is defined before trying to relaying a null * configuration. * @param conf */ @Override public void setConf(Configuration conf) { super.setConf(conf); getRawMapping().setConf(conf); }
/** * Get dependencies in the topology for a given host * @param name - host name for which we are getting dependency * @return a list of hosts dependent on the provided host name */ @Override public List<String> getDependency(String name) { //normalize all input names to be in the form of IP addresses name = NetUtils.normalizeHostName(name); if (name==null) { return Collections.emptyList(); } List<String> dependencies = dependencyCache.get(name); if (dependencies == null) { //not cached dependencies = getRawMapping().getDependency(name); if(dependencies != null) { dependencyCache.put(name, dependencies); } } return dependencies; }