@Test public void testCQJquery() { ClientLibrary jQuery = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "jquery").getClientLibrary(); ClientLibrary graniteUtils = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "granite.utils").setDependentLibraries(jQuery).getClientLibrary(); ClientLibrary graniteJQuery = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "granite.jquery").setDependentLibraries(jQuery, graniteUtils).getClientLibrary(); ClientLibrary cqQuery = new MockClientLibraryBuilder(MockClientLibraryBuilder.MockClientLibraryType.JS, "cq.jquery").setDependentLibraries(graniteJQuery).getClientLibrary(); List<String> allCategories = new ArrayList<String>(); ClientLibOptimizerServlet.getSortedDependentCategories(Collections.singleton(cqQuery), Collections.singleton("cq.jquery"), LibraryType.JS, allCategories); Assert.assertThat(allCategories, Matchers.contains("jquery", "granite.utils","granite.jquery", "cq.jquery")); }
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); }    }