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

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

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

import io.hyperfoil.api.config.Step;
import io.hyperfoil.api.session.Access;
import io.hyperfoil.api.session.Session;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;

public abstract class DependencyStep implements Step {
   private static final Logger log = LoggerFactory.getLogger(Step.class);
   private static final boolean trace = log.isTraceEnabled();

   private final Access[] dependencies;

   protected DependencyStep(Access[] dependencies) {
      this.dependencies = dependencies;
   }

   @Override
   public boolean invoke(Session session) {
      if (dependencies != null) {
         for (Access ref : dependencies) {
            if (!ref.isSet(session)) {
               if (trace) {
                  log.trace("Sequence is blocked by missing var reference {}", ref);
               }
               return false;
            }
         }
      }
      return true;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy