ProfileUtil { public static Profile lookup(String name, File directory) throws IOException { List<Profile> profiles = readProfileFromClasspath(name); File profileFile = findProfileYaml(directory); if (profileFile != null) { List<Profile> fileProfiles = fromYaml(new FileInputStream(profileFile)); for (Profile profile : fileProfiles) { if (profile.getName().equals(name)) { profiles.add(profile); break; } } } Collections.sort(profiles, Collections.<Profile>reverseOrder()); return mergeProfiles(profiles); } private  ProfileUtil(); static Profile findProfile(String profileArg, File resourceDir); static ProcessorConfig blendProfileWithConfiguration(ProcessorConfigurationExtractor configExtractor,
                                                                String profile,
                                                                File resourceDir,
                                                                ProcessorConfig config); static Profile lookup(String name, File directory); static List<Profile> readAllFromClasspath(String name, String ext); static List<Profile> fromYaml(InputStream is); static final String[] PROFILE_FILENAMES; static final String DEFAULT_PROFILE; final static ProcessorConfigurationExtractor GENERATOR_CONFIG; final static ProcessorConfigurationExtractor ENRICHER_CONFIG; final static ProcessorConfigurationExtractor WATCHER_CONFIG; }
@Test public void lookup() throws IOException, URISyntaxException { File dir = getProfileDir(); Profile profile = ProfileUtil.lookup("simple", dir); assertEquals("simple", profile.getName()); assertEquals("http: profile = ProfileUtil.lookup("one", dir); assertTrue(profile.getGeneratorConfig().use("foobar")); assertNull(ProfileUtil.lookup("three", dir)); }