ChecklistPlanner { public static Map<URL, List<JsonObject>> parseChecklists(final URL manifestUrl) throws Exception { Map<URL, List<URL>> manifestLookup = Util.mapManifestHeaderResources(OAKPAL_CHECKLIST, manifestUrl); return parseChecklists(manifestLookup); } ChecklistPlanner(final List<String> activeChecklistIds); void provideChecklists(final List<Checklist> constructed); void discoverChecklists(); void discoverChecklists(final ClassLoader classLoader); void discoverChecklists(final List<File> files); List<InitStage> getInitStages(); List<CheckSpec> getEffectiveCheckSpecs(final List<CheckSpec> checkOverrides); static List<Checklist> constructChecklists(final Map<URL, List<JsonObject>> parsed); static Map<URL, List<JsonObject>> parseChecklists(final URL manifestUrl); static Map<URL, List<JsonObject>> parseChecklists(final ClassLoader classLoader); static Map<URL, List<JsonObject>> parseChecklists(final List<File> files); static final String OAKPAL_CHECKLIST; static final String OAKPAL_MODULENAME; static final String BUNDLE_SYMBOLICNAME; static final String AUTOMATIC_MODULE_NAME; }
@Test public void testParseChecklists() throws Exception { List<Fun.ThrowingSupplier<Map<URL, List<JsonObject>>>> parsers = Arrays.asList( () -> ChecklistPlanner.parseChecklists(Arrays.asList(alphaDir, bravoDir, charlieDir)), () -> ChecklistPlanner.parseChecklists(getTestClassLoader()), this::parseIndivChecklists ); for (Fun.ThrowingSupplier<Map<URL, List<JsonObject>>> parser : parsers) { Map<URL, List<JsonObject>> parsed = parser.tryGet(); assertTrue("parsed contains alpha module", parsed.containsKey(alphaManifest)); assertEquals("alpha checklist size is", 1, parsed.get(alphaManifest).size()); assertEquals("alpha checklist 0 name is", "alpha", parsed.get(alphaManifest).get(0).getString("name")); assertTrue("parsed contains bravo module", parsed.containsKey(bravoManifest)); assertEquals("bravo checklist size is", 2, parsed.get(bravoManifest).size()); assertEquals("bravo checklist 0 name is", "bravo-1", parsed.get(bravoManifest).get(0).getString("name")); assertEquals("bravo checklist 1 name is", "bravo-2", parsed.get(bravoManifest).get(1).getString("name")); assertTrue("parsed contains charlie module", parsed.containsKey(charlieManifest)); assertEquals("charlie checklist size is", 1, parsed.get(charlieManifest).size()); assertFalse("charlie checklist 0 name is missing (defaults to module name)", parsed.get(charlieManifest).get(0).containsKey("name")); } }