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

us.abstracta.jmeter.javadsl.bridge.serialization.constructs.TestPlanExecutionConstruct Maven / Gradle / Ivy

Go to download

Module which allows to build simple adapters for JMeter Java DSL in other languages

The newest version!
package us.abstracta.jmeter.javadsl.bridge.serialization.constructs;

import java.util.Map;
import org.yaml.snakeyaml.nodes.Node;
import us.abstracta.jmeter.javadsl.bridge.TestPlanExecution;
import us.abstracta.jmeter.javadsl.bridge.serialization.BridgedObjectConstructor;
import us.abstracta.jmeter.javadsl.bridge.serialization.TestElementConstructorException;
import us.abstracta.jmeter.javadsl.core.DslJmeterEngine;
import us.abstracta.jmeter.javadsl.core.DslTestPlan;

public class TestPlanExecutionConstruct extends BaseBridgedObjectConstruct {

  private static final String TAG = "testPlanExecution";
  private final BridgedObjectConstructor constructor;

  public TestPlanExecutionConstruct(BridgedObjectConstructor constructor) {
    this.constructor = constructor;
  }

  @Override
  public Object construct(Node node) {
    Map properties = getNodeProperties(node, TAG);
    DslJmeterEngine engine = (DslJmeterEngine) constructor.constructObject(
        properties.remove("engine"));
    DslTestPlan testPlan = (DslTestPlan) constructor.constructObject(
        properties.remove("testPlan"));
    if (!properties.isEmpty()) {
      throw new TestElementConstructorException(TAG, node,
          "unknown properties " + String.join(",", properties.keySet()));
    }
    return new TestPlanExecution(engine, testPlan);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy