@Test void shouldLookupPlatformForDependentExtensionInQuarkusFinal() { ExtensionInstallPlan result = extensionRegistry.planInstallation("1.3.2.Final", Arrays.asList("quarkus-arc", "quarkus-vertx")); assertThat(result).isNotNull(); assertThat(result.getPlatforms()).hasSize(2); assertThat(result.getPlatforms()) .extracting(AppArtifactCoords::getArtifactId) .contains("quarkus-universe-bom", "quarkus-bom"); assertThat(result.getManagedExtensions()).hasSize(2); assertThat(result.getIndependentExtensions()).isEmpty(); }
@Override public ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords) { ExtensionInstallPlan.Builder builder = ExtensionInstallPlan.builder(); boolean multipleKeywords = keywords.size() > 1; for (String keyword : keywords) { int countColons = StringUtils.countMatches(keyword, ":"); if (countColons == 1) { AppArtifactKey artifactKey = AppArtifactKey.fromString(keyword); builder.addManagedExtension(new AppArtifactCoords(artifactKey, null)); continue; } else if (countColons > 1) { builder.addIndependentExtension(AppArtifactCoords.fromString(keyword)); continue; } List<ExtensionReleaseTuple> tuples = listInternalExtensions(quarkusCore, keyword); if (tuples.size() != 1 && multipleKeywords) { return ExtensionInstallPlan.EMPTY; } else if (tuples.size() > 1 && !ExtensionPredicate.isPattern(keyword)) { throw new MultipleExtensionsFoundException(keyword, tuples.stream().map(this::toQuarkusExtension).collect(Collectors.toList())); } for (ExtensionReleaseTuple tuple : tuples) { ArtifactKey id = tuple.getExtension().getId(); String groupId = id.getGroupId(); String artifactId = id.getArtifactId(); String version = tuple.getRelease().getRelease().getVersion(); AppArtifactCoords extensionCoords = new AppArtifactCoords(groupId, artifactId, version); List<AppArtifactCoords> platformCoords = tuple.getRelease().getPlatforms() .stream() .map(c -> new AppArtifactCoords( c.getCoords().getId().getGroupId(), c.getCoords().getId().getArtifactId(), "pom", c.getCoords().getVersion())) .collect(Collectors.toList()); if (platformCoords.isEmpty()) { builder.addIndependentExtension(extensionCoords); } else { builder.addManagedExtension(extensionCoords); for (AppArtifactCoords platformCoord : platformCoords) { builder.addPlatform(platformCoord); } } } } return builder.build(); }
DefaultExtensionRegistry implements ExtensionRegistry { @Override public ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords) { ExtensionInstallPlan.Builder builder = ExtensionInstallPlan.builder(); boolean multipleKeywords = keywords.size() > 1; for (String keyword : keywords) { int countColons = StringUtils.countMatches(keyword, ":"); if (countColons == 1) { AppArtifactKey artifactKey = AppArtifactKey.fromString(keyword); builder.addManagedExtension(new AppArtifactCoords(artifactKey, null)); continue; } else if (countColons > 1) { builder.addIndependentExtension(AppArtifactCoords.fromString(keyword)); continue; } List<ExtensionReleaseTuple> tuples = listInternalExtensions(quarkusCore, keyword); if (tuples.size() != 1 && multipleKeywords) { return ExtensionInstallPlan.EMPTY; } else if (tuples.size() > 1 && !ExtensionPredicate.isPattern(keyword)) { throw new MultipleExtensionsFoundException(keyword, tuples.stream().map(this::toQuarkusExtension).collect(Collectors.toList())); } for (ExtensionReleaseTuple tuple : tuples) { ArtifactKey id = tuple.getExtension().getId(); String groupId = id.getGroupId(); String artifactId = id.getArtifactId(); String version = tuple.getRelease().getRelease().getVersion(); AppArtifactCoords extensionCoords = new AppArtifactCoords(groupId, artifactId, version); List<AppArtifactCoords> platformCoords = tuple.getRelease().getPlatforms() .stream() .map(c -> new AppArtifactCoords( c.getCoords().getId().getGroupId(), c.getCoords().getId().getArtifactId(), "pom", c.getCoords().getVersion())) .collect(Collectors.toList()); if (platformCoords.isEmpty()) { builder.addIndependentExtension(extensionCoords); } else { builder.addManagedExtension(extensionCoords); for (AppArtifactCoords platformCoord : platformCoords) { builder.addPlatform(platformCoord); } } } } return builder.build(); } }
DefaultExtensionRegistry implements ExtensionRegistry { @Override public ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords) { ExtensionInstallPlan.Builder builder = ExtensionInstallPlan.builder(); boolean multipleKeywords = keywords.size() > 1; for (String keyword : keywords) { int countColons = StringUtils.countMatches(keyword, ":"); if (countColons == 1) { AppArtifactKey artifactKey = AppArtifactKey.fromString(keyword); builder.addManagedExtension(new AppArtifactCoords(artifactKey, null)); continue; } else if (countColons > 1) { builder.addIndependentExtension(AppArtifactCoords.fromString(keyword)); continue; } List<ExtensionReleaseTuple> tuples = listInternalExtensions(quarkusCore, keyword); if (tuples.size() != 1 && multipleKeywords) { return ExtensionInstallPlan.EMPTY; } else if (tuples.size() > 1 && !ExtensionPredicate.isPattern(keyword)) { throw new MultipleExtensionsFoundException(keyword, tuples.stream().map(this::toQuarkusExtension).collect(Collectors.toList())); } for (ExtensionReleaseTuple tuple : tuples) { ArtifactKey id = tuple.getExtension().getId(); String groupId = id.getGroupId(); String artifactId = id.getArtifactId(); String version = tuple.getRelease().getRelease().getVersion(); AppArtifactCoords extensionCoords = new AppArtifactCoords(groupId, artifactId, version); List<AppArtifactCoords> platformCoords = tuple.getRelease().getPlatforms() .stream() .map(c -> new AppArtifactCoords( c.getCoords().getId().getGroupId(), c.getCoords().getId().getArtifactId(), "pom", c.getCoords().getVersion())) .collect(Collectors.toList()); if (platformCoords.isEmpty()) { builder.addIndependentExtension(extensionCoords); } else { builder.addManagedExtension(extensionCoords); for (AppArtifactCoords platformCoord : platformCoords) { builder.addPlatform(platformCoord); } } } } return builder.build(); } DefaultExtensionRegistry(Registry registry); }
DefaultExtensionRegistry implements ExtensionRegistry { @Override public ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords) { ExtensionInstallPlan.Builder builder = ExtensionInstallPlan.builder(); boolean multipleKeywords = keywords.size() > 1; for (String keyword : keywords) { int countColons = StringUtils.countMatches(keyword, ":"); if (countColons == 1) { AppArtifactKey artifactKey = AppArtifactKey.fromString(keyword); builder.addManagedExtension(new AppArtifactCoords(artifactKey, null)); continue; } else if (countColons > 1) { builder.addIndependentExtension(AppArtifactCoords.fromString(keyword)); continue; } List<ExtensionReleaseTuple> tuples = listInternalExtensions(quarkusCore, keyword); if (tuples.size() != 1 && multipleKeywords) { return ExtensionInstallPlan.EMPTY; } else if (tuples.size() > 1 && !ExtensionPredicate.isPattern(keyword)) { throw new MultipleExtensionsFoundException(keyword, tuples.stream().map(this::toQuarkusExtension).collect(Collectors.toList())); } for (ExtensionReleaseTuple tuple : tuples) { ArtifactKey id = tuple.getExtension().getId(); String groupId = id.getGroupId(); String artifactId = id.getArtifactId(); String version = tuple.getRelease().getRelease().getVersion(); AppArtifactCoords extensionCoords = new AppArtifactCoords(groupId, artifactId, version); List<AppArtifactCoords> platformCoords = tuple.getRelease().getPlatforms() .stream() .map(c -> new AppArtifactCoords( c.getCoords().getId().getGroupId(), c.getCoords().getId().getArtifactId(), "pom", c.getCoords().getVersion())) .collect(Collectors.toList()); if (platformCoords.isEmpty()) { builder.addIndependentExtension(extensionCoords); } else { builder.addManagedExtension(extensionCoords); for (AppArtifactCoords platformCoord : platformCoords) { builder.addPlatform(platformCoord); } } } } return builder.build(); } DefaultExtensionRegistry(Registry registry); static DefaultExtensionRegistry fromURLs(Collection<URL> urls); static DefaultExtensionRegistry fromPlatform(QuarkusPlatformDescriptor platform); @Override Set<String> getQuarkusCoreVersions(); @Override Set<Extension> getExtensionsByCoreVersion(String version); @Override Set<Extension> list(String quarkusCore, String keyword); @Override ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords); Registry getRegistry(); }
DefaultExtensionRegistry implements ExtensionRegistry { @Override public ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords) { ExtensionInstallPlan.Builder builder = ExtensionInstallPlan.builder(); boolean multipleKeywords = keywords.size() > 1; for (String keyword : keywords) { int countColons = StringUtils.countMatches(keyword, ":"); if (countColons == 1) { AppArtifactKey artifactKey = AppArtifactKey.fromString(keyword); builder.addManagedExtension(new AppArtifactCoords(artifactKey, null)); continue; } else if (countColons > 1) { builder.addIndependentExtension(AppArtifactCoords.fromString(keyword)); continue; } List<ExtensionReleaseTuple> tuples = listInternalExtensions(quarkusCore, keyword); if (tuples.size() != 1 && multipleKeywords) { return ExtensionInstallPlan.EMPTY; } else if (tuples.size() > 1 && !ExtensionPredicate.isPattern(keyword)) { throw new MultipleExtensionsFoundException(keyword, tuples.stream().map(this::toQuarkusExtension).collect(Collectors.toList())); } for (ExtensionReleaseTuple tuple : tuples) { ArtifactKey id = tuple.getExtension().getId(); String groupId = id.getGroupId(); String artifactId = id.getArtifactId(); String version = tuple.getRelease().getRelease().getVersion(); AppArtifactCoords extensionCoords = new AppArtifactCoords(groupId, artifactId, version); List<AppArtifactCoords> platformCoords = tuple.getRelease().getPlatforms() .stream() .map(c -> new AppArtifactCoords( c.getCoords().getId().getGroupId(), c.getCoords().getId().getArtifactId(), "pom", c.getCoords().getVersion())) .collect(Collectors.toList()); if (platformCoords.isEmpty()) { builder.addIndependentExtension(extensionCoords); } else { builder.addManagedExtension(extensionCoords); for (AppArtifactCoords platformCoord : platformCoords) { builder.addPlatform(platformCoord); } } } } return builder.build(); } DefaultExtensionRegistry(Registry registry); static DefaultExtensionRegistry fromURLs(Collection<URL> urls); static DefaultExtensionRegistry fromPlatform(QuarkusPlatformDescriptor platform); @Override Set<String> getQuarkusCoreVersions(); @Override Set<Extension> getExtensionsByCoreVersion(String version); @Override Set<Extension> list(String quarkusCore, String keyword); @Override ExtensionInstallPlan planInstallation(String quarkusCore, Collection<String> keywords); Registry getRegistry();  }