All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hyperfoil.cli.commands.BaseRunIdCommand Maven / Gradle / Ivy

package io.hyperfoil.cli.commands;

import org.aesh.command.CommandException;
import org.aesh.command.option.Argument;

import io.hyperfoil.cli.context.HyperfoilCommandInvocation;
import io.hyperfoil.controller.Client;

public abstract class BaseRunIdCommand extends ServerCommand {
   @Argument(description = "ID of the run", completer = RunCompleter.class)
   private String runId;

   protected Client.RunRef getRunRef(HyperfoilCommandInvocation invocation) throws CommandException {
      ensureConnection(invocation);
      Client.RunRef runRef;
      if (runId == null || runId.isEmpty()) {
         runRef = invocation.context().serverRun();
         if (runRef == null) {
            failMissingRunId(invocation);
         }
      } else {
         runRef = invocation.context().client().run(runId);
         invocation.context().setServerRun(runRef);
      }
      return runRef;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy