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

Add option to CLI ti set community bom if not running RHBQ #1279

Merged
merged 1 commit into from
Sep 4, 2024
Merged
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
Expand Up @@ -29,6 +29,7 @@
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

import io.quarkus.test.bootstrap.QuarkusCliRestService;
import io.quarkus.test.services.quarkus.model.QuarkusProperties;
import io.smallrye.common.os.OS;

public abstract class QuarkusCLIUtils {
Expand Down Expand Up @@ -259,6 +260,33 @@ public static Properties getProperties(QuarkusCliRestService app) throws XmlPull
return getPom(app).getProperties();
}

/**
* Change given properties in app's pom.
* Other properties are unchanged.
*/
public static void changePropertiesInPom(QuarkusCliRestService app, Properties properties)
throws XmlPullParserException, IOException {
Model pom = getPom(app);
Properties pomProperties = pom.getProperties();
pomProperties.putAll(properties);
pom.setProperties(pomProperties);
savePom(app, pom);
}

/**
* If tests are not on RHBQ it will set properties in app's pom to work with community quarkus BOM.
* Expects that app is using RHBQ by default.
*/
public static void setCommunityBomIfNotRunningRHBQ(QuarkusCliRestService app, String communityQuarkusVersion)
throws XmlPullParserException, IOException {
if (!QuarkusProperties.getVersion().contains("redhat")) {
Properties communityBomProperties = new Properties();
communityBomProperties.put("quarkus.platform.group-id", "io.quarkus.platform");
communityBomProperties.put("quarkus.platform.version", communityQuarkusVersion);
changePropertiesInPom(app, communityBomProperties);
}
}

/**
* Get main pom of the application (the one in root dir).
*/
Expand Down