Skip to content

Commit

Permalink
feat: load package configuration file and upload it with enterprisePa…
Browse files Browse the repository at this point in the history
…ckage target

Ref: MISC-446
  • Loading branch information
Obero committed Jan 31, 2024
1 parent 6cb8421 commit 9f85ecc
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/io/gatling/mojo/EnterpriseUploadMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package io.gatling.mojo;

import io.gatling.plugin.BatchEnterprisePlugin;
import io.gatling.plugin.configuration.PackageConfiguration;
import io.gatling.plugin.exceptions.EnterprisePluginException;
import java.io.File;
import java.util.UUID;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -51,6 +53,20 @@ public final class EnterpriseUploadMojo extends AbstractEnterprisePluginMojo {

@Override
public void execute() throws MojoFailureException {
final BatchEnterprisePlugin enterprisePlugin = initBatchEnterprisePlugin();

final String jsonConfig = PackageConfiguration.loadToJson(mavenProject.getBasedir());

if (jsonConfig != null) {
try {
getLog().info("Package configuration file detected, applying it.");
packageId = enterprisePlugin.uploadPackageConfiguration(jsonConfig).toString();
getLog().info("Package id: " + packageId);
} catch (EnterprisePluginException e) {
throw new MojoFailureException("Failed to upload package configuration", e);
}
}

if (packageId == null && simulationId == null) {
final String msg =
"Missing packageID\n"
Expand All @@ -62,7 +78,6 @@ public void execute() throws MojoFailureException {
}

final File file = enterprisePackage();
final BatchEnterprisePlugin enterprisePlugin = initBatchEnterprisePlugin();

RecoverEnterprisePluginException.handle(
() ->
Expand Down

0 comments on commit 9f85ecc

Please sign in to comment.