### Question:
ProfileUtil { public static List<Profile> fromYaml(InputStream is) throws IOException { TypeReference<List<Profile>> typeRef = new TypeReference<List<Profile>>() {}; return mapper.readValue(is, typeRef); } 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; }### Answer:
@Test public void simple() throws IOException { InputStream is = getClass().getResourceAsStream("/jshift/config/profiles-lookup-dir/profiles.yaml"); assertNotNull(is); List<Profile> profiles = ProfileUtil.fromYaml(is); assertNotNull(profiles); assertEquals(profiles.size(),3); Profile profile = profiles.get(0); assertEquals("simple", profile.getName()); ProcessorConfig config = profile.getEnricherConfig(); assertTrue(config.use("base")); assertFalse(config.use("blub")); config = profile.getGeneratorConfig(); assertFalse(config.use("java.app")); assertTrue(config.use("spring.swarm")); }
@Test public void multiple() throws IOException { InputStream is = getClass().getResourceAsStream("/jshift/config/ProfileUtilTest-multiple.yml"); assertNotNull(is); List<Profile> profiles = ProfileUtil.fromYaml(is); assertEquals(2,profiles.size()); }
@Test public void simple() throws IOException { InputStream is = getClass().getResourceAsStream("/fabric8/config/profiles-lookup-dir/profiles.yaml"); assertNotNull(is); List<Profile> profiles = ProfileUtil.fromYaml(is); assertNotNull(profiles); assertEquals(profiles.size(),3); Profile profile = profiles.get(0); assertEquals("simple", profile.getName()); ProcessorConfig config = profile.getEnricherConfig(); assertTrue(config.use("base")); assertFalse(config.use("blub")); config = profile.getGeneratorConfig(); assertFalse(config.use("java.app")); assertTrue(config.use("spring.swarm")); }
@Test public void multiple() throws IOException { InputStream is = getClass().getResourceAsStream("/fabric8/config/ProfileUtilTest-multiple.yml"); assertNotNull(is); List<Profile> profiles = ProfileUtil.fromYaml(is); assertEquals(2,profiles.size()); }