us.abstracta.jmeter.javadsl.bridge.serialization.constructs.TestPlanExecutionConstruct Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmeter-java-dsl-bridge Show documentation
Show all versions of jmeter-java-dsl-bridge Show documentation
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);
}
}