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

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

There is a newer version: 0.27.1
Show newest version
package io.hyperfoil.cli.commands;

import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;

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

@CommandDefinition(name = "forget", description = "Removes benchmark from controller.")
public class Forget extends BenchmarkCommand {
   @Override
   public CommandResult execute(HyperfoilCommandInvocation invocation) throws CommandException, InterruptedException {
      Client.BenchmarkRef benchmarkRef = ensureBenchmark(invocation);
      try {
         if (benchmarkRef.forget()) {
            invocation.println("Benchmark " + benchmarkRef.name() + " was deleted.");
            return CommandResult.SUCCESS;
         } else {
            invocation.error("Cannot find benchmark " + benchmarkRef.name());
            return CommandResult.FAILURE;
         }
      } catch (RestClientException e) {
         invocation.error(e);
         return CommandResult.FAILURE;
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy