ListProvidersScanner implements ArtifactInstaller { @Override public void update(File artifact) { String filePath = artifact.getAbsolutePath(); logger.info("Updating list provider {}", filePath); ResourceTuple resource = fileToListNames.get(filePath); Properties properties; try { properties = readProperties(artifact); } catch (IOException e) { logger.error("Unable to read file " + filePath); return; } String orgId = Objects.toString(properties.getProperty(LIST_ORG_KEY), ALL_ORGANIZATIONS); if (resource != null && !orgId.equals(resource.getOrganizationId())) { removeResourceListProvider(artifact); } addResourceListProvider(filePath, properties); }  void setListProvidersService(ListProvidersService listProvidersService); @Override boolean canHandle(File artifact); @Override void install(File artifact); @Override void update(File artifact); @Override void uninstall(File artifact); static final String LIST_PROVIDERS_DIRECTORY; static final String LIST_NAME_KEY; static final String LIST_TRANSLATABLE_KEY; static final String LIST_ORG_KEY; static final String LIST_DEFAULT_KEY; }
@Test public void testDefaultUpdate() throws Exception { File file = getResourceFile("/ListProvidersScannerTest-GoodProperties.properties"); listProvidersScanner.update(file); Map<String, String> dictionary = listProvidersService.getList(listName, null, false); assertEquals("TEST.VALUE.1", dictionary.get("TEST.KEY.1")); assertEquals("TEST.VALUE.2", dictionary.get("TEST.KEY.2")); assertEquals("TEST.VALUE.3", dictionary.get("TEST.KEY.3")); }