@Test public void testInstallInputOrgInPropertiesFileExpectsAddedToService() throws Exception { Organization org1 = EasyMock.createMock(Organization.class); EasyMock.expect(org1.getId()).andReturn("org1").anyTimes(); EasyMock.replay(org1); Organization org2 = EasyMock.createMock(Organization.class); EasyMock.expect(org2.getId()).andReturn("org2").anyTimes(); EasyMock.replay(org2); EasyMock.expect(securityService.getOrganization()).andReturn(org1).anyTimes(); EasyMock.replay(securityService); File file = getResourceFile("/ListProvidersScannerTest-WithOrg.properties"); listProvidersScanner.install(file); ResourceListQuery query = new ResourceListQueryImpl(); assertEquals(1, listProvidersService.getAvailableProviders().size()); assertEquals(listName, listProvidersService.getAvailableProviders().get(0)); assertEquals("org1", org1.getId()); assertTrue("Provider is not registered", listProvidersService.hasProvider(listName, org1.getId())); Map<String, String> dictionary = listProvidersService.getList(listName, query, false); assertEquals(3, dictionary.size()); 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")); }
@Override public void install(File artifact) { String filePath = artifact.getAbsolutePath(); logger.info("Installing list provider {}", filePath); Properties properties; try { properties = readProperties(artifact); } catch (IOException e) { logger.error("Unable to read file " + filePath); return; } addResourceListProvider(filePath, properties); }
ListProvidersScanner implements ArtifactInstaller { @Override public void install(File artifact) { String filePath = artifact.getAbsolutePath(); logger.info("Installing list provider {}", filePath); Properties properties; try { properties = readProperties(artifact); } catch (IOException e) { logger.error("Unable to read file " + filePath); return; } addResourceListProvider(filePath, properties); } }
ListProvidersScanner implements ArtifactInstaller { @Override public void install(File artifact) { String filePath = artifact.getAbsolutePath(); logger.info("Installing list provider {}", filePath); Properties properties; try { properties = readProperties(artifact); } catch (IOException e) { logger.error("Unable to read file " + filePath); return; } addResourceListProvider(filePath, properties); }  }
ListProvidersScanner implements ArtifactInstaller { @Override public void install(File artifact) { String filePath = artifact.getAbsolutePath(); logger.info("Installing list provider {}", filePath); Properties properties; try { properties = readProperties(artifact); } catch (IOException e) { logger.error("Unable to read file " + filePath); return; } 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); }
ListProvidersScanner implements ArtifactInstaller { @Override public void install(File artifact) { String filePath = artifact.getAbsolutePath(); logger.info("Installing list provider {}", filePath); Properties properties; try { properties = readProperties(artifact); } catch (IOException e) { logger.error("Unable to read file " + filePath); return; } 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; }