@Test public void groupLevelMd() throws Exception { final Metadata m1 = g("foo"); final Metadata m2 = g("foo", "bar"); final Metadata m3 = g("baz"); final Metadata m = merger.merge( ImmutableList.of(new Envelope("1", m1), new Envelope("2", m2), new Envelope("3", m3)) ); assertThat(m, notNullValue()); assertThat(m.getModelVersion(), equalTo("1.1.0")); assertThat(m.getPlugins(), hasSize(3)); final List<String> prefixes = Lists.newArrayList(Iterables.transform(m.getPlugins(), new Function<Plugin, String>() { @Override public String apply(final Plugin input) { return input.getArtifactId(); } })); assertThat(prefixes, containsInAnyOrder("foo-maven-plugin", "bar-maven-plugin", "baz-maven-plugin")); }
public void merge(final OutputStream outputStream, final MavenPath mavenPath, final Map<Repository, Content> contents) { log.debug("Merge metadata for {}", mavenPath.getPath()); List<Envelope> metadatas = new ArrayList<>(contents.size()); try { for (Map.Entry<Repository, Content> entry : contents.entrySet()) { addReadMetadata(mavenPath, metadatas, entry); } final Metadata mergedMetadata = merge(metadatas); if (mergedMetadata == null) { return; } MavenModels.writeMetadata(outputStream, mergedMetadata); } catch (IOException e) { log.error("Unable to merge {}", mavenPath, e); } }
RepositoryMetadataMerger extends ComponentSupport { public void merge(final OutputStream outputStream, final MavenPath mavenPath, final Map<Repository, Content> contents) { log.debug("Merge metadata for {}", mavenPath.getPath()); List<Envelope> metadatas = new ArrayList<>(contents.size()); try { for (Map.Entry<Repository, Content> entry : contents.entrySet()) { addReadMetadata(mavenPath, metadatas, entry); } final Metadata mergedMetadata = merge(metadatas); if (mergedMetadata == null) { return; } MavenModels.writeMetadata(outputStream, mergedMetadata); } catch (IOException e) { log.error("Unable to merge {}", mavenPath, e); } } }
RepositoryMetadataMerger extends ComponentSupport { public void merge(final OutputStream outputStream, final MavenPath mavenPath, final Map<Repository, Content> contents) { log.debug("Merge metadata for {}", mavenPath.getPath()); List<Envelope> metadatas = new ArrayList<>(contents.size()); try { for (Map.Entry<Repository, Content> entry : contents.entrySet()) { addReadMetadata(mavenPath, metadatas, entry); } final Metadata mergedMetadata = merge(metadatas); if (mergedMetadata == null) { return; } MavenModels.writeMetadata(outputStream, mergedMetadata); } catch (IOException e) { log.error("Unable to merge {}", mavenPath, e); } }  }
RepositoryMetadataMerger extends ComponentSupport { public void merge(final OutputStream outputStream, final MavenPath mavenPath, final Map<Repository, Content> contents) { log.debug("Merge metadata for {}", mavenPath.getPath()); List<Envelope> metadatas = new ArrayList<>(contents.size()); try { for (Map.Entry<Repository, Content> entry : contents.entrySet()) { addReadMetadata(mavenPath, metadatas, entry); } final Metadata mergedMetadata = merge(metadatas); if (mergedMetadata == null) { return; } MavenModels.writeMetadata(outputStream, mergedMetadata); } catch (IOException e) { log.error("Unable to merge {}", mavenPath, e); } }  void merge(final OutputStream outputStream,
                    final MavenPath mavenPath,
                    final Map<Repository, Content> contents); boolean metadataEquals(final Metadata md1, final Metadata md2); @Nullable Metadata merge(final Iterable<Envelope> metadatas); }
RepositoryMetadataMerger extends ComponentSupport { public void merge(final OutputStream outputStream, final MavenPath mavenPath, final Map<Repository, Content> contents) { log.debug("Merge metadata for {}", mavenPath.getPath()); List<Envelope> metadatas = new ArrayList<>(contents.size()); try { for (Map.Entry<Repository, Content> entry : contents.entrySet()) { addReadMetadata(mavenPath, metadatas, entry); } final Metadata mergedMetadata = merge(metadatas); if (mergedMetadata == null) { return; } MavenModels.writeMetadata(outputStream, mergedMetadata); } catch (IOException e) { log.error("Unable to merge {}", mavenPath, e); } }  void merge(final OutputStream outputStream,
                    final MavenPath mavenPath,
                    final Map<Repository, Content> contents); boolean metadataEquals(final Metadata md1, final Metadata md2); @Nullable Metadata merge(final Iterable<Envelope> metadatas);  }