LocalizerResourceConfig { public LocalResourceType getResourceLocalType(final String resourceName) { String typeStr = config.get(String.format(RESOURCE_LOCAL_TYPE, resourceName), DEFAULT_RESOURCE_LOCAL_TYPE); return LocalResourceType.valueOf(StringUtils.upperCase(typeStr)); } LocalizerResourceConfig(final Config config); List<String> getResourceNames(); Path getResourcePath(final String resourceName); LocalResourceType getResourceLocalType(final String resourceName); LocalResourceVisibility getResourceLocalVisibility(final String resourceName); String getResourceLocalName(final String resourceName);  }
@Test public void testInvalidType() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("No enum constant org.apache.hadoop.yarn.api.records.LocalResourceType.INVALIDTYPE"); Map<String, String> configMap = new HashMap<>(); configMap.put("yarn.resources.myResource1.path", "http: configMap.put("yarn.resources.myResource1.local.name", "readme"); configMap.put("yarn.resources.myResource1.local.type", "invalidType"); configMap.put("yarn.resources.myResource1.local.visibility", "application"); Config conf = new MapConfig(configMap); LocalizerResourceConfig manager = new LocalizerResourceConfig(conf); manager.getResourceLocalType("myResource1"); }