Skip to content

Commit

Permalink
Merge pull request #1279 from mocenas/add_cli_methods_to_framework
Browse files Browse the repository at this point in the history
Add option to CLI ti set community bom if not running RHBQ
  • Loading branch information
michalvavrik authored Sep 4, 2024
2 parents 571c920 + e4bfaed commit 4f41e55
Showing 1 changed file with 28 additions and 0 deletions.
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

0 comments on commit 4f41e55

Please sign in to comment.