@Test public void testIsRelevantConfigurationWithOrCombinations() { Set<String> currentRunmodes = new HashSet<String>( Arrays.asList("samplecontent", "author", "netcentric", "crx3tar", "crx2", "local")); slingSettings = new ExtendedSlingSettingsServiceImpl(currentRunmodes); Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration("test.yaml", "fragments.dev,local", slingSettings))); Assert.assertFalse((ConfigFilesRetrieverImpl.isRelevantConfiguration("test.yaml", "fragments.int,prod", slingSettings))); Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration("test.yaml", "fragments.author.dev,author.local", slingSettings))); Assert.assertFalse((ConfigFilesRetrieverImpl.isRelevantConfiguration("test.yaml", "fragments.publish.dev,publish.local", slingSettings))); }
static boolean isRelevantConfiguration(final String entryName, final String parentName, ExtendedSlingSettingsService slingSettings) { if (!entryName.endsWith(".yaml") && !entryName.equals("config") ) { return false; } String runModeSpec = extractRunModeSpecFromName(parentName); if (runModeSpec.isEmpty()) { LOG.debug("Install file '{}', because parent name '{}' does not have a run mode specified.", entryName, parentName); return true; } final boolean restrictionFulfilled = slingSettings.isMatchingRunModeSpec(runModeSpec); if (restrictionFulfilled) { LOG.debug("The relevant run modes are all set, therefore proceed installing file '{}'", entryName); } else { LOG.debug("The run mode restrictions could not be fullfilled, therefore not installing file '{}'", entryName); } return restrictionFulfilled; }
ConfigFilesRetrieverImpl implements ConfigFilesRetriever { static boolean isRelevantConfiguration(final String entryName, final String parentName, ExtendedSlingSettingsService slingSettings) { if (!entryName.endsWith(".yaml") && !entryName.equals("config") ) { return false; } String runModeSpec = extractRunModeSpecFromName(parentName); if (runModeSpec.isEmpty()) { LOG.debug("Install file '{}', because parent name '{}' does not have a run mode specified.", entryName, parentName); return true; } final boolean restrictionFulfilled = slingSettings.isMatchingRunModeSpec(runModeSpec); if (restrictionFulfilled) { LOG.debug("The relevant run modes are all set, therefore proceed installing file '{}'", entryName); } else { LOG.debug("The run mode restrictions could not be fullfilled, therefore not installing file '{}'", entryName); } return restrictionFulfilled; } }
ConfigFilesRetrieverImpl implements ConfigFilesRetriever { static boolean isRelevantConfiguration(final String entryName, final String parentName, ExtendedSlingSettingsService slingSettings) { if (!entryName.endsWith(".yaml") && !entryName.equals("config") ) { return false; } String runModeSpec = extractRunModeSpecFromName(parentName); if (runModeSpec.isEmpty()) { LOG.debug("Install file '{}', because parent name '{}' does not have a run mode specified.", entryName, parentName); return true; } final boolean restrictionFulfilled = slingSettings.isMatchingRunModeSpec(runModeSpec); if (restrictionFulfilled) { LOG.debug("The relevant run modes are all set, therefore proceed installing file '{}'", entryName); } else { LOG.debug("The run mode restrictions could not be fullfilled, therefore not installing file '{}'", entryName); } return restrictionFulfilled; }  }
ConfigFilesRetrieverImpl implements ConfigFilesRetriever { static boolean isRelevantConfiguration(final String entryName, final String parentName, ExtendedSlingSettingsService slingSettings) { if (!entryName.endsWith(".yaml") && !entryName.equals("config") ) { return false; } String runModeSpec = extractRunModeSpecFromName(parentName); if (runModeSpec.isEmpty()) { LOG.debug("Install file '{}', because parent name '{}' does not have a run mode specified.", entryName, parentName); return true; } final boolean restrictionFulfilled = slingSettings.isMatchingRunModeSpec(runModeSpec); if (restrictionFulfilled) { LOG.debug("The relevant run modes are all set, therefore proceed installing file '{}'", entryName); } else { LOG.debug("The run mode restrictions could not be fullfilled, therefore not installing file '{}'", entryName); } return restrictionFulfilled; }  @Override Map<String, String> getConfigFileContentFromNode(String rootPath, Session session); @Override Map<String, String> getConfigFileContentFromPackage(Archive archive); }
ConfigFilesRetrieverImpl implements ConfigFilesRetriever { static boolean isRelevantConfiguration(final String entryName, final String parentName, ExtendedSlingSettingsService slingSettings) { if (!entryName.endsWith(".yaml") && !entryName.equals("config") ) { return false; } String runModeSpec = extractRunModeSpecFromName(parentName); if (runModeSpec.isEmpty()) { LOG.debug("Install file '{}', because parent name '{}' does not have a run mode specified.", entryName, parentName); return true; } final boolean restrictionFulfilled = slingSettings.isMatchingRunModeSpec(runModeSpec); if (restrictionFulfilled) { LOG.debug("The relevant run modes are all set, therefore proceed installing file '{}'", entryName); } else { LOG.debug("The run mode restrictions could not be fullfilled, therefore not installing file '{}'", entryName); } return restrictionFulfilled; }  @Override Map<String, String> getConfigFileContentFromNode(String rootPath, Session session); @Override Map<String, String> getConfigFileContentFromPackage(Archive archive);  }