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

io.hyperfoil.http.steps.HttpStepCatalog Maven / Gradle / Ivy

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

import org.kohsuke.MetaInfServices;

import io.hyperfoil.api.config.BaseSequenceBuilder;
import io.hyperfoil.api.config.Step;
import io.hyperfoil.api.config.StepBuilder;
import io.hyperfoil.http.api.HttpMethod;
import io.hyperfoil.core.builders.StepCatalog;
import io.hyperfoil.impl.StepCatalogFactory;

public class HttpStepCatalog extends StepCatalog {
   public static final Class SC = HttpStepCatalog.class;

   HttpStepCatalog(BaseSequenceBuilder parent) {
      super(parent);
   }

   /**
    * Issue a HTTP request.
    *
    * @param method HTTP method.
    * @return Builder.
    */
   public HttpRequestStep.Builder httpRequest(HttpMethod method) {
      return new HttpRequestStep.Builder().addTo(parent).method(method);
   }

   /**
    * Block current sequence until all requests receive the response.
    *
    * @return This sequence.
    */
   public BaseSequenceBuilder awaitAllResponses() {
      return parent.step(new AwaitAllResponsesStep());
   }


   /**
    * Drop all entries from HTTP cache in the session.
    *
    * @return This sequence.
    */
   public BaseSequenceBuilder clearHttpCache() {
      return parent.step(new StepBuilder.ActionStep(new ClearHttpCacheAction()));
   }

   @MetaInfServices(StepCatalogFactory.class)
   public static class Factory implements StepCatalogFactory {
      @Override
      public Class clazz() {
         return HttpStepCatalog.class;
      }

      @Override
      public Step.Catalog create(BaseSequenceBuilder sequenceBuilder) {
         return new HttpStepCatalog(sequenceBuilder);
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy