@Test public void testSimpleHierarchy() { ClientLibrary clientLibraryA = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "categoryA").getClientLibrary(); ClientLibrary clientLibraryB = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "categoryB").setDependentLibraries(clientLibraryA).getClientLibrary(); ClientLibrary clientLibraryC = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "categoryC").setEmbeddedJsLibraries(clientLibraryB).getClientLibrary(); List<String> allCategories = new ArrayList<String>(); ClientLibOptimizerServlet.getSortedDependentCategories(Collections.singleton(clientLibraryC), Collections.singleton("categoryC"), LibraryType.JS, allCategories); Assert.assertThat(allCategories, Matchers.contains("categoryA", "categoryB", "categoryC")); }
private List<String> getSortedDependentCategories(Set<String> originalCategories, LibraryType type, List<String> existingCategories) { final Collection<ClientLibrary> libraries = htmlLibraryManager.getLibraries( originalCategories.toArray(new String[0]), null, true, false); return getSortedDependentCategories(libraries, originalCategories, type, existingCategories); }
ClientLibOptimizerServlet extends SlingSafeMethodsServlet { private List<String> getSortedDependentCategories(Set<String> originalCategories, LibraryType type, List<String> existingCategories) { final Collection<ClientLibrary> libraries = htmlLibraryManager.getLibraries( originalCategories.toArray(new String[0]), null, true, false); return getSortedDependentCategories(libraries, originalCategories, type, existingCategories); } }
ClientLibOptimizerServlet extends SlingSafeMethodsServlet { private List<String> getSortedDependentCategories(Set<String> originalCategories, LibraryType type, List<String> existingCategories) { final Collection<ClientLibrary> libraries = htmlLibraryManager.getLibraries( originalCategories.toArray(new String[0]), null, true, false); return getSortedDependentCategories(libraries, originalCategories, type, existingCategories); }  }
ClientLibOptimizerServlet extends SlingSafeMethodsServlet { private List<String> getSortedDependentCategories(Set<String> originalCategories, LibraryType type, List<String> existingCategories) { final Collection<ClientLibrary> libraries = htmlLibraryManager.getLibraries( originalCategories.toArray(new String[0]), null, true, false); return getSortedDependentCategories(libraries, originalCategories, type, existingCategories); }   }
ClientLibOptimizerServlet extends SlingSafeMethodsServlet { private List<String> getSortedDependentCategories(Set<String> originalCategories, LibraryType type, List<String> existingCategories) { final Collection<ClientLibrary> libraries = htmlLibraryManager.getLibraries( originalCategories.toArray(new String[0]), null, true, false); return getSortedDependentCategories(libraries, originalCategories, type, existingCategories); }    }