Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed platform stream selection when platform key is null #22729

Merged
merged 1 commit into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package io.quarkus.devtools.project.create;

import io.quarkus.devtools.testing.registry.client.TestRegistryClientBuilder;
import io.quarkus.maven.ArtifactCoords;
import io.quarkus.registry.catalog.PlatformStreamCoords;
import java.nio.file.Path;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class UpstreamStreamCoordsWithNullPlatformKeyTest extends MultiplePlatformBomsTestBase {

private static final String DOWNSTREAM_PLATFORM_KEY = "io.downstream.platform";
private static final String UPSTREAM_PLATFORM_KEY = "io.upstream.platform";

@BeforeAll
public static void setup() throws Exception {
TestRegistryClientBuilder.newInstance()
gastaldi marked this conversation as resolved.
Show resolved Hide resolved
//.debug()
.baseDir(configDir())
// registry
.newRegistry("downstream.registry.test")
.recognizedQuarkusVersions("*-downstream")
// platform key
.newPlatform(DOWNSTREAM_PLATFORM_KEY)
.newStream("1.0")
// 1.0.4 release
.newRelease("1.1.1-downstream")
.quarkusVersion("1.1.1-downstream")
.upstreamQuarkusVersion("1.1.1")
// default bom including quarkus-core + essential metadata
.addCoreMember()
// foo platform member
.newMember("acme-a-bom").addExtension("io.acme", "ext-a", "1.1.1-downstream").release()
.stream().platform().registry()
.clientBuilder()
.newRegistry("upstream.registry.test")
// platform key
.newPlatform(UPSTREAM_PLATFORM_KEY)
// 2.0 STREAM
.newStream("2.0")
// 2.0.5 release
.newRelease("2.0.5")
.quarkusVersion("2.0.5")
// default bom including quarkus-core + essential metadata
.addCoreMember()
.newMember("acme-a-bom").addExtension("io.acme", "ext-a", "2.0.5").release().stream().platform()
// 1.0 STREAM
.newStream("1.0")
.newRelease("1.1.1")
.quarkusVersion("1.1.1")
// default bom including quarkus-core + essential metadata
.addCoreMember()
.newMember("acme-a-bom").addExtension("io.acme", "ext-a", "1.1.1")
.registry()
.clientBuilder()
.build();

enableRegistryClient();
}

protected String getMainPlatformKey() {
return UPSTREAM_PLATFORM_KEY;
}

@Test
public void createUsingStream2_0() throws Exception {
final Path projectDir = newProjectDir("created-using-upstream-2.0");
createProject(projectDir, new PlatformStreamCoords(null, "2.0"), List.of("ext-a"));

assertModel(projectDir,
List.of(mainPlatformBom(), platformMemberBomCoords("acme-a-bom")),
List.of(new ArtifactCoords("io.acme", "ext-a", null)),
"2.0.5");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public ExtensionCatalog resolveExtensionCatalog(PlatformStreamCoords streamCoord

PlatformStream stream = null;
int registryIndex = 0;
while (registryIndex < registries.size()) {
while (registryIndex < registries.size() && stream == null) {
final RegistryExtensionResolver qer = registries.get(registryIndex++);
final PlatformCatalog platforms = qer.resolvePlatformCatalog();
if (platforms == null) {
Expand All @@ -508,8 +508,10 @@ public ExtensionCatalog resolveExtensionCatalog(PlatformStreamCoords streamCoord
continue;
}
stream = platform.getStream(streamId);
if (stream != null) {
break;
}
}
break;
}

if (stream == null) {
Expand Down