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

io.hyperfoil.core.steps.NextSequenceStep Maven / Gradle / Ivy

There is a newer version: 0.27.1
Show newest version
package io.hyperfoil.core.steps;

import java.util.Collections;
import java.util.List;

import org.kohsuke.MetaInfServices;

import io.hyperfoil.api.config.InitFromParam;
import io.hyperfoil.api.config.Name;
import io.hyperfoil.api.config.Step;
import io.hyperfoil.api.config.StepBuilder;
import io.hyperfoil.api.session.Session;

public class NextSequenceStep implements Step {
   private final String name;

   public NextSequenceStep(String name) {
      this.name = name;
   }

   @Override
   public boolean invoke(Session session) {
      session.nextSequence(name);
      return true;
   }

   /**
    * Schedules a new sequence instance to be executed.
    */
   @MetaInfServices(StepBuilder.class)
   @Name("nextSequence")
   public static class Builder implements StepBuilder, InitFromParam {
      private String name;

      /**
       * Sequence name.
       *
       * @param name Name of the instantiated sequence.
       * @return Self.
       */
      public Builder name(String name) {
         this.name = name;
         return this;
      }

      @Override
      public List build() {
         return Collections.singletonList(new NextSequenceStep(name));
      }

      /**
       * @param param Name of the instantiated sequence.
       * @return Self.
       */
      @Override
      public Builder init(String param) {
         return name(param);
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy